Re: A style question
- From: Frank Buss <fb@xxxxxxxxxxxxx>
- Date: Wed, 28 Feb 2007 02:38:05 +0100
job-271842874@xxxxxxxxxxxxxx wrote:
I cranked out a Lisp version. It seems a bit clunky, so I thought I'd see
if anyone had suggestions for improvements.
looks ok, but I would use loop and organize the body of the loop a bit
different:
(defun fizz-buzz (n)
(loop for i from 1 to n
for fizz = (zerop (mod i 3))
for buzz = (zerop (mod i 5)) do
(when fizz (princ "Fizz"))
(when buzz (princ "Buzz"))
(when (not (or fizz buzz)) (princ i))
(terpri)))
--
Frank Buss, fb@xxxxxxxxxxxxx
http://www.frank-buss.de, http://www.it4-systems.de
.
- Follow-Ups:
- Re: A style question
- From: job-271842874
- Re: A style question
- References:
- A style question
- From: job-271842874
- A style question
- Prev by Date: A style question
- Next by Date: Re: A style question
- Previous by thread: A style question
- Next by thread: Re: A style question
- Index(es):
Relevant Pages
|