99 Bottles of Beer/Lisp: Difference between revisions

m
updated Ol sample
m (moved to Common Lisp)
m (updated Ol sample)
Line 96:
 
=={{header|Ol}}==
<lang olscheme>
(setqdefine nn 99)
(let loop ((n nn))
(print n " bottles of beer on the wall,")
(print n " bottles of beer.")
(print "Take one down, pass it around, ")
(if (eq? n 1)
(begin
(print "No more bottles of beer on the wall.")
(print))
(begin
(print (- n 1) " bottles of beer on the wall,")
(print)
(loop (- n 1)))))
 
(for-each (lambda (n)
(print "No more bottles of beer on the wall,")
(let ((bottle (lambda (n) (if (eq? n 1) " bottle" " bottles")))
(print "No more bottles of beer.")
(ifm (eq?- n 1)))
(print "Go to the store and buy some more,")
(beginprint
(print nn " bottles of beer on the wall.")
(printn (-bottle n 1) " bottles of beer on the wall, ")
n (bottle n) " of beer." "\n"
(print "Take one down, and pass it around, ")
(if (eq? m 0) "no more" m)
(print "No more bottles (bottle m) " of beer on the wall,.\n")))
(reverse (iota nn 1)))
(print
(print "No more bottles of beer on the wall., ")
(print n "no more bottles of beer.") "\n"
(print "Go to the store and buy some more, ")
(print nnn " bottles of beer on the wall,.")
</lang>