Scala Notes: Streams

In functional programming, lists are fundamental data structures, but in some cases, they can constitute a lack of performance:

Streams are data structures like lists, but its tail is only evaluated by demand. The goal is to avoid computing the tail of a sequence until is needed for the evaluation result (delayed evaluation).

Stream behavior differs from List in that the parameter tail is a by-name parameter. For this reason the tail is not evaluated until someone demands it.