-
Notifications
You must be signed in to change notification settings - Fork 465
/
Copy pathext_list.mli
71 lines (46 loc) · 2.33 KB
/
ext_list.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
(* OCamlScript compiler
* Copyright (C) 2015-2016 Bloomberg Finance L.P.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
(* Author: Hongbo Zhang *)
(** Extension to the standard library [List] module *)
(** TODO some function are no efficiently implemented. *)
val filter_map : ('a -> 'b option) -> 'a list -> 'b list
val same_length : 'a list -> 'b list -> bool
val init : int -> (int -> 'a) -> 'a list
val take : int -> 'a list -> 'a list * 'a list
val exclude_tail : 'a list -> 'a list
val filter_map2 : ('a -> 'b -> 'c option) -> 'a list -> 'b list -> 'c list
val filter_map2i : (int -> 'a -> 'b -> 'c option) -> 'a list -> 'b list -> 'c list
val filter_mapi : (int -> 'a -> 'b option) -> 'a list -> 'b list
val flat_map2 : ('a -> 'b -> 'c list) -> 'a list -> 'b list -> 'c list
val flat_map : ('a -> 'b list) -> 'a list -> 'b list
val flat_map2_last : (bool -> 'a -> 'b -> 'c list) -> 'a list -> 'b list -> 'c list
val map_last : (bool -> 'a -> 'b) -> 'a list -> 'b list
val stable_group : ('a -> 'a -> bool) -> 'a list -> 'a list list
val drop : int -> 'a list -> 'a list
val for_all_ret : ('a -> bool) -> 'a list -> 'a option
val for_all_opt : ('a -> 'b option) -> 'a list -> 'b option
(** [for_all_opt f l] returns [None] if all return [None],
otherwise returns the first one.
*)
val fold : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
(** same as [List.fold_left].
Provide an api so that list can be easily swapped by other containers
*)
val rev_map_append : ('a -> 'b) -> 'a list -> 'b list -> 'b list
val rev_map_acc : 'a list -> ('b -> 'a) -> 'b list -> 'a list
val rev_iter : ('a -> unit) -> 'a list -> unit