OxL Reference

method iter.windows

Sliding windows of n consecutive elements (none if there are fewer than n).

Example:

oxl✓ checked in CI
fn main() io {
  print("{[1, 2, 3, 4].iter().windows(3).collect()}")
}
Output
[[1, 2, 3], [2, 3, 4]]
pub(api) move fn windows<I>(n: I) -> iter<List<T>>

Complexity. O(n * size); each window is a new list.

Since. 1.0.0-beta

Parameters

NameType
nI

Returns

iter<List<T>>

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/iter.oxl:424

See also