What about putting array.empty in object.d?

Simen Kjærås simen.kjaras at gmail.com
Wed Mar 21 15:25:30 PDT 2012


On Wed, 21 Mar 2012 22:30:17 +0100, Jacob Carlborg <doob at me.com> wrote:

> On 2012-03-21 21:49, Jonathan M Davis wrote:
>> On Wednesday, March 21, 2012 10:17:08 Jacob Carlborg wrote:
>>> http://www.ruby-doc.org/core-1.8.7/Enumerable.html#method-i-any-3F
>>
>> So, std.algorithm.canFind then? There has been some discussion of  
>> renaming it
>> to any (or at least the overload that just takes the predicate and the  
>> range),
>> but canFind gives you the behavior regardless.
>>
>> - Jonathan M Davis
>
> Yes, I didn't see the overload. But the Ruby version has a default  
> predicate, that does this:
>
> canFind!("a")([3, 4, 5]);
>
> I'm usually using "any?" to check if an array contains any values.
>

I hope you mean canFind!("true")([3, 4, 5]);. canFind!"a" fails for
arrays where all elements are 0.


More information about the Digitalmars-d mailing list