mapfilter : ('a -> 'b) -> 'a list -> 'b list
# mapfilter hd [[1;2;3];[4;5];[];[6;7;8];[]];; val it : int list = [1; 4; 6] # mapfilter (fun (h::t) -> h) [[1;2;3];[4;5];[];[6;7;8];[]];; Warning: this pattern-matching is not exhaustive. Here is an example of a value that is not matched: [] Exception: Match_failure ("", 24547, -35120).