The standard Scala collect, in order to implement map & filter.
The standard Scala collect, in order to implement map & filter.
It may seem unnatural to return a Future[…] here, but we cannot know whether the first element exists until we have applied its filter.
The first element of the spool.
The first element of the spool. Invalid for empty spools.
The (deferred) tail of the spool.
The (deferred) tail of the spool. Invalid for empty spools.
Concatenates two spools.
Concatenates two spools.
Applies a function that generates a spool to each element in this spool, flattening the result into a single spool.
Apply {{f}} for each item in the spool, until the end.
Apply {{f}} for each item in the spool, until the end. {{f}} is applied as the items become available.
A version of {{foreach}} that wraps each element in an {{Option}}, terminating the stream (EOF) with {{None}}.
Fully buffer the spool to a {{Seq}}.
Fully buffer the spool to a {{Seq}}. The returned future is satisfied when the entire result is ready.
A spool is an asynchronous stream. It more or less mimics the scala {{Stream}} collection, but with cons cells that have deferred tails.
Construction is done with Spool.cons, Spool.empty. Convenience syntax like that of scala.Stream is provided. In order to use these operators for deconstruction, they must be imported explicitly ({{import Spool.{*::, **:: }}} )
explicitly ({{import Spool.{*::, **:: }}}