-;;; DOTIMES and DOLIST could be defined more concisely using destructuring
-;;; macro lambda lists or DESTRUCTURING-BIND, but then it'd be tricky to use
-;;; them before those things were defined. They're used enough times before
-;;; destructuring mechanisms are defined that it looks as though it's worth
-;;; just implementing them ASAP, at the cost of being unable to use the
-;;; standard destructuring mechanisms.
-(defmacro-mundanely dotimes (var-count-result &body body)
- (multiple-value-bind ; to roll our own destructuring
- (var count result)
- (apply (lambda (var count &optional (result nil))
- (values var count result))
- var-count-result)
- (cond ((numberp count)
- `(do ((,var 0 (1+ ,var)))
- ((>= ,var ,count) ,result)
- (declare (type unsigned-byte ,var))
- ,@body))
- (t (let ((v1 (gensym)))
- `(do ((,var 0 (1+ ,var)) (,v1 ,count))
- ((>= ,var ,v1) ,result)
- (declare (type unsigned-byte ,var))
- ,@body))))))
-(defmacro-mundanely dolist (var-list-result &body body)
- (multiple-value-bind ; to roll our own destructuring
- (var list result)
- (apply (lambda (var list &optional (result nil))
- (values var list result))
- var-list-result)
- ;; We repeatedly bind the var instead of setting it so that we never have
- ;; to give the var an arbitrary value such as NIL (which might conflict
- ;; with a declaration). If there is a result form, we introduce a
- ;; gratuitous binding of the variable to NIL w/o the declarations, then
- ;; evaluate the result form in that environment. We spuriously reference
- ;; the gratuitous variable, since we don't want to use IGNORABLE on what
- ;; might be a special var.
+(defmacro-mundanely dolist ((var list &optional (result nil)) &body body)
+ ;; We repeatedly bind the var instead of setting it so that we never
+ ;; have to give the var an arbitrary value such as NIL (which might
+ ;; conflict with a declaration). If there is a result form, we
+ ;; introduce a gratuitous binding of the variable to NIL without the
+ ;; declarations, then evaluate the result form in that
+ ;; environment. We spuriously reference the gratuitous variable,
+ ;; since we don't want to use IGNORABLE on what might be a special
+ ;; var.
+ (multiple-value-bind (forms decls) (parse-body body nil)