MCPcopy Create free account
hub / github.com/Axect/Peroxide / zip_with

Function zip_with

src/structure/vector.rs:551–562  ·  view source on GitHub ↗

Explicit version of `zip_with`

(f: F, xs: &[T], ys: &[T])

Source from the content-addressed store, hash-verified

549
550/// Explicit version of `zip_with`
551pub fn zip_with<F, T>(f: F, xs: &[T], ys: &[T]) -> Vec<T>
552where
553 F: Fn(T, T) -> T,
554 T: Default + Copy,
555{
556 let l = min(xs.len(), ys.len());
557 let mut result = vec![T::default(); l];
558 for i in 0..l {
559 result[i] = f(xs[i], ys[i]);
560 }
561 result
562}
563
564/// Explicit version of `zip_with` in parallel
565#[cfg(feature = "parallel")]

Callers 4

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 3

minFunction · 0.85
fFunction · 0.50
lenMethod · 0.45

Tested by 1

mainFunction · 0.68