mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-08 04:05:30 -05:00
better CCKlist.flat_map
This commit is contained in:
parent
29ff651f3b
commit
9bcc410c36
1 changed files with 5 additions and 1 deletions
|
|
@ -120,5 +120,9 @@ let rec append l1 l2 = match l1 with
|
||||||
let rec flat_map f l = match l with
|
let rec flat_map f l = match l with
|
||||||
| `Nil -> `Nil
|
| `Nil -> `Nil
|
||||||
| `Cons (x, l') ->
|
| `Cons (x, l') ->
|
||||||
append (f x) (flat_map f (l' ()))
|
_flat_map_app f (f x) (l' ()) ()
|
||||||
|
and _flat_map_app f l l' () = match l with
|
||||||
|
| `Nil -> flat_map f l'
|
||||||
|
| `Cons (x, tl) ->
|
||||||
|
`Cons (x, _flat_map_app f (tl ()) l')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue