Adjacent Pairs Range

Sebastiaan Koppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 15 07:12:00 PDT 2015


On Monday, 14 September 2015 at 10:45:52 UTC, Per Nordlöw wrote:
> On Monday, 14 September 2015 at 05:37:05 UTC, Sebastiaan Koppe 
> wrote:
>> What about using zip and a slice?
>
> Slicing requires a RandomAccessRange (Array). This is too 
> restrictive. We want to change operations such as 
> adjacentTuples with for example map and reduce without the need 
> for temporary copies of the whole range. This is the thing 
> about D's standard library.
>
> Read up on D's range concepts.

dropOne then.

I saw your adjacentTuples. Two questions:

a) can't you use a ringbuffer instead of copy when N > 2?
b) shouldn't front() return a range over that ringbuffer?


More information about the Digitalmars-d-learn mailing list