正在加载图片...
1. Arithmetic calculator 6 (define (eval exp) 8 ((number? exp) exp) ((sum? exp (eval-sum exp)) 10 (el (error unknown expression exp)))) 12 13(define (eval exp) (+(eval (cadr exp))(eval (caddr exp)))) 16 17(eva1'(p1us*24(p1us*56)))1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1. Arithmetic calculator (define (tag-check e sym) (and (pair? e) (eq? (car e) sym))) (define (sum? e) (tag-check e 'plus*)) (define (eval exp) (cond ((number? exp) exp) ((sum? exp) (eval-sum exp)) (else (error "unknown expression " exp)))) (define (eval-sum exp) (+ (eval (cadr exp)) (eval (caddr exp)))) (eval '(plus* 24 (plus* 5 6)))
向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有