let find_remove f l = let rec aux acc = function | [] -> raise Not_found | hd :: tl -> if f hd then (hd,rev_append acc tl) else aux (hd :: acc) tl in aux [] l