Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

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: (2.50 in 2 votes)
	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

VersionAuthorDateCommentsRate
Exact "official" lyrics, incl caseGordon E. Peterson II08/14/070
2D.H.04/20/051

Comments

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!

Name:

eMail:

URL:

Security Code:
  
Comment: