Next: 16.4 巾集合(power set)
Up: 16 集合
Previous: 16.2 集合の包含関係
集合が等しいかどうかを調べる関数set=を作ることを
考える.集合が等しいということは,二つの集合が
互いに部分集合であるということになるので,
部分集合かどうかを調べる関数subsetpにより
set=を作ることにする.
(defun set= (a b)
(and (subsetp a b) (subsetp b a)))
という具合に定義でき,
(set= '(a b c) '(b c a))
t
(set= '(a b c) '(b c a d))
nil
(set= '((a) (b) (c)) '((b) (c) (a)))
t
という具合になる.
generated through LaTeX2HTML. M.Inaba 平成18年5月7日