Browse files

allow facts to be called with empty list

  • Loading branch information...
1 parent 6dc09f2 commit 080b0d63b7e401fc2ac9844aa31ff51e29637dbf Jason Jackson committed Feb 17, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/main/clojure/clojure/core/logic.clj
@@ -1455,6 +1455,7 @@
(def f-sym (partial sym-helper "f"))
(def a-sym (partial sym-helper "a"))
(defn- ->sym [& args]
(symbol (apply str args)))
@@ -1582,7 +1583,9 @@
(defn facts
"Define a series of facts. Takes a vector of vectors where each vector
represents a fact tuple, all with the same number of elements."
- ([rel [f :as tuples]] (facts rel (count f) tuples))
+ ([rel [f :as tuples]]
+ (if (seq tuples)
+ (facts rel (count f) tuples)))
([^Rel rel arity tuples]
(let [rel-ns (:ns (meta rel))
rel-set (var-get (ns-resolve rel-ns (set-sym (.name rel) arity)))

0 comments on commit 080b0d6

Please sign in to comment.