Re: A style question
- From: Richard M Kreuter <kreuter@xxxxxxxxx>
- Date: Wed, 28 Feb 2007 15:22:24 -0500
Tim Bradshaw <tfb@xxxxxxxx> writes:
On 2007-02-28 17:38:48 +0000, Richard M Kreuter <kreuter@xxxxxxxxx> said:
I'm unhappy about the explicit looping however. I can see two
solutions to this:
* something really gratuitous involving GO
* something equally gratuitous involving a lot of LAMBDAs.
I'm sorry, but here's the best I can do for now.
(unwind-protect
(prog ((i 0) mod3 mod5)
(declare (special i mod3 mod5))
(setf (symbol-function 'cl-user::format-eval)
(lambda (stream thing colon atsign)
(declare (ignore stream colon atsign))
(handler-bind ((warning #'muffle-warning))
(eval thing))))
(setf mod3 (mod i 3)
mod5 (mod i 5))
format
(ecase
(catch 'go
(format
t
"~&~[~[~3@*~A~A~:;~3@*~A~*~]~:;~[~4@*~A~:;~D~2*~]~]~%~/CL-USER::FORMAT-EVAL/"
mod3 mod5 i "Fizz" "Buzz"
'(progn
(incf i)
(setf
mod3 (mod i 3)
mod5 (mod i 5))
(if (> i 100)
(throw 'go 'quit)
(throw 'go 'format)))))
(format (go format))
(quit (go quit)))
quit nil)
(fmakunbound 'cl-user::format-eval))
I know, it doesn't have enough LAMBDAs.
--
RmK
.
- References:
- A style question
- From: job-271842874
- Re: A style question
- From: Frank Buss
- Re: A style question
- From: job-271842874
- Re: A style question
- From: Tim Bradshaw
- Re: A style question
- From: Richard M Kreuter
- Re: A style question
- From: Tim Bradshaw
- Re: A style question
- From: Richard M Kreuter
- Re: A style question
- From: Tim Bradshaw
- A style question
- Prev by Date: Re: -2 is not a real number?!?
- Next by Date: Re: Useless SBCL on Win32: memory problem
- Previous by thread: Re: A style question
- Next by thread: Re: A style question
- Index(es):