keen/col/mut-stack

Source
mut-stack[t] record (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).
is-empty[t] bool(a t mut-stack)
true if a.size == 0.
size[t] nat64(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 without removing it. Returns an empty option if a is-empty.
pop[t] t option(a t mut-stack)
Removes and returns the top element of the stack. Returns an empty option if a is-empty.
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))