In case you ever wanted to write really short APL code

The problem is that the function has multiple statements ⍺←2 and ⍵*÷⍺ but what you’ve put into the notebook document is just a single statement ⍺←2 ⍵*÷⍺ =. You can separate statements with as in root ← {⍺←2 ⋄ ⍵*÷⍺} or use `]dinput to indicate that this notebook block defines a multiline function:

]dinput
root ← {
    ⍺←2
    ⍵*÷⍺
}

Similarly, for the function with a guard, write root ← {⍺=0:0 ⋄ ⍵*÷⍺} or

]dinput
root ← {
    ⍺=0:0
    ⍵*÷⍺
}

We’ll look into making this automated in the future, so you can omit ]dinput.

4 Likes