[r6rs-discuss] bound identifier predicate
Derick Eddington
derick.eddington at gmail.com
Mon Jun 22 05:35:06 EDT 2009
On Mon, 2009-06-22 at 12:45 +1000, Ramana Kumar wrote:
> Derick are there any flaws in this simplification of your (and Aziz's) idea?
(The tricks are Aziz's. I only fixed a bug in them by combining them.)
> (library (some suitable name)
> (export free-identifier-bound?)
> (import (rnrs) (rnrs eval))
> (define free-identifier-bound?
> (let ((empty-ctxt (eval '(syntax id) (environment '(only (rnrs) syntax)))))
> (lambda (id)
> (unless (identifier? id)
> (assertion-violation 'free-identifier-bound? "not an identifier" id))
> (or (free-identifier=? id #'syntax)
> (not (free-identifier=? id
> (datum->syntax empty-ctxt
> (syntax->datum id)))))))))
That's broken because:
(import (rename (rnrs) (syntax rnrs:syntax)))
(free-identifier-bound? (rnrs:syntax syntax))
=> #T
but `syntax' is not bound.
The eval approach could be made to work by following the predicate I
posted. It would buy needing to specially handle a few less identifiers
and not needing the tiny auxiliary libraries. Some people might not
like using eval when libraries can do it.
--
: Derick
----------------------------------------------------------------
More information about the r6rs-discuss
mailing list