D equivalent for LINQ Where

Ali Çehreli acehreli at yahoo.com
Sat May 3 18:08:45 UTC 2025


On 5/2/25 2:44 PM, Python wrote:
 > On Friday, 2 May 2025 at 14:33:57 UTC, Richard (Rikki) Andrew Cattermole
 > wrote:
 >> Have you tried filter?
 >>
 >> https://dlang.org/phobos/std_algorithm_iteration.html#.filter
 >
 > Thx. Anyway, what find returns aftrr first occurrence is unexpected.

Yes, understandably unexpected.

However, the choice of returning a range solves the other design problem 
of what to do when no item is found. 'find' communicates that case with 
an empty range.

Ali



More information about the Digitalmars-d-learn mailing list