From: Yukihiro Matsumoto Date: 2005-03-16T00:58:12+09:00 Subject: Re: Array#nitems and Object#nil? Hi, In message "Re: Array#nitems and Object#nil?" on Tue, 15 Mar 2005 22:58:07 +0900, Florian Gross writes: |On another note: Can we perhaps introduce Enumerable#count which returns |the number of elements for which the block is true? I know that we can |do .find_all { ... }.size, but constructing an Array of all elements |just to get its size seems wasteful. enum.inject(0){|i,j| j ? i + 1 : i } No array construction, bit harder to read than #count. matz.