This is a list of commands available in Liverpool Forth. Each commands takes a certain number of arguments from the operands stack and leaves its results on the operand stack. This is indicated in the column before and after. The | denotes the bottom of the stack.
before command after description
num1 abs num2 absolute value
num1 num2 add sum add two numbers
|any1 ... anyn clear | discard all elements
mark any1 ... anyn cleartomark - discard elements down to mark
any1 ... anyn n copy any1 ... anyn any1 ... anyn duplicate n elements
num1 cos num2 cosine of num1
|any1 ... anyn count |any1 ... anyn n count elements on stack
mark any1 ... anyn counttomark mark any1 ... anyn n count elements down to mark
/quote proc def - define /quote as proc
num1 num2 div quotient divide two numbers
any dup any any duplicate top element
any1 any2 exch any2 any1 exchange top two elements
any exec - execute arbitrary object
- exit - exit innermost active loop
num1 floor num2 num1 rounded downwards
init incr limit proc for - execute proc ith values from init by steps of incr to limit
obj1 obj2 ge bool is obj1 greater or equal than obj2
obj1 obj2 gt bool is obj1 greater than obj2
num1 num2 idiv quotient integer divide
bool proc if - execute proc if bool is true
bool proc1 proc2 ifelse execute proc1 if bool is true proc2 otherwise
anyn ... any0 n index anyn ... any0 anyn duplicate arbitrary element
obj1 obj2 le bool is obj1 less or equal to obj2
num1 ln num2 base e logarithm
/quote load proc retreive definition of /quote
proc loop - repeat proc forever
obj1 obj2 lt bool is obj1 less than obj2
- mark mark push mark on stack
num1 num2 mod remainder num1 modulo num2
num1 num2 mul product multiply two numbers
num1 neg num2 negative of num1
any oprint - print any object to console
any pop discard top element
string print - print string to console
- rand int random integer
int proc repeat - repeat proc int times
a(n-1) ... a0 n j roll a(j-1 mod n)... a0 a1 ... a(j mod n) roll n elements j times
num1 round num2 num1 rounded to nearest integer
num1 sin num2 sine of num1
num1 sqrt num2 square root of num1
int srand - set random seed
num1 num2 sub difference subtract two numbers

[click here if you see no menu]