Sequence of an indefinite length as a design pattern
The conventional engineering vision of data transformations is that they occur over finite collections materialized in the memory, hence allowing these collections to be enumerated with Seq.length
, yielding a number of elements. However, the F# sequences (as well as .NET IEnumerable<T>
per se) grant the following generalization: in some cases, a more math-centric vision might be useful, which suggests looking at sequences as countable but not necessarily finite.
A meticulous reader may immediately object that the countable entity, when applied to practical computing, is necessarily finite because eventually, it is limited by underlying physical hardware, which comes out in boundary values, for example:
System.Int32.MaxValue = 2147483647 System.Int64.MaxValue = 9223372036854775807L
However, I would oppose this objection by saying that this mere consideration does not in any way limit the length of the F# sequences that might be produced...