in reply to Re: too much free time (99 Bottles of Beer)
in thread too much free time
Of course, nowadays I'd write it in Perl 6, taking advantage of constants, aliasing, lazy mappings over infinite lists, string interpolation of code, automatic command-line interfaces, parameter defaults, countdown sequences, and indentable heredocs:
constant @bottles_of_beer := ('No', 1, 2...*).map(->$n{"$n bottle{'s' if $n ne 1} of beer"}); sub MAIN(Int $max = 99) { for $max...1 -> $n { say qq:to<BURP!> @bottles_of_beer[$n] on the wall, @bottles_of_beer[$n]. Take one down, pass it around, @bottles_of_beer[$n-1] on the wall. BURP! } }
;-)
Damian
In Section
Meditations