Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
18
Task/Call-a-function/Uiua/call-a-function.uiua
Normal file
18
Task/Call-a-function/Uiua/call-a-function.uiua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Generally functions have a fixed number of un-named arguments.
|
||||
JustOne ← (1) # Nonadic. Returns a 1.
|
||||
PlusOne ← +1 # Monadic. Adds 1 to its argument.
|
||||
MeanOne ← ÷ 2 + # Dyadic. Mean of its two arguments.
|
||||
# Triadic = ++, Tetradic = +++, Pentadic = ++++, etc
|
||||
|
||||
# Values are passed and returned on the stack.
|
||||
JustOne # -> 1 on the stack
|
||||
PlusOne # consumes the 1, adds 1, leaves the 2 on the stack.
|
||||
MeanOne 3 # MeanOne sees 3 and 2 on the stack and returns 2.5
|
||||
|
||||
# Some functions can take an optional suffix.
|
||||
⁅1.23456 # ->1
|
||||
⁅₂1.23456 # -> 1.23
|
||||
|
||||
# Some operators can take function packs, leading to more flexibility.
|
||||
# E.g. '⊃ fork' applies all the functions to its arguments.
|
||||
⊃(¯|+|-|÷|×|$"_ _ _"1) 2 3 # -> ¯2 5 1 1.5 6 "1 2 3"
|
||||
Loading…
Add table
Add a link
Reference in a new issue