Skip to content

clear

Input Stack:
...
Output Stack:

Remove all items from the stack, leaving it completely empty. This is useful for resetting the stack state during complex expression building or when you need to discard all accumulated intermediate results.

Parameters

  • ...: All items currently on the stack (variable number of arguments)

Behavior

  • Complete removal: Removes every item from the stack regardless of count or type
  • Empty result: Stack becomes completely empty after execution
  • Destructive: All stack contents are permanently lost (cannot be recovered)

Examples

Clearing a stack with multiple items:

a,b,c,:clear
PosInputOutput
0 c
1 b
2 a
  • :drop - Remove single item from stack
  • :ndrop - Remove N items from stack (partial clearing)
  • :depth - Check stack depth before clearing
  • :freeze - Preserve items before clearing (protects from clearing)