[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Elementary question about backquote in T.
- To: scheme@mit-mc
- Subject: Elementary question about backquote in T.
- From: Sanjai Narain <narain@rand-unix.ARPA>
- Date: Thu ,24 Oct 85 00:59:49 EDT
I hope it is okay to send a T question to this list, since I am not aware
of a separate list for T.
If we define:
(define-macro (bar x) `(list ,(car x)))
then (macro-expand '(bar '(1 2)) *scratch-env*) ==> (list quote). That is, an
attempt to evaluate (bar '(1 2)) will give an error to the effect that
quote is unbound.
This appears to me rather confusing. A macro is ideally a rewrite rule.
So I expect (bar '(1 2)) to be rewritten to the form (list u) where
u = (car '(1 2)) i.e. (list u) must be rewritten to (list 1).
This expectation is supported by the following observations:
> (set x '(1 2))
;; x is bound to '(1 2)
> `(list ,(car x))
==> (list 1)
What am I missing? By the way, Franzlisp backquote behaves similarly.
Thanks for any comments.
-- Sanjai