keen/col/mut-stack

Source
mut-stack[t] record mut (has private fields)

Mutable stack.

Elements are pushed and popped from the top of the stack. Iterates from the bottom (least recently pushed) to the top (most recently pushed).

list-new[t] t mut-stack(a t[])
copy[t] t mut-stack(a t mut-stack)
This is O(a size).
to[t] t mut-stack(a t[])
Copy from a list. This is O(a size).
to[t] t[](a t mut-stack)
Copy to an array. This is O(a size).
any[t] bool(a t mut-stack)
size[t] nat32(a t mut-stack)
Number of elements in the stack. This is O(1).
~=[t] void(a t mut-stack, value t)
Pushes a value to the top of the stack.
~~=[t] void(a t mut-stack, values t[])
Pushes many values to the top of the stack.
peek[t] t option(a t mut-stack)
Returns the top element of the stack (if any) without removing it.
pop[t] t option(a t mut-stack)
Removes and returns the top element of the stack (if any).
some[t] bool(a t mut-stack, f bool mut(t))
some-reverse[t] bool(a t mut-stack, f bool mut(t))
filter=[t] void(a t mut-stack, f bool mut(t))