module Stack_intf: sig
.. end
An interface for stacks that follows Core
's conventions, as opposed to OCaml's
standard Stack
module.
val __pa_ounit_275876e34cf609db118f3d84b799a790 : string
An interface for stacks that follows Core
's conventions, as opposed to OCaml's
standard Stack
module.
module type S = sig
.. end
An interface for stacks that follows Core
's conventions, as opposed to OCaml's
standard Stack
module.
fold
, iter
, find
, and find_map
visit the elements in order from the top of
the stack to the bottom. to_list
and to_array
return the elements in order from
the top of the stack to the bottom.
of_list l
returns a stack whose top is the first element of l
and bottom is the
last element of l
.
create ()
returns an empty stack.
push t a
adds a
to the top of stack t
.
pop t
removes and returns the top element of t
as Some a
, or returns None
if
t
is empty.
top t
returns Some a
, where a
is the top of t
, unless is_empty t
, in which
case top
returns None
.
clear t
discards all elements from t
.
copy t
returns a copy of t
.
until_empty t f
repeatedly pops an element a
off of t
and runs f a
, until
t
becomes empty. It is fine if f
adds more elements to t
, in which case the
most-recently-added element will be processed next.