Last active
February 19, 2018 14:45
-
-
Save tlareg/f7a685986b9bdc054fbbd67035c89213 to your computer and use it in GitHub Desktop.
loop js lambda calculus y combinator
This file contains 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 loop = (cb, counter, maxCounter) => | |
((x, i, max) => x(x, i, max)) | |
( | |
(x, i, max) => ( | |
cb(i), | |
(i++ < max) && x(x, i, max) | |
), | |
counter, | |
maxCounter | |
) | |
loop(i => console.log(i), 0, 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment