From: Adam Shelly Date: 2008-03-27T04:08:24+09:00 Subject: Re: golf: tabs to bullets On 3/25/08, ara howard wrote: > On Mar 25, 2008, at 5:22 PM, David A. Black wrote: > > I'm seeing it differently; I see Martin's like this: > oh yeah - interesting. the fix: > > cfp2:~ > cat a.rb > DATA.read.gsub(%r/(?:\t\ ?)+/){|s|' '*(n=s.count("\t")-1)+%w(* - o x) > [n]+' '}.display > > __END__ > foo > bar > baz > hello > world > > (86 bytes of code) Here's one that shaves 9 bytes of Ara's while adding 2 fixes to match the original spec: use modulo for a circular list of bullets, and take an input filename from the command line, instead of imbedding it. $><<$<.read.gsub(/(?:\t\ ?)+/){|s|' '*(n=s.chop.size-1)+'*-ox'[n%4].chr+' '} (77 bytes)