-
-
Save dotsonjb14/f0b33c969d32be1758705fa0d651b111 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Managing maps | |
(defn alpha-ball-1 [wme-var] | |
(when <alpha-tests-succeed> | |
(when (empty? <ball-map>) | |
(swap! empty-count dec)) | |
(put <ball-map> (:__id wme-var) wme-var) | |
(reset! <cur-ball-map> {(:__id wme-var) wme-var}) | |
(main-fun) | |
(reset! <cur-ball-map> <ball-map>))) | |
(defn alpha-cube-1 [wme-var] | |
(let [hash-val (<hash-fun> wme-var)] | |
(when (empty? <cube-map>) | |
(swap! empty-count dec)) | |
(let [existing (or (.get <cube-map> hash-val) | |
(let [m (make-map)] | |
(.put <cube-map> hash-val m) | |
m))] | |
(.put ^HashMap existing (:__id ^Wme wme-var) wme-var)) | |
(reset! <cur-cube-map> {(:__id wme-var) wme-var}) | |
(main-fun) | |
(reset! <cur-cube-map> <cube-map>))) | |
;; Matching and instantiation | |
(defn op-1 [hash-val result-fun] | |
(doseq [cube (vals (get @?cube-cur-2 hash-val))] | |
(result-fun cube))) | |
(defn upstream-2 [result-fun] | |
(doseq [ball (vals @?ball-cur-1)] | |
(result-fun ball))) | |
(defn upstream-1 [result-fun] | |
(upstream-2 (fn [?ball] | |
(op-1 (:radius ball) | |
(fn [?cube] (result-fun ?ball ?cube)))))) | |
(defn main-fun [] | |
(when (= empty-count-1 0) | |
(upstream-1 (fn [?ball ?cube] | |
(create-instantiation ...))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment