Curring - shindakioku/fpfantasy GitHub Wiki
Wiki Now, curry in fpfantasy have the limit on 5 functions because dart doesn't have the spread operator :c
You can use currry
function or choose one from 5 variants (curryN - 1, 2, 3, 4, 5).
Curry :: Function(Handler) -> Int|NotRequired(argsLength: default(2)) -> Function(1..5 args)
var a = curry((a, b) => a + b);
var b = a(1);
print('1 + 1 = ${b(1)}, 1 + 2 = ${b(2)}'); // 1 + 1 =2, 1 + 2 = 3
print('1 + 3 = ${a(1, 3)}, 1 + 2 = ${(a(1)(2))}'); // 1 + 3 = 4, 1 + 2 = 3
With three arguments
var a = curry((a, b, c) => a + b + c, argsLength: 3);
print('1 + 2 + 3 = ${a(1)(2)(3)}, 4 + 5 + 6 = ${a(4, 5, 6)}');
// 1 + 2 + 3 - 6, 4 + 5 + 6 - 15