aux []
let rec list_findopt f l =
- let rec aux = function
+ let rec aux k = function
| [] -> None
| x::tl ->
- (match f x with
- | None -> aux tl
+ (match f x k with
+ | None -> aux (succ k) tl
| Some _ as rc -> rc)
in
- aux l
+ aux 0 l
let split_nth n l =
let rec aux acc n l =
let floc_of_loc (loc_begin, loc_end) =
Stdpp.make_loc (loc_begin, loc_end)
-let dummy_floc = floc_of_loc (-1, -1)
+let dummy_floc = floc_of_loc (0, 0)
let raise_localized_exception ~offset floc exn =
let x, y = loc_of_floc floc in
;;
let list_seq start stop =
+ if start > stop then [] else
let rec aux pos =
if pos = stop then []
else pos :: (aux (pos+1))