An interface for stacks that follows Core's conventions, as opposed to OCaml's standard Stack module.
module type S = sig .. end
type 'a t
include Invariant.S1 with type t := 'a t
include Container.S1 with type t := 'a t
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.
val of_list : 'a list -> 'a t
of_list l returns a stack whose top is the first element of l and bottom is the last element of l.
val create : unit -> 'a t
create () returns an empty stack.
val push : 'a t -> 'a -> unit
push t a adds a to the top of stack t.
val pop : 'a t -> 'a option
pop t removes and returns the top element of t as Some a, or returns None if t is empty.
val pop_exn : 'a t -> 'a
val top : 'a t -> 'a option
top t returns Some a, where a is the top of t, unless is_empty t, in which case top returns None.
val top_exn : 'a t -> 'a
val clear : 'a t -> unit
clear t discards all elements from t.
val copy : 'a t -> 'a t
copy t returns a copy of t.
val until_empty : 'a t -> ('a -> unit) -> unit
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.
val t_of_sexp : (Sexplib.Sexp.t -> 'a) -> Sexplib.Sexp.t -> 'a t
val sexp_of_t : ('a -> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t
val bin_t : 'a Bin_prot.Type_class.t -> 'a t Bin_prot.Type_class.t
val bin_read_t : 'a Bin_prot.Read.reader -> 'a t Bin_prot.Read.reader
val __bin_read_t__ : 'a Bin_prot.Read.reader -> (int -> 'a t) Bin_prot.Read.reader
val bin_reader_t : 'a Bin_prot.Type_class.reader -> 'a t Bin_prot.Type_class.reader
val bin_size_t : 'a Bin_prot.Size.sizer -> 'a t Bin_prot.Size.sizer
val bin_write_t : 'a Bin_prot.Write.writer -> 'a t Bin_prot.Write.writer
val bin_writer_t : 'a Bin_prot.Type_class.writer -> 'a t Bin_prot.Type_class.writer