Skip to content

Instantly share code, notes, and snippets.

@halcat0x15a
Forked from yuroyoro/ScalazFizzBuzz.scala
Created August 8, 2012 06:09
Show Gist options
  • Save halcat0x15a/3292679 to your computer and use it in GitHub Desktop.
Save halcat0x15a/3292679 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