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-16.html#%_thm_2.59" "Exercise 2.59")
解答例
(define (union-set set1 set2)
(cond ((null? set1) set2)
((null? set2) set1)
((element-of-set? (car set1) set2)
(union-set (cdr set1) set2))
(else (cons (car set1) (union-set (cdr set1) set2)))))
実行例
gosh> (union-set '(0 2 4 6 8 10) '(0 3 6 9 12)) (2 4 8 10 0 3 6 9 12)
コード
##(sicp-answer-code "ex-2.59.scm")