From 8deda3d11f478852dc3053ec5889a393e86fe420 Mon Sep 17 00:00:00 2001 From: hellerve Date: Mon, 2 Mar 2020 11:07:07 +0100 Subject: [PATCH] initial installable release --- kanon.janet | 6 +++--- project.janet | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/kanon.janet b/kanon.janet index 09bb612..d93af50 100644 --- a/kanon.janet +++ b/kanon.janet @@ -1,11 +1,11 @@ -(use unify) +(import unify :as u) (defn rand-nth [e] (get e (math/floor (* (math/random) (length e))))) (defn unifications [clause facts context] (if (> (length clause) 0) - (let [bindings (keep |(unify (first clause) $ context) facts)] + (let [bindings (keep |(u/unify (first clause) $ context) facts)] (mapcat |(unifications (slice clause 1) facts $) bindings)) [context])) @@ -20,7 +20,7 @@ (selection-strategy possibilities))) (defn apply-rule [rule facts context] - (let [new-facts (map |(apply-subst context $) (rule :consequent))] + (let [new-facts (map |(u/apply-subst context $) (rule :consequent))] (union new-facts facts))) (defn step [rules facts] diff --git a/project.janet b/project.janet index 082433c..33afd2d 100644 --- a/project.janet +++ b/project.janet @@ -3,7 +3,8 @@ :author "Veit Heller" :license "WTFPL" :url "https://github.com/hellerve/kanon" - :repo "git+https://github.com/hellerve/kanon.git") + :repo "git+https://github.com/hellerve/kanon.git" + :dependencies ["https://github.com/andrewchambers/janet-unify"]) (declare-source :name "kanon"