Created
May 6, 2014 12:06
-
-
Save dmamills/85f276c9a57640b23753 to your computer and use it in GitHub Desktop.
shitty sequence
This file contains hidden or 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
| function sequence() { | |
| var args = arguments; | |
| return function(n) { | |
| for(var i =0;i < args.length;i++) { | |
| n = args[i](n) | |
| } | |
| return n; | |
| } | |
| } | |
| function addOne(n) { return n+1;} | |
| function double(n) { return n*2;} | |
| sequence(addOne,addOne,double,double)(0); // 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment