skip(N) range

Jonathan M Davis jmdavisProg at gmx.com
Tue Jul 19 17:52:42 PDT 2011


On 2011-07-19 17:29, Adam Wey wrote:
> Is there a skip() function for ranges? I need to skip N elements of a range
> and then take M elements. Something like
> 
> writeln(take(range, 10), ": ", take(skip(range, 10), 10));

No, but this pull request

https://github.com/D-Programming-Language/phobos/pull/147

will introduce the drop function which does that. It hasn't been merged in 
yet though. The closest that there is right now is to call popFrontN, but
you can't do that in the middle of an expression like that.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list