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: Otto Diesenbacher-Reinmüller
Subject: Re: Each ¨ - behavior of func without parameter
Date: Mon, 04 Jan 2021 10:16:55 +0100
User-agent: mu4e 1.4.13; emacs 28.0.50

Hi Jürgen,

many thanks for clarification - yep, that makes sense, that the function
by itself forces, whether it is niladic/monadic/dyadic.

br Otto

Dr. Jürgen Sauermann <mail@jürgen-sauermann.de> writes:

> 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


-- 
Dipl. Ing. (FH) Otto Diesenbacher-Reinmüller
diesenbacher.net
Salzburg, Österreich



reply via email to

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