From: Robert Dober Date: 2006-08-02T19:28:58+09:00 Subject: Re: golfing Eratosthenes ------=_Part_68629_31459126.1154514536329 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 8/2/06, Daniel Baird wrote: > > On 8/2/06, Daniel Baird wrote: > > Hi all, > > > > I've been golfing around with the sieve of Eratosthenes. Here's what > > I've got so far: > > > > a=3D(2..100).to_a;p a.each{|c|a.map!{|d|c&&d&&c > > > It's already under 80 chars, but I'd still love to remove the > > definition of the array a, and do the whole thing with no semicolons. > > Any suggestions? > > > > Improvement: > > a=3D(2..100).to_a;p a.each{|c|a.reject!{|d|c nil, or do the final compact. Seems ok even though I'm editing the > array I'm looping through.. > > ;D > > -- > Daniel Baird > http://tiddlyspot.com (free, effortless TiddlyWiki hosting) > http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog :: > Things That Suck) > > --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_68629_31459126.1154514536329--