bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Local variables in lambdas


From: Louis de Forcrand
Subject: Re: [Bug-apl] Local variables in lambdas
Date: Sun, 14 Aug 2016 20:16:50 -0400

Yes, the first seems more appropriate and readable. However, I would argue that the variables
in that list should be the ones to be made global; for me it is easier to forget that an argument is
global rather than forget that it is local.

In addition, I believe that this would be more compatible with other APLs; NARS and Dyalog,
which are the two I have on hand, both treat all lambda variables as local. However this could
break compatibility with older GNU APL lambdas.

In any case, just being able to choose wether a variable is local or global would be great.

Cheers,
Louis

On 14 Aug 2016, at 15:50, Juergen Sauermann <address@hidden> wrote:

Hi,

Thinking about lambdas once more I had an idea of a syntax for declaring local variables in
the lambda. In order to bring lambdas and proper functions closer together rather than separating
them more than necessary, we could use the same syntax as in proper defined functions: a list
of variable names separated by semicolons. A lambda with body ⍺+⍵ and local variables C, D,
and E would then be declared as:

      {+⍵;C;D;E}

One could also think of

      {C;D;E;⍺+⍵}

But the first looks more appealing to me. Any opinions?

/// Jürgen


reply via email to

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