Re: D equivalent for LINQ Where

2025-05-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, May 3, 2025 12:08:45 PM Mountain Daylight Time Ali Çehreli via Digitalmars-d-learn wrote: > 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_

Re: D equivalent for LINQ Where

2025-05-03 Thread Ali Çehreli via Digitalmars-d-learn
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, understa

Re: D equivalent for LINQ Where

2025-05-02 Thread Python via Digitalmars-d-learn
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.

Re: D equivalent for LINQ Where

2025-05-02 Thread monkyyy via Digitalmars-d-learn
On Friday, 2 May 2025 at 14:32:04 UTC, Python wrote: I am trying to get some items from a list, but `find` gives me unexpected results. ``` import std.stdio; import std.algorithm; int[] x = [1, 2, 3, 4, 5, 1, 2, 3]; void main() { auto selection = x.find!(a => a == 2); foreach(item;se

Re: D equivalent for LINQ Where

2025-05-02 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Have you tried filter? https://dlang.org/phobos/std_algorithm_iteration.html#.filter

D equivalent for LINQ Where

2025-05-02 Thread Python via Digitalmars-d-learn
I am trying to get some items from a list, but `find` gives me unexpected results. ``` import std.stdio; import std.algorithm; int[] x = [1, 2, 3, 4, 5, 1, 2, 3]; void main() { auto selection = x.find!(a => a == 2); foreach(item;selection) { writeln(item); } } ``` Out