Created
March 24, 2016 13:55
-
-
Save wat-aro/398004a3df4a5d6e26dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (eval exp env) | |
(cond ((self-evaluating? exp) exp) | |
((variable? exp) (lookup-variable-value exp env)) | |
((quoted? exp) (text-of-quotation exp)) | |
((assignment? exp) (eval-assignment exp env)) | |
((definition? exp) (eval-definition exp env)) | |
((if? exp) (eval-if exp env)) | |
((lambda? exp) | |
(make-procedure (lambda-parameters exp) | |
(lambda-body exp) | |
env)) | |
((let? exp) (eval (let->combination exp) env)) | |
((let*? exp) (eval (let*->nested-lets exp) env)) | |
((letrec? exp) (eval (letrec->let exp) env)) ;;letrecを追加 | |
((begin? exp) | |
(eval-sequence (begin-actions exp) env)) | |
((cond? exp) (eval (cond->if exp) env)) | |
((and? exp) (eval (and->if exp) env)) | |
((or? exp) (eval (or->if exp) env)) | |
((application? exp) | |
(my-apply (eval (operator exp) env) | |
(list-of-values (operands exp) env))) | |
(else | |
(error "Unknown expression type --EVAL" exp)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment