Evaluation of Special Forms

; Evaluation of IF special form
(define (m-if ifform env)
  (if (m-eval (cadr ifform) env)
      (m-eval (caddr ifform) env)
      (m-eval (cadddr ifform) env)))

; Evaluation of SET! special form: ; change the value in the environment (define (m-set! form env) (let ((pair (assoc (cadr form) env))) (if pair (set-cdr! pair (m-eval (caddr form) env)) (m-error "Unbound variable " (cadr form))) ) )

; Evaluation of BEGIN special form (define (m-begin statements env lastval) (if (null? statements) lastval (m-begin (cdr statements) env (m-eval (car statements) env)) ) )

Contents    Page-10    Prev    Next    Page+10    Index