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: Juergen Sauermann
Subject: Re: [Bug-apl] This looks wrong
Date: Thu, 07 Aug 2014 12:44:46 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5

Hi,

actually you can. There are 2 points in time that are relevant:

1. tokenization time (when the statement text is converted into tokens). At this
time (in GNU APL) the {} is detected and converted into a (possibly niladic) defined function.

2. execution time (when the statement is executed). At this time the niladic function is executed.

In immediate execution mode these two times are so close that they look the same.
If you defined a function containing a lambda then the difference becomes visible (1. is
when you close the ∇-editor and 2. is when you execute the function.

      ∇foo
[1] bar←{1⊣⎕←2}
[2] ∇
     
      foo
2

The reason why ⎕NC shows 2 below is because 'f' is a variable whose current
value is a function.

/// Jürgen



On 08/07/2014 10:52 AM, Jay Foad wrote:
So the only benefit of the GNU APL approach is that it
allows the definition of niladic functions by assigning from a lambda.
I don't understand. You can't use assignment to name a niladic lambda
in GNU APL, because it will be evaluated before the assignment
happens:

      f←{1⊣⎕←2}
2
      f
1
      ⎕NC'f' ⍝ it's an array, not a function
2

Jay.




reply via email to

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