From: Michael Campbell Date: 2002-10-17T23:01:57+09:00 Subject: Re: Please check my algorithm --- Martin DeMello wrote: > "Mike Campbell" wrote in message > news:... > > > > > > ISBN_RE.match(self) && > > > ( (numbers.inject([0]){|x,y| x << (x[-1]+y)}.inject(0){|x,y| > x+y}) % 11).zero? > > > > > > martin > > > > Was the intent here to shorten the code to beyond obfuscation > threshholds? > > > > I thought that was one thing so many on this group rail against > perl for... > > Nope, just to use two injects rather than an accumulator (which was > what was asked). Which needed the first inject to collect into an > array (since the second inject needed to be passed one). > > Besides which, golfing and playing variations on a theme are fun, > as > long as you don't mistake the result for maintainable code :) Yeah, I apologize for my tone there; I didn't mean to come across as nasty as it sounded. It amuses me sometimes to see the accolades for how much easier ruby is to read/write (or how much harder perl is!) because of the more regular syntax. Then inevitably when someone asks how to do something, the responses leapfrog each other in terseness _well_ beyond reasonable readability. =) ===== -- Use your computer to help find a cure for cancer: http://members.ud.com/projects/cancer/ Yahoo IM: michael_s_campbell __________________________________________________ Do you Yahoo!? Faith Hill - Exclusive Performances, Videos & More http://faith.yahoo.com