btw, there's also a ticket on this, #3810, but the trac is currently not in working order--
note that there's a new server on the way[1].

-Thomas

[1] http://weblog.rubyonrails.org/2006/8/10/new-dedicated-trac-server- on-the-way

Am 14.08.2006 um 17:11 schrieb Jay Miller:

I'd be concerned about the extreme lack of efficiency with that implementation. The algorithm is exponential, and worse than that, in one of the most common cases does no work at all despite taking so much time. I wouldn't use it in the library directly.

On 8/14/06, Thomas Fuchs <[EMAIL PROTECTED]> wrote: That method should be named "uniq" (to match the ruby enumerables, which
Prototype heavily borrows from), and should be added to the Prototype
enumerables-- seems like a nice extension. :)

-Thomas

Am 14.08.2006 um 00:06 schrieb Martin Ström:

> And the little more elegant, prototypish way ;)
>
> Object.extend(Array.prototype, {
>     unique: function() {
>         return this.inject ([], function(array, value) {
>             if (!array.include(value)) array.push (value);
>             return array;
>         });
>     }
> });
>
> _$$_old = $$;
>
> function $$() {return _$$_old.apply(null, arguments).unique()}
>
> Ciao
> Martin

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to