This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How can you tell when an identifier is the name of a bound variable?


Richard Frith-Macdonald <richard@brainstorm.co.uk> writes:

> What I need is something like a symbol->bound? procedure so I could write
>  (if (symbol->bound? ',foo)
> 	,foo
> 	(symbol->string ',foo))

Replace `symbol->bound?' with `defined?'.

(There is actually a problem associated with this.  The question is:
In which top-level environment should `defined?' check for the
binding?  You probably want it to check in the environment of the
macro application.  But, as your code is written, it will check in the
environment of the macro definition.  This difference will be
noticeable if the macro definition and the macro application occurs in
different modules.)

/mdj