Skip to content

Instantly share code, notes, and snippets.

@pixelknitter
Last active August 29, 2015 14:02
Show Gist options
  • Save pixelknitter/77a8c4e428dedea4c2ac to your computer and use it in GitHub Desktop.
Save pixelknitter/77a8c4e428dedea4c2ac to your computer and use it in GitHub Desktop.
var puzzlers = [
function ( a ) { return 8*a - 10; },
function ( a ) { return (a-3) * (a-3) * (a-3); },
function ( a ) { return a * a + 4; },
function ( a ) { return a % 5; }
];
var start = 2;
var applyAndEmpty = function(num, queueOfFunctions) {
var value = queueOfFunctions.shift()(num);
alert(value);
if (queueOfFunctions.length == 0) { return value; }
return applyAndEmpty(value, queueOfFunctions);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment