; ======================================================================
;
; Structure and Interpretation of Computer Programs
; (trial answer to excercises)
;
; 计算机程序的构造和解释(习题试解)
;
; created: code17 03/06/05
; modified:
; (保持内容完整不变前提下,可以任意转载)
; ======================================================================
;; SICP No.1.38
(define (e k)
(define (n i) 1.0)
(define (d i) (if (= (remainder i 3) 2)
(* 2 (/ (+ i 1) 3))
1))
(+ (cont-frac n d k) 2))
;; Test-it;;
;; Welcome to MzScheme version 209, Copyright (c) 2004 PLT Scheme, Inc.
;; > (e 3)
;; 2.75
;; > (e 10)
;; 2.7182817182817183
;; > (e 100)
;; 2.7182818284590455
;; >
本文地址:http://com.8s8s.com/it/it23023.htm