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

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