Curried JavaScript functions
svendtofte.com
Curried JavaScript functions
1–8 of 8 posts
Re: Curried JavaScript functions
#2instead of this:
we could have something like: which is arguably simpler and cleaner. However, one extra closure is used.. maybe it makes it more complicated for some? But, overall, pretty clear and interesting article :o
function add (a,b,c){
if (arguments.length
function add (a,b,c) {
return curry(arguments, 3, function (x,y,z) {
return a+b+c;
};
}
Re: Curried JavaScript functions
#3Suggestion: instead of this: function add (a,b,c){ if (arguments.length we could have something like: function add (a,b,c) { return curry(arguments, 3, function (x,y,z) { return a+b+c; }; } which is arguably simpler and cleaner. However, one extra closure is used.. maybe it makes it more complicated for some? But, overall, pretty clear and interesting article :o
Re: Curried JavaScript functions
#4Re: Curried JavaScript functions
#5Suggestion: instead of this: function add (a,b,c){ if (arguments.length we could have something like: function add (a,b,c) { return curry(arguments, 3, function (x,y,z) { return a+b+c; }; } which is arguably simpler and cleaner. However, one extra closure is used.. maybe it makes it more complicated for some? But, overall, pretty clear and interesting article :o
!
Re: Curried JavaScript functions
#6Suggestion: instead of this: function add (a,b,c){ if (arguments.length we could have something like: function add (a,b,c) { return curry(arguments, 3, function (x,y,z) { return a+b+c; }; } which is arguably simpler and cleaner. However, one extra closure is used.. maybe it makes it more complicated for some? But, overall, pretty clear and interesting article :o
var add = curry(function(a,b,c) { return a + b + c; });
You can find the code at http://ianhenderson.org/curry.js if you're interested.