Thanks a lot, Matthew! That works!

On Tue, May 14, 2013 at 8:06 AM, Matthew Flatt <mfl...@cs.utah.edu> wrote:

> Hi Alfred,
>
> See
>
>   http://docs.racket-lang.org/guide/eval.html#(part._namespaces)
>
> Matthew
>
> At Tue, 14 May 2013 07:01:51 -0400, Alfred Zhong wrote:
> > Hi Racket experts,
> >
> > I am reading SICP and trying this piece of code using Racke:
> >
> > (define (definition-value exp)
> >     (if (symbol? (cadr exp))
> >         (caddr exp)
> >           (make-lambda
> >             (cdadr exp) ; formal parameters
> >                (cddr exp)  ; body
> >         )
> >     )
> > )
> >
> > (define (make-lambda parameters body)
> >     (cons 'lambda (cons parameters body))
> > )
> >
> > (  (eval  (definition-value '(define (double x) (+ x x))) ) 10)
> >
> > In REPL, it return 20 with no problem.
> >
> > However, if I put it into a file and use racket command to run it (with
> > #lang scheme in the file)
> >
> > it complains:
> > compile: unbound identifier (and no #%app syntax transformer is bound)
> at:
> > lambda in: (lambda (x) (+ x x))
> >
> > Do you have any idea what happened there? How can I solve this problem?
> >
> > Thanks,
> > Alfred
> > ____________________
> >   Racket Users list:
> >   http://lists.racket-lang.org/users
>
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to