mirror of
https://github.com/nushell/nushell
synced 2024-12-29 06:23:11 +00:00
627 B
627 B
title | layout | version |
---|---|---|
each window | command | 0.59.1 |
Runs a block on window groups of window_size
that slide by n rows.
Signature
> each window (window_size) (block) --stride
Parameters
window_size
: the size of each windowblock
: the block to run on each window--stride {int}
: the number of rows to slide over between windows
Examples
A sliding window of two elements
> echo [1 2 3 4] | each window 2 { |it| $it.0 + $it.1 }
A sliding window of two elements, with a stride of 3
> [1, 2, 3, 4, 5, 6, 7, 8] | each window 2 --stride 3 { |x| $x.0 + $x.1 }