fix for 4.08

This commit is contained in:
Simon Cruanes 2023-12-01 15:01:06 -05:00
parent fcee2f9c41
commit 50b478366f

View file

@ -332,7 +332,7 @@ let rec equal f l1 l2 =
let rec flat_map_kont f l kont = let rec flat_map_kont f l kont =
match l with match l with
| [] -> kont [] | [] -> kont []
| [x] -> | [ x ] ->
let x = f x in let x = f x in
kont x kont x
| x :: l' -> | x :: l' ->
@ -342,25 +342,11 @@ let rec flat_map_kont f l kont =
[@@@iflt 5.1] [@@@iflt 5.1]
let[@inline] flat_map f l = match l with let[@inline] flat_map f l =
| [] -> []
| [x] -> f x
| x :: tl
let rec aux f l kont =
match l with match l with
| [] -> kont [] | [] -> []
| x :: l' -> | [ x ] -> f x
let y = f x in | x :: tl -> flat_map_kont f l Fun.id
let kont' tail =
match y with
| [] -> kont tail
| [ x ] -> kont (x :: tail)
| [ x; y ] -> kont (x :: y :: tail)
| l -> kont (append l tail)
in
aux f l' kont'
in
aux f l Fun.id
[@@@else_] [@@@else_]