mirror of
https://github.com/PDP-10/its.git
synced 2026-02-14 20:06:27 +00:00
Update Mini Prolog to handle lists.
This commit is contained in:
committed by
Lars Brinkhoff
parent
d45189f2c6
commit
1b691a8019
@@ -81,6 +81,12 @@
|
||||
(rename-variables (rest term)
|
||||
list-of-level)))))
|
||||
|
||||
(defun resolve (x e)
|
||||
(cond ((atom x) x)
|
||||
((variable-p x) (resolve (value x e) e))
|
||||
(t (cons (resolve (car x) e)
|
||||
(resolve (cdr x) e))))))
|
||||
|
||||
(defun print-bindings (environment-left environment)
|
||||
(cond ((rest environment-left)
|
||||
(cond ((zerop
|
||||
@@ -88,8 +94,8 @@
|
||||
(print
|
||||
(second (first (first environment-left))))
|
||||
(princ " = ")
|
||||
(prin1 (value (first (first environment-left))
|
||||
environment))))
|
||||
(prin1 (resolve (first (first environment-left))
|
||||
environment))))
|
||||
(print-bindings (rest environment-left) environment))))
|
||||
|
||||
;; a sample database:
|
||||
|
||||
Reference in New Issue
Block a user