Created
August 8, 2012 04:42
-
-
Save yuroyoro/3292113 to your computer and use it in GitHub Desktop.
Scalazで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
import scalaz._,Scalaz._ | |
val fizzbuzz = (x:Int) => (Enum[Int].from(0) map {n => ((n%3 === 0).option("Fizz") |+| (n%5 === 0).option("Buzz")) <+> n.shows.pure[Option]} take x+1 flatten).foreach(println) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment