On Friday, 8 April 2016 at 18:27:59 UTC, Laeeth Isharc wrote:
suppose I have a forward or random access range. what's the best way to compare each element with the element 4 elements prior to that element? I could map each element to a tuple of the element and the element 4 bars previously and do it that way. any neater way ?
I'd do it like this, but I guess that is what you mean with mapping it to a tuple:
zip( r, r[4..$] ).map!((t) => t[0] == t[1]);
