fn dedup
Drops an element equal to the one before it.
Example:
use std.stream { dedup }
fn nums() -> stream<i32> {
for i in [1, 1, 2, 2, 2, 1] { yield i }
}
fn main() io {
var out: List<i32> = []
for await x in nums() |> dedup() { out.push(x) }
print("{out}")
}Output
[1, 2, 1]
pub(api) fn dedup<T: Eq, E>(s: stream<T, E>) -> stream<T, E>Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
s | stream<T, E> |
Returns
stream<T, E>
Effects
none declared (pure unless the body says otherwise)
Defined in: std/stream/stream.oxl:192