fn window
Tumbling time windows: the elements that arrive within d of the first element of a window, as one list.
Example:
use std.stream { window }
fn nums() -> stream<i32> {
for i in 1..=3 { yield i }
}
fn main() io, time {
var sizes: List<usize> = []
for await w in nums() |> window(1s) {
sizes.push(w.len())
}
print("{sizes}")
}Output
[3]
pub(api) fn window<T, E>(s: stream<T, E>, d: Duration) -> stream<List<T>, E> timeComplexity. O(1) per element.
Since. 1.0.0-beta
Parameters
Returns
Effects
time
Defined in: std/stream/stream.oxl:421