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: Louis de Forcrand
Subject: Re: [Bug-apl] Local sysvars in lambdas
Date: Thu, 25 Aug 2016 15:15:25 +0200

Yep, still 0 after )SIC.
I checked it with this function:

      ∇F;⎕IO
[1] ⎕IO←~⎕IO ◊ →1∇

And indeed ⎕IO goes back to its original value after )SIC.

Thank you. I should have put that in the original email.

Louis

On 25 Aug 2016, at 04:01, Christian Robert <address@hidden> wrote:

After second though, you may have/had a point.

keep investigating.

Xtian.

On 2016-08-24 21:54, Louis de Forcrand wrote:
You are entirely right, I didn't do that when I reproduced it for the email. However I believe that I did check quad IO after )SIC the first time it happened and it was still 0.
Almost like the variables being localised are localised after execution?
I'll check again when I can.

Thanks for pointing that out.
Louis

On 25 Aug 2016, at 03:39, Christian Robert <address@hidden> wrote:

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]