[Bese-devel] Re: more feedback
Andreas Fuchs
asf at boinkor.net
Thu Apr 15 10:30:15 UTC 2004
On 2004-04-13, Jan Rychter <jan at rychter.com> wrote:
> Ok. Having played with UCW during some airplane trips, I now know
> where it gets stuck. It was looping forever in (defmethod find-frame
> ((s standard-session) (frame-id string)) ...). Possibly because of
> some problem with ITERATE. I have rewritten the iterate using loop:
>
> (defmethod find-frame ((s standard-session) (frame-id string))
> "Returns the frame whose id is STEP-ID and eliminates any
> frames in the stack in the session after the frame. If no frame
> with that id exists the session's stack is left untouched and
> an error of type inexistent-frame-id is signaled."
> (loop with stack = (session.stack s)
> while stack
> when (string= (frame.id (car stack)) frame-id)
> do (progn (setf (session.stack s) stack)
> (return-from find-frame (car stack)))
> else do (pop stack)
> finally (return-from find-frame nil)))
perhaps it would make sense to use a more iterate-y variant of the
code (which looks like a literal translation of the WHILE form (-:
let's see...
(iterate
(for stack on (session.stack s))
(finding stack such-that (string= (frame.id (car stack)) frame-id)
into found-session-stack)
(finally (when found-session-stack
(setf (session.stack s) found-session-stack)
(return (car found-session-stack)))))
should look better (and work, too). I'm looking forward to your
comments.
Cheers,
--
Andreas Fuchs, <asf at boinkor.net>, asf at jabber.at, antifuchs
More information about the bese-devel
mailing list