Module Femtolib.List


module List: sig .. end

val init : int -> (int -> 'a) -> 'a list
val nb_distinct : 'a list -> int
Assumes sorted input
val merge_lists : ('a -> 'a -> int) -> 'a list list -> 'a list
Like List.merge, but takes more than only two lists as input. Assuming that all the lists in l are sorted according to the comparison function cmp, merge_lists cmp l will return a sorted list containting all the elements of the lists of l. Tail-recursive on l but not on the lists contained in l since it uses List.merge. More efficient than

let merge_lists comp = List.fold_left (List.merge comp) [].

val max : ('a -> 'a -> bool) -> 'a list -> 'a
val iteri : (int -> 'a -> 'b) -> 'a list -> unit
val dedoublonne : 'a list -> 'a list
Removes the duplicates from a list. Linear time. Not tail recursive.
Assumes sorted input.
val stable_dedoublonne : 'a list -> 'a list
Removes the duplicates from a list. Does not assumes sorted input. Tail recursive. Elements from the list are kept in their original order. Quadratic time.
val stable_dedoublonne_fast : 'a list -> 'a list
Removes the duplicates from a list. Does not assumes sorted input. Tail recursive. Elements from the list are kept in their original order. Faster than stable_dedoublonne on big lists.