diff --git a/sledge/src/import/vector.ml b/sledge/src/import/vector.ml index c0963d157..53092b7f2 100644 --- a/sledge/src/import/vector.ml +++ b/sledge/src/import/vector.ml @@ -81,5 +81,10 @@ let of_list x = v (Array.of_list x) let of_list_rev x = v (Array.of_list_rev x) let of_option x = v (Option.to_array x) let reduce_exn x ~f = Array.reduce_exn (a x) ~f + +let unzip x = + let y, z = Array.unzip (a x) in + (v y, v z) + let to_list x = Array.to_list (a x) let to_array = a diff --git a/sledge/src/import/vector.mli b/sledge/src/import/vector.mli index fca160dbe..b025d1616 100644 --- a/sledge/src/import/vector.mli +++ b/sledge/src/import/vector.mli @@ -175,7 +175,9 @@ val reduce_exn : 'a t -> f:('a -> 'a -> 'a) -> 'a (* val random_element_exn : ?random_state:Base.Random.State.t -> 'a t -> 'a *) (* val zip : 'a t -> 'b t -> ('a * 'b) t option *) (* val zip_exn : 'a t -> 'b t -> ('a * 'b) t *) -(* val unzip : ('a * 'b) t -> 'a t * 'b t *) + +val unzip : ('a * 'b) t -> 'a t * 'b t + (* val sorted_copy : 'a t -> compare:('a -> 'a -> int) -> 'a t *) (* val last : 'a t -> 'a *)