From: Christoph Date: 2002-07-14T21:01:44+09:00 Subject: Re: hey! where's #count? "Tom Sawyer" wrote in .... > i went to count the number of equal objects in an array and discoverd > there was no #count. that was odd, i thought, there's one for string. > but then it occured to me, #count would be in Enumberable. but no. it is > not. hey! why not? I guess I would write #count (not sure if this is such a descriptive name) as class Array def count() uniq.size end end Thinking about it, there is seems to be a good argument to move #uniq, with possible addition of #count (as I said I don't like that name), from the Array class to the Enumerable module since the uniq algorithm (of class Array) module Enumerable def uniq hsh = {} each {|e| hsh[e] = true } hsh.keys end end only relies on each. /Christoph