Skip to content

Instantly share code, notes, and snippets.

@yuroyoro
Created August 8, 2012 04:42
Show Gist options
  • Save yuroyoro/3292113 to your computer and use it in GitHub Desktop.
Save yuroyoro/3292113 to your computer and use it in GitHub Desktop.
ScalazでFizzBuzz
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