On Thursday, June 6, 2019 10:21:39 PM MDT rnd via Digitalmars-d-learn wrote:
> On Thursday, 6 June 2019 at 21:32:11 UTC, Jonathan M Davis wrote:
> > If any is not given a predicate, it defaults to just checking
> > whether the element itself is true (requiring that the element
> > be bool), which
On Thursday, 6 June 2019 at 21:32:11 UTC, Jonathan M Davis wrote:
If any is not given a predicate, it defaults to just checking
whether the element itself is true (requiring that the element
be bool), which is why Marco's suggestion works, but it's a
rather odd way to write the code and will
On Thursday, June 6, 2019 5:50:36 AM MDT rnd via Digitalmars-d-learn wrote:
> 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;
>
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
On Thursday, June 6, 2019 3:01:11 AM MDT rnd via Digitalmars-d-learn wrote:
> I am trying to check if any character in the string is > 127 by
> following function:
>
> import std.algorithm.searching;
> import std.algorithm.iteration;
> bool isBinary(char[] ss){
>return (any!(map!(a => a >
I am trying to check if any character in the string is > 127 by
following function:
import std.algorithm.searching;
import std.algorithm.iteration;
bool isBinary(char[] ss){
return (any!(map!(a => a > 127)(ss)));
}
However, I am getting this error:
Error: variable ss cannot be read at