The Finite Laziness of Scala Streams
The official Haskell wiki discusses literally dozens of ways to produce a list of prime numbers, but the one that caught my attention the other day is not listed there. Its centerpiece is a fold of a recursively defined infinite list of infinite lists (lists are lazy in Haskell). In this post, I’ve documented my attempt to rewrite it in Scala using streams.