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. |
Push
| Input | A stack and an element. |
| Output | A new stack with the element added to the top. |
Pop
| Input | A stack. |
| Output | A new stack with the top element removed. |
Peek
| Input | A stack. |
| Output | The element at the top of the stack. |
Is Empty
| Input | A stack. |
| Output | True if the stack is empty, false otherwise. |
Is Not Empty
| Input | A stack. |
| Output | True if the stack is not empty, false otherwise. |
Length
| Input | A stack. |
| Output | The number of elements in the stack. |
Reverse
| Input | A stack. |
| Output | A new stack with the elements in reverse order. |