0.8.4-SNAPSHOT Arrow_down_16x16
  • (-run opts [x :as bindings] & goals)

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/core/logic.clj:1177 top

(defmacro -run [opts [x :as bindings] & goals]
  (if (> (count bindings) 1)
    (let [[rbindings as-key [as]] (partition-by #{:as} bindings)]
      (if (seq as-key)
        `(-run ~opts [~as] (fresh [~@rbindings] (== ~as [~@rbindings]) ~@goals))
        `(-run ~opts [q#] (fresh ~bindings (== q# ~bindings) ~@goals))))
    `(let [opts# ~opts
           xs# (take* (fn []
                        ((fresh [~x]
                           (reifyg ~x))
                         (tabled-s (:occurs-check opts#)
                            (merge {:reify-vars true} opts#)))))]
       (if-let [n# (:n opts#)]
         (take n# xs#)
Vars in clojure.core.logic/-run:
Used in 0 other vars

Comments top

No comments for -run. Log in to add a comment.