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

Last change on this file since 486 was 486, checked in by ayache, 8 years ago

Deliverable D2.2

File size: 2.0 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(* [split a i] splits the list a in two lists: one with the elements
15   up until the [i]th (exclusive) and one with the rest. *)
16
17val split: 'a list -> int -> ('a list * 'a list)
18
19val update_list_assoc: 'a -> 'b -> ('a * 'b) list -> ('a * 'b) list
20
21(* Pasted from Pottier's PP compiler *)
22
23(* [combine] turns a pair of lists into a list of pairs. It never
24   fails: the length of the output list is the minimum of the lengths
25   of the input lists. *)
26
27val combine: 'a list -> 'b list -> ('a * 'b) list
28
29(* [subtract xs1 xs2] returns the list [xs1] deprived of as many
30   elements as there are in the list [xs2]. *)
31
32val subtract: 'a list -> 'b list -> 'a list
33
34(* [mirror] reverses the order of the pair components in a list
35   of pairs. *)
36
37val mirror: ('a * 'b) list -> ('b * 'a) list
38
39(* [length l] is the length of the list [l]. *)
40
41val length: 'a list -> int32
42
43(* [prefix k xs] returns the prefix of length [k] of the list [xs].
44   If [xs] has length less than [k], [xs] is returned. *)
45
46val prefix: int -> 'a list -> 'a list
47
48(* [memoize f] produces a memoizing version of the function [f].
49   It requires the domain of [f] to support generic equality. *)
50
51val memoize: ('a -> 'b) -> ('a -> 'b)
52
53(* [filter_map filter map l] returns the list [l] where elements satisfying the
54   [filter] function have been replaced by their application to the [map]
55   function. Elements that do not satisfy [filter] are not in the result
56   list. *)
57
58val filter_map: ('a -> bool) -> ('a -> 'b) -> 'a list -> 'b list
59
60(* [string_of_list sep f l] returns the string obtained by applying [f] to each
61   element of [l] and separating their output with [sep]. *)
62
63val string_of_list: string -> ('a -> string) -> 'a list -> string
Note: See TracBrowser for help on using the repository browser.