diff --git a/src/pvec/containers_pvec.ml b/src/pvec/containers_pvec.ml index 9f30dd07..6de797fe 100644 --- a/src/pvec/containers_pvec.ml +++ b/src/pvec/containers_pvec.ml @@ -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 diff --git a/src/pvec/containers_pvec.mli b/src/pvec/containers_pvec.mli index 2112a4d0..2c3bd25e 100644 --- a/src/pvec/containers_pvec.mli +++ b/src/pvec/containers_pvec.mli @@ -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. *)