1Stack(3)                         OCaml library                        Stack(3)
2
3
4

NAME

6       Stack - Last-in first-out stacks.
7

Module

9       Module   Stack
10

Documentation

12       Module Stack
13        : sig end
14
15
16       Last-in first-out stacks.
17
18       This module implements stacks (LIFOs), with in-place modification.
19
20
21
22
23
24
25       type 'a t
26
27
28       The type of stacks containing elements of type 'a .
29
30
31
32
33       exception Empty
34
35
36       Raised when Stack.pop or Stack.top is applied to an empty stack.
37
38
39
40
41       val create : unit -> 'a t
42
43       Return a new stack, initially empty.
44
45
46
47
48       val push : 'a -> 'a t -> unit
49
50
51       push x s adds the element x at the top of stack s .
52
53
54
55
56       val pop : 'a t -> 'a
57
58
59       pop  s  removes  and returns the topmost element in stack s , or raises
60       Empty if the stack is empty.
61
62
63
64
65       val top : 'a t -> 'a
66
67
68       top s returns the topmost element in stack s , or raises Empty  if  the
69       stack is empty.
70
71
72
73
74       val clear : 'a t -> unit
75
76       Discard all elements from a stack.
77
78
79
80
81       val copy : 'a t -> 'a t
82
83       Return a copy of the given stack.
84
85
86
87
88       val is_empty : 'a t -> bool
89
90       Return true if the given stack is empty, false otherwise.
91
92
93
94
95       val length : 'a t -> int
96
97       Return the number of elements in a stack.
98
99
100
101
102       val iter : ('a -> unit) -> 'a t -> unit
103
104
105       iter  f  s applies f in turn to all elements of s , from the element at
106       the top of the stack to the element at the bottom  of  the  stack.  The
107       stack itself is unchanged.
108
109
110
111
112
113
114OCamldoc                          2017-03-22                          Stack(3)
Impressum