Built-in Words
Quick Reference
!
'
*
+
,
,,
-
.
..
/
<
<=
=
==
=>
?
ADSR
AND
BOOL
CEIL
CHARS
CHORD
CHR
COLLECT
CONCAT
CSPRNG
DATETIME
DEF
DEL
EVAL
EXEC
FALSE
FILL
FILTER
FLOOR
FOLD
FRAME
FX-RESET
GAIN
GAIN-RESET
GET
HASH
INSERT
JOIN
LENGTH
MAP
MOD
NIL
NOT
NOW
NUM
OR
PAN
PAN-RESET
PLAY
PRINT
RANGE
RANK
REMOVE
REORDER
REPLACE
RESHAPE
REVERSE
ROUND
SAW
SEQ
SHAPE
SIM
SINE
SLOT
SORT
SPLIT
SQUARE
STR
TAKE
TIMES
TIMESTAMP
TRANSPOSE
TRI
TRUE
Target Specification
.
Stack top mode (default). Operations affect only the top element.
[ 1 2 3 ] LENGTH # Operates on top element..
Stack mode - operates on entire stack
a b c .. REVERSE # Result: c b aConsumption Mode
,
Consume mode (default). Operands are removed from stack after operation.
[ 1 ] [ 2 ] , + # Result: [ 3 ] (same as default),,
Keep mode - operands remain on stack, result is added
[ 1 ] [ 2 ] ,, + # Result: [ 1 ] [ 2 ] [ 3 ]
[ 3 ] [ 4 ] ,, * # Result: [ 3 ] [ 4 ] [ 12 ]Modifiers are order-independent: ,, .. and .. ,, produce the same result.
Input Helpers
'
Single quote - starts a string literal
'hello' # String valueFRAME
Create bracket structure with specified shape
[ 2 3 ] FRAME # Creates a 2x3 frame structurePosition Operations (0-indexed)
GET
Get element at position. Negative index counts from end.
[ 10 20 30 ] [ 0 ] GET # Result: [ 10 ]
[ 10 20 30 ] [ -1 ] GET # Result: [ 30 ]INSERT
Insert element at position
[ 1 3 ] [ 1 2 ] INSERT # Result: [ 1 2 3 ]REPLACE
Replace element at position
[ 1 2 3 ] [ 0 9 ] REPLACE # Result: [ 9 2 3 ]REMOVE
Remove element at position
[ 1 2 3 ] [ 1 ] REMOVE # Result: [ 1 3 ]Quantity Operations
LENGTH
Get element count
[ 1 2 3 4 5 ] LENGTH # Result: [ 5 ]TAKE
Take N elements from start (positive) or end (negative)
[ 1 2 3 4 5 ] [ 3 ] TAKE # Result: [ 1 2 3 ]
[ 1 2 3 4 5 ] [ -2 ] TAKE # Result: [ 4 5 ]Stream-First Vector Operations
SPLIT
Split vector at specified sizes
[ 1 2 3 4 5 6 ] [ 2 3 ] SPLIT # Result: [ 1 2 ] [ 3 4 5 ] [ 6 ]CONCAT
Concatenate vectors
[ a ] [ b ] CONCAT # Result: [ a b ]REVERSE
Reverse order
[ 1 2 3 ] REVERSE # Result: [ 3 2 1 ]RANGE
Generate inclusive range
[ 0 5 ] RANGE # Result: [ 0 1 2 3 4 5 ]SORT
Sort ascending
[ 3 1 4 1 5 ] SORT # Result: [ 1 1 3 4 5 ]Constants
TRUE FALSE NIL
Boolean and null constants
TRUE # Pushes TRUE
FALSE # Pushes FALSE
NIL # Pushes NIL (empty value)String Operations
CHARS
Split string into character vector
'hello' CHARS # Result: [ 'h' 'e' 'l' 'l' 'o' ]JOIN
Join character vector into string
[ 'h' 'e' 'l' 'l' 'o' ] JOIN # Result: 'hello'Parse/Convert
NUM
Parse string to number (returns NIL on failure)
'123' NUM # Result: [ 123 ]
'abc' NUM # Result: NILSTR
Convert value to string
[ 123 ] STR # Result: '123'BOOL
Normalize to boolean
'true' BOOL # Result: TRUE
[ 100 ] BOOL # Result: TRUECHR
Convert number to Unicode character
[ 65 ] CHR # Result: 'A'DateTime
NOW
Get current Unix timestamp
NOW # Result: [ 1732531200 ]DATETIME
Convert timestamp to datetime vector
[ 1732531200 ] 'LOCAL' DATETIME # Result: [ 2024 11 25 23 0 0 ]TIMESTAMP
Convert datetime vector to timestamp
[ 2024 11 25 23 0 0 ] 'LOCAL' TIMESTAMP # Result: [ 1732531200 ]Arithmetic
+ - * /
Element-wise operations with broadcasting
[ 1 2 3 ] [ 10 ] + # Result: [ 11 12 13 ]
[ 1 2 3 ] [ 4 5 6 ] * # Result: [ 4 10 18 ]MOD
Modulo operation
[ 7 ] [ 3 ] MOD # Result: [ 1 ]FLOOR CEIL ROUND
Rounding operations
[ 7/3 ] FLOOR # Result: [ 2 ]
[ 7/3 ] CEIL # Result: [ 3 ]
[ 5/2 ] ROUND # Result: [ 3 ]Comparison
= < <=
Comparison operators (equality, less than, less than or equal)
[ 1 2 ] [ 1 2 ] = # Result: TRUE
[ 1 ] [ 2 ] < # Result: TRUE
[ 2 ] [ 2 ] <= # Result: TRUELogic
AND OR NOT
Logical operations (supports three-valued logic with NIL)
TRUE FALSE AND # Result: FALSE
TRUE FALSE OR # Result: TRUE
TRUE NOT # Result: FALSEHigher-Order Functions
MAP
Apply word to each element
[ 1 2 3 ] 'DOUBLE' MAP # Result: [ 2 4 6 ]FILTER
Keep matching elements
[ 1 2 3 4 ] 'EVEN?' FILTER # Result: [ 2 4 ]FOLD
Reduce with initial value
[ 1 2 3 4 ] [ 0 ] '+' FOLD # Result: [ 10 ]I/O
Print and pop stack top
[ 42 ] PRINT # Outputs: 42Music
SEQ
Set sequential playback mode
[ 440 550 660 ] SEQ PLAY # Play 3 notes sequentiallySIM
Set simultaneous playback mode (chord)
[ 440 550 660 ] SIM PLAY # Play 3 notes as chordSLOT
Set slot duration in seconds
0.25 SLOT # 1 slot = 0.25 seconds
1/4 SLOT # Fraction also works (same as above)GAIN
Set volume level (0.0-1.0)
0.5 GAIN # 50% volumeGAIN-RESET
Reset volume to default (100%)
GAIN-RESETPAN
Set stereo position (-1.0 left to 1.0 right)
-0.5 PAN # slightly leftPAN-RESET
Reset pan to center
PAN-RESETFX-RESET
Reset all audio effects
FX-RESET # gain=1.0, pan=0.0PLAY
Play audio
[ 440 ] PLAY # Play 440Hz toneWord Management
DEF
Define custom word using code block syntax { ... } or ( ... )
{ [ 2 ] * } 'DOUBLE' DEFDEL
Delete custom word
'DOUBLE' DEL?
Show word definition
'DOUBLE' ?Control Flow
COND
Evaluate guard/body pairs and execute the first matching branch.
[ 42 ]
{ [ 0 ] < } { 'negative' }
{ IDLE } { 'positive' }
COND$
Route flow through condition-action code block pairs. Modifiers: . (branch), .. (loop), ,, (bifurcation)
{ ,, [ 0 ] < } { [ -1 ] * } { } $ # ABS
[ 0 ] { ,, [ 5 ] < } { [ 1 ] + } .$ # Count to 5== (Pipeline)
Visual data flow marker (no-op)
[ 1 2 3 ] == { [ 2 ] * } MAP # Readable pipeline=> (Nil Coalescing)
Return alternative value when NIL
NIL => [ 0 ] # Result: [ 0 ]
[ 42 ] => [ 0 ] # Result: [ 42 ]!
Force flag - allows DEL/DEF of dependent words
! 'WORD' DEL # Force deleteRandom
CSPRNG
Cryptographically secure random number generation
[ 6 ] [ 1 ] CSPRNG # Result: random [0, 5/6]
[ 5 ] CSPRNG # Generate 5 random numbersHash
HASH
Deterministic hash of any value
'hello' HASH # Result: [ 0.xxx ]
[ 128 ] 'hello' HASH # 128-bit hash output