Skip to content

Instantly share code, notes, and snippets.

@dinocarl
Last active June 3, 2020 15:52
Show Gist options
  • Save dinocarl/f4a1c1ee0ed4c82f7a00108d15256540 to your computer and use it in GitHub Desktop.
Save dinocarl/f4a1c1ee0ed4c82f7a00108d15256540 to your computer and use it in GitHub Desktop.
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