display | more...

These are common terminology in Forth and other computer languages with a stack.

peek or tos
Examine top of stack. (... x y tos gives you y and keeps the stack)
Add element to top of stack; other elements are pushed down. (... x push y makes the stack ... x y)
Remove element from top of stack. ( ... x y pop makes the stack ... x)
Swap top two stack elements. (... x y swap makes the stack ... y x)
"Rotate" top 3 elements, bringing third element to top of stack. (... x y z rot makes the stack ... y z x)
"Rotate" top 3 elements in other direction. (... x y z unrot makes the stack ... z x y)
Duplicate top stack element. (... x dup makes the stack ... x x)
Duplicate second stack element over top of stack. (... x y over makes the stack ... x y x; equivalent to swap dup unrot)
nip, tuck, pick, ...
Over the years, Forth programmers invented many more useful operations!

Log in or register to write something here or to contact authors.