Skip to content

Okabe Wordlist

Vanja edited this page Oct 23, 2025 · 19 revisions

Math

Binary Operations

Word Stack Info
+ ( a b -- c ) c is the sum of a plus b
- ( a b -- c ) c is the difference of a minus b
* ( a b -- c ) c is the product of a times b
/ ( a b -- c ) c is the floating-point quotient of a divided by b
// ( a b -- c ) c is the floored integer quotient of a divided by b
/% ( a b -- c d ) c is the integer quotient of a divided by b and d is the remainder
% ( a b -- c ) c is the remainder of a divided by b

Unary Operations

Word Stack Info
sqrt ( a -- sqrt(a) ) square root of a
++ ( a -- b ) b is a plus 1
-- ( a -- b ) b is a minus 1
trunc ( a -- b ) b is a with everything to the right of the decimal point removed, leaving an integer
floor ( a -- b ) b is a with everything to the right of the decimal point rounded down to the nearest integer
ceil ( a -- b ) b is a with everything to the right of the decimal point rounded up to the nearest integer

Stack

stack

Word Stack Info
dup ( a -- a a ) push copy of top of stack to stack
drop ( a -- ) discard top of stack
swap ( a b -- b a ) swap position of top two numbers on stack
rot ( a b c -- b c a ) move third element of stack to top of stack
-rot ( b c a -- a b c ) move top element on stack to third position
pick ( [a .. z] n -- [a .. z] i ) pop the stack and copy the item at n index to the top of the stack
over ( a b -- a b a ) copy the second element from stack to top of stack
tuck ( a b -- b a b ) swap over
roll ( [a .. z] n -- [a .. z, excl i] i ) pop the stack and move the item at n index to the top of the stack
. ( a -- ) pop stack and echo number to standard output
top ( a -- a ) echo number on top of stack to standard output
to$ ( num -- ) $( -- num ) pop stack and push as string to $stack

rstack

Word Stack Info
>r ( a -- ) r( -- a ) pop stack, push to rstack
r> ( -- a ) r( a -- ) pop rstack, push to stack
rcmp ( a -- a t ) r( b -- ) t is 1 if a is almost equal to b and 0 otherwise

$stack

Word Stack Info
$dup $( s -- s s ) push copy of top of $stack to $stack
$drop $( s -- ) discard top of $stack
$swap ( s1 s2 -- s2 s1 ) swap position of top two strings on $stack
$ $( s -- ) pop $stack and echo string to standard output
$top $( s -- s ) echo string on top of $stack to standard output
$len $( s -- s ) ( -- len(s) ) push length of string on top of $stack to stack
& $( s1 s2 -- s1and2 ) concatenate top two strings on $stack, top string is the appended string
$>d $( s -- ) d[ -- s ] pop $stack and store in defer register
d>$ $( -- s ) d[ s -- ] push defer register contents to $stack and clear register

qstack

Word Stack Info
>q $( s -- ) q( -- s ) pop $stack, push to qstack
q> $( -- s ) q( s -- ) pop qstack, push to $stack
' q( q -- q ) execute top of qstack
'. q( q -- ) pop qstack and execute
'x q( q -- ) empty qstack

@stack

Word Stack Info

Pseudo-Boolean

Word Stack Info
> ( a b -- a t ) t is 1 if a is greater than b, otherwise t is 0
>= ( a b -- a t ) t is 1 is a is greater than or equal to b, otherwise t is 0
>0 ( a -- a t ) t is 1 if a is greater than 0, otherwise t is 0
< ( a b -- a t ) t is 1 if a is less than b, otherwise t is 0
<= ( a b -- a t ) t is 1 is a is less than or equal to b, otherwise t is 0
<0 ( a b -- a t ) t is 1 if a is less than 0, otherwise t is 0
= ( a b -- a t ) t is 1 if a is nearly equal to b, otherwise t is 0
=0 ( a -- a t ) t is 1 if a is nearly equal to 0, otherwise t is 0
&& ( a b -- t ) t is 1 if a and b are both 1, otherwise t is 0
| ( a b -- t ) t is 1 if a and/or b are 1, otherwisw t is 0
x| ( a b -- t ) t is 1 if only a or b is 1, otherwise t is 0
! ( a -- b ) if a is 1, b is 0; if a is 0, b is 1

Conditionals

Word Stack Usage Info
? ( t -- ) q( t -- ) pbool_result_int ( branch_quote ) ? pop stack, pop qstack, execute quote if 1, otherwise discard
?: ( t -- ) q( t f -- ) pbool_result_int ( true_branch ) ( false_branch ) ?: pop stack, pop qstack twice, execute first quote if 1, otherwise execute second quote, discard the quote that was not executed

Meta

Word Stack Usage Info
proc $( s -- ) q( q -- ) "proc_name" ( proc_quote ) proc >> proc_name pop $stack and qstack, store quote as a named procedure / word at the given string (note: string is stripped of whitespace before saving)
cmd $( s -- ) "console command -w args" cmd pop string stack and pipe to terminal, print output and exit code
include $( s -- ) "okabe_file.ok" include store the current memory state; interpret okabe_file.ok until private; clear working memory but retain named entities such as procedures, variables, and arrays; restore original memory state
private N/A private stop interpretation at this point when file is included
memclear N/A memclear empty all stacks and defer register
memdump N/A memdump print representation of current virtual memory state to standard output; include all stacks and defer register

File Operations

Word Stack Usage Info
file $( file_name -- ) "file_name" file open file_name for reading / writing
close N/A close close currently open file
fWritwLn $( line -- ) '"some text" fWriteLn` pop $stack and write to currently open file

Clone this wiki locally