Why any! with map! is not working here

rnd r_narang at yahoo.com
Thu Jun 6 11:50:36 UTC 2019


On Thursday, 6 June 2019 at 09:49:28 UTC, Jonathan M Davis wrote:
>
> So, to start, the any portion should be something more like
>
> any!pred(ss);
>
> or
>
> ss.any!pred();
>
> or
>
> ss.any!pred;
>
> where pred is whatever the predicate is.

Apparently, following also works:


any(ss.map!(a => a > 127))   // as written by Marco de Wild
or
any(map!(a => a > 127)(ss))


Thanks for detailed explanations.
Philosophically, I personally think, there should be only one way 
to do such things since that will add to simplicity, as in C.
Apparently, smallness and simplicity of C contributed greatly to 
its success.
Only drawbacks of C, like its unsafe parts, should be removed and 
clearly advantages newer concepts should be added in a clearly 
defined manner.
Just thinking loudly!




More information about the Digitalmars-d-learn mailing list