; ======================================================================
;
; Structure and Interpretation of Computer Programs
; (trial answer to excercises)
;
; 计算机程序的构造和解释(习题试解)
;
; created: code17 02/25/05
; modified:
; (保持内容完整不变前提下,可以任意转载)
; ======================================================================
;; SICP No.1.9
;; 本题为理解题
;; 函数1,根据替换模型,运算过程为
;;
;; (+ 4 5) -------------------.
;; (inc (+ 3 5)) |
;; (inc (inc (+ 2 5))) |
;; (inc (inc (inc (+ 1 5)))) |
;; (inc (inc (inc (inc (+ 0 5))))) |
;; (inc (inc (inc (inc 5)))) |
;; (inc (inc (inc 6))) |
;; (inc (inc 7)) |
;; (inc 8) |
;; 9 <-------------------------'
;;
;; "deferred operations" 显然存在,substitution所引起的expansion和contraction
;; 也显然存在,因此这是一个递归过程(recursive process)
;; 函数2,根据替换模型,运算过程为
;;
;; (+ 4 5) |
;; (+ 3 6) |
;; (+ 2 7) |
;; (+ 1 8) |
;; (+ 0 9) |
;; 9 v
;;
;; 没有"deferred operations"存在,两个参数已经包含有所有的状态信息
;; 因此这是一个迭代过程(iterative process)