Pattern matching and infinite streams
问题 So, I'm working to teach myself Scala, and one of the things I've been playing with is the Stream class. I tried to use a naïve translation of the classic Haskell version of Dijkstra's solution to the Hamming number problem: object LazyHammingBad { private def merge(a: Stream[BigInt], b: Stream[BigInt]): Stream[BigInt] = (a, b) match { case (x #:: xs, y #:: ys) => if (x < y) x #:: merge(xs, b) else if (y < x) y #:: merge(a, ys) else x #:: merge(xs, ys) } val numbers: Stream[BigInt] = 1 #::