On Saturday, May 12, 2012 01:51:46 Mehrdad wrote: > On Friday, 11 May 2012 at 21:53:06 UTC, Jonathan M Davis wrote: > > I know that haskell has such a function, and there were a > > number of complaints previously that we _didn't_ have an any > > function which does exactly what std.algorithm.any now does. > > It's a very functional approach to use predicates like that and > > I get the impression that it's common in other functional > > languages based on other's comments. The only one off the top > > of my head that I _know_ has such a function though is haskell. > > Again, I know enough FP to know what predicates are, and of > course, this is common in functional languages. > > Even Scheme has a 'there-exists?' function just for this purpose. > > I wasn't saying having "such a function" is weird -- I was just > asking if you know of any languages in which the NAME is "any()", > since I would've imagined it to be something more intuitive like > "exists()" or "contains" or "has" or whatever. > (I was giving C# as an example, because C# uses "Any()" to mean, > "are there any elements in this list?", NOT with the meaning D > uses.)
any goes with all. In one case, you're asking whether "any" element in the range/list is true for the predicate. In the other, you're asking whether "all" elements in a range/list are true for the predicate. And when you think of it that way, it's quite intuitive. But clearly, what you're familiar with leads you to think in a different way. - Jonathan M Davis