[Openmcl-devel] accessing lexical variables (lexical-environment vsdefinition-environment)

David L. Rager ragerdl at cs.utexas.edu
Tue Jul 19 09:41:44 PDT 2005


Is this your final objective, or are you trying to save the values
relevant to a function call for processing a closure later?

-----Original Message-----
From: openmcl-devel-bounces at clozure.com
[mailto:openmcl-devel-bounces at clozure.com] On Behalf Of Marco Baringer
Sent: Tuesday, July 19, 2005 9:34 AM
To: openmcl-devel at clozure.com
Subject: [Openmcl-devel] accessing lexical variables
(lexical-environment vsdefinition-environment)


i need a function which, at macro expansion time, collects the names
(as symbols) of all the visibile lexical variables. is there anything
which looks blatently wrong with this?

(defun lexical-variables (environment)
  (loop
     for env = environment
          then (ccl::lexenv.parent-env env)
     while (and env
                (not (ccl::istruct-typep env
'ccl::definition-environment)))
     for vars = (ccl::lexenv.variables env)
     when (listp vars)
     append (mapcar (lambda (var)
                      ;; ccl::var-name is a macro, se we can't do
#'ccl::var-name directly
                      (ccl::var-name var))
                    vars)))  

in particular i want to make sure that i can stop looking for
variables as soon as i hit a definition-environment object.

tia.

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

_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/mailman/listinfo/openmcl-devel




More information about the Openmcl-devel mailing list