Skip to content

Instantly share code, notes, and snippets.

@datajohnny
Last active Jan 11, 2016
Embed
What would you like to do?
rules endpoint
(ns ruru.endpoint.rules
(:require [compojure.core :refer :all]
[clara.rules :refer :all]
[clara.tools.inspect :refer :all]))
(defrecord Person [name age])
(defrule adult
"Is the person older than 21."
[Person (> 21 age)]
=>
("Is older than 21"))
(defn run-examples
"Rule runner"
[]
(-> (mk-session 'ruru.endpoint.rules)
(insert (->Person "Johnny" 22))
(fire-rules)
(inspect)
(str " Here is the final")))
(defn rules-endpoint [config]
(routes
(GET "/rules" [] (run-examples))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment