Language REBOL
(Generalized song dialect)
Date: | 07/06/05 |
Author: | Gregg Irwin |
URL: | n/a |
Comments: | 1 |
Info: | http://www.rebol.com |
Score: | ![]() |
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
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
1 | Anonymous | 04/20/05 | 1 | ![]() ![]() |
series functions | Nicolas | 06/22/10 | 1 | ![]() ![]() |
network read | Nicolas | 06/22/10 | 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