From: Martin Duerst Date: 2007-12-18T16:14:35+09:00 Subject: Re: Enumerable#uniq, anybody? At 20:20 07/12/17, murphy wrote: >Martin Duerst wrote: >> However, it looks somewhat ugly and unnecessary, and it isn't compatible >> with 1.8. This could easily be fixed by adding uniq to Enumerator, the >> simplest form being: >> def uniq >> to_a.uniq >> end >the current implementation of uniq depends on the receiver being >converted into a hash table (to make it O(m) instead of O(m**2)). you >probably wouldn't expect that from an enumerator...to_a makes it clear, >though. I don't understand your argument. to_a means "convert to an Array", not "convert to a Hash". How uniq is implemented internally shouldn't bother anybody (as long as it is fast). Regards, Martin. #-#-# Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University #-#-# http://www.sw.it.aoyama.ac.jp mailto:duerst@it.aoyama.ac.jp