[486] | 1 | |
---|

| 2 | (** This module provides some additional functions on lists. *) |
---|

| 3 | |
---|

| 4 | val make: 'a -> int -> 'a list |
---|

| 5 | |
---|

| 6 | val index_of : 'a -> 'a list -> int |
---|

| 7 | |
---|

| 8 | val foldi: (int -> 'a -> 'b -> 'a) -> 'a -> 'b list -> 'a |
---|

| 9 | |
---|

| 10 | val iteri: (int -> 'a -> unit) -> 'a list -> unit |
---|

| 11 | |
---|

| 12 | val mapi: (int -> 'a -> 'b) -> 'a list -> 'b list |
---|

| 13 | |
---|

| 14 | (* [split a i] splits the list a in two lists: one with the elements |
---|

| 15 | up until the [i]th (exclusive) and one with the rest. *) |
---|

| 16 | |
---|

| 17 | val split: 'a list -> int -> ('a list * 'a list) |
---|

| 18 | |
---|

| 19 | val update_list_assoc: 'a -> 'b -> ('a * 'b) list -> ('a * 'b) list |
---|

| 20 | |
---|

| 21 | (* Pasted from Pottier's PP compiler *) |
---|

| 22 | |
---|

| 23 | (* [combine] turns a pair of lists into a list of pairs. It never |
---|

| 24 | fails: the length of the output list is the minimum of the lengths |
---|

| 25 | of the input lists. *) |
---|

| 26 | |
---|

| 27 | val combine: 'a list -> 'b list -> ('a * 'b) list |
---|

| 28 | |
---|

| 29 | (* [subtract xs1 xs2] returns the list [xs1] deprived of as many |
---|

| 30 | elements as there are in the list [xs2]. *) |
---|

| 31 | |
---|

| 32 | val subtract: 'a list -> 'b list -> 'a list |
---|

| 33 | |
---|

| 34 | (* [mirror] reverses the order of the pair components in a list |
---|

| 35 | of pairs. *) |
---|

| 36 | |
---|

| 37 | val mirror: ('a * 'b) list -> ('b * 'a) list |
---|

| 38 | |
---|

| 39 | (* [length l] is the length of the list [l]. *) |
---|

| 40 | |
---|

| 41 | val length: 'a list -> int32 |
---|

| 42 | |
---|

| 43 | (* [prefix k xs] returns the prefix of length [k] of the list [xs]. |
---|

| 44 | If [xs] has length less than [k], [xs] is returned. *) |
---|

| 45 | |
---|

| 46 | val prefix: int -> 'a list -> 'a list |
---|

| 47 | |
---|

| 48 | (* [memoize f] produces a memoizing version of the function [f]. |
---|

| 49 | It requires the domain of [f] to support generic equality. *) |
---|

| 50 | |
---|

| 51 | val memoize: ('a -> 'b) -> ('a -> 'b) |
---|

| 52 | |
---|

| 53 | (* [filter_map filter map l] returns the list [l] where elements satisfying the |
---|

| 54 | [filter] function have been replaced by their application to the [map] |
---|

| 55 | function. Elements that do not satisfy [filter] are not in the result |
---|

| 56 | list. *) |
---|

| 57 | |
---|

| 58 | val filter_map: ('a -> bool) -> ('a -> 'b) -> 'a list -> 'b list |
---|

| 59 | |
---|

| 60 | (* [string_of_list sep f l] returns the string obtained by applying [f] to each |
---|

| 61 | element of [l] and separating their output with [sep]. *) |
---|

| 62 | |
---|

| 63 | val string_of_list: string -> ('a -> string) -> 'a list -> string |
---|