> (depth-first *blocks-graph* '((b on c) (a on b) (c on table)) '((a on table) (b on c) (c on a))) nilこのようになって,パスがないという答えが返ってくる. それは当然であり,状態が同じかどうかを判定する ところでこの状態表現へ対応していないからである. そこで,ここでグラフの頂点の比較はリスト表現された ものの集合であるということから,集合が等しいかどうかを判定する 関数set=を使って,二つのノード状態が等しいかどうかを 判定する基本関数を以下のように,
(defun node-equal (a b) (set= a b))と定義する.ただし,今の場合,この集合の要素を比較する 関数はeqではだめで,equalでなければならない. このようにすれば,
> (depth-first *blocks-graph* '((b on c) (a on b) (c on table)) '((a on table) (b on c) (c on a))) (((b on c) (a on b) (c on table)) ((a on table) (b on c) (c on table)) ((a on table) (b on table) (c on table)) ((a on table) (b on table) (c on b)) ((a on table) (b on table) (c on a)) ((a on table) (b on c) (c on a)))という結果になり,無事探索が成功する. このように,問題空間の表現をシンボル,リスト, 集合で表すことが可能であるが,それぞれにおいて 状態が同じかどうかを判定する手続きnode-equalを 定義しなおせば同じ探索手続きを用いることが できる.