sw-examples: bottles-of-beer.sw3
Raw file here.
-- Implement, and run, the bottles of beer song:
max |bottles> => |4>
bottles |0> => |no more bottles>
bottles |1> => |1 bottle>
bottles |*> #=> |_self> __ |bottles>
first-line |*> #=> to-upper[1] bottles |_self> __ |of beer on the wall,> __ bottles |_self> __ |of beer.>
second-line |*> #=> |Take one down and pass it around,> __ bottles minus[1] |_self> __ |of beer on the wall.>
second-line |0> #=> |Go to the store and buy some more,> __ bottles max |bottles> __ |of beer on the wall.>
row |*> #=> first-line |_self> . second-line |_self> . |>
sing |*> #=> sdrop tidy print row sreverse srange(|0>, max |bottles>) |>
sing
Home