CS代考程序代写 ;eval: (+ 1 (* 2 3)) => 7

;eval: (+ 1 (* 2 3)) => 7
; eval: + => # ; eval: 1 => 1
; eval: (* 2 3) => 6
; eval: * => # ; eval: 2 => 2
; eval: 3 => 3
; apply: # to 2,3 => 6
; apply: + to 1,6 => 7

(define (double x)(+ x x))

;eval: (double 5) =>10
; eval: double => # ; eval: 5 => 5
; apply: double to 5
; eval: (+ 5 5)
; eval: +
; eval: 5
; eval: 5
; apply: + to 5,5 => 10

;example substitution model
(double 5)
(+ 5 5)
10

;some functions
(define (square x)(* x x))
(define (sos x y)(+ (square x)(square y)))
(define (f a)(sos (+ a 1)(* a 2)))

;substitution model
(f 5)
(sos (+ 5 1)(* 5 2))
(sos 6 10)
(+ (square 6)(square 10))
(+ (* 6 6)(* 10 10))
(+ 36 100)
136

;special form
(define newVar (+ 1 2))