mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
fix for 4.08
This commit is contained in:
parent
206a084e7e
commit
60b3ab2465
1 changed files with 6 additions and 20 deletions
|
|
@ -332,7 +332,7 @@ let rec equal f l1 l2 =
|
|||
let rec flat_map_kont f l kont =
|
||||
match l with
|
||||
| [] -> kont []
|
||||
| [x] ->
|
||||
| [ x ] ->
|
||||
let x = f x in
|
||||
kont x
|
||||
| x :: l' ->
|
||||
|
|
@ -342,25 +342,11 @@ let rec flat_map_kont f l kont =
|
|||
|
||||
[@@@iflt 5.1]
|
||||
|
||||
let[@inline] flat_map f l = match l with
|
||||
| [] -> []
|
||||
| [x] -> f x
|
||||
| x :: tl
|
||||
let rec aux f l kont =
|
||||
let[@inline] flat_map f l =
|
||||
match l with
|
||||
| [] -> kont []
|
||||
| x :: l' ->
|
||||
let y = f x in
|
||||
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
|
||||
| [] -> []
|
||||
| [ x ] -> f x
|
||||
| x :: tl -> flat_map_kont f l Fun.id
|
||||
|
||||
[@@@else_]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue