Hi,
in my opinion lambdas should be as close to defined functions as possible
and local variables are one aspect of that.
Many lambdas are simpler with ⎕IO←0 so localizing ⎕IO is a frequent
simplification.
The primary reason why GNU APL does not support multi-line lambdas is
that the
multi-line lambdas of same other APL interpreters have a return value
semantics
(like: the first not-assigned value is the return value) that differs
from the return
value semantics of defined functions (like: the last assigned value
to the return variable
is the return value).
I did not think that having different semantics for lambdas and for
defined functions
is a good idea in the first place and therefore I did not implement
multi-line lambdas.
There are also other complications when a lambda has more than one line.
Best Regads,
Jürgen
On 7/10/21 1:37 AM, Russtopia wrote:
Hi, reading GNU APL documentation, in the section 2.7 "2.7 Direct
Functions (Lambdas)",
It states that lambdas do not support multiple expressions (amongst
other features). If this is the case, what purpose does allowing
local variable declarations serve?
Allowing
SUM ← { ⍺ + ⍵ ;C;D }
.. but not allowing multiple statements prevents assigning to C or
D, or really using them at all, so what is the purpose of allowing
their declaration? Please forgive me if I am missing something
obvious here.
Thanks,
-Russ