let for_all t ~f = try (iter t (fun x -> if not (f x) then raise Not_found else ()); true) with Not_found -> false