Created
May 6, 2018 13:37
-
-
Save pomber/ba5855a15ef60247770832cd12b3ecc1 to your computer and use it in GitHub Desktop.
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
import R from "ramda"; | |
var divisibleBy = R.curry(R.pipe(R.flip(R.modulo), R.equals(0))); | |
var fizzbuzz = R.map( | |
R.cond([ | |
[R.both(divisibleBy(3), divisibleBy(5)), R.always("FizzBuzz")], | |
[divisibleBy(3), R.always("Fizz")], | |
[divisibleBy(5), R.always("Buzz")], | |
[R.T, R.identity] | |
]) | |
); | |
console.log(fizzbuzz(R.range(1, 16))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment