Options
All
  • Public
  • Public/Protected
  • All
Menu

File Stream

A lazy, potentially infinite, sequence of values.

The code is organized through the class EmptyStream (empty list or tail), the class ConsStream (list value and lazy pointer to next), and the type alias Stream (empty or cons).

Finally, "static" functions on Option are arranged in the class StreamStatic and are accessed through the global constant Stream.

Use take() for instance to reduce an infinite stream to a finite one.

Examples:

Stream.iterate(1, x => x*2).take(4);
=> Stream.of(1,2,4,8)

Stream.continually(Math.random).take(2);
=> Stream.of(0.49884723907769635, 0.3226548779864311)

Index

Classes

Type aliases

Variables

Type aliases

Stream

Stream: EmptyStream<T> | ConsStream<T>

A Stream is either EmptyStream or ConsStream "static methods" available through StreamStatic

param

the item type

Variables

Stream

Stream: StreamStatic = new StreamStatic()

The Stream constant allows to call the Stream "static" methods

Generated using TypeDoc