Dfns (Direct Functions)¶
Syntax¶
Arguments¶
⍵-- right argument (always available)⍺-- left argument (available in dyadic calls)
Default left argument¶
Use ⍺←value to provide a default for ⍺. If the dfn is called monadically, ⍺ takes the default value. If called dyadically, the default is ignored.
Body¶
The body is a sequence of statements separated by ⋄ (diamond). The value of the last evaluated expression is the result.
Assignment inside dfns¶
You can assign local variables inside a dfn body. These are scoped to the dfn.
Scoping¶
Dfns use lexical scope. Assignments inside {} create local bindings. Unresolved names look outward through enclosing dfns to the workspace.
Multiple statements¶
Separate statements with ⋄. The last expression's value is returned.