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 Irken

Date:03/03/11
Author:Mike Gogulski
URL:n/a
Comments:0
Info:http://www.nightmare.com/rushing/irken/irken/lang.html
Score: (3.00 in 16 votes)
;; -*- Mode: Irken -*-
;;
;; By Mike Gogulski <mike@gogulski.com> 3 March 2011
;;
;; Irken is a simplified, statically-typed dialect of Scheme. It uses an
;; ML-like type system supporting parametetric polymorphism (i.e., "let
;; polymorphism") and algebraic datatypes. With type inference and a
;; pattern-matching syntax, it could be considered ML with a lisp/scheme
;; syntax.
;;
;; Language author: Sam Rushing
;; Language home page: http://www.nightmare.com/rushing/irken/irken/lang.html
;;
;; Tested under Linux 2.6.35-24-generic-pae #42-Ubuntu SMP i686 GNU/Linux
;;
;; Derived from http://99-bottles-of-beer.net/language-scheme-2524.html

(include "lib/core.scm")
(include "lib/pair.scm")
(include "lib/string.scm")

((lambda (f count) (f f count))
 (lambda (f count) 
   (cond ((= count 0) 
          (print-string (string-append "No more bottles of beer on the wall, " 
                                "no more bottles of beer. "))
          (newline)
          (print-string (string-append "Go to the store and buy some more, "
                                "99 bottles of beer on the wall."))
          (newline))
         (else (print-string (string-append (int->string count)
                                     (if (> count 1) " bottles "
                                         " bottle ")
                                     "of beer on the wall, "
                                     (int->string count)
                                     (if (> count 1) " bottles "
                                         " bottle ") 
                                     "of beer."))
               (newline)
               (print-string (string-append "Take one down, pass it around, "
                                     (if (= count 1) "no more"
                                         (int->string (- count 1)))
                                     (if (= count 2) " bottle "
                                         " bottles ")
                                     "of beer on the wall"))
               (newline) (newline)
               (f f (- count 1))))) 
 99)

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
More Irken-like, less Scheme-likeSam Rushing01/27/120

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: