Fuzion Logo
flang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

stream

🌌stream

stream -- a stream of values

NYI: Check if stream should be replaced by a lazy list, which is a choice
of either nil or a tuple (head, tail). This should avoid the need to store
mutable state.

collect all items from this stream into an array

create a list from this stream

create a stream of T.

A stream contains mutable state, so it cannot be reused or shared
between threads.

Default implementation uses asList. Heirs must redefine at least
one of asList or asStream.

create a string from the elements of this stream

create a new stream that contains the first elements of this stream for
which 'f e' is false

create a stream that consists of all be the elements if this stream followed
by all the elements of s

count the elements of this stream

create new stream from all elements for which predicate f is true

fold the elements of this stream using the given monoid.

e.g., to sum the elements of a stream of i32, use s.fold i32.sum

apply f to all elements in this stream

apply 'f' to each element 'e' as long as 'f e'

does this stream have one more element?

create a new stream from all elements for which predicate f is true, infix
operator synonyme of filter.

NYI: What is better, 'infix |&' or 'infix &', or something else?

apply f to all elements in this stream, infix operator synonyme of forAll.

create a new stream from all elements for which predicate f is true, infix
operator synonyme of filter.

check if predicate f holds for all elements produced by this stream

check if predicate f holds for at least one element produced by this stream

map the stream to a new stream applying function f to all elements

This performs a lazy mapping, f is called only when the elements
are taken from the stream.

NYI: This currently does not work with the C backend since generics resolution
for stream.this.next confuses the type from the outer feature (T) with the type
from the inherited feature (B).

the next element in this stream

get the next element or nil if !hasNext

print the elements of this stream