foreach loop
Edwin van Leeuwen via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Nov 3 07:42:15 PST 2015
On Tuesday, 3 November 2015 at 15:29:31 UTC, Namal wrote:
>> writefln("Count is: %s", arr
>> .filter!(a => a==true)
>> .sum);
>>
>> // Note: std.algorithm.sum is the same as
>> // std.algorithm.reduce!((a,b)=a+b);
>
Shouldn't you be using walkLength instead of sum, since you are
counting the left over values?
import std.range : walkLength;
writefln("Count is: %s", arr
.filter!(a => a==false)
.walkLength);
More information about the Digitalmars-d-learn
mailing list