pub fn zip_range<T: Clone + PartialOrd, U: Clone>(
x: &[T],
y: &[U],
) -> Vec<(Range<T>, U)>
Expand description
Generate and Zip Range of Intervals
§Examples
extern crate peroxide;
use peroxide::fuga::*;
use std::ops::Range;
let x: Vec<i32> = vec![1, 2, 3, 4];
let y: Vec<i32> = x.iter().map(|&t| t.pow(2)).collect();
let r = zip_range(&x, &y);
let answer = vec![
(Range { start: 1, end: 2 }, 1),
(Range { start: 2, end: 3 }, 4),
(Range { start: 3, end: 4 }, 9),
];
assert_eq!(r, answer);