Idiomatic adjacent_difference

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 16 15:55:38 PDT 2015


On Friday, 16 October 2015 at 15:02:54 UTC, anonymous wrote:
> On Friday, October 16, 2015 02:03 PM, Per Nordlöw wrote:
>
>> zip(r, r.dropOne).map!((t) => t[1]-t[0]);
>
> You should r.save one or both of those. The dropOne may affect 
> both instances if you don't .save.
>
> By the way, what's the point of `dropOne` over `drop(1)`? It's 
> not shorter. Does it do anything subtly different?

The only difference is that dropOne calls popFront and drop calls 
popFrontN.


More information about the Digitalmars-d-learn mailing list