一个小时前本来想贴的,怕惹到人生气,所以保存草稿的…
;;CSCI 1901
;;Homework 1
;;Jincheng Yu
;;
;;Problem 2: Taylor series for the value of the mathematical constant e
(define (taylor n)
(define (factor n)
(define (factorial n)
(cond ((= 1 n) 1)
((= 0 n) 1)
(else (* n (factorial (- n 1))))))
(/ 1 (factorial n)))
(define (taylor-helper counter result)
(if (= 0 counter)
(+ result (factor 0))
(taylor-helper (- counter 1) (+ result (factor counter)))
)
)
(taylor-helper n 0)
)
btw, (for SEO purpose) Dean’s list

#1 by 共享登陆站 on February 17, 2009 - 20:58
路过,顶一下。