datastructures v0.2.6 Data.Stack.Simple
A simple stack.
Summary
Functions
Check if the stack is empty
Fold the stack from the left
Fold the stack from the right
Check if the value is present in the stack
Creates an empty stack
Creates a new stack from the given enumerable
Peek the element that would be popped
Pop a value from the stack
Push a value in the stack
Reverse the stack
Get the size of the stack
Convert the stack to a list
Types
Functions
Check if the stack is empty.
Creates an empty stack.
Peek the element that would be popped.
Examples
iex> T.new |> Stack.push(42) |> Stack.peek
42
iex> T.new |> Stack.peek(:empty)
:empty
Pop a value from the stack.
Examples
iex> T.new |> Stack.push(42) |> Stack.push(23) |> Stack.pop
{23,#Stack<[42]>}
iex> T.new |> Stack.pop(:empty)
{:empty,#Stack<[]>}
Push a value in the stack.
Examples
iex> T.new |> Stack.push(42) |> Stack.push(23) |> Stack.push(1337)
#Stack<[1337,23,42]>
Get the size of the stack.