mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-05 19:00:31 -05:00
feat pvec: add flat_map
This commit is contained in:
parent
01402388e4
commit
f13fb6f471
2 changed files with 7 additions and 0 deletions
|
|
@ -352,6 +352,9 @@ let append a b =
|
|||
else
|
||||
fold_left push a b
|
||||
|
||||
let flat_map f v : _ t =
|
||||
fold_left (fun acc x -> append acc (f x)) empty v
|
||||
|
||||
let rec equal_tree eq t1 t2 =
|
||||
match t1, t2 with
|
||||
| Empty, Empty -> true
|
||||
|
|
|
|||
|
|
@ -82,8 +82,12 @@ val append : 'a t -> 'a t -> 'a t
|
|||
(** [append a b] adds all elements of [b] at the end of [a]. This is
|
||||
at least linear in the length of [b]. *)
|
||||
|
||||
|
||||
val map : ('a -> 'b) -> 'a t -> 'b t
|
||||
|
||||
val flat_map : ('a -> 'b t) -> 'a t -> 'b t
|
||||
(** @since NEXT_RELEASE *)
|
||||
|
||||
val choose : 'a t -> 'a option
|
||||
(** Return an element. It is unspecified which one is returned. *)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue