Language SPITBOL
(this one uses pattern matching)
| Date: | 08/14/07 |
| Author: | Gordon E. Peterson II |
| URL: | http://personal.terabites.com |
| Comments: | 0 |
| Info: | http://www.snobol4.com |
| Score: |
output = (stanza = 99 (bob = " bottles of beer") (otw = " on the wall")
+ ", " 99 bob "." (cr = char(13) char(10))
+ (todpia = "Take one down and pass it around, ") 98 bob otw ".")
more output = cr (stanza ? (spand = span(dd = "0123456789")) . i
+ (bsm = " bottle" ("s" | null)) $ bs
+ break(dd) . t1 spand *bs break("T") . t2 todpia
+ (*spand . j | "no more" *?(j = 100)) *bsm =
+ (nb = (gt(i = i - 1) i,"No more") " bottle"
+ (eq(i,1),"s")) t1 replace(nb,"N","n") t2
+ (eq(i) "Go to the store and buy some more, " ?(j = 100),
+ todpia) (eq(j = j - 1) "no more", j) " bottle" (eq(j,1),"s"))
+ :s(more)
end
Download Source | Write Comment
Alternative Versions
| Version | Author | Date | Comments | Rate |
|---|---|---|---|---|
| 1 | D.H. | 04/20/05 | 1 | |
| Exact "official" lyrics, incl case | Gordon E. Peterson II | 08/14/07 | 0 |
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