Created
May 26, 2024 04:28
-
-
Save kat0h/317d456d79e505c9a84844050348f664 to your computer and use it in GitHub Desktop.
FizzBuzz
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 z=a=>(b=>a(c=>b(b)(c)))(b=>a(c=>b(b)(c))) | |
const r=n=>(m=>z(x=>i=>i==m?[]:[i,x(i+1)]))(n)(0) | |
const map=f=>l=>z(x=>m=>m[1].length==0?[f(m[0]),[]]:[f(m[0]),x(m[1])])(l) | |
const fizzbuzz=x=>map(i=>i%15?i%3?i%5?i:'Buzz':'Fizz':'FizzBuzz')(r(x)) | |
console.log(fizzbuzz(100).flat(1/0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment