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 Forth

(ANS standard)

Date:07/12/05
Author:Ian Osgood
URL:n/a
Comments:8
Info:http://www.forth.org/
Score: (3.64 in 89 votes)
\ ANS Forth, well-factored

:noname   dup . ." bottles" ;
:noname       ." 1 bottle"  ;
:noname ." no more bottles" ;
create bottles , , ,

: .bottles  dup 2 min cells bottles + @ execute ;
: .beer     .bottles ."  of beer" ;
: .wall     .beer ."  on the wall" ;
: .take     ." Take one down and pass it around" ;
: .verse    .wall ." , " .beer ." ." cr
         1- .take ." , " .wall ." ." cr ;
: verses   begin cr .verse ?dup 0= until ;

99 verses

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
original versionDan Reish04/20/050

Comments

>>  Commentifier said on 08/06/06 16:43:56

Commentifier What, no stack comments??

>>  Ian Osgood said on 08/08/06 19:05:29

Ian Osgood You got me...

verses is ( n -- )

All the other words are ( n -- n )

>>  JPN said on 12/01/06 17:57:11

JPN Very elegant, and very much "in the spirit of Forth."

>>  Michael said on 09/29/07 14:24:03

Michael Man, Forth is weird.

>>  Frank Earl (aka Svartalf) said on 10/27/07 18:04:14

Frank Earl (aka Svartalf) Forth is no weirder than many human languages- it was designed to be expressive and concise at the same time. This is nice and clean; ColorForth would be even more compact, I'd suspect, but be readable (well, to a Forth programmer...) all the same.

Now, this isn't a weird language- Befunge, False, Brainf*ck, and Malbolge are weird ones. >:-)

>>  Serial Drinker said on 12/16/07 01:57:07

Serial Drinker Very cool, but doesn't output the final "Go to the store..." sentence.

>>  Dugeen said on 02/22/08 16:17:29

Dugeen Sheer beauty

>>  JD said on 04/21/08 07:56:55

JD This is sweet and compact. However, I never get to go to the store and refill my cooler.

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: