I have to write scheme with scheme.. quiet funny, but that's the situation. Any way, Here's an example for trying to write "lambda" expression with all the proucedors that I may use,and I need help in writing "Let" expression also. how can I translate the "Let" expression into lambda using similar way? Thanks.
(define (lambda? exp) (tag-check exp 'lambda))
(define (eval exp env)
(cond ((number? exp) exp)
((symbol? exp) (lookup exp env))
((define? exp) (eval-define exp env))
((if? exp) (eval-if exp env))
((lambda? exp) (eval-lambda exp env))
((application? exp) (apply (eval (car exp) env)
(map (lambda (e) (eval e env))
(cdr exp))))
(else (error "unknown expression " exp))))
(define (eval-lambda exp env)
(make-procedure (lambda-parameters exp)
(lambda-body exp)
env))
(define (lambda-parameters exp) (cadr exp))
(define (lambda-body exp) (cddr exp))
(define (make-procedure parameters body env)
(list 'procedure parameters body env))
You just need to write a program which would transform.
And check out SICP chapter 4.