Chat (Lingr.com)
Informaiton
Daily
Column
- MySQL日本語の旅(5/1)
- アクセス向上秘伝(5/9)
- 一風変ったHaskellλ門(6/13)
- SICP Answer Book (5/31) 問題3.26追加
Zope Solution
Extra
アーカイブ
OSS案内所
Site Info
関連リンク
##(link2sicp "book-Z-H-20.html#%_thm_3.1" "Exercise 3.1")
解答例
(define (make-accumulator init-value)
(let ((sum init-value))
(lambda (val)
(set! sum (+ sum val))
sum)))
実行例
Gauche-0.8.5 を使う
gosh> (define A (make-accumulator 5)) A gosh> (A 10) 15 gosh> (A 10) 25
--hidenao
コード
##(sicp-answer-code "ex-3.1.scm")