Function flip
Source pub fn flip<'a, A, B, C, F, G>(f: F) -> impl Fn(B) -> Box<dyn Fn(A) -> C + 'a>
Expand description
Returns a version of the input curried binary function
with its arguments flipped.
§Type Signature
forall a b c. (a -> b -> c) -> b -> a -> c
§Examples
use fp_library::functions::flip;
let subtract = |a| move |b| a - b;
assert_eq!(flip(subtract)(1)(0), -1);