99 Bottles of Beer/Lisp: Difference between revisions
Content added Content deleted
m (moved to Common Lisp) |
m (updated Ol sample) |
||
Line 96: | Line 96: | ||
=={{header|Ol}}== |
=={{header|Ol}}== |
||
<lang |
<lang scheme> |
||
( |
(define nn 99) |
||
(let loop ((n nn)) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
(print)) |
|||
(begin |
|||
⚫ | |||
(print) |
|||
(loop (- n 1))))) |
|||
(for-each (lambda (n) |
|||
⚫ | |||
(let ((bottle (lambda (n) (if (eq? n 1) " bottle" " bottles"))) |
|||
(print "No more bottles of beer.") |
|||
⚫ | |||
⚫ | |||
⚫ | |||
(print nn " bottles of beer on the wall.") |
|||
⚫ | |||
n (bottle n) " of beer." "\n" |
|||
⚫ | |||
(if (eq? m 0) "no more" m) |
|||
⚫ | |||
(reverse (iota nn 1))) |
|||
(print |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
</lang> |
</lang> |
||