Module Option.List

val cons : 'a option -> 'a list -> 'a list

List.cons x l equals y::l if x is Some y and l otherwise.

val flatten : 'a option list -> 'a list

List.flatten l is the list of all the ys such that l contains Some y (in the same order).

val map : ('a -> 'b option) -> 'a list -> 'b list option

List.map f [a1;...;an] is the list Some [b1;...;bn] if for all i, there is a bi such that f ai is Some bi; it is None if, for at least one i, f ai is None.