The difference between concat (#:::) and append (++) on streams should be documented more clearly. The append method does say that ++ works in very subtle ways, but it breaks down in even simple cases. Consider fibs defined as below.
def fibs: Stream[Int] = Stream(0, 1) ++ (fibs.zip(fibs.tail).map { case (a, b) => a + b })
Calling fibs will result in a stack overflow, despite (as documentation says), the left hand side of ++ being a Stream. Using concat (#:::) however works as expected.
def fibs: Stream[Int] = Stream(0, 1) #::: (fibs.zip(fibs.tail).map { case (a, b) => a + b })
Since this is a subtle issue (not clear whether a bug), it might just be wise to add a warning about this behaviour higher up in the documentation, and in the official docs.
The difference between concat (
#:::) and append (++) on streams should be documented more clearly. The append method does say that++works in very subtle ways, but it breaks down in even simple cases. Consider fibs defined as below.Calling
fibswill result in a stack overflow, despite (as documentation says), the left hand side of++being aStream. Using concat (#:::) however works as expected.Since this is a subtle issue (not clear whether a bug), it might just be wise to add a warning about this behaviour higher up in the documentation, and in the official docs.