Execute HQ9+/Common Lisp: Difference between revisions
m
Fixed syntax highlighting.
(category tags...) |
m (Fixed syntax highlighting.) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1:
▲{{implementation|HQ9+}}{{collection|RCHQ9+}}[[Category:Common Lisp]]
The interpreter (in [[Common Lisp]]) accepts a string, treated as program text, or a pathname object, in which case the contents of the file are the program text.
<
"Return the contents of the file as a string."
(with-output-to-string (out)
Line 19 ⟶ 18:
with accumulator = 0
for c across src
do (
(
(
(
(
(do ((n 99 (1- n))) ((zerop n))
(format out "~&~%~w bottle~:p of beer on the wall~%~
Line 35 ⟶ 34:
Go to the store and buy some more~%~
99 bottles of beer on the wall.~%")))
finally (return accumulator)))</
|