<div dir="ltr">Thanks a lot, Matthew! That works!</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 14, 2013 at 8:06 AM, Matthew Flatt <span dir="ltr"><<a href="mailto:mflatt@cs.utah.edu" target="_blank">mflatt@cs.utah.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Alfred,<br>
<br>
See<br>
<br>
<a href="http://docs.racket-lang.org/guide/eval.html#(part._namespaces)" target="_blank">http://docs.racket-lang.org/guide/eval.html#(part._namespaces)</a><br>
<br>
Matthew<br>
<div><div class="h5"><br>
At Tue, 14 May 2013 07:01:51 -0400, Alfred Zhong wrote:<br>
> Hi Racket experts,<br>
><br>
> I am reading SICP and trying this piece of code using Racke:<br>
><br>
> (define (definition-value exp)<br>
> (if (symbol? (cadr exp))<br>
> (caddr exp)<br>
> (make-lambda<br>
> (cdadr exp) ; formal parameters<br>
> (cddr exp) ; body<br>
> )<br>
> )<br>
> )<br>
><br>
> (define (make-lambda parameters body)<br>
> (cons 'lambda (cons parameters body))<br>
> )<br>
><br>
> ( (eval (definition-value '(define (double x) (+ x x))) ) 10)<br>
><br>
> In REPL, it return 20 with no problem.<br>
><br>
> However, if I put it into a file and use racket command to run it (with<br>
> #lang scheme in the file)<br>
><br>
> it complains:<br>
> compile: unbound identifier (and no #%app syntax transformer is bound) at:<br>
> lambda in: (lambda (x) (+ x x))<br>
><br>
> Do you have any idea what happened there? How can I solve this problem?<br>
><br>
> Thanks,<br>
> Alfred<br>
</div></div>> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</blockquote></div><br></div>