# 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.

## getstack

getstack **⇒** get-stack

See get-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}

Removes the first element from the stack, dequotes it, and restores the second 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.

## setstack

setstack **⇒** set-stack

See set-stack.

## set-stack

quot **⇒** a_{*}

Substitute the existing stack with the contents of quot.

## sip

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

Saves the quot_{1}, dequotes quot_{2}, and restores quot_{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.