Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 55 lines (40 sloc) 1.47 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 (**
19 Manipulation of non empty lists
20 *)
21
22 type 'a t = 'a * 'a list
23
24 (** unwrap a value of type t *)
25 val unwrap : 'a t -> 'a list
26
27 (** wrap a list
28 @raise Invalid_argument if the list is empty
29 *)
30 val wrap : 'a list -> 'a t
31
32 (**
33 Build an new HdList from an element
34 *)
35 val singleton : 'a -> 'a t
36
37 val length : 'a t -> int
38 val hd : 'a t -> 'a
39 val tl : 'a t -> 'a list
40
41 val last : 'a t -> 'a
42
43 val nth : 'a t -> int -> 'a
44 val rev : 'a t -> 'a t
45 val iter : ('a -> unit) -> 'a t -> unit
46 val map : ('a -> 'b) -> 'a t -> 'b t
47
48 val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc
49 val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc
50
51 val reduce_left : ('a -> 'a -> 'a) -> 'a t -> 'a
52 val reduce_left : ('a -> 'a -> 'a) -> 'a t -> 'a
53
54 val fold_left_map : ('acc -> 'a -> 'acc * 'a) -> 'acc -> 'a t -> 'acc * 'a t
Something went wrong with that request. Please try again.