Skip to content

Commit

Permalink
Remove duplicate code #471
Browse files Browse the repository at this point in the history
  • Loading branch information
tonsky committed May 23, 2024
1 parent 61edb9e commit 995f8a2
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/datascript/query.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -556,17 +556,6 @@
(prod-rel (assoc production :tuples []) (empty-rel binding)))]
(update context :rels collapse-rels new-rel)))

(defn substitute-constant [context pattern-el]
(when (free-var? pattern-el)
(when-some [rel (rel-with-attr context pattern-el)]
(when-some [tuple (first (:tuples rel))]
(when (nil? (fnext (:tuples rel)))
(let [idx (get (:attrs rel) pattern-el)]
(#?(:cljs da/aget :clj get) tuple idx)))))))

(defn substitute-constants [context pattern]
(mapv #(or (substitute-constant context %) %) pattern))

;;; RULES

(defn rule? [context clause]
Expand Down

0 comments on commit 995f8a2

Please sign in to comment.