Skip to content

Instantly share code, notes, and snippets.

@adampolar
Created March 10, 2017 11:17
Show Gist options
  • Save adampolar/adae79aebaab0375cb2ffc94d22bf32c to your computer and use it in GitHub Desktop.
Save adampolar/adae79aebaab0375cb2ffc94d22bf32c to your computer and use it in GitHub Desktop.
"Your scientists were so preoccupied with whether or not they could... they didn’t stop to think if they should."
function addRecursive(a, compute) {
return compute? a : (b, compute2) =>addRecursive(a + b, compute2);
}
console.log(addRecursive(1)(1)(15)(6)(10)(2, true)); //35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment