[plt-scheme] determine free variables

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Mar 24 21:34:46 EDT 2008

There is still a nice opportunity for refactoring here!


On Mar 24, 2008, at 9:18 PM, Jay McCarthy wrote:
> That's interesting.
>
> A note though: that implementation doesn't handle
> letrec-syntaxes+values which isn't in true fully expanded code, but
> will show up in the result of local-expand with an empty stop list.
> (I've talked to mflatt about this and he said there isn't a way to get
> true fully expanded code.)
>
> Jay
>
> On Mon, Mar 24, 2008 at 7:15 PM, Sam TH <samth at ccs.neu.edu> wrote:
>> On Mon, Mar 24, 2008 at 8:42 PM, Jay McCarthy  
>> <jay.mccarthy at gmail.com> wrote:
>>> Look at collects/web-server/lang/freevars.ss for a (syntax ->  
>>> (listof
>>>  identifier-syntax)) function
>>
>>  There's also an implementation (intended for use in other libraries)
>>  in syntax/free-vars (maybe the webserver should use that?).
>>
>>  sam th
>>
>>
>>
>>>
>>>  (Only works on expanded code)
>>>
>>>  Jay
>>>
>>>
>>>
>>>  On Mon, Mar 24, 2008 at 5:55 PM, YC <yinso.chen at gmail.com> wrote:
>>>> Hi all -
>>>>
>>>> What's the best approach to determine free variables at source  
>>>> level?
>>>>
>>>> What i am trying to accomplish is to take a scheme expression  
>>>> from a file,
>>>> say
>>>>
>>>> (+ foo bar)
>>>>
>>>> and transform
>>>>
>>>> (lambda (foo bar)
>>>>   (+ foo bar))
>>>>
>>>> for arbitrary scheme expressions.
>>>>
>>>> Are there procedures that would allow me to determine whether a  
>>>> symbol has a
>>>> binding?  Given scheme identifier can be bound to different  
>>>> values, it seems
>>>> like this would require some sort of runtime environment  
>>>> inspection - is
>>>> that true?
>>>>
>>>> Thanks,
>>>> yc
>>>>
>>>>
>>>
>>>> _________________________________________________
>>>>   For list-related administrative tasks:
>>>>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>>
>>>>
>>>
>>>
>>>
>>>  --
>>>  Jay McCarthy <jay.mccarthy at gmail.com>
>>>  http://jay.teammccarthy.org
>>>
>>>
>>> _________________________________________________
>>>   For list-related administrative tasks:
>>>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>
>>
>>
>>
>>  --
>>  sam th
>>  samth at ccs.neu.edu
>>
>
>
>
> -- 
> Jay McCarthy <jay.mccarthy at gmail.com>
> http://jay.teammccarthy.org
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.