Function fnrs::map

source ·
pub fn map<T, F>(inp: &[T], f: &F) -> Vec<T>where
    F: Fn(&T) -> T,
Expand description

Aplies function over each element in slice and returns a vector of the results in order.

Example

assert_eq!(fnrs::map(&vec![2,3,4], &|x| x + 1), vec![3,4,5]);