[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

99 bottles



I don't know Python so I can't evaluate (so to speak) this, but I thought
you might find it entertaining.
-- Dan

From: Dave Rolsky <autarch@urth.org>
Date: Tue, 8 Oct 2002 00:56:44 -0500 (CDT)

On Wed, 2 Oct 2002, oxymoron wrote:

 > Here's my minimal Python version:
 >
 > print "".join(map(lambda n,b="\nTake one down, pass it around\n%s 
bottles of "+
 > "beer on the 
wall\n":b%n+b[30:]%n+b[31:-12]%n,range(99,0,-1)+["no"]))[63:-52]

Hah, that's not minimal.  That's a whopping 157 characters without line
breaks!  That's positively effusive.

Here's a _real_ minimal version, 139 characters of lovely Perl:

$b=sub{(99_-@_-$_||No)." bottles of beer on the wall\n"};
warn map{&$b.substr(&$b,0,18)."\nTake one down, pass it 
around\n".&$b(0).$/}0..98

They both handle "no bottles", but they also both blow it with "one
bottles".  Oh well.


-dave