On Friday, 2 August 2019 at 22:35:53 UTC, Adam D. Ruppe wrote:
On Friday, 2 August 2019 at 21:44:28 UTC, Jordan Wilson wrote:
        // outputs 1 2 2 3
        z.map!(a => tuple!("number","iseven")(a, a.isEven))
         .filter!(a => a.iseven)
         .array;

I *think* what's happening here is first it calls map() first going into the filter... then it gets called again when it is being evaluated for the array.

So like basically consider if you had:

if(filter(a())
   array ~= a();


that kind of thing. I think anyway, I'm not entirely sure but it fits what I can see happening here.

but idk why it is actually doing this in the phobos implementation

In my real-world case "isEven" is a long running function. I'll put an .array after the map and see if it makes a difference.

Thanks,

Jordan

Reply via email to