From: spooq Date: 2006-11-09T22:15:05+09:00 Subject: Re: thousand ways to rome you are absolutely correct, my mind is rotting from weeks of sitting at my desk twiddling my thumbs with no work to do. On 11/9/06, Robert Dober wrote: > On 11/9/06, spooq wrote: > > > > use map! instead > > > nope, > try to understand the difference between split(regexp), map and map! > than decide for yourself > Look at this for example > > "he, nice, guys".split(',').map!{|x| x.strip} > why would you use map! ? > try to put the above expression into a context > e.g. > x = ... > > Hint: using map! on unreferenced objects is quite useless. > > What about > x= "he, nice".split(",") > x.map!{|x|x.strip} > > try > x.map!{|x|x.strip!} > would you like to use this? > > If you want to walk do not learn to drive ;) > > Cheers > Robert > > On 11/9/06, Chris Mueller wrote: > > > good timing to you first two guys;) > > > > > > thx very much. got some new ruby cells working in my brain. > > > > > > i tried same thing as ".map" with "array.each" before, but this does > > > only apply on a copy i suppose... > > > > > > and of course the regexp way is ... groovy! > > > > > > -- > > > Posted via http://www.ruby-forum.com/. > > > > > > > > > > > > > -- > The reasonable man adapts himself to the world; the unreasonable one > persists in trying to adapt the world to himself. Therefore all progress > depends on the unreasonable man. > > - George Bernard Shaw > >