Caffeine v0.2.0 Caffeine.Stream

Find the API under this module

Link to this section Summary

Types

t()

The Caffeine.Stream data structure

Functions

A stream whose head is the element e and whose tail s is the expression to generate successive elements

The first element, if any, of the stream

A simple map

A special value whose presence signals the end of a stream

A predicate to test for the sentinel value

The stream, if any, succeeding the first element

Extracts n consecutive elements from the stream

Link to this section Types

Link to this opaque t() (opaque)
t()

The Caffeine.Stream data structure

Link to this section Functions

Link to this macro construct(e, s) (macro)
construct(term(), Macro.t()) :: t()

A stream whose head is the element e and whose tail s is the expression to generate successive elements

Warning: don’t evaluate the expression s before passing it to construct/2 otherwise it’s no longer lazy.

Link to this function construct?(list)
construct?(t()) :: boolean()
Link to this function head(x)
head(t()) :: term()

The first element, if any, of the stream

Link to this function map(s, f)
map(t(), (term() -> term())) :: t()

A simple map

The output stream is the input stream w/ the function f applied to each of the elements.

Link to this function sentinel()
sentinel() :: []

A special value whose presence signals the end of a stream

Link to this function sentinel?(list)
sentinel?(t()) :: boolean()

A predicate to test for the sentinel value

Link to this function tail(x)
tail(t()) :: t()

The stream, if any, succeeding the first element

Link to this function take(x, n)
take(t(), integer()) :: list()

Extracts n consecutive elements from the stream

A list of less than n elements out if it reaches the sentinel.