Sequence vs LazyList
data-structures, f#, lazy-evaluation, sequence
Solution
`LazyList` computes each element only once regardless of how many times the list is traversed. In this way, it's closer to a sequence returned from `Seq.cache` (rather than a typical sequence). But, other than caching, `LazyList` behaves exactly like a list: it uses a list structure under the hood and supports pattern matching. So you might say: use `LazyList` instead of `seq` when you need list semantics and caching (in addition to laziness).
Regarding both being infinite, `seq`'s memory usage is constant while `LazyList`'s is linear.
These docs may be worth a read.
Problem
I can't wrap my head around the differences between sequence and `LazyList`. They're both lazy and potentially infinite. While `seq<'T>` is `IEnumerable<'T>` from .NET framework, `LazyList` is included in F# PowerPack. In practice, I encounter sequences much more often than `LazyList`s. What are their differences in terms of performance, usage, readability, etc? What are reasons for such a bad reputation of `LazyList` compared to that of `seq`?