type LazyList |
LazyLists are possibly-infinite, cached sequences. See also IEnumerable/Seq for
uncached sequences. Calling "get" on the same lazy list value you will keep
getting the same (cached) result. LazyLists normally involve delayed computations
without side-effects, and calling "get" may cause these computations to be executed. The results
of these computations are cached - evaluations will be performed
only once for each element of the lazy list. This is different to IEnumerable/Seq where
recomputation happens each time an enumerator is created and the sequence traversed.
LazyLists can represent cached potentially-infinite computations. Because they are cached they may cause
memory leaks if some part of your code maintains a live reference to
the head of an infinite or very large lazy list while iterating it, or if a reference is
maintained after the list is no longer required.
Although lazy lists are an abstract type you may pattern match against them using the
LazyList.Cons and LazyList.Nil active patterns. These may force the computation of elements
of the list.
|