享受代码,享受人生

SOA is an integration solution. SOA is message oriented first.
The Key character of SOA is loosely coupled. SOA is enriched
by creating composite apps.
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

SICP 习题1.11

Posted on 2006-05-05 18:00  idior  阅读(1648)  评论(2编辑  收藏  举报


(define (f n)
  (if (< n 3)
         n
        (f-iter 0 1 2 n)))

(define (f-iter a b c count)
        (if (= count 2)
            c
            (f-iter b c (+ c (* 2 b) (* 3 a)) (- count 1))))

(f-iter a b c count)

(f-iter b c (+ c (* 2 b) (* 3 a)) (- count 1))))

a=b b=c c=3a+2b+c

没什么好说的迭代就是比递规强,就是那个count-change的例子比较郁闷,不知道后面是怎么优化的。