[
Skip Navigation
] [
CSUSB
] / [
CNS
] / [
Comp Sci Dept
] / [
R J Botting
] / [
Samples
] /
99beers
[
Index
] [
Contents
] [
Source Text
] [
About
] [
Notation
] [
Copyright
] [
Comment/Contact
] [Search
]
Tue Sep 18 15:24:56 PDT 2007
Contents
99 Bottles of Beer on the Wall
: MATHS description
99 Bottles of Beer on the Wall
You'd have a lot more fun if you went to the following site: [
beer.html
]
MATHS description
song
::= !
verse
(99-(1..98;Id)) !
e
. This means: concatenate 99 verses number 99,98,97,....0 and and
e
end verse.
For i:1..99,
verse
(i)::=
botw
(
b
(i))
t1d
b
(i-1)
otw
"\n".
botw
(x)::=x
otw
x ";\n".
b
::(0..)->string= 0+>"No more bottles of beer" | 1 +> " 1 bottle of beer" | map[i:2..] (i " bottles of beer").
(
above
)|-
b = following,
i
b(i)
0
"No more bottles of beer"
1
"1 bottle of beer"
2..
i ! " bottles of beer"
otw
::=" on the wall.\n".
t1d
::="Take one down, pass it around, \n".
e
::=
botw
(0) "Go to the store and buy some more... ".
. . . . . . . . . ( end of section
99 Bottles of Beer on the Wall
)
<<
Contents | End
>>
End