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

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

New memory model and bug fixes in 8051 branch. Added primitive operations in interpreters from Clight to LIN.

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