Module type Stack_intf.S

module type S = sig .. end

type 'a t 
include Invariant.S1
include Container.S1
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.Unsafe_read_c.reader -> 'a t Bin_prot.Read_ml.reader
val bin_read_t_ : 'a Bin_prot.Unsafe_read_c.reader ->
'a t Bin_prot.Unsafe_read_c.reader
val bin_read_t__ : 'a Bin_prot.Unsafe_read_c.reader ->
(int -> 'a t) Bin_prot.Unsafe_read_c.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.Unsafe_write_c.writer ->
'a t Bin_prot.Write_ml.writer
val bin_write_t_ : 'a Bin_prot.Unsafe_write_c.writer ->
'a t Bin_prot.Unsafe_write_c.writer
val bin_writer_t : 'a Bin_prot.Type_class.writer -> 'a t Bin_prot.Type_class.writer

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.