On Friday, 16 October 2015 at 12:03:56 UTC, Per Nordlöw wrote:
On Friday, 16 October 2015 at 11:48:19 UTC, Edwin van Leeuwen wrote:
zip(r, r[1..$]).map!((t) => t[1]-t[0]);

And for InputRanges (not requiring random-access):

zip(r, r.dropOne).map!((t) => t[1]-t[0]);

We should have a good implementation of slidingWindow in std.range, it's a useful iteration pattern (although it does sometimes encourage inefficient algorithms).

Reply via email to