stack.fs (lib)
The stack.fs
library contains words define and use stacks.
Usage
Define a new stack with STACK
and clear
it before use.
require stack.fs
10 STACK my-stack
: main
my-stack clear ;
Word Index
clear
( a-addr β )
Clears the stack.
empty?
( a-addr β f )
Returns whether the stack is empty.
peek
( a-addr β x )
Returns the top value from the stack, without removing it.
pop
( a-addr β x )
Pops the top value from the stack.
push
( x a-addr β )
Pushes a value on the stack.
size
( a-addr β u )
Returns the number of values on the stack.
STACK
( u βnameβ β )
Create a new stack for at most u values.