Consume an entire range

Diggory diggsey at googlemail.com
Wed May 29 21:25:33 PDT 2013


On Thursday, 30 May 2013 at 04:18:14 UTC, Jonathan M Davis wrote:
> On Thursday, May 30, 2013 06:12:51 Diggory wrote:
>> On Thursday, 30 May 2013 at 03:53:06 UTC, Brad Anderson wrote:
>> > On Thursday, 30 May 2013 at 03:50:52 UTC, Brad Anderson 
>> > wrote:
>> >> Is there a simple way to consume a range apart from
>> >> std.array.array?  I don't need to result of the range stored
>> >> in an array, I just need a lazy map to evaluate completely.
>> > 
>> > Obviously I could just popFront.  To be more clear, I want
>> > something like eat() or consume() or exhaust() that I can 
>> > tack
>> > on the end of my chained algorithm calls.
>> 
>> There's "walkLength"?
>
> Ah, I should have thought of that, though that won't work if 
> the range defines
> length. Of course, if it defines length, you can always use 
> popFrontN with
> length.
>
> - Jonathan M Davis

Do you think it would be worth adding a "consume" method to 
std.range or std.algorithm?


More information about the Digitalmars-d-learn mailing list