pub fn compose<A, B, C, F, G>(f: F, g: G) -> impl Fn(A) -> CExpand description
Backward composition of two functions.
§Arguments
f- A function that takes a value inBand returns a value inCg- A function that takes a value inAand returns a value inB
§Returns
A new function that takes a value in A and returns a value in C
§Example
use overture_core::compose::compose;
let add_one = |x: i32| x + 1;
let multiply_by_two = |x: i32| x * 2;
let composed = compose(multiply_by_two, add_one);
assert_eq!(composed(5), 12); // (5 + 1) * 2 = 12