SICP 問題 4.61
;; 先頭の2つの隣接関係 (rule (?x next-to ?y in (?x ?y . ?u))) ;; リストのcdrの隣接関係 ;; (1 2 3 4 5)だとvが1,zが(2 3 4 5).2行目で,zに対してもnext-toをやると読める. (rule (?x next-to ?y in (?v . ?z)) (?x next-to ?y in ?z)) ;; 質問 (?x next-to ?y in (1 (2 3) 4)) ;; => (1 next-to (2 3) in (1 (2 3) 4)) (2 3) next-to 4 in (1 (2 3) 4) ;; 質問 (?x next-to 1 in (2 1 3 1)) ;; => (2 next-to 1 in (2 1 3 1)) (3 next-to 1 in (2 1 3 1))