package dolmen_type

  1. Overview
  2. Docs

Module Misc.ListsSource

List helpers

Sourceval init : int -> (int -> 'a) -> 'a list

Create a list of the given length by calling th e givne function for each element (starting from 0 up until the length minus one.

Sourceval replicate : int -> 'a -> 'a list

Create a list containing n-times the given element.

Sourceval take_drop : int -> 'a list -> 'a list * 'a list

take_drop n l tries and split the list into a first list containing the first n elements of l, and in a second list the rest.

Sourceval iter3 : ('a -> 'b -> 'c -> unit) -> 'a list -> 'b list -> 'c list -> unit

Same as List.iter2 but for 3 lists.

Sourceval map3 : ('a -> 'b -> 'c -> 'd) -> 'a list -> 'b list -> 'c list -> 'd list

Same as List.map2 but for 3 lists.

Sourceval fold_left_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b list -> 'a * 'c list

Same as List.fold_left_map (which is onlt available for ocaml >= 4.11).

Sourceval split3 : ('a * 'b * 'c) list -> 'a list * 'b list * 'c list

Similar to List.split but for triplets.