fn zip
Pairs the n-th elements of both streams; ends when either ends.
Example:
use std.stream { zip }
fn letters() -> stream<str> {
for s in ["a", "b"] { yield s }
}
fn nums() -> stream<i32> {
for i in 1..=5 { yield i }
}
fn main() io {
var out: List<str> = []
for await (l, n) in letters() |> zip(nums()) { out.push("{l}{n}") }
print("{out}")
}Output
["a1", "b2"]
pub(api) fn zip<A, B, E>(a: stream<A, E>, b: stream<B, E>) -> stream<(A, B), E>Since. 1.0.0-beta
Parameters
Returns
stream<(A, B), E>
Effects
none declared (pure unless the body says otherwise)
Defined in: std/stream/stream.oxl:325