Skip to main content
added 10 characters in body
Source Link
Bergi
  • 670.6k
  • 162
  • 1k
  • 1.5k

You can easily write a function that applies multiple arguments to such a curried function:

const applyuncurry = fn => (...args) => args.reduce((f, x) => f(x), fn); // or alternatively: const applyuncurry = fn => (...args) => { let f = fn; for (const x of args) f = f(x); return f; } 

Now you can invoke add like so:

applyuncurry(add)(2, 3, 4) 

and if you still hate that you could also use

const $ = applyuncurry(applyuncurry); $(add, 2, 3, 4) 

You can easily write a function that applies multiple arguments to such a curried function:

const apply = fn => (...args) => args.reduce((f, x) => f(x), fn); // or alternatively: const apply = fn => (...args) => { let f = fn; for (const x of args) f = f(x); return f; } 

Now you can invoke add like so:

apply(add)(2, 3, 4) 

and if you still hate that you could also use

const $ = apply(apply); $(add, 2, 3, 4) 

You can easily write a function that applies multiple arguments to such a curried function:

const uncurry = fn => (...args) => args.reduce((f, x) => f(x), fn); // or alternatively: const uncurry = fn => (...args) => { let f = fn; for (const x of args) f = f(x); return f; } 

Now you can invoke add like so:

uncurry(add)(2, 3, 4) 

and if you still hate that you could also use

const $ = uncurry(uncurry); $(add, 2, 3, 4) 
added 26 characters in body
Source Link
Bergi
  • 670.6k
  • 162
  • 1k
  • 1.5k

You can easily write a function that applies multiple arguments to such a curried function:

const apply = ffn => (...args) => args.reduce((f, x) => f(x), ffn); // or alternatively: const apply = ffn => (...args) => { let f = fn; for (letconst x of args) f = f(x); return f; } 

Now you can invoke add like so:

apply(add)(2, 3, 4) 

and if you still hate that you could also use

const $ = apply(apply); $(add, 2, 3, 4) 

You can easily write a function that applies multiple arguments to such a curried function:

const apply = f => (...args) => args.reduce((f, x) => f(x), f); // or alternatively: const apply = f => (...args) => { for (let x of args) f = f(x); return f; } 

Now you can invoke add like so:

apply(add)(2, 3, 4) 

and if you still hate that you could also use

const $ = apply(apply); $(add, 2, 3, 4) 

You can easily write a function that applies multiple arguments to such a curried function:

const apply = fn => (...args) => args.reduce((f, x) => f(x), fn); // or alternatively: const apply = fn => (...args) => { let f = fn; for (const x of args) f = f(x); return f; } 

Now you can invoke add like so:

apply(add)(2, 3, 4) 

and if you still hate that you could also use

const $ = apply(apply); $(add, 2, 3, 4) 
added 103 characters in body
Source Link
Bergi
  • 670.6k
  • 162
  • 1k
  • 1.5k

You can easily write a function that applies multiple arguments to such a curried function:

const apply = f => (...args) => args.reduce((f, x) => f(x), f); // or alternatively: const apply = f => (...args) => { for (let x of args) f = f(x); return f; } 

Now you can invoke add like so:

apply(add)(2, 3, 4) 

and if you still hate that you could also use

const $ = apply(apply); $(add, 2, 3, 4) 

You can easily write a function that applies multiple arguments to such a curried function:

const apply = f => (...args) => args.reduce((f, x) => f(x), f); // or alternatively: const apply = f => (...args) => { for (let x of args) f = f(x); return f; } 

Now you can invoke add like so:

apply(add)(2, 3, 4) 

You can easily write a function that applies multiple arguments to such a curried function:

const apply = f => (...args) => args.reduce((f, x) => f(x), f); // or alternatively: const apply = f => (...args) => { for (let x of args) f = f(x); return f; } 

Now you can invoke add like so:

apply(add)(2, 3, 4) 

and if you still hate that you could also use

const $ = apply(apply); $(add, 2, 3, 4) 
Source Link
Bergi
  • 670.6k
  • 162
  • 1k
  • 1.5k
Loading