Skip to content

Instantly share code, notes, and snippets.

@yvern
Created January 20, 2023 19:05
Show Gist options
  • Save yvern/70913708987aef7efd1d99d93826ca74 to your computer and use it in GitHub Desktop.
Save yvern/70913708987aef7efd1d99d93826ca74 to your computer and use it in GitHub Desktop.
(ns yvern.test-rules
(:require [clara.rules :refer [defrule insert!]]
[yvern.defrule :as check]))
(check/defrule
(defrule ok
[:a]
=>
(insert! {:fact-type :b})))
(check/defrule
(defrule also-ok
[:a]
=>
(let [b :b]
(insert! {:fact-type b}))))
(check/defrule
(defrule not-ok
[:a]
=>
(when (< 0.5 (rand))
(insert! {:fact-type :b}))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment