How to force evaluation of range?

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 12 17:11:53 PST 2016


On Friday, 12 February 2016 at 20:43:24 UTC, Taylor Hillegeist 
wrote:
> So I have this code and I have to add the element
> .each!(a => a.each!("a"));
> to the end in order for it to evaluate the range completely and 
> act like I expect it too. Is there a  better thing to put in 
> the place of
> .each!(a => a.each!("a"));?
>
> [...]

If you need the value that a range returns (i.e. the range 
performs "computation") then use .array

If you just want the range evaluated use walkLength


More information about the Digitalmars-d-learn mailing list