8992c742fc
FossilOrigin-Name: 85584e9a667625b397425dd290a5daeb2ada5c858b62499ebfd9ba903849f559
30 lines
665 B
Forth
30 lines
665 B
Forth
# 99 Bottles
|
|
|
|
Display the text for the *99 Bottles of Beer* song.
|
|
|
|
~~~
|
|
'example/Autopsy.forth include
|
|
|
|
{ 'bottle 'bottles 'of 'beer 'on 'the 'wall 'no 'more
|
|
'Take 'one 'down, 'pass 'it 'around }
|
|
[ dup ':%s_'%s_s:put_sp_; s:format s:evaluate ] a:for-each
|
|
|
|
{ [ no more bottles ]
|
|
[ #1 n:put sp bottle ]
|
|
[ dup n:put sp bottles ]
|
|
} 'BOTTLES const
|
|
|
|
:number-bottles
|
|
dup #2 n:min BOTTLES swap a:fetch call ;
|
|
|
|
:display-verse
|
|
number-bottles of beer on the wall nl
|
|
number-bottles of beer nl
|
|
n:dec Take one down, pass it around nl
|
|
number-bottles of beer on the wall nl ;
|
|
|
|
:verses (n-)
|
|
repeat 0; nl display-verse again ;
|
|
|
|
#99 verses
|
|
~~~
|