From: Mark Devlin Date: 2006-03-11T09:58:47+09:00 Subject: Re: Help me understand why the Ruby block is slower than wit Alan Burch wrote: > I mis-spoke. Not a factor of 10 faster, just marginally. I had > "wordlist" in my directory as a list of the unique 10 letter words. > I do like the code better still, but with out the block, it's still much > faster. Also using uniq! rather than size is quicker than taking the > size twice. Solely for my own amusement, since I'm still trying teach myself Ruby... File.open("./words").read.split.collect! {|x| x if x.length == 10 && x.split(//).uniq! == nil}.compact!.each {|x| puts x } -- Posted via http://www.ruby-forum.com/.