From: Josef 'Jupp' SCHUGT Date: 2003-11-18T06:47:00+09:00 Subject: Re: Reason #642 to use Ruby instead of C++ -Carpal Tunnel Syndrome Hi! * Phil Tomson; 2003-11-17, 14:21 UTC: > b.each {|n| > if adj_hsh[node].include? n > external_cost += 1 > end > } > > Five lines in Ruby. In C++: > > for(LI n=b.begin();n!=b.end();++n) > { > if(_adj_map[node].find(*n) != _adj_map[node].end()) > { > external_cost++; > } > } Now that is *really unfair. Following an alternative scheme of writing C(++) programs that are only five lines. for(LI n=b.begin(); n != b.end(); ++n) { if(_adj_map[node].find(*n) != _adj_map[node].end()) { external_cost++; } } I almost always write my C code like that. Note that one can save even more lines and write for(LI n=b.begin(); n != b.end(); ++n) if(_adj_map[node].find(*n) != _adj_map[node].end()) external_cost++; The essential mistake is counting lines. What one should count is the number of characters. Josef 'Jupp' Schugt -- .-------. message > 100 kB? / | | sender = spammer? / | R.I.P.| text = spam? / ___| |___