So I understand that call-by-need is simply a memoized version of call-by-name. In Martin Odersky's FP Course on Coursera, in lecture 7.3 (Lazy Evaluation), he mentions that if Streams were implemented using call-by-name, then it could potentially lead to a blowup in computational complexity.
What would be an example of such a blowup?
Call-by-name:
def cons[T](hd: T, tl: => Stream[T]) = new Stream[T] {
def head = hd
def tail = tl
...
}
Call-by-need:
def cons[T](hd: T, tl: => Stream[T]) = new Stream[T] {
def head = hd
lazy val tail = tl
...
}