Last active
June 3, 2020 15:52
-
-
Save dinocarl/f4a1c1ee0ed4c82f7a00108d15256540 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 izzer = (str, mod) => (num) => modulo(num, mod) === 0 | |
? str | |
: ''; | |
const izzerStr = compose( | |
join(''), | |
juxt([ | |
izzer('fizz', 3), | |
izzer('buzz', 5), | |
]) | |
); | |
const izzerStrOrNumStr = (str, num) => isEmpty(str) | |
? toString(num) | |
: str; | |
const numOrIzzer = (num) => izzerStrOrNumStr( | |
izzerStr(num), | |
num | |
); | |
const fizzBuzz = compose( | |
map(numOrIzzer), | |
range(1), | |
inc | |
); | |
fizzBuzz(60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment