diff --git a/src/lib.rs b/src/lib.rs index 04c5865..a33d2e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -229,6 +229,15 @@ where self.as_mut().iter_mut() } + /// Returns an array of the same size as `self`, with function `f` applied to each element in + /// order. + pub fn map(self, f: F) -> Array + where + F: FnMut(T) -> O, + { + self.into_iter().map(f).collect() + } + /// Concatenates `self` with `other`. #[inline] pub fn concat(self, other: Array) -> Array>