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

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

32 and 16 bits operations support in D2.2/8051

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