[Date Prev] [Date Index] [Date Next]
[Thread Prev] [Thread Index] [Thread Next]

[xyzzy:01215] Re: do-symbols



    Tue, 24 Nov 1998 11:22:46 +0900 の
   “[xyzzy:01213] Re: do-symbols”
    への返事です.

| 修正はもうちょい待って。

待った? とりあえずこれを使っておいて下さい。ちなみに、
do-external-symbols も同様にバグっています。

(defmacro do-symbols ((var &optional (package nil sv) result-form) &body body)
  (let ((vl (gensym))
	(v (gensym))
	(l (gensym))
	(i (gensym))
	(break (gensym))
	(retval (gensym))
	(pkg (gensym)))
    (multiple-value-bind (decl body)
	(lisp::find-declaration body)
      `(let ((,vl '()))
	 ,@decl
	 (setq ,pkg (if ,sv ,package *package*))
	 (push (si:*package-external ,pkg) ,vl)
	 (push (si:*package-internal ,pkg) ,vl)
	 (dolist (x (package-use-list ,pkg))
	   (push (si:*package-external x) ,vl))
	 (block ,break
	   (dolist (,v ,vl (let ((,var nil)) ,result-form))
	     (let ((,l (length ,v)))
	       (dotimes (,i ,l)
		 (let* ((,break 't)
			(,retval (dolist (,var (svref ,v ,i) (setq ,break 'nil))
				   ,@body)))
		   (when ,break
		     (return-from ,break ,retval)))))))))))

--
亀井哲弥(Tetsuya Kamei)
kamei@xxxxxxxxxxxx/JCA00343@xxxxxxxxxxx

Index Home