Skip to content
Ryan Brush edited this page Sep 13, 2013 · 28 revisions

Developer documentation is in progress.

Defining rules

Rules are typically defined with defrule, which has this structure:

defrule railroad diagram

A simple rule looks like this:

(defrule free-lunch-with-gizmo
  "Anyone who purchases a gizmo gets a free lunch."
  [Purchase (= item :gizmo)]
  =>
  (insert! (->Promotion :free-lunch-with-gizmo :lunch)))

Where Purchase is a Clojure Record or Java JavaBean containing an item field. If there exists a purchase that matches the :gizmo keyword, a new promotion is inserted into working memory, by simply creating a new Promotion record.

Defining queries

Queries are typically defined with defquery, which has the following structure:

defquery railroad diagram

A sample query looks like this:

(defquery get-promotions
  "Query to find promotions for the purchase."
  []
  [?promotion <- Promotion])

Using the

Developer documentation will be coming here.

For now, refer to the introduction, architecture overview, and clara examples project to see how to use the system.

Additional Resources

Clone this wiki locally