Skip to content

drop

Input Stack:
item: Any
Output Stack:

Remove the item on the top of the stack. This is useful for discarding intermediate results or cleaning up the stack during complex expression building.

Parameters

  • item: The item on top of the stack to remove (can be any type)

Examples

Removing the top item from a stack with multiple items:

a,b,c,:drop
PosInputOutput
0 c b
1 b a
2 a

Attempting to drop from an empty stack results in an error:

:drop

Warning

Throws an exception due to an empty stack.

  • :dup - Duplicate the top item (opposite of dropping)
  • :swap - Reorder items instead of removing them
  • :over - Access items without removing them
  • :list - Collect all items into a list instead of dropping them