Module List_utils

module List_utils: sig .. end
Extra functions over lists

val is_empty : 'a list -> bool
is_empty l returns true if l = []
val take : int -> 'a list -> 'a list
take n l returns up to the n first elements of list l
val drop : int -> 'a list -> 'a list
drop n l removes the n first elements of list l if n is greater than the length of the list, returns [].
val last : 'a list -> 'a
last l returns the last element of list l. Raise Failure "last" if the list is empty
val rev_flatten : 'a list list -> 'a list
rev_flatten l reverses and flatten the list of list l at the same time. It is the same as doing List.flatten l |> List.rev but tail-recursive and more efficient. *
val flat_map : ('a -> 'b list) -> 'a list -> 'b list
flat_map f l is like f l |> List.flatten but tail-recusrive and more efficient
val hd_hd : 'a list -> 'a * 'a
hd_hd l gets the two first elements of a list.
Raises Failure "hd_hd" if l is empty or the singleton list