On Wednesday, 9 September 2015 at 11:30:26 UTC, Bahman Movaqar wrote:
On Wednesday, 9 September 2015 at 08:29:20 UTC, cym13 wrote:
The way I would have written it is:

auto result = foobars.filter!(fb => nums.all!(n => (fb.x * fb.y) > n)) .filter!(fb => nums.all!(n => fb.x < n && fb.y < n));

For the lame example I gave, something similar occurred to me at first; but then I thought 4 `filter`s (assuming `all` is simply a `filter`) might be non-idiomatic as it might incur some performance penalty.

Note that this can easily be rewritten with only one `filter` and one `all`:

auto result = foobars.filter!(
                fb => nums.all!(
                    n => fb.x * fb.y > n
                      && fb.x < n
                      && fb.y < n));

Reply via email to