Skip to content
This repository
Newer
Older
100644 89 lines (70 sloc) 1.825 kb
fccc6851 » MLstate
2011-06-21 Initial open-source release
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (**
19 Manipulation of mutable list.
20 *)
21
22 (**
23 Fee free to add any persistent function from [List] in this module,
24 in the imperative version.
25 *)
26
27 type 'a t
28 val create : unit -> 'a t
29
30 (**
31 O(n)
32 *)
33 val to_list : 'a t -> 'a list
34
35 (**
36 O(1)
37 *)
38 val to_rev_list : 'a t -> 'a list
39
40 val clear : 'a t -> unit
41 val add : 'a t -> 'a -> unit
42
43 (**
44 O(n)
45 *)
46 val mem : 'a -> 'a t -> bool
47
48 (**
49 tail rec, O(n)
50 *)
51 val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
52
53 (**
54 tail rec, O(n)
55 *)
56 val fold_right : ('a -> 'b -> 'b) -> 'a t -> 'b -> 'b
57
58 (**
59 tail rec, O(n)
60 *)
61 val length : 'a t -> int
62
63 (**
64 tail rec, O(n)
65 *)
66 val iter : ('a -> unit) -> 'a t -> unit
67
68 (**
69 tail rec, O(n)
70 *)
71 val rev_iter : ('a -> unit) -> 'a t -> unit
72
73 val is_empty : 'a t -> bool
74
75 (**
76 appends the reversed list at the end of the mutable list
77 *)
78 val rev_append : 'a t -> 'a list -> unit
79
80 (**
81 appends the list at the end of the mutable list
82 *)
83 val append : 'a t -> 'a list -> unit
84
85 val from_list : 'a list -> 'a t
86 val from_rev_list : 'a list -> 'a t
87 val reset_from_list : 'a t -> 'a list -> unit
88 val reset_from_rev_list : 'a t -> 'a list -> unit
89 val update : ('a list -> 'a list) -> 'a t -> unit
Something went wrong with that request. Please try again.