pub fn map<T, U, F>(data: &[T], f: F) -> Vec<U>where F: Fn(&T) -> U,
Maps elements using a function.
use d3rs::array::map; let data = vec![1, 2, 3, 4, 5]; let squares = map(&data, |x| x * x); assert_eq!(squares, vec![1, 4, 9, 16, 25]);