macro_rules! compose { ($($lst:expr),+) => { ... }; (arg $arg:ident, $head:expr, $($tail:expr),*) => { ... }; (arg $arg:ident, $last:expr) => { ... }; }
Expand description
Compose functions.
(f ∘ g ∘ h)(x) = f(g(h(x)))
Example
use rust2fun::prelude::*;
let f = |x| x + 1;
let g = |x| x / 2;
let h = |x| x * 3;
let composed = compose!(h, g, f, |x: i32| -x);
assert_eq!(6, composed(-3));