aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/cList.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cList.ml')
-rw-r--r--lib/cList.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/cList.ml b/lib/cList.ml
index cf2a54c4b..643ef7f2b 100644
--- a/lib/cList.ml
+++ b/lib/cList.ml
@@ -91,6 +91,7 @@ sig
val index0 : 'a -> 'a list -> int
val index0_f : ('a -> 'a -> bool) -> 'a -> 'a list -> int
val iteri : (int -> 'a -> unit) -> 'a list -> unit
+ val fold_left_until : ('c -> 'a -> 'c CSig.until) -> 'c -> 'a list -> 'c
val fold_right_i : (int -> 'a -> 'b -> 'b) -> int -> 'a list -> 'b -> 'b
val fold_left_i : (int -> 'a -> 'b -> 'a) -> int -> 'a -> 'b list -> 'a
val fold_right_and_left :
@@ -424,6 +425,12 @@ let index x =
let index0 x l = index x l - 1
+let fold_left_until f accu s =
+ let rec aux accu = function
+ | [] -> accu
+ | x :: xs -> match f accu x with CSig.Stop x -> x | CSig.Cont i -> aux i xs in
+ aux accu s
+
let fold_right_i f i l =
let rec it_f i l a = match l with
| [] -> a