Language scheme
(slightly shorter, efficient, featureful)
Date: | 08/29/05 |
Author: | Ricardo Malafaia |
URL: | n/a |
Comments: | 1 |
Info: | http://www.schemers.org |
Score: | (2.96 in 25 votes) |
;; rmalafaia@gmail.com, 2005-08-29 ;; slightly shorter and more efficient ;; some more language features shown as well (let ((str+ string-append) (n->s number->string)) (define (bottles n) (str+ (case n ((0) "No more bottles") ((1) "One bottle") (else (str+ (n->s n) " bottles"))) " of beer")) (define (beer n) (if (> n 0) (let ((bn (bottles n)) (msg (lambda (b cmp) (display (str+ b cmp)) (newline)))) (msg bn " on the wall") (msg bn "") (msg "Take one down, pass it around" "") (msg (bottles (- n 1)) " on the wall") (newline) (beer (- n 1))))) (beer 99))
Download Source | Write Comment
Alternative Versions
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
original version | Tim Goodwin | 04/20/05 | 2 | |
define-less version | lambda the ultimate | 10/14/10 | 0 | |
uses the hygenic macro system | Evan Farrer | 08/11/05 | 2 | |
Cleanly factored MAP-based version | Gnomon | 04/18/08 | 2 | |
REALLY using hygienic macros | NMH | 02/02/11 | 0 |
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!
Comments
RiceDEIDRE22 said on 03/10/10 05:26:01
Every body remembers that today's life seems to be very expensive, nevertheless some people need money for various stuff and not every man gets big sums money. Thus to receive some <a href="http://lowest-rate-loans.com/topics/home-loans">home loans</a> or just car loan will be good way out.