-
-
Save logarytm/6bf3865ee2efa7f5bf63a30ea8a00b6c to your computer and use it in GitHub Desktop.
range() without loops or recursion… or is it?
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
(f => (g => g(g))(g => f(x => g(g)(x))))((x) => ([a, b, c = 1]) => a === b ? [a] : [a, ...x([a + c, b, c])])([1, 10]) | |
// [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] | |
// Note: Functional programmers and mathematicians have known this trick | |
// for decades under the name of a Y combinator. I did not invent this. | |
// I recommend deciphering this thing on your own, though. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment