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 hackMongo

Date:04/20/05
Author:Geza Gyuk
URL:n/a
Comments:0
Info:n/a
Score: (2.29 in 28 votes)
hackMongo is an extension of the Mongo plotting package

! Does the beer song... sends output to a postscript file
! Geza Gyuk - gyuk@oddjob.uchicago.edu

printer 1
erase

data beer.dat
setv rounds c1(1)                       ! get number of rounds
                                        ! from first line, first
setv container bottles                  ! column of file beer.dat
expand {5/rounds}
loop i {rounds} 2 -1
   relocate 0.1 {i*5/(5*rounds)}
   putlabel 6 {i} bottles of beer on the wall,
   relocate 0.1 {(i*5-1)/(5*rounds)}
   putlabel 6 {i} bottles of beer,
   relocate 0.1 {(i*5-2)/(5*rounds)}
   putlabel 6 take one down and pass it around,
   if ({i}=2) setv container bottle
   relocate 0.1 {(i*5-3)/(5*rounds)}
   putlabel 6 {i-1} {container} of beer on the wall.
   relocate 0.1 {(i*5-4)/(5*rounds)}
   putlabel 6
endloop

relocate 0.1 {5/(5*rounds)}
putlabel 6 1 bottle of beer on the wall,
relocate 0.1 {4/(5*rounds)}
putlabel 6 1 bottle of beer,
relocate 0.1 {3/(5*rounds)}
putlabel 6 take it down and pass it around,
relocate 0.1 {2/(5*rounds)}
putlabel 6 no more bottles of beer on the wall.

hardcopy
end

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: