Subject: Re: Code walker library for CL
From: (Rob Warnock)
Date: Thu, 26 Mar 2009 20:22:18 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Pascal J. Bourguignon <> wrote:
| Indeed, implementations often provide one. 
| Eg. #+clisp ext:expand-form

+cmu walker:walk-form


    WALKER:WALK-FORM (form &optional environment walk-function)

where the default walk-function is:

    (lambda (subform context env)
      (declare (ignore context env))

There's also WALKER:MACROEXPAND-ALL (a wrapper around WALK-FORM,
which binds special variable WALKER:WALK-FORM-EXPAND-MACROS-P to T),
which is useful when you want to see the expansions of things
inside special forms, e.g.:

    > (macroexpand
	'(let ((x 1))
	   (incf x)))

    (LET ((X 1))
      (INCF X))
    > (walker:macroexpand-all
	'(let ((x 1))
	   (incf x)))

    (LET ((X 1))
      (LET* ((#1=#:G1589 1) (#2=#:G1588 (+ X #1#)))
	  (SETQ X #2#)))


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607