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

Reply via email to