On 28.06.2007 16:11, Robert Dober wrote:
> On 6/28/07, Robert Klemme <shortcutter / googlemail.com> wrote:
>> On 28.06.2007 12:56, Robert Dober wrote:
>> > On 6/28/07, Robert Klemme <shortcutter / googlemail.com> wrote:

>> > But that is not what OP asked for <G>
>> >
>> > (a|[]).map{|e|a.grep(e).size} ### I know it might not work as we use
>> > #=== here
>>
>> Sorry, Robert, but I don't think this is what the OP was asking for:
>>
>> irb(main):001:0> a = %w{a a a b b c c c d d e}
>> => ["a", "a", "a", "b", "b", "c", "c", "c", "d", "d", "e"]
>> irb(main):002:0> a.map{|e|a.grep(e).size}
>> => [3, 3, 3, 2, 2, 3, 3, 3, 2, 2, 1]
> Careful here Robert I wrote
> 
> (a|[]) which is a more computation intensive way to write a.uniq. --
> its a coding joke brrr

Umpf!  I actually overlooked that one.  Somehow I read it as (a||[]). 
Duh!  Sorry for the noise.  Btw, that idiom was not part of my 
repertoire.  So I actually learned something today - although I have to 
say I'd rather stick with #uniq - it's easier for my brain. :-)

Kind regards

	robert