bug-apl
[Top][All Lists]
Advanced

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

Re: Each ¨ - behavior of func without parameter


From: Dr . Jürgen Sauermann
Subject: Re: Each ¨ - behavior of func without parameter
Date: Sun, 3 Jan 2021 18:08:02 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi Otto,

simple answer:
{3} is niladic in GNU APL (since lack of ⍵) and monadic
(why?) in Dyalog et al.

To get the Dyalog behaviour in GNU APL use
{3⊣⍵} instead of {3}:

      {3⊣⍵} ¨⍳5
3 3 3 3 3

That makes the lambda monadic in GNU APL and discards its argument
like Dyalog does. You will get the same SYNTAX ERROR in Dyalog if you
call EACH with a niladic function (except that it can't be a lambda then):

      ⎕FX 'Z←FOO' 'Z←3'
      FOO¨⍳5
SYNTAX ERROR
      FOO¨⍳5
         ∧

I personally believe that there should be no differences between "normal"
defined functions (with ⎕FX or the ∇-editor) and lambda, but that opinion
is not shared unanimously.

Best Regards,
Jürgen


On 1/3/21 2:32 PM, Otto Diesenbacher-Reinmüller wrote:
Dear APLers,

I don't think this is a bug, but intentionally:

Doing f.e.:

{ 3 } ¨ ⍳5

results in gnu-apl to an error:

SYNTAX ERROR
      λ1¨⍳5
      ^  ^

In other APLs, this works just fine, f.e. dyalog (or even april):

      { 3 } ¨ ⍳5
3 3 3 3 3

More general without Each/¨, f.e. 
  { 3 } 55

results in gnu-apl in

3 55

but in dyalog (and others) in

3

What's the background of this different behavior in gnu-apl? I also
couldn't find any hint in IBMs APL2 Reference for this behavior.

br & and many thanks for any hint!

br Otto



reply via email to

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