1.2.0 permalink Arrow_down_16x16
  • (predicate-map rs)
Given a rules-set, return a map of rules keyed by their predicates.
Each value will be a set of rules.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/datalog/rules.clj:152 top

(defn predicate-map
  "Given a rules-set, return a map of rules keyed by their predicates.
   Each value will be a set of rules."
  [rs]
  (let [add-rule (fn [m r]
                   (let [pred (-> r :head literal-predicate)
                         os (get m pred #{})]
                     (assoc m pred (conj os r))))]
    (reduce add-rule {} rs)))
Vars in clojure.contrib.datalog.rules/predicate-map: defn let reduce
Used in 0 other vars

Comments top

No comments for predicate-map. Log in to add a comment.