Created
December 16, 2017 15:03
-
-
Save Expl4Life/4869716e324482d4d548a7725b2db4d9 to your computer and use it in GitHub Desktop.
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
const apply = (times, fn, value) => { | |
const iter = (counter, acc) => { | |
if (counter === 0) { | |
return acc; | |
} | |
return iter(counter - 1, fn(acc)); | |
}; | |
return iter(times, value); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment