Discova
Back to cards
Programming1 min readWikipedia, updated 23 June 2026

Stream (abstract data type)

Potentially infinite analog of a list, in type theory and functional programming

In type theory and functional programming, a stream is a potentially infinite analog of a list, given by the coinductive definition:

Generating and computing with streams requires lazy evaluation, either implicitly in a lazily evaluated language or by creating and forcing thunks in an eager language. In total languages they must be defined as codata and can be iterated over using (guarded) corecursion.

Java provides the Stream interface under the java.util.stream namespace.

JavaScript provides the ReadableStream, WritableStream and TransformStream interfaces.

Python have the StreamReader and StreamWriter classes in the asyncio module.

.NET provides the abstract class Stream which is implemented by classes such as FileStream and MemoryStream.

In Rust a struct can implement the Read trait. There is also the Cursor struct wraps an in-memory buffer.

Adapted from the Wikipedia article, CC BY-SA 4.0. Continue on Wikipedia

Go deeper

Ideas this article links to.