Hi,

Am Freitag, 18. MÁ” 2005, 02:12:23 +0900 schrieb Yukihiro Matsumoto:
> In message "Re: Array#nitems and Object#nil?"
>     on Fri, 18 Mar 2005 01:34:49 +0900, Florian Gross <flgr / ccan.de> writes:
> 
> |>  enum.inject(0){|i,j| j ? i + 1 : i }
> |> 
> |> No array construction, bit harder to read than #count.
> |
> |Is it too rare to deserve a built-in short cut?
> 
> I'm not sure.  I've never had need for this operation before in the
> 10+ years of Ruby programming though.

That's 3 years per effective code line, if you add the block
feature to Array#nitems.

I appended it to my demanded and regarded private patch list at
<http://projects.bertram-scharpf.de/tmp/bertram-scharpf-ruby.patch>.

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de