-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Defining a function will return a Function object.
A Function can only take one argument, but that argument can be an Index List or Pair List.
Single line function definitions are expressed thusly:
ƒ(x): x +(1)
For multiple arguments you can express it thusly:
ƒ({x, z}): x +(z)
Defaults can be expressed as such:
ƒ(x: 0): x +(1)
Multiline functions are expressed thusly (Only the last line is returned):
ƒ(x):
log("Hello, World.")
x +(1)
Function invocation is expressed thusly:
increment: ƒ(x): x +(1)
increment(1)
For multiple arguments you would express it thusly:
increment: ƒ({value, by}): x +(z)
increment({value: 1, by: 1})
Of course for currying you would express thusly:
ƒ(x): ƒ(y): x +(y)
And currying with multiline is express thusly:
ƒ(x):
ƒ(y):
x +(y)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels