aboutsummaryrefslogtreecommitdiff
path: root/kernel/type_errors.mli
diff options
context:
space:
mode:
authorGabriel Scherer2015-06-27 22:01:38 +0200
committerMaxime Dénès2016-06-27 12:45:41 +0200
commit56a7d450fb67268d121e69a5e111968d0dfb2a6a (patch)
tree98485b86b0505cefc082c37f074932ff8eaa02a4 /kernel/type_errors.mli
parent39163205cc59b98028eaaeace86463bb8c990818 (diff)
add CList.extract_first
we already have val remove_first : ('a -> bool) -> 'a list -> 'a list (** Remove the first element satisfying a predicate, or raise [Not_found] *) now we also have the more general val extract_first : ('a -> bool) -> 'a list -> 'a list * 'a (** Remove and return the first element satisfying a predicate, or raise [Not_found] *) The implementation is tail-recursive. The code I'm hoping to factorize reimplements extract_first in a tail-recursive way, so it seemed good to preserve this. On the other hand remove_first is not tail-recursive itself, and that gives better constant factors in real-life cases. It's unclear what is the best choice.
Diffstat (limited to 'kernel/type_errors.mli')
0 files changed, 0 insertions, 0 deletions