Skip to content

Instantly share code, notes, and snippets.

@dmamills
Created May 6, 2014 12:06
Show Gist options
  • Select an option

  • Save dmamills/85f276c9a57640b23753 to your computer and use it in GitHub Desktop.

Select an option

Save dmamills/85f276c9a57640b23753 to your computer and use it in GitHub Desktop.
shitty sequence
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