Module Belt.MutableStack
An FILO(first in last out) stack data structure
First in last out stack.
This module implements stacks, with in-place modification.
ocaml
type 'a treasonml
type t('a);ocaml
val make : unit -> 'a treasonml
let make: unit => t('a);returns a new stack, initially empty.
ocaml
val clear : 'a t -> unitreasonml
let clear: t('a) => unit;Discard all elements from the stack.
ocaml
val copy : 'a t -> 'a treasonml
let copy: t('a) => t('a);copy x O(1) operation, return a new stack
ocaml
val push : 'a t -> 'a -> unitreasonml
let push: t('a) => 'a => unit;ocaml
val popUndefined : 'a t -> 'a Js.undefinedreasonml
let popUndefined: t('a) => Js.undefined('a);ocaml
val pop : 'a t -> 'a optionreasonml
let pop: t('a) => option('a);ocaml
val topUndefined : 'a t -> 'a Js.undefinedreasonml
let topUndefined: t('a) => Js.undefined('a);ocaml
val top : 'a t -> 'a optionreasonml
let top: t('a) => option('a);ocaml
val isEmpty : 'a t -> boolreasonml
let isEmpty: t('a) => bool;ocaml
val size : 'a t -> intreasonml
let size: t('a) => int;ocaml
val forEachU : 'a t -> ('a -> unit) Js.Fn.arity1 -> unitreasonml
let forEachU: t('a) => Js.Fn.arity1(('a => unit)) => unit;ocaml
val forEach : 'a t -> ('a -> unit) -> unitreasonml
let forEach: t('a) => ('a => unit) => unit;ocaml
val dynamicPopIterU : 'a t -> ('a -> unit) Js.Fn.arity1 -> unitreasonml
let dynamicPopIterU: t('a) => Js.Fn.arity1(('a => unit)) => unit;ocaml
val dynamicPopIter : 'a t -> ('a -> unit) -> unitreasonml
let dynamicPopIter: t('a) => ('a => unit) => unit;dynamicPopIter s f apply f to each element of s. The item is poped before applying f, s will be empty after this opeartion. This function is useful for worklist algorithm