Returns a stack. Immutable. Use Stacks.mutable for a mutable alternative.
The basic usage is push/pop to add/remove, returning the modified stack. Use the property peek to see what's on top.
push
pop
peek
Options
List of items to add to stack. Items will be pushed 'left to right', ie array index 0 will be bottom of the stack.
// Createlet s = stack();// Add one or more itemss = s.push(1, 2, 3, 4);// See what's at the top of the stacks.peek; // 4// Remove from the top of the stack, returning// a new stack without items = s.pop();s.peek; // 3 Copy
// Createlet s = stack();// Add one or more itemss = s.push(1, 2, 3, 4);// See what's at the top of the stacks.peek; // 4// Remove from the top of the stack, returning// a new stack without items = s.pop();s.peek; // 3
Returns a stack. Immutable. Use Stacks.mutable for a mutable alternative.
The basic usage is
push
/pop
to add/remove, returning the modified stack. Use the propertypeek
to see what's on top.