Page 1 of 1
execution order
Posted: Tue Nov 23, 2010 4:44 pm
by giangiquario
Please consider the following behaviour (in a clear workspace):
Code: Select all
⊂[1↓⍳⍴⍴wsx]wsx←2 3⍴⍳5
VALUE ERROR
⊂[1↓⍳⍴⍴wsx]wsx←2 3⍴⍳5
∧
Maybe incorrect?
Re: execution order
Posted: Thu Nov 25, 2010 10:27 am
by JohnS|Dyalog
Hi Gianluigi
Dyalog allows:
Code: Select all
v←0 0 0
v[1] n ← 2 3 ⍝ assign n and first item of v
v n
2 0 0 3
In this case, the interpreter has to evaluate the expression as far to the left as the v before deciding whether the brackets form an index (if v is an array) or an axis (as in your example) if v is a function.
It cannot skip over the []s to have a peek, because APL also allows, in a clear WS:
Morten suggests this elegant code-around for your example:
Strange things, brackets; you can see why J removed them :-).