Skip to content

Instantly share code, notes, and snippets.

@yvern
Created January 20, 2023 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yvern/0f8268d3c9be0395ff115b21c4bee603 to your computer and use it in GitHub Desktop.
Save yvern/0f8268d3c9be0395ff115b21c4bee603 to your computer and use it in GitHub Desktop.
(defrule overflow?
[?middle <- :middle]
[:or [?max <- :top] [?max <- :right]]
[:test (<= ($ ?max) ($ ?middle))]
=>
(insert! {:fact-type :overflow!}))
(defrule underflow?
[?middle <- :middle]
[:or [?min <- :bottom] [?min <- :left]]
[:test (<= ($ ?middle) ($ ?min))]
=>
(insert! {:fact-type :underflow!}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment