Created
November 24, 2015 16:13
-
-
Save fuqcool/fe43cacef1ff87c36376 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Mimics the way Haskell function works */ | |
function cascade(fn, n) { | |
return (function helper(args) { | |
return function () { | |
args = args.concat(Array.prototype.slice.call(arguments)) | |
return (args.length >= n) ? fn.apply(null, args) : helper(args) | |
} | |
}([])) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example