Functions -
lang.stream
close |
Closes a stream.
|
filter |
Selects the members from a stream for which a function returns true.
|
forEach |
Applies a function to each member of a stream.
|
iterator |
Returns an iterator over a stream.
|
map |
Applies a function to each member of a stream and returns a stream of the results.
|
next |
Returns the next element in the stream wrapped in a record or () if the stream ends.
|
reduce |
Combines the members of a stream using a combining function.
|
Closes a stream. This releases any system resources being used by the stream.
Parameters
- stm stream
-
the stream to close
-
Return Type
(ErrorType?) () if the close completed successfully, otherwise an error
Selects the members from a stream for which a function returns true.
Parameters
- stm stream
-
the stream
-
func
function(Type) returns (boolean)
-
a predicate to apply to each member to test whether it should be selected
-
Return Type
(stream) new stream only containing members of
stm
for whichfunc
evaluates to true
Applies a function to each member of a stream. The Combining function is applied to each member of stream in order.
Parameters
- stm stream
-
the stream
-
func
function(Type) returns (())
-
a function to apply to each member
-
Return Type
(ErrorType?) An error if iterating the stream encounters an error
Returns an iterator over a stream.
Parameters
- stm stream
-
the stream
-
Return Type
(T6) a new iterator object that will iterate over the members of
stm
.
Applies a function to each member of a stream and returns a stream of the results.
Parameters
- stm stream
-
the stream
-
func
function(Type) returns (Type1)
-
a function to apply to each member
-
Return Type
(stream) new stream containing result of applying
func
to each member ofstm
in order
Returns the next element in the stream wrapped in a record or () if the stream ends.
Parameters
- strm stream
-
The stream
-
Return Type
(T1 | ErrorType | ()) If the stream has elements, return the element wrapped in a record with single field called
value
, otherwise returns ()
reduce
(stream stm, function(Type1, Type) returns (Type1)
func, Type1 initial)
Combines the members of a stream using a combining function. The combining function takes the combined value so far and a member of the stream, and returns a new combined value.
Parameters
- stm stream
-
the stream
-
func
function(Type1, Type) returns (Type1)
-
combining function
- initial Type1
-
initial value for the first argument of combining function
-
Return Type
(Type1 | ErrorType) result of combining the members of
stm
using the combining function