The most elegant implementation of FizzBuzz
That&#x27;s a slick way to remove the conditionals indeed.  Inspired by it, here&#x27;s a Scala version (checked with v2.11):<p><pre><code>  object Fizzbuzz
  {
      val fizzes = List (None, None, Some (&quot;Fizz&quot;)).toStream;
      val buzzes = List (None, None, None, None, Some (&quot;Buzz&quot;)).toStream;
      val reducer : (Option[String], Option[String]) =&gt; Option[String] =
          (a, b) =&gt; Option ((a ++ b).mkString).filterNot (_.isEmpty);

      def apply (amount : Int) : Seq[String] =
          Stream.continually (fizzes)
              .flatten
              .zip (Stream.continually (buzzes).flatten)
              .map (reducer.tupled)
              .zipWithIndex
              .map {
                  case (s, n) =&gt; s.getOrElse ((n + 1).toString);
                  }
              .take (amount);
  }

  Fizzbuzz (100).foreach (println)</code></pre>