[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] unquote in environments
From: |
Daishi Kato |
Subject: |
Re: [Chicken-users] unquote in environments |
Date: |
Fri, 07 Dec 2007 00:15:23 +0900 |
User-agent: |
Wanderlust/2.15.5 (Almost Unreal) Emacs/21.4 Mule/5.0 (SAKAKI) |
I see.
Let me ask differently.
#;1> (use environments)
; loading /usr/local/chicken-2.732/lib/chicken/3/environments.so ...
(environment-extend! env 'with-input-from-string with-input-from-string)
#;2> (define env (make-environment))
#;3> (environment-extend! env 'read read)
#;4> (environment-extend! env 'with-input-from-string with-input-from-string)
#;5> (eval '(with-input-from-string "(let ((x 2)) `(1 2 ,x))" read) env)
(let ((x 2)) (quasiquote (1 2 (unquote x))))
How do I expand the quasiquote macro in the environment?
I don't want to extend the environment to have ##sys#list.
Maybe, extending macroexpand?
Thanks.
Daishi
At Thu, 6 Dec 2007 09:24:37 -0500,
John Cowan wrote:
>
> Daishi Kato scripsit:
>
> > Is this an expected behavior? --daishi
> >
> > CHICKEN
> > Version 2.732 - linux-unix-gnu-x86 [ manyargs dload ptables applyhook
> > cross ]
> > (c)2000-2007 Felix L. Winkelmann compiled 2007-12-04 on spirits
> > (Linux)
> >
> > #;1> (use environments)
> > ; loading /usr/local/chicken-2.732/lib/chicken/3/environments.so ...
> > #;2> (define env (make-environment))
> > #;3> (eval '(let ((x 2)) `(1 2 ,x)) env)
> > Error: unbound variable: ##sys#list
>
> Sure. If you create an empty environment and then invoke macros that
> generate calls to functions not in that environment, errors are exactly
> what you should expect. In this case, the macro "quasiquote" generates
> calls to the function "##sys#list":
>
> #;6> (macroexpand '`(1 2 ,x))
> (##sys#list (quote 1) (quote 2) x)
>
> --
> Don't be so humble. You're not that great. John Cowan
> --Golda Meir address@hidden
>
> ******************************
> XREA.COM -Free Web Hosting-
> http://www.xrea.com/
> ******************************