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 REBOL

(Generalized song dialect)

Date:07/06/05
Author:Gregg Irwin
URL:n/a
Comments:1
Info:http://www.rebol.com
Score: (3.00 in 41 votes)
sing: func [input /local n stmt num chop phrase sing-verse] [
    parse input [set num integer! copy stmt to end]
    n: num
    chop: func [word] [head remove back tail form word]
    phrase: func [val] [
        reform switch/default val [
            0 [["No more" stmt]]
            1 [[val head change copy stmt chop stmt/1]]
        ] [[val stmt]]
    ]
    sing-verse: func [val] [
        print [phrase n "on the wall," join phrase n "."]
        print either n > 0 [
            ["Take one down and pass it around," phrase n - 1 "on the wall." newline]
        ][
            rejoin ["Go to the store and buy some more..." phrase num "."]
        ]
    ]
    while [n >= 0] [sing-verse n  n: n - 1]
]
sing [99 bottles of beer]
sing [7 carafes of wine]

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
1Anonymous04/20/051
series functionsNicolas06/22/101
network readNicolas06/22/100

Comments

>>  Boyer20Sondra said on 05/09/10 13:27:49

Boyer20Sondra Lots of specialists argue that <a href="http://lowest-rate-loans.com/topics/home-loans">lowest-rate-loans.com</a> help people to live their own way, because they can feel free to buy necessary stuff. Furthermore, different banks give consolidation loan for different persons.

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: