saito wrote:
> In R6RS, I want to branch by existence of identifier
> definition.
It may be that I am not understanding what you really want,
in this case sorry. I assume that you want a predicate for
expand time that would allow you to define a macro like this:
(define-syntax if-bound
(lambda (stx)
(syntax-case stx ()
((_ ?id)
(if (is-it-bound? #'?id)
#'(do-something)
#'(do-something-else))))))
(let ((a 1))
(if-bound a) ==expands to==> (do-something)
(if-bound b) ==expands to==> (do-something-else)
)
I do not think that it is possible to write such a
IS-IT-BOUND? predicate in R6RS.
So:
* Notice that an empty BEGIN form is not valid in all the
contexts; if you want a no-operation form use: (values).
* Your macro is built around FREE-IDENTIFIER=?;
unfortunately it does not work the way you expect. This
predicate answers this question: if we take two
identifiers and put them in the output form of a macro
expansion, will they resolve to the same binding?
I hope that reading [1] can help you clear your mind; it
is just the R6RS document with a bit more examples.
[1] <
http://marcomaggi.github.com/docs/nausicaa.html/stdlib-syntax_002dcase-identifier.html>
HTH
--
Marco Maggi