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

Re: 99 bottles



Daniel Weinreb <DLWeinreb@attbi.com> writes:

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

And who can resist joining in.. here's my "perl envy" one in common
lisp, which clearly isn't a winner at 229 non-whitespace characters:

(loop for beers from 99 downto 1
      do (format t "~
~&~S bottle~:P of beer on the wall. ~:*~S bottle~:P of beer.
Take one down pass it around, ~
~:[no more bottles~;~S more bottle~:P~] of beer on the wall."
                 beers (> beers 1) (1- beers)))

It outputs:

99 bottles of beer on the wall. 99 bottles of beer.
Take one down pass it around, 98 more bottles of beer on the wall.
.....
2 bottles of beer on the wall. 2 bottles of beer.
Take one down pass it around, 1 more bottle of beer on the wall.
1 bottle of beer on the wall. 1 bottle of beer.
Take one down pass it around, no more bottles of beer on the wall.

Cheers,
Luke