Name the subterm-handling instructions something not completely stupid
The `unify-*` instructions in the original WAM are used both in both program
mode and query mode. In program mode, they are used to unify subterms of
arguments with things. In query mode, they are used to write the subterms of
the arguments into the head.
You may have noticed the common word in both of these descriptions is "subterm"
and not "unify". Let's use that word to name the instructions so it's less
confusing.
author |
Steve Losh <steve@stevelosh.com> |
date |
Sun, 10 Jul 2016 14:28:48 +0000 |
parents |
2415dbe555d2 |
children |
4d17e3cb6fa2 |
(defpackage #:bones.utils
(:use
#:cl
#:defstar
#:cl-arrows
#:bones.quickutils)
(:export
#:repeat
#:hex
#:push-if-new
#:recursively
#:recur
#:when-let
#:unique-items
#:dis
#:gethash-or-init
#:make-queue
#:enqueue
#:dequeue
#:queue-contents
#:queue-empty-p
#:queue-append)
(:shadowing-import-from #:cl-arrows
#:->))
(defpackage #:bones.circle
(:use #:cl #:defstar)
(:export
#:make-circle-with
#:make-empty-circle
#:circle-to-list
#:circle-prepend
#:circle-prepend-circle
#:circle-append
#:circle-append-circle
#:circle-next
#:circle-prev
#:circle-forward
#:circle-backward
#:circle-value
#:circle-rotate
#:circle-nth
#:circle-insert-before
#:circle-insert-after
#:circle-sentinel-p
#:circle-empty-p
#:circle-remove
#:circle-backward-remove
#:circle-forward-remove
#:circle-replace
#:circle-backward-replace
#:circle-forward-replace
#:circle-splice
#:circle-backward-splice
#:circle-forward-splice
#:circle-insert-beginning
#:circle-insert-end))
(defpackage #:bones.wam
(:use
#:cl
#:defstar
#:optima
#:cl-arrows
#:bones.circle
#:bones.quickutils
#:bones.utils)
(:export
#:make-database
#:with-database
#:with-fresh-database
#:invoke-rule
#:invoke-fact
#:invoke-facts
#:rule
#:fact
#:facts
#:push-logic-frame
#:pop-logic-frame
#:finalize-logic-frame
#:push-logic-frame-with
#:invoke-query
#:invoke-query-all
#:invoke-query-map
#:invoke-query-do
#:invoke-query-find
#:invoke-prove
#:query
#:query-all
#:query-map
#:query-do
#:query-find
#:prove
#:call
#:?
#:!
)
(:import-from #:optima
#:match)
(:shadowing-import-from #:cl-arrows
#:->))
(defpackage #:bones.paip
(:use
#:cl
#:defstar
#:bones.quickutils)
(:documentation "Test?")
(:export
;; Unification, constants
#:unify
#:fail
#:no-bindings
#:*check-occurs*
;; Destructive unification
#:unify!
#:unbound
#:bound-p
;; Database management
#:clear-db
#:clear-predicate
#:fact
#:rule
#:add-fact
#:rule-fact
;; Lisp data structures as results
#:return-one
#:return-all
;; Interactive queries
#:query
#:query-one
#:query-all))
(defpackage #:bones
(:use #:cl #:bones.wam)
(:export
#:make-database
#:with-database
#:with-fresh-database
#:invoke-rule
#:invoke-fact
#:invoke-facts
#:rule
#:fact
#:facts
#:push-logic-frame
#:pop-logic-frame
#:finalize-logic-frame
#:push-logic-frame-with
#:invoke-query
#:invoke-query-all
#:invoke-query-map
#:invoke-query-do
#:invoke-query-find
#:invoke-prove
#:query
#:query-all
#:query-map
#:query-do
#:query-find
#:prove
#:call
#:?
#:!
))