2 (** This module provides some additional functions on lists or arithmetics. *)
5 val pos : 'a -> 'a list -> int
7 val reduce : 'a list -> 'b list -> ('a list * 'a list) * ('b list * 'b list)
9 (* raise Failure "MiscPottier.map3" if the list arguments are not of the same
11 val map3 : ('a -> 'b -> 'c -> 'd) -> 'a list -> 'b list -> 'c list -> 'd list
13 val max_list : 'a list -> 'a
15 val pow : int -> int -> int
17 val make: 'a -> int -> 'a list
19 val index_of : 'a -> 'a list -> int
21 val foldi_until : int -> (int -> 'a -> 'b -> 'a) -> 'a -> 'b list -> 'a
23 val foldi : (int -> 'a -> 'b -> 'a) -> 'a -> 'b list -> 'a
25 val iteri : (int -> 'a -> unit) -> 'a list -> unit
27 val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
29 (* Raises Not_found if the list is empty. *)
30 val last : 'a list -> 'a
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. *)
34 val split: 'a list -> int -> ('a list * 'a list)
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
39 val split_last : 'a list -> ('a list * 'a)
41 val update_list_assoc: 'a -> 'b -> ('a * 'b) list -> ('a * 'b) list
43 (* Pasted from Pottier's PP compiler *)
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. *)
49 val combine: 'a list -> 'b list -> ('a * 'b) list
51 (* [subtract xs1 xs2] returns the list [xs1] deprived of as many
52 elements as there are in the list [xs2]. *)
54 val subtract: 'a list -> 'b list -> 'a list
56 (* [mirror] reverses the order of the pair components in a list
59 val mirror: ('a * 'b) list -> ('b * 'a) list
61 (* [length l] is the length of the list [l]. *)
63 val length: 'a list -> int32
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. *)
68 val prefix: int -> 'a list -> 'a list
70 (* [memoize f] produces a memoizing version of the function [f].
71 It requires the domain of [f] to support generic equality. *)
73 val memoize: ('a -> 'b) -> ('a -> 'b)
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
80 val filter_map: ('a -> bool) -> ('a -> 'b) -> 'a list -> 'b list
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]. *)
85 val string_of_list: string -> ('a -> string) -> 'a list -> string