41 lines
952 B
Scheme
41 lines
952 B
Scheme
|
(load "util.scm")
|
||
|
(load "misc/sicp-query.scm")
|
||
|
|
||
|
(initialize-data-base microshaft-data-base)
|
||
|
|
||
|
(display "\nex-4.61 - next-to\n")
|
||
|
|
||
|
(eval-query '(append-to-form x y z))
|
||
|
(eval-query '(rule (append-to-form () ?y ?y)))
|
||
|
(eval-query
|
||
|
'(rule (append-to-form (?u . ?v) ?y (?u . ?z))
|
||
|
(append-to-form ?v ?y ?z)))
|
||
|
|
||
|
(eval-query '(append-to-form (a b) (c d) ?z)) (newline)
|
||
|
; (eval-query '(append-to-form (a b) ?y (a b c d))) (newline)
|
||
|
; (eval-query '(append-to-form ?x ?y (a b c d))) (newline)
|
||
|
|
||
|
(eval-query '(rule (?x next-to ?y in (?x ?y . ?u))))
|
||
|
|
||
|
(eval-query
|
||
|
'(rule (?x next-to ?y in (?v . ?z))
|
||
|
(?x next-to ?y in ?z)))
|
||
|
|
||
|
; (eval-query '(?x next-to ?y in (1 (2 3) 4))) (newline)
|
||
|
; (1 next-to (2 3))
|
||
|
; ((2 3) next-to 4)
|
||
|
|
||
|
; (eval-query '(?x next-to 1 in (2 1 3 1))) (newline)
|
||
|
; (2 next-to 1)
|
||
|
; (3 next-to 1)
|
||
|
|
||
|
(display "[answered]\n")
|
||
|
|
||
|
(display "\nex-4.62 - last-pair\n")
|
||
|
|
||
|
(display "\nex-4.63\n")
|
||
|
|
||
|
;(display "\nex-4.64\n")
|
||
|
;(display "\nex-4.65\n")
|
||
|
|