On Friday, 29 January 2016 at 08:06:14 UTC, glathoud wrote:
Thanks. I am glad be wrong on that one.

I had a look at map & filter in the source code ; pleased to see they're lazily implemented!

map
https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm/iteration.d#L425

filter
https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm/iteration.d#L924
I had to look for FilterResult!
https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm/iteration.d#L979

Small remark: One could make the laziness of filter a bit more clear in the doc though - at least for newbies like me.
http://dlang.org/phobos/std_algorithm_iteration.html

Best regards,
Guillaume

While it's not entirely true because one can implement a non-lazy range, any time you see the word "range" in the documentation you should think that it is lazy. Ranges are an important concept in D so we usually don't bother explaining it in the doc. You can read about it here if you need to: http://ddili.org/ders/d.en/ranges.html and http://dlang.org/phobos/std_range.html

Reply via email to