From: Drew Olson Date: 2007-05-10T06:55:35+09:00 Subject: Re: What's the most ruby-ish way to write this python code? Thanks for the response. > Note though that you should use word[i+1..-1] (not word[i..-1]) in > order to get the same result as your python code. I noticed this just after I posted...good catch :) > The fastest executing algorithm that I could find was: > ar = [] > (0...word.size).each do |i| > letters.split(//).each do |c| > ar << word.dup > ar[-1][i] = c > end > end This was my suspicion as well. At least to my way of think, this seems decidedly non-ruby-esque. How is it that map has more overhead than duplicating the word i*c times? Another question for the performance folks out there: will I see a performance gain when I access the resulting words from this method if I store them in a set rather than an array? -- Posted via http://www.ruby-forum.com/.