Created
January 20, 2023 18:58
-
-
Save yvern/35705e32442bdb28fb32d9da67332919 to your computer and use it in GitHub Desktop.
This file contains 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
(ns yvern.hard-rule | |
(:require [clara.rules :refer [defrule insert!]])) | |
(def $ (comp val first)) | |
(defrule all-together | |
[?middle <- :middle] | |
[:or | |
[:and [?max <- :top] [?min <- :bottom]] | |
[:and [?min <- :left] [?max <- :right]]] | |
=> | |
(cond | |
(<= ($ ?max) ($ ?middle)) | |
(insert! {:fact-type :overflow}) | |
(<= ($ ?middle) ($ ?min)) | |
(insert! {:fact-type :underflow}))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment