source: Deliverables/D2.2/8051/src/utilities/miscPottier.mli @ 619

Last change on this file since 619 was 619, checked in by ayache, 9 years ago

Update of D2.2 from Paris.

File size: 2.2 KB
Line 
1
2(** This module provides some additional functions on lists. *)
3
4val make: 'a -> int -> 'a list
5
6val index_of : 'a -> 'a list -> int
7
8val foldi : (int -> 'a -> 'b -> 'a) -> 'a -> 'b list -> 'a
9
10val iteri : (int -> 'a -> unit) -> 'a list -> unit
11
12val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
13
14(* Raises Not_found if the list is empty. *)
15val last : 'a list -> 'a
16
17(* [split l i] splits the list [l] in two lists: one with the elements
18   up until the [i]th (exclusive) and one with the rest. *)
19
20val split: 'a list -> int -> ('a list * 'a list)
21
22(* [split_last l] returns the list [l] without its last element and its last
23   element. Raises Invalid_argument "MiscPottier.split_last" if the list is
24   empty. *)
25
26val split_last : 'a list -> ('a list * 'a)
27
28val update_list_assoc: 'a -> 'b -> ('a * 'b) list -> ('a * 'b) list
29
30(* Pasted from Pottier's PP compiler *)
31
32(* [combine] turns a pair of lists into a list of pairs. It never
33   fails: the length of the output list is the minimum of the lengths
34   of the input lists. *)
35
36val combine: 'a list -> 'b list -> ('a * 'b) list
37
38(* [subtract xs1 xs2] returns the list [xs1] deprived of as many
39   elements as there are in the list [xs2]. *)
40
41val subtract: 'a list -> 'b list -> 'a list
42
43(* [mirror] reverses the order of the pair components in a list
44   of pairs. *)
45
46val mirror: ('a * 'b) list -> ('b * 'a) list
47
48(* [length l] is the length of the list [l]. *)
49
50val length: 'a list -> int32
51
52(* [prefix k xs] returns the prefix of length [k] of the list [xs].
53   If [xs] has length less than [k], [xs] is returned. *)
54
55val prefix: int -> 'a list -> 'a list
56
57(* [memoize f] produces a memoizing version of the function [f].
58   It requires the domain of [f] to support generic equality. *)
59
60val memoize: ('a -> 'b) -> ('a -> 'b)
61
62(* [filter_map filter map l] returns the list [l] where elements satisfying the
63   [filter] function have been replaced by their application to the [map]
64   function. Elements that do not satisfy [filter] are not in the result
65   list. *)
66
67val filter_map: ('a -> bool) -> ('a -> 'b) -> 'a list -> 'b list
68
69(* [string_of_list sep f l] returns the string obtained by applying [f] to each
70   element of [l] and separating their output with [sep]. *)
71
72val string_of_list: string -> ('a -> string) -> 'a list -> string
Note: See TracBrowser for help on using the repository browser.