![]()
|
Module Stackmodule Stack:
Last-in first-out stacks.
This module implements stacks (LIFOs), with in-place modification. type
The type of stacks containing elements of type
'a .exception Empty val create :
Return a new stack, initially empty.
val push : push x s adds the element x at the top of stack s .val pop : pop s removes and returns the topmost element in stack s ,
or raises Empty if the stack is empty.val top : top s returns the topmost element in stack s ,
or raises Empty if the stack is empty.val clear :
Discard all elements from a stack.
val copy :
Return a copy of the given stack.
val is_empty :
Return
true if the given stack is empty, false otherwise.val length :
Return the number of elements in a stack.
val iter : iter f s applies f in turn to all elements of s ,
from the element at the top of the stack to the element at the
bottom of the stack. The stack itself is unchanged. |