bug-apl
[Top][All Lists]
Advanced

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

[Bug-apl] Local sysvars in lambdas


From: Louis de Forcrand
Subject: [Bug-apl] Local sysvars in lambdas
Date: Thu, 25 Aug 2016 03:09:23 +0200

      ∇Z←F N;⎕IO
[1] Z←⍎(N>1)⊃'N' 'N×F N-1'⊣⎕IO←0∇
      F 6
720
      f←{⍎(⍵>1)⊃'⍵' '⍵×f ⍵-1'⊣⎕IO←0;⎕IO}
      f 6
SYNTAX ERROR
λ1[1]  λ←⍎(⍵>1)⊃'⍵' '⍵×f ⍵-1'⊣⎕IO←0;⎕IO
       ^                            ^
      ⎕IO
0
      )SIC
      ⎕IO←1
      f←{⍎(⍵>1)⊃'⍵' '⍵×⍙ ⍵-1'⊣⎕IO←0;⎕IO}
      f 6
VALUE ERROR
      ⍵×⍙ ⍵-1
        ^
      ⎕IO
0
      )SIC


As is shown, system variables such as ⎕IO cannot be localised
in lambdas as they can be in del-fns.
The last example is there because I just thought the order of
execution was intriguing: it seems to show that the error with
local ⎕IO was signalled at the end (left) of the lambda. This
of course might be as it should.

In addition I was wondering if there is a way to refer to the
enclosing lambda / function anonymously, i.e. ∇ in Dyalog.
That is how I first entered the faulty symbol, and found this
potential bug.

Good luck,
Louis


reply via email to

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