bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] This looks wrong


From: Elias Mårtenson
Subject: Re: [Bug-apl] This looks wrong
Date: Thu, 7 Aug 2014 21:53:41 +0800

But having {⎕←'foo'} REPEAT 10 result in an error is certainly surprising to me. Also, if you look at where lambdas are actually used, the current behaviour results in more surprises than the Dyalog model. Even disregarding the surprises part (which I can agree is often a matter of personal taste), the Dyalog model is distinctly more useful.

And, one could argue that knowing that lambdas are always variadic is quite consistent in itself.

Regards,
Elias


On 7 August 2014 20:56, Juergen Sauermann <address@hidden> wrote:
Hi,

for me it is not at all clear why {1} 0 should eat (and discard) its right argument.

In other words why would {1} 0 behave differently than N 0 with N being a niladic function?

That would create new rules in the APL syntax without a need. I would rather opt for David's
"principle of least surprises" than for Dyalog compatibility in this case.

/// Jürgen



On 08/07/2014 10:43 AM, Elias Mårtenson wrote:
Jay,

That makes sense. So the only benefit of the GNU APL approach is that it allows the definition of niladic functions by assigning from a lambda.

My personal opinion is that that's barely a benefit, and that the Dyalog approach is much better.

Perhaps Jürgen is willing to reconsider?

Regards,
Elias


On 7 August 2014 16:35, Jay Foad <address@hidden> wrote:
Elias,

There is no such thing as a niladic lambda in Dyalog.

In Dyalog "niladic lambda functions [are] not [...] allowed at all.
Instead, they [are] interpreted as monadic functions that ignore their
argument."

So {1} is a monadic function. You can evaluate it by applying it to an argument:

      {1}0
1

(Actually in Dyalog lambdas are not monadic or dyadic. They are all
"ambivalent". If they do not refer to ⍺ then any left argument will be
ignored.)

Jay.

On 7 August 2014 09:09, Elias Mårtenson <address@hidden> wrote:
> Jay,
>
> I also noticed that Dyalog does not allow self-evaluation of niladic
> lambdas. I.e. the _expression_ {1} on its own does not evaluate to 1, but
> rather to something else (it's displayed as {1}, and I'm not sure you can do
> anything with it other than assigning it to a variable).
>
> Regards,
> Elias
>
>
> On 7 August 2014 16:00, Jay Foad <address@hidden> wrote:
>>
>> On 6 August 2014 14:15, Elias Mårtenson <address@hidden> wrote:
>> > My suggestion is that niladic lambda functions will not be allowed at
>> > all.
>> > Instead, they will be interpreted as monadic functions that ignore their
>> > argument.
>>
>> That's consistent with the behaviour of Dyalog.
>>
>> Jay.
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]