MutableStack
First in last out stack. This module implements stacks, with in-place modification.
t
RESCRIPT
type t<'a>make
RESCRIPT
let make: unit => t<'a>Returns a new stack, initially empty.
clear
RESCRIPT
let clear: t<'a> => unitDiscard all elements from the stack.
copy
RESCRIPT
let copy: t<'a> => t<'a>copy(x) O(1) operation, return a new stack.
push
RESCRIPT
let push: (t<'a>, 'a) => unitpopUndefined
RESCRIPT
let popUndefined: t<'a> => Js.undefined<'a>pop
RESCRIPT
let pop: t<'a> => option<'a>topUndefined
RESCRIPT
let topUndefined: t<'a> => Js.undefined<'a>top
RESCRIPT
let top: t<'a> => option<'a>isEmpty
RESCRIPT
let isEmpty: t<'a> => boolsize
RESCRIPT
let size: t<'a> => intforEachU
RESCRIPT
let forEachU: (t<'a>, 'a => unit) => unitforEach
RESCRIPT
let forEach: (t<'a>, 'a => unit) => unitdynamicPopIterU
RESCRIPT
let dynamicPopIterU: (t<'a>, 'a => unit) => unitdynamicPopIter
RESCRIPT
let dynamicPopIter: (t<'a>, 'a => unit) => unitdynamicPopIter(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.