This link ( http://www.99-bottles-of-beer.net/lyrics.html )
shows the correct output:
...
2 bottles of beer on the wall, 2 bottles of beer.
Take one down and pass it around, 1 bottle of beer on the wall.
1 bottle of beer on the wall, 1 bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.
The showcased CL version (
http://www.99-bottles-of-beer.net/language-common-lisp-114.html ),
written by Geoff Summerhayes and Kent M. Pitman,
procuces this incorrect output:
...
Two bottles of beer on the wall,
Two bottles of beer.
You take one down, pass it around,
One bottle of beer on the wall.
-----
One bottle of beer on the wall,
One bottle of beer.
You take one down, pass it around,
*No* more bottles of beer on the wall.
-----
And the code, as posted, wouldn't even run! It hadn't even
been tested once! At the bottom of the page, read:
Geoffrey Summerhayes said on 09/26/05 21:43:59
Minor correction, the line
·········@(~R~)~
should read
·········@(~R~)~
Talk about a maintainability nightmare! And yet Rob Warnock
(who seems to think highly of this crap) says that this "isn't
actually a particularly complex FORMAT". No wonder Yahoo
scrapped Paul Graham's Commune-Lisp code.
The other CL version
( http://www.99-bottles-of-beer.net/language-common-lisp-141.html?PHPSESSID=f389a6708517a579075820baf8ca7137 )
produced this incorrect output:
...
2 bottles of beer on the wall.
2 bottles of beer.
Take one down, pass it around.
1 bottle of beer on the wall.
1 bottle of beer on the wall.
1 bottle of beer.
Take one down, pass it around.
0 bottles of beer on the wall.
Time to go to the store.
So Commune Lisp and Commune Lispers are batting 0. Producing the
required output is simply too hard for them and their language.
Consequently, they print whatever they please. They don't care
about facts. Perception is reality!
When the altitude is 1400 feet, they output -7 feet.
On 6 Mar, 12:21, "William James" <·········@yahoo.com> wrote:
> [I NEED HELP!!]
Hey, I love you, so please read carefully:
If you don't stop now, CL will eat more and more of your precious
days.
Please stay away!
It's one of the hardest drugs around on planet earth!!
But I guess it's already too late...
On 6 Mar, 11:21, "William James" <·········@yahoo.com> wrote:
> This link (http://www.99-bottles-of-beer.net/lyrics.html)
[snip]
> So Commune Lisp and Commune Lispers are batting 0. Producing the
> required output is simply too hard for them and their language.
> Consequently, they print whatever they please. They don't care
> about facts. Perception is reality!
It's certainly a shame that the posted version doesn't work as is but
I think most rational people are able to distinguish between
programmer error and programming language failure. Your comment about
maintainability would also be fair if this wasn't a deliberately
extravagant example to show off the power of a sub-language embedded
within CL. Very few people would set out to write this sort of code
for real.
--
Phil
http://phil.nullable.eu/
On Mar 6, 2:42 pm, Phil Armitage <···············@gmail.com> wrote:
> Very few people would set out to write this sort of code
> for real.
Touché :)
The version below should produce the output as shown here:
<http://www.99-bottles-of-beer.net/lyrics.html>. I hope the
whitespace survives posting.
Code follows.
(in-package :cl-user)
(defun bottles (stream arg &optional colonp atp &rest args)
(declare (ignore atp args))
(format stream "~[~:[n~;N~]o more bottles~:;~:*~A bottle~:*~P~]" arg
colonp))
(defun bottle-song (&optional (in-stock 99) (stream *standard-
output*))
;; Original idea by Geoff Summerhayes <·······@hotmail.com>
;; Formatting idea by Fred Gilham <······@snapdragon.csl.sri.com>
;; Actual formatting & minor recoding by Kent M Pitman
;; <······@world.std.com>
;; Redone for conformance to <http://www.99-bottles-of-beer.net/>
;; by Michael Weber <········@foldr.org>.
(format
stream
"~{~1&~0%~
~00000%~
~00000%~
~00000%~
~00000000%~
~:/bottles/ ~
of beer on th~0%~
e wall, ~00001:*~
~99/bottles/ of ~
beer.~1:*~%~[Go ~
to the store and~
~0000% buy some ~
more, ~/bottles/~
~00% of beer on ~
the wall.~01%~:;~
Take one down an~
d pass it around~
, ~999/bottles/ ~
~:*of beer on th~
e wall.~002%~]~}"
(append (loop for bottle from in-stock downto 0 collect bottle)
(list in-stock))))
On Mar 6, 12:21 pm, "William James" <·········@yahoo.com> wrote:
> This link (http://www.99-bottles-of-beer.net/lyrics.html)
> shows the correct output:
>
> ...
>
> 2 bottles of beer on the wall, 2 bottles of beer.
> Take one down and pass it around, 1 bottle of beer on the wall.
>
> 1 bottle of beer on the wall, 1 bottle of beer.
> Take one down and pass it around, no more bottles of beer on the wall.
>
> No more bottles of beer on the wall, no more bottles of beer.
> Go to the store and buy some more, 99 bottles of beer on the wall.
>
> The showcased CL version (http://www.99-bottles-of-beer.net/language-common-lisp-114.html),
> written by Geoff Summerhayes and Kent M. Pitman,
> procuces this incorrect output:
>
> ...
>
> Two bottles of beer on the wall,
> Two bottles of beer.
> You take one down, pass it around,
> One bottle of beer on the wall.
>
> -----
>
> One bottle of beer on the wall,
> One bottle of beer.
> You take one down, pass it around,
> *No* more bottles of beer on the wall.
>
> -----
>
> And the code, as posted, wouldn't even run! It hadn't even
> been tested once! At the bottom of the page, read:
>
> Geoffrey Summerhayes said on 09/26/05 21:43:59
>
> Minor correction, the line
> ·········@(~R~)~
> should read
> ·········@(~R~)~
>
> Talk about a maintainability nightmare! And yet Rob Warnock
> (who seems to think highly of this crap) says that this "isn't
> actually a particularly complex FORMAT". No wonder Yahoo
> scrapped Paul Graham's Commune-Lisp code.
>
> The other CL version
> (http://www.99-bottles-of-beer.net/language-common-lisp-141.html?PHPSE...)
> produced this incorrect output:
>
> ...
>
> 2 bottles of beer on the wall.
> 2 bottles of beer.
> Take one down, pass it around.
> 1 bottle of beer on the wall.
>
> 1 bottle of beer on the wall.
> 1 bottle of beer.
> Take one down, pass it around.
> 0 bottles of beer on the wall.
>
> Time to go to the store.
>
> So Commune Lisp and Commune Lispers are batting 0. Producing the
> required output is simply too hard for them and their language.
> Consequently, they print whatever they please. They don't care
> about facts. Perception is reality!
>
> When the altitude is 1400 feet, they output -7 feet.
Sounds like you drank too much beer and you cannot even debug a simple
Communist Lisp program. That counts as the 4th programming homework
for you. You are failing the other three :)
Cheers
--
Marco
Marco Antoniotti <·······@gmail.com> writes:
> Sounds like you drank too much beer and you cannot even debug a simple
> Communist Lisp program.
Ah, that's where the bottle went.
--
Thomas
On 6 Mar, 12:21, "William James" <·········@yahoo.com> wrote:
> [I like 99 beers]
BTW, I like the ArrowLISP version best.
No numbers, no strings: only symbols!
http://www.99-bottles-of-beer.net/language-arrowlisp-1175.html
From: Javier
Subject: Re: This crap was written in Commune Lisp
Date:
Message-ID: <gor23q$vr6$1@aioe.org>
William James escribi�:
>
> This link ( http://www.99-bottles-of-beer.net/lyrics.html )
> shows the correct output:
>
> ...
>
> 2 bottles of beer on the wall, 2 bottles of beer.
> Take one down and pass it around, 1 bottle of beer on the wall.
>
> 1 bottle of beer on the wall, 1 bottle of beer.
> Take one down and pass it around, no more bottles of beer on the wall.
>
> No more bottles of beer on the wall, no more bottles of beer.
> Go to the store and buy some more, 99 bottles of beer on the wall.
>
>
>
>
>
> The showcased CL version (
> http://www.99-bottles-of-beer.net/language-common-lisp-114.html ),
> written by Geoff Summerhayes and Kent M. Pitman,
> procuces this incorrect output:
>
> ...
>
> Two bottles of beer on the wall,
> Two bottles of beer.
> You take one down, pass it around,
> One bottle of beer on the wall.
>
> -----
>
> One bottle of beer on the wall,
> One bottle of beer.
> You take one down, pass it around,
> *No* more bottles of beer on the wall.
>
> -----
>
>
>
> And the code, as posted, wouldn't even run! It hadn't even
> been tested once! At the bottom of the page, read:
>
> Geoffrey Summerhayes said on 09/26/05 21:43:59
>
> Minor correction, the line
> ·········@(~R~)~
> should read
> ·········@(~R~)~
>
>
> Talk about a maintainability nightmare! And yet Rob Warnock
> (who seems to think highly of this crap) says that this "isn't
> actually a particularly complex FORMAT". No wonder Yahoo
> scrapped Paul Graham's Commune-Lisp code.
>
>
>
>
>
> The other CL version
> ( http://www.99-bottles-of-beer.net/language-common-lisp-141.html?PHPSESSID=f389a6708517a579075820baf8ca7137 )
> produced this incorrect output:
>
> ...
>
> 2 bottles of beer on the wall.
> 2 bottles of beer.
> Take one down, pass it around.
> 1 bottle of beer on the wall.
>
> 1 bottle of beer on the wall.
> 1 bottle of beer.
> Take one down, pass it around.
> 0 bottles of beer on the wall.
>
> Time to go to the store.
>
>
>
> So Commune Lisp and Commune Lispers are batting 0. Producing the
> required output is simply too hard for them and their language.
> Consequently, they print whatever they please. They don't care
> about facts. Perception is reality!
>
> When the altitude is 1400 feet, they output -7 feet.
>
>
It's true:
error in FORMAT: parameters found after #\: or ··@ modifier
-----~2%~
~{~&~1&~
~[~^~:;~
·····@(~
~R~) bo~
ttle~:P o~
f beer on t~
he wall~01:*~[.~
~:;,·······@(~R~ ..
[Condition of type SB-FORMAT:FORMAT-ERROR]
See also:
Common Lisp Hyperspec, 22.3 [:section]
On 6 Mar, 11:21, "William James" <·········@yahoo.com> wrote:
> This link (http://www.99-bottles-of-beer.net/lyrics.html)
> shows the correct output:
>
> ...
>
> 2 bottles of beer on the wall, 2 bottles of beer.
> Take one down and pass it around, 1 bottle of beer on the wall.
>
> 1 bottle of beer on the wall, 1 bottle of beer.
> Take one down and pass it around, no more bottles of beer on the wall.
>
> No more bottles of beer on the wall, no more bottles of beer.
> Go to the store and buy some more, 99 bottles of beer on the wall.
>
> The showcased CL version (http://www.99-bottles-of-beer.net/language-common-lisp-114.html),
> written by Geoff Summerhayes and Kent M. Pitman,
> procuces this incorrect output:
>
> ...
>
> Two bottles of beer on the wall,
> Two bottles of beer.
> You take one down, pass it around,
> One bottle of beer on the wall.
>
> -----
>
> One bottle of beer on the wall,
> One bottle of beer.
> You take one down, pass it around,
> *No* more bottles of beer on the wall.
>
> -----
>
> And the code, as posted, wouldn't even run! It hadn't even
> been tested once! At the bottom of the page, read:
>
> Geoffrey Summerhayes said on 09/26/05 21:43:59
>
> Minor correction, the line
> ·········@(~R~)~
> should read
> ·········@(~R~)~
>
> Talk about a maintainability nightmare! And yet Rob Warnock
> (who seems to think highly of this crap) says that this "isn't
> actually a particularly complex FORMAT". No wonder Yahoo
> scrapped Paul Graham's Commune-Lisp code.
>
> The other CL version
> (http://www.99-bottles-of-beer.net/language-common-lisp-141.html?PHPSE...)
> produced this incorrect output:
>
> ...
>
> 2 bottles of beer on the wall.
> 2 bottles of beer.
> Take one down, pass it around.
> 1 bottle of beer on the wall.
>
> 1 bottle of beer on the wall.
> 1 bottle of beer.
> Take one down, pass it around.
> 0 bottles of beer on the wall.
>
> Time to go to the store.
>
> So Commune Lisp and Commune Lispers are batting 0. Producing the
> required output is simply too hard for them and their language.
> Consequently, they print whatever they please. They don't care
> about facts. Perception is reality!
>
> When the altitude is 1400 feet, they output -7 feet.
Well here is a Qi solution that can be fairly easily parsed into CL.
(define lyric
0 -> (verse 0)
N -> (do (verse N) (lyric (- N 1))))
(define verse
0 -> (output "No more bottles of beer on the wall, no more bottles
of beer.~%
Go to the store and buy some more, 99 bottles of beer on the wall.~%")
N -> (let N-1 (- N 1)
(output "~A bottle~P of beer on the wall, ~A bottle~P of
beer.~%
Take one down and pass it around, ~A of beer on the wall.~%~%"
N N N N (if (= N-1 0)
"no more bottles"
(make-string "~A bottle~P" N-1 N-1)))))
This song takes me back to happy times ;).
Mark
William James wrote:
>
> This link ( http://www.99-bottles-of-beer.net/lyrics.html )
> shows the correct output:
>
> ...
>
> 2 bottles of beer on the wall, 2 bottles of beer.
> Take one down and pass it around, 1 bottle of beer on the wall.
>
> 1 bottle of beer on the wall, 1 bottle of beer.
> Take one down and pass it around, no more bottles of beer on the wall.
>
> No more bottles of beer on the wall, no more bottles of beer.
> Go to the store and buy some more, 99 bottles of beer on the wall.
>
>
>
>
>
> The showcased CL version (
> http://www.99-bottles-of-beer.net/language-common-lisp-114.html ),
> written by Geoff Summerhayes and Kent M. Pitman,
> procuces this incorrect output:
>
> ...
>
> Two bottles of beer on the wall,
> Two bottles of beer.
> You take one down, pass it around,
> One bottle of beer on the wall.
>
> -----
>
> One bottle of beer on the wall,
> One bottle of beer.
> You take one down, pass it around,
> *No* more bottles of beer on the wall.
>
> -----
>
>
>
> And the code, as posted, wouldn't even run! It hadn't even
> been tested once! At the bottom of the page, read:
>
> Geoffrey Summerhayes said on 09/26/05 21:43:59
>
> Minor correction, the line
> ·········@(~R~)~
> should read
> ·········@(~R~)~
>
>
> Talk about a maintainability nightmare! And yet Rob Warnock
> (who seems to think highly of this crap) says that this "isn't
> actually a particularly complex FORMAT". No wonder Yahoo
> scrapped Paul Graham's Commune-Lisp code.
>
>
>
>
>
> The other CL version
> ( http://www.99-bottles-of-beer.net/language-common-lisp-141.html?PHPSESSID=f389a6708517a579075820baf8ca7137 )
> produced this incorrect output:
>
> ...
>
> 2 bottles of beer on the wall.
> 2 bottles of beer.
> Take one down, pass it around.
> 1 bottle of beer on the wall.
>
> 1 bottle of beer on the wall.
> 1 bottle of beer.
> Take one down, pass it around.
> 0 bottles of beer on the wall.
>
> Time to go to the store.
>
>
>
> So Commune Lisp and Commune Lispers are batting 0. Producing the
> required output is simply too hard for them and their language.
> Consequently, they print whatever they please. They don't care
> about facts. Perception is reality!
>
> When the altitude is 1400 feet, they output -7 feet.
>
>
You better stick to posting Ruby, my friend. Natural language is making
you look like a jerk.
hth,kenny