partialRight<T1, T2, R> function
UnaryFun<T1, R>
partialRight<T1, T2, R>(
- BinaryFun<
T1, T2, R> f, - T2 b
Returns a partial applied version of function f
, in a right-to-left manner.
It holds the function f
and an argument b
, returns a new function,
which accepts an argument a
, when applied, it returns the result of f(a, b)
. For example:
final subtract = (num a, num b) => a - b;
final subtract2 = partialRight(subtract, 2);
final subtractBy2 = partial(subtract, 2);
subtract2(3); // => (3 - 2) => 1
subtractBy2(3); // => (2 - 3) => -1
See Parital Application & Currying
Implementation
UnaryFun<T1, R> partialRight<T1, T2, R>(BinaryFun<T1, T2, R> f, T2 b) =>
(a) => f(a, b);