I don't think I've grokked currying yet. I understand what it does, and how to do it. I just can't think of a situation I would use it.
Where are you using currying in javascript (or where are the main libraries using it)? DOM manipulation or general application development examples welcome.
EDIT: One of the answers mentions animation. Functions like "slideUp", "fadeIn" take an element as an arguments and are normally a curried function returning the high order function with the default "animation function" built-in. Why is that better than just applying the higher-up function with some defaults?
Oh and are there any drawbacks to using it?
Cheers.
EDIT: As requested here are some good resources on javascript currying:
- http://www.dustindiaz.com/javascript-curry/
- Crockford, Douglas (2008) Javascript: The Good Parts
- http://www.svendtofte.com/code/curried_javascript/ (Takes a detour into ML so skip the whole section from "A crash course in ML" and start again at "How to write curried JavaScript")
- http://blog.morrisjohns.com/javascript_closures_for_dummies
- http://stackoverflow.com/questions/111102/how-does-a-javascript-closure-work
- http://ejohn.org/blog/partial-functions-in-javascript (Mr. Resig on the money as per usual)
I'll add more as they crop up in the comments.