2 * Curry - Function currying
\r
3 * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
\r
4 * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
\r
7 * @author Ariel Flesler
\r
11 function curry( fn ){
\r
13 var args = curry.args(arguments),
\r
14 master = arguments.callee,
\r
17 return args.length >= fn.length ? fn.apply(self,args) : function(){
\r
18 return master.apply( self, args.concat(curry.args(arguments)) );
\r
23 curry.args = function( args ){
\r
24 return Array.prototype.slice.call(args);
\r
27 Function.prototype.curry = function(){
\r