From: "عمر ملقب بالثانی" Date: 2008-07-12T22:30:17+09:00 Subject: Re: inject idiom Thanks to both of you ara.t.howard and Kentaro-san for the nice hints. As far as I could tell from your tips, Ruby-style encourages conciseness (hence the use of hash.update or the custom .set method that returns the hash). And it seems that inject({}) is in any case preferred to h={} and each loop, right? GOTO Kentaro wrote: > Do you like this? > [...] Yes. Short and to the point but still quite clear to a beginner. ara.t.howard wrote: > i prefer > [...] I liked the map method a lot (it reminds me the Perl map) and the way one can build the hash step by step with .update (or .merge!) [on that, I checked in The Ruby Programming Language]. I'll try to stick on that kind of idiom. > . use space to give meaning: a newline is one char > . use explicit var names as comments I am already used to this with Perl... (I pasted a slightly less spaced code here) > . try to minimize method chaining so stacktraces to line #42 have > at least some meaning I got your point on minimising method chaining but not what you meant with line #42. Thanks again. Kind regards, Ömer. -- Posted via http://www.ruby-forum.com/.