bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Local sysvars in lambdas


From: Christian Robert
Subject: Re: [Bug-apl] Local sysvars in lambdas
Date: Wed, 24 Aug 2016 21:39:41 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

try ⎕IO

*after*  )sic

the fact is that when a function is interruped, you see "by the last" 
interrupted function. Until you type )sic or )reset

my 2 cents, as usual, I may be wrong.

Xtian.


On 2016-08-24 21:09, Louis de Forcrand wrote:
      ∇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]