src/gdl.lisp @ 167ffd6a7a6a

Lisp grounder, work-in-progress
author Steve Losh <steve@stevelosh.com>
date Mon, 26 Sep 2016 12:27:26 +0000
parents (none)
children d21ec254ff4e
(in-package #:scully.gdl)

(defun read-gdl (filename)
  (let ((*package* (find-package :ggp-rules)))
    (with-open-file (stream filename)
      (loop
        :with done = (gensym)
        :for form = (read stream nil done)
        :while (not (eq form done))
        :collect form))))

(defun load-rules (database rules)
  (push-logic-frame-with database
    (mapc (lambda (rule)
            (if (and (consp rule)
                     (eq (car rule) 'ggp-rules::<=))
              (apply #'invoke-rule database (cdr rule))
              (invoke-fact database rule)))
          rules)))