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:
> >
> >> Btw, thanks for leaving the inject solution to me. :-)
> > Shame on you!!! ;)
>
> Um, why?  Somehow I don't get the joke, sorry. :-)
Really or are you metajoking?anyway to get out of recursive joke mode,
we are sometimes competing about #inject.
>
> > 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

Read my post please you can learn sooooo much. -- this is a joke!

Robert

-- 
I always knew that one day Smalltalk would replace Java.
I just didn't know it would be called Ruby
-- Kent Back