Closed herwinw closed 3 years ago
I think it just assumes index origin to be set to zero.
⎕IO←0
⍳4
0 1 2 3
I tried the Runnable link from the README, that iota is 1-indexed for me. I'm not sure whether that's a global default, or it saves something in cookies which causes the result to differ depending on that.
Since TryAPL has index origin 1 by default, some possible fixes would be:
Subtract one instead of adding (as the R sample does)
¯1+2×⍳10
or set the index origin to zero first in the linked snippet (the sharable link unfortunately needs to fit on one line)
⎕IO←0 ⋄ 1+2×⍳10
1+2×⍳10 ⊣ ⎕IO←0
We decided to go with ¯1+2×⍳10
. Thanks for pointing this out.
It looks like
⍳
in APL starts at 1 instead of 0, the code snippet linked in the readme generates the sequence,3, 5 .. 21