Language CRM114
| Date: | 04/20/05 |
| Author: | Dave Plonka |
| URL: | n/a |
| Comments: | 0 |
| Info: | n/a |
| Score: |
# 99 Bottles for "the CRM114 Discriminator"
# Dave Plonka - plonka@doit.wisc.edu, Mar 15 2003
# with modifications by WSY
window
isolate (:n:)
alter (:n:) /99/
isolate (:s:)
alter (:s:) /s/
{
# print starting preamble of verse
output /:*:n: bottle:*:s: of beer on the wall,:*:_nl:/
output /:*:n: bottle:*:s: of beer:*:_nl:/
# actually decrement the bottles
output /take one down, pass it around,:*:_nl:/
syscall ( :*:n:-1:*:_nl: ) (:n:) /bc/
# remove the trailing new-line:
match (:n:) [:n:] /[0-9]+/
# handle the one case (get rid of the "s")
{
match [:n:] /^1$/
alter (:s:) //
}
# handle the zero case:
match <absent> [:n:] /^0$/
# and if we get to here, we're nonzero on bottles, so go round again.
output /:*:n: bottle:*:s: of beer on the wall.:*:_nl::*:_nl:/
liaf
}
output /no more bottles of beer on the wall.:*:_nl:/
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments