let concat_map l ~f = let rec aux acc = function | [] -> List.rev acc | hd :: tl -> aux (rev_append (f hd) acc) tl in aux [] l