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

Last change on this file since 1585 was 1585, checked in by tranquil, 8 years ago

fighting with a bug of the translation from RTL to ERTL

File size: 3.3 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
12val fold3_left : ('a -> 'b -> 'c -> 'd -> 'a) ->
13  'a -> 'b list -> 'c list -> 'd list -> 'a
14val fold3_right : ('a -> 'b -> 'c -> 'd -> 'd) ->
15  'a list -> 'b list -> 'c list -> 'd -> 'd
16
17val max_list : 'a list -> 'a
18
19val pow : int -> int -> int
20
21val make: 'a -> int -> 'a list
22
23val makei : (int -> 'a) -> int -> 'a list
24
25val index_of : 'a -> 'a list -> int
26
27val foldi_until : int -> (int -> 'a -> 'b -> 'a) -> 'a -> 'b list -> 'a
28
29val foldi : (int -> 'a -> 'b -> 'a) -> 'a -> 'b list -> 'a
30
31val iteri : (int -> 'a -> unit) -> 'a list -> unit
32
33val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
34
35(* Raises Not_found if the list is empty. *)
36val last : 'a list -> 'a
37
38(* [split l i] splits the list [l] in two lists: one with the elements
39   up until the [i]th (exclusive) and one with the rest. *)
40val split: 'a list -> int -> ('a list * 'a list)
41
42(* [split_last l] returns the list [l] without its last element and its last
43   element. Raises Invalid_argument "MiscPottier.split_last" if the list is
44   empty. *)
45val split_last : 'a list -> ('a list * 'a)
46
47val update_list_assoc: 'a -> 'b -> ('a * 'b) list -> ('a * 'b) list
48
49(* Pasted from Pottier's PP compiler *)
50
51(* [combine] turns a pair of lists into a list of pairs. It never
52   fails: the length of the output list is the minimum of the lengths
53   of the input lists. *)
54
55val combine: 'a list -> 'b list -> ('a * 'b) list
56
57(* [subtract xs1 xs2] returns the list [xs1] deprived of as many
58   elements as there are in the list [xs2]. *)
59
60val subtract: 'a list -> 'b list -> 'a list
61
62(* [mirror] reverses the order of the pair components in a list
63   of pairs. *)
64
65val mirror: ('a * 'b) list -> ('b * 'a) list
66
67(* [length l] is the length of the list [l]. *)
68
69val length: 'a list -> int32
70
71(* [prefix k xs] returns the prefix of length [k] of the list [xs].
72   If [xs] has length less than [k], [xs] is returned. *)
73
74val prefix: int -> 'a list -> 'a list
75
76(* [memoize f] produces a memoizing version of the function [f].
77   It requires the domain of [f] to support generic equality. *)
78
79val memoize: ('a -> 'b) -> ('a -> 'b)
80
81(* [filter_map filter map l] returns the list [l] where elements satisfying the
82   [filter] function have been replaced by their application to the [map]
83   function. Elements that do not satisfy [filter] are not in the result
84   list. *)
85
86val filter_map: ('a -> bool) -> ('a -> 'b) -> 'a list -> 'b list
87
88(* [string_of_list sep f l] returns the string obtained by applying [f] to each
89   element of [l] and separating their output with [sep]. *)
90
91val string_of_list: string -> ('a -> string) -> 'a list -> string
92
93(* [sublist h k l] gives the sublist of [l] starting from index [h] to
94   [k] excluded. Can raise [Invalid_argument "sublist: invalid interval"]. *)
95val sublist : 'a list -> int -> int -> 'a list
96
97(* [fill l n] makes a list of length [n] using elements from [l], possibly
98   repeating it. Raises Invalid_argument if [n < 0] or [l = []]. *)
99val fill : 'a list -> int -> 'a list
100
Note: See TracBrowser for help on using the repository browser.