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 Ursala

(functional programming)

Date:07/13/08
Author:Dennis Furey
URL:http://www.basis.uklinux.net
Comments:0
Info:http://www.basis.uklinux.net/ursala
Score: (2.50 in 4 votes)
# compile with --show to display the lyrics

#import nat

# each function takes a natural number to a block of text

quantity = # forms the appropriate plural

~&iNC+ --' of beer'+ ~&?(
   1?=/'1 bottle'! --' bottles'+ ~&h+ %nP,
   'no more bottles'!)

verse =

^(successor,~&); ("s","n"). -[
   -[quantity "s"]- on the wall, -[quantity "s"]-,
   Take one down and pass it around, -[quantity "n"]- on the wall.]-

refrain "n" =

-[
   No more bottles of beer on the wall, -[quantity 0]-.
   Go to the store and buy some more, -[quantity "n"]- on the wall.]-

whole_song "n" = ~&tttt2SPSNiCSL (verse*x iota "n")--<refrain "n">

main = whole_song 99

Download Source | Write Comment

Alternative Versions

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: