Module Util.Stack
val create : unit -> 'a tCreate an empty stack.
val push : 'a -> 'a t -> unitAdd an element to a stack.
val find : ('a -> bool) -> 'a t -> 'aFind the first element satisfying the predicate.
- raises Not_found
it there is none.
val is_empty : 'a t -> boolWhether a stack is empty.
val iter : ('a -> unit) -> 'a t -> unitIterate a function over elements, from the last added one.
val clear : 'a t -> unitEmpty a stack.
val length : 'a t -> intLength of a stack.
val pop : 'a t -> 'aRemove and returns the first element of the stack.
- raises Empty
if empty.
val top : 'a t -> 'aRemove the first element of the stack without modifying it.
- raises Empty
if empty.
val to_list : 'a t -> 'a listConvert to a list.
val find_map : ('a -> 'b option) -> 'a t -> 'bFind the first element that returns
Some _.- raises Not_found
it there is none.
val fold_until : ('c -> 'a -> 'c CSig.until) -> 'c -> 'a t -> 'cLike CList.fold_left_until. The stack is traversed from the top and is not altered.