[plt-scheme] Some more syntax-handling fun --- trying to extract all the definitions in an arbitrary file

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Mar 21 09:13:31 EST 2006

At Mon, 20 Mar 2006 16:01:02 -0800 (PST), Danny Yoo wrote:
> I'm studying the reference manual about "Expanding Expressions to
> Primitive Syntax", and was wondering: is EXPAND generally the right tool
> to use to make sure the syntax is top-level-expr form before I start doing
> the preprocessing stuff?  In what contexts might one want to use the other
> expand-* functions?

Use `expand-syntax' if you've already expanded the expression once, so
that it already has a starting lexical context, or if you've explicitly
given a syntax object a starting lexical context.

Use `expand-[syntax-]to-top-form' if you're dealing with non-module
code, and you need to find and flatten `begin's.

Use `expand-once' only for debugging.


Posted on the users mailing list.