From: "Hal E. Fulton" Date: 2003-08-08T04:31:55+09:00 Subject: Re: Elegant solution for a loop-break problem ----- Original Message ----- From: "Rudolf Polzer" Newsgroups: comp.lang.ruby To: "ruby-talk ML" Sent: Thursday, August 07, 2003 2:26 PM Subject: Re: Elegant solution for a loop-break problem > Scripsit ille �Brian Candler� : > > In Ruby: > > > > l = %w{one two three} > > l.each do |elem| > > elem.replace('X' + elem.upcase) > > end > > p l > > > > In other words, you have to mutate the existing element; assigning to 'elem' > > does not replace the element, it simply makes the local variable point > > elsewhere. > > Yes, that is exactly the problem. You might search for a post of mine a few months back where I mentioned my idea of a "super-iterator" that would work around this problem (and two or three others). Hal -- Hal Fulton hal9000@hypermetrics.com