new to the condition system
- From: Q <qalex1@xxxxxxxxx>
- Date: 30 Apr 2007 13:55:25 -0700
I'm trying to solve something akin to the following problem:
(defun test-fn ()
(handler-case
(random-fn)
(error (e)
(handler-fn))))
(defun random-fn ()
(loop as rand = (random 10)
do
(if (> rand 8)
(error "im too big ~d~%" rand)
(format t "no problem with me ~d~%" rand))))
(defun handler-fn ()
(format t "WHOOPS, found an error~%")
(test-fn))
Basically, I'd like to run test-fn, and every time random-fn returns
an error, I'd like to report the error and just restart from scratch
with test-fn. As written, these 3 functions very quickly return a
stack overflow, because we're just getting deeper and deeper into new
instances of test-fn. I'm obviously misusing the lisp conditional
system, but I'm a bit confused as to how to use it correctly. Any
help?
Thanks!
.
- Follow-Ups:
- Re: new to the condition system
- From: Kent M Pitman
- Re: new to the condition system
- Prev by Date: Re: lisp-based netcat standin?
- Next by Date: Re: new to the condition system
- Previous by thread: lisp-based netcat standin?
- Next by thread: Re: new to the condition system
- Index(es):