Reference

Stack

New
Input A list of elements.
Output A stack containing the list of elements with the last element at the top of the stack.

Signature

Example

Push
Input A stack and an element.
Output A new stack with the element added to the top.

Signature

Example

Pop
Input A stack.
Output A new stack with the top element removed.

Signature

Example

Peek
Input A stack.
Output The element at the top of the stack.

Signature

Example

Is Empty
Input A stack.
Output True if the stack is empty, false otherwise.

Signature

Example

Is Not Empty
Input A stack.
Output True if the stack is not empty, false otherwise.

Signature

Example

Length
Input A stack.
Output The number of elements in the stack.

Signature

Example

Reverse
Input A stack.
Output A new stack with the elements in reverse order.

Signature

Example