Re: Sequences other than list and vector
From: Lars Brinkhoff (lars.spam_at_nocrew.org)
Date: 26 Nov 2003 11:00:51 +0100
Kent M Pitman <firstname.lastname@example.org> writes:
> Lars Brinkhoff <email@example.com> writes:
> > tfb@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
> > > (defmacro dosequence ((var sequence &optional result) &body forms)
> > > `(block nil
> > > (map nil (lambda (,var) ,@forms) ,sequence)
> > > ,@(when result (list `(let ((,var nil)) ,result)))))
> > Perhaps throw in a tagbody too.
> My immediate thought was - where?
Around ,@forms was my idea, but after reading your reply, I guess
that's not the only possibility.
> I rushed back to CLHS, just knowing I probably left this vague. The
> wording "The body of dolist is like a tagbody." can, I suppose, be
> construed to imply "and the result-form doesn't get injected into it."
> but that's a pretty lousy way for me to have written it. Then again,
> maybe it was always vague. (Anyone got CLTL handy? Mine's packed.
"The body of the loop is implicitly a tagbody construct; it may
contain tags to serve as the targets of go statements."
I can't see anything about whether the result form should be inside or
outside the implicit tagbody.
-- Lars Brinkhoff, Services for Unix, Linux, GCC, HTTP Brinkhoff Consulting http://www.brinkhoff.se/