[plt-scheme] procedure-environment

From: Doug Orleans (dougo at place.org)
Date: Fri Aug 26 14:47:36 EDT 2005

William Josephson writes:
 > I'm in the process of porting code from a guile-based
 > environment that makes heavy use of guile's
 > procedure-environment to determine the value bound to
 > free variables in lambdas.  I'm curious to know if
 > anyone has suggestions on how to implement the
 > equivalent in mzScheme.

I made a simple procedure reflection facility as part of my Socrates
language (for my PhD thesis research).  It probably wouldn't be usable
as-is for your purposes but it might give you a good start.  In a
nutshell, the idea is to compute the free variables at
syntax-expansion time, then create another lambda in the same lexical
scope whose body is a case statement mapping the variable names to
their current values.  For more details, see chapter 7 of my
dissertation or browse the source code (starting with
socrates/proc-src.ss), both available via Sourceforge:

http://socrates-lang.sf.net

HTML documentation and PLaneT distribution still pending.

--dougo at place.org



Posted on the users mailing list.