RosettaCodeData/Task/Generator-Exponential/Scala/generator-exponential-2.scala
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

5 lines
234 B
Scala

def filtered2(s:Stream[Int], c:Stream[Int]):Stream[Int]=(s, c) match {
case (sh#::_, ch#::ct) if (sh>ch) => filtered2(s, ct)
case (sh#::st, ch#::_) if (sh<ch) => sh #:: filtered2(st, c)
case (_#::st, _) => filtered2(st, c)
}