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 Derive 6

Date:02/02/07
Author:John Coleman
URL:n/a
Comments:0
Info:http://education.ti.com/educationportal/sites/US/productDetail/us_derive6.html
Score: (2.94 in 99 votes)
#1: bottles(n):=if(n=1," bottle "," bottles ")

#2: beers(n) := ADJOIN(n, APPEND(bottles(n),"of beer"))

#3: first_line(n):= If(n>0,
                   APPEND(beers(n), " on the wall, ", beers(n) , "."),
                  "No more bottles of beer on the wall, no more bottles of beer")

#4: share := "Take one down and pass it around, "

#5: second_tail(n):= If(n>1, 
                       APPEND(beers(n-1), " on the wall."),
                       "no more bottles of beer on the wall.")

#6: second_line(n):= If(n>0,
                       APPEND(share, second_tail(n)),
                       APPEND("Go to the store and buy some more, ", 
                           beers(99), " on the wall."))

#7: song:=PROG(
              n:=99,
              LOOP(If(n<0,RETURN("")),
                  DISPLAY(first_line(n)),
                  DISPLAY(second_line(n)),
                  DISPLAY(""),
                  n := n-1))

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: