Windowed sequences


The sequences.windowed vocabulary provides a read-only virtual sequence whose elements are slices of length n from the current element looking backwards, inclusive of the current element. Slices may be less than n elements in length, especially at the head of the sequence, where the first slice will be of length 1.

Windowed sequences support nth and length from the Sequence protocol.

Creating a windowed sequence:
<windowed-sequence> ( sequence n -- windowed-sequence )


Helper words for creating bounds-checked slices:
in-bound ( n sequence -- n' )

in-bounds ( a b sequence -- a' b' sequence )