On 08/14/2015 03:26 PM, Timon Gehr wrote:
On 08/14/2015 05:12 AM, H. S. Teoh via Digitalmars-d-learn wrote:...I didn't figure out how to eliminate the short slices toward the end,... :o) ...
Less hacky and less efficient: auto slidingWindow(R)(R range, int k) { return iota(k).map!(i=>range.save.drop(i)) .array.transposed.zip(range.save.drop(k-1)).map!(a=>a[0]); }