Fast.ai APL study session 6

For future reference:

Curly braces are ‘explained’ somewhat, here

Also,

Braces

An ambivalent function with an optional left argument, a conditional control structure, one local variable, and a shy result:

      ∇ {res}←{left} AddMult2 right;local
        :If 0=⎕NC'left'     ⍝ if variable "left" is not defined already
            left←0
        :EndIf
        local←left+right
        res←2×local
      ∇
      AddMult2 3     ⍝ result is "shy"
      ⎕←AddMult2 3   ⍝ coerce display of result
6
      1 AddMult2 3      ⍝ result is "shy"
      10×1 AddMult2 3   ⍝ use result anyway
80

1 Like