Created
March 22, 2015 10:26
-
-
Save apauley/ca8197f5b9b822097c50 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 scalaz._ | |
import Scalaz._ | |
object FizzBuzz { | |
def fizz(n: Int): Option[String] = if (n % 3 == 0) some("fizz") else None | |
def buzz(n: Int): Option[String] = if (n % 5 == 0) Some("buzz") else None | |
def fizzbuzz(n: Int): String = (fizz(n) |+| buzz(n)).getOrElse(n.toString) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment