Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 41 lines (35 sloc) 1.459 kb
fccc685 Initial open-source release
MLstate authored
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 (* CF mli *)
19 module List = BaseList
20
21 type 'a t = { mutable d : 'a list }
22 let create () = { d = [] }
23 let clear d = d.d <- []
24 let add d a = d.d <- a::d.d
25 let append d l = d.d <- List.rev_append l d.d
26 let rev_append d l = d.d <- List.append l d.d
27 let mem a d = List.mem a d.d
28 let fold_right fct d acc = List.fold_left (fun acc d -> fct d acc) acc d.d
29 let fold_left fct acc d = List.fold_left fct acc (List.rev d.d)
30 let to_list d = List.rev d.d
31 let to_rev_list d = d.d
32 let length d = List.length d.d
33 let iter f d = List.iter f (List.rev d.d)
34 let rev_iter f d = List.iter f d.d
35 let is_empty d = List.is_empty d.d
36 let from_list l = { d = List.rev l }
37 let from_rev_list l = { d = l }
38 let reset_from_list d l = d.d <- List.rev l
39 let reset_from_rev_list d l = d.d <- l
40 let update f d = reset_from_list d (f (to_list d))
Something went wrong with that request. Please try again.