OxL Reference

streams

Sensor readings as a stream<i32>: a generator with yield and a pipeline of std.stream operators joined with the pipe |> (x |> f(a) is f(x, a), §10.3).

sh
oxl run examples/streams
oxl test examples/streams
FunctionPipeline
scaled(floor)readings() |> dedup() |> filter(…) |> map(…)
running()readings() |> scan(0, (acc, x) => acc + x)
groups(n)readings() |> batch(n, 1s): groups by size or by time

A stream is lazy: nothing is read until for await consumes it. The other operators (merge, zip, window, throttle, debounce) are in std.stream.

Project files · Download (zip)