Does YUI3 library have currying functionality ?
A:
You can use Currying within Javascript and YUI3 is Javascript and CSS so yes, you can use Currying within YUI3.
Frankie
2010-09-01 23:52:57
Yeah, I have my own currying function. I'm not sure if there is already a way to do currying within YUI3, to avoid repeating code.
Rogeliorv
2010-09-01 23:54:56
@user437445 afaik there isn't. Even looked it up in the docs and found nothing. Guess it's just not mainstream methodology! ;)
Frankie
2010-09-02 00:00:43
+1
A:
Currying is done using the bind method provided by the oop module.
var add3 = Y.bind(function (a, b) { return a + b; }, null, 3);
console.log(add3(39)); // prints 42
lawnsea
2010-09-11 21:18:47
Thanks, Y.bind seems to be the way to go. I have my own implementation, but using this is definitely better.
Rogeliorv
2010-09-13 20:24:19