[Bese-devel] Re: compile-op error on backtracking.lisp

Marco Baringer mb at bese.it
Fri Jun 16 15:08:01 UTC 2006


Nikodemus Siivola <nikodemus at random-state.net> writes:

> Question: what kind of queries do you perform on the environment, and
> how? Do you dip into the internals, or do you use eg. SB-CLTL2?

we need a way to know all of the local variables and functions (we
should grab symbol-macros and macrolets as well, but we don't
atm). this is done using these snippets (arnesi/src/lexenv.lisp):

#+sbcl
(defmethod lexical-variables ((environment sb-kernel:lexenv))
  (loop
     for var-spec in (sb-c::lexenv-vars environment)
     when (and (atom (cdr var-spec))
               (not (and (typep (cdr var-spec) 'sb-c::lambda-var)
			 (sb-c::lambda-var-ignorep (cdr var-spec)))))
     collect (car var-spec)))

#+sbcl
(defmethod lexical-functions ((environment sb-kernel:lexenv))
  (mapcar #'first (sb-c::lexenv-funs environment)))

i didn't know about sb-cltl2's existence, but it looks like that's
missing the map-environment function.

-- 
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen




More information about the bese-devel mailing list