Operator to get all (overlapping) subarrays of given length
A stack-oriented programming language suitable for code golfing
Status: Alpha
Brought to you by:
aditsu
Say the operator is x, then
[1 2 3 4 5 6]3x
should yield
[[1 2 3][2 3 4][3 4 5][4 5 6]]
This would mostly be useful to apply binary functions to consecutive pairs of elements, like getting forward differences:
[1 2 1 3 1 4]2xWf%::-
yields
[1 -1 2 -2 3]
Not as good as a generalised difference operator, but this would probably be useful in a lot of other situations, too (particularly in string manipulation).
Implemented as
ewin CJam 0.6.5 (coming soon)