(defun take-it-out-for-a-test-walk-1 (form)
(let ((copy-of-form (copy-tree form))
(result (walk-form form nil
- #'(lambda (x y env)
- (format t "~&Form: ~S ~3T Context: ~A" x y)
- (when (symbolp x)
- (let ((lexical (var-lexical-p x env))
- (special (var-special-p x env)))
- (when lexical
- (format t ";~3T")
- (format t "lexically bound"))
- (when special
- (format t ";~3T")
- (format t "declared special"))
- (when (boundp x)
- (format t ";~3T")
- (format t "bound: ~S " (eval x)))))
- x))))
+ (lambda (x y env)
+ (format t "~&Form: ~S ~3T Context: ~A" x y)
+ (when (symbolp x)
+ (let ((lexical (var-lexical-p x env))
+ (special (var-special-p x env)))
+ (when lexical
+ (format t ";~3T")
+ (format t "lexically bound"))
+ (when special
+ (format t ";~3T")
+ (format t "declared special"))
+ (when (boundp x)
+ (format t ";~3T")
+ (format t "bound: ~S " (eval x)))))
+ x))))
(cond ((not (equal result copy-of-form))
(format t "~%Warning: Result not EQUAL to copy of start."))
((not (eq result form))
(with-output-to-string (*standard-output*)
(let ((the-lexical-variables ()))
(walk-form '(let ((a 1) (b 2))
- #'(lambda (x) (list a b x y)))
+ (lambda (x) (list a b x y)))
()
- #'(lambda (form context env)
- (declare (ignore context))
- (when (and (symbolp form)
- (var-lexical-p form env))
- (push form the-lexical-variables))
- form))
+ (lambda (form context env)
+ (declare (ignore context))
+ (when (and (symbolp form)
+ (var-lexical-p form env))
+ (push form the-lexical-variables))
+ form))
(or (and (= (length the-lexical-variables) 3)
(member 'a the-lexical-variables)
(member 'b the-lexical-variables)
(error "Walker didn't do lexical variables of a closure properly."))))
""))
\f
+;; old PCL hung up on it
+(defmethod #:foo ()
+ (defun #:bar ()))
+\f
(quit :unix-status 104)