Stack.Xt
Explicit transaction log passing on stacks.
swap s1 s2
exchanges the contents of the stacks s1
and s2
.
to_seq s
returns a domain safe sequence for iterating through the elements of the stack top to bottom.
The sequence is based on a constant time, O(1)
, snapshot of the stack and modifications of the stack have no effect on the sequence.
push x s
adds the element x
to the top of the stack s
.
pop_opt s
removes and returns the topmost element of the stack s
, or None
if the stack is empty.
pop_all s
removes and returns a domain safe sequence for iterating through all the elements that were in the stack top to bottom.
pop_blocking s
removes and returns the topmost element of the stack s
, or blocks waiting for the queue to become non-empty.
top_opt s
returns the topmost element in stack s
, or None
if the stack is empty.