Category : Files from Magazines
Archive   : AIOCT86.ZIP
Filename : INSIDE3.LTG
LISTING 3
;;; Production System. Copyright Raul E. Valdes-Perez, 1986. All Rights Reserved.
;;; USER FUNCTIONS ARE:
;;; (defrule name lhs rhs)
;;; (fact datum)
;;; (data)
;;; (run)
;;; (see-rule rule)
;;;
;;; GLOBAL VARIABLES ARE:
;;; *rules*
;;; *facts*
(defun defrule (name lhs rhs)
(prog (rule)
(setq rule (gensym 'r))
(putprop rule name 'name)
(putprop rule (cdr (assoc 'patterns lhs)) 'patterns)
(putprop rule (cdr (assoc 'assert rhs)) 'assert)
(putprop rule (cdr (assoc 'delete rhs)) 'delete)
(setq *rules* (cons rule *rules*))))
;;; user adds a fact
(defun fact (datum)
(add-fact datum 'user))
(defun add-fact (datum origin)
(prog (fact)
(setq fact (gensym 'f))
(putprop fact datum 'datum)
(putprop fact origin 'origin)
(setq *facts* (cons fact *facts*))))
;;; print data in working memory
(defun data ()
(data2 *facts*))
(defun data2 (f)
(cond ((null f) nil)
(t (pr (get (car f) 'datum))
(data2 (cdr f)))))
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/