# stack Module

## clear-stack

a **⇒** ∅

Empties the stack.

## cleave

a_{1} (quot_{*}) **⇒** a_{*}

Applies each quotation contained in the first element to the second element a_{1}.

## cons

a_{1} (a_{*}) **⇒** (a_{1} a_{*})

Prepends a_{1} to the quotation on top of the stack.

## dip

a_{1} (a_{2}) **⇒** a_{*} a_{1}

Removes the first and second element from the stack, dequotes the first element, and restores the second element.

## dup

a_{1} **⇒** a_{1} a_{1}

Duplicates the first element on the stack.

## get-stack

∅ **⇒** (a_{*})

Puts a quotation containing the contents of the stack on the stack.

## id

∅ **⇒** ∅

Does nothing.

## keep

a_{1} quot **⇒** a_{*} a_{1}

Applies each quotation contained in the first element to each subsequent corresponding element.

## nip

a_{1} a_{2} **⇒** a_{2}

Removes the second element from the stack.

## over

a_{1} a_{2} **⇒** a_{1} a_{2} a_{1}

Pushes a copy of the second element on top of the stack.

## pick

a_{1} a_{2} a_{3} **⇒** a_{1} a_{2} a_{3} a_{1}

Pushes a copy of the third element on top of the stack.

## pop

a **⇒** ∅

Removes the first element from the stack.

## rolldown

a_{1} a_{2} a_{3} **⇒** a_{2} a_{3} a_{1}

Moves the third element in first position, the second in third position and the the first in second position.

## rollup

a_{1} a_{2} a_{3} **⇒** a_{3} a_{2} a_{1}

Moves the third and second element into second and third position and moves the first element into third position.

## set-stack

quot **⇒** a_{*}

Substitute the existing stack with the contents of quot.

## sip

a_{1} (a_{2}) **⇒** a_{*} a_{1}

Saves the a_{1}, dequotes a_{2}, and restores a_{1}.

## spread

a_{*} (quot_{*}) **⇒** a_{*}

Applies each quotation contained in the first element to each subsequent corresponding element.

## swap

a_{1} a_{2} **⇒** a_{2} a_{1}

Swaps the first two elements on the stack.

## swons

(a_{*}) a_{1} **⇒** (a_{1} a_{*})

Prepends a_{1} to the quotation that follows it.