Skip to content

Commit

Permalink
- fix tuple-key-fn to return array in CLJ
Browse files Browse the repository at this point in the history
- revert 2 of the aget -> get CLJ conditionals; the rest appear to be necessary due to use of string keys
  • Loading branch information
benfleis committed May 20, 2015
1 parent 858225d commit 6d30234
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/datascript/query.cljc
Expand Up @@ -338,7 +338,7 @@
(let [getters (to-array getters)]
(fn [tuple]
(list* #?(:cljs (.map getters #(% tuple))
:clj (map #(% tuple) getters)))))))
:clj (dc/into-arr (map #(% tuple) getters))))))))

(defn hash-attrs [key-fn tuples]
(loop [tuples tuples
Expand Down Expand Up @@ -430,7 +430,7 @@
(defn- context-resolve-val [context sym]
(when-let [rel (some #(when (contains? (:attrs %) sym) %) (:rels context))]
(when-let [tuple (first (:tuples rel))]
(#?(:cljs aget :clj get) tuple ((:attrs rel) sym)))))
(aget tuple ((:attrs rel) sym)))))

(defn- rel-contains-attrs? [rel attrs]
(not (empty? (set/intersection (set attrs) (set (keys (:attrs rel)))))))
Expand Down Expand Up @@ -655,7 +655,7 @@
t2 (:tuples rel)]
(let [res (aclone t1)]
(dotimes [i len]
(when-let [idx (#?(:cljs aget :clj get) copy-map i)]
(when-let [idx (aget copy-map i)]
(aset res i (#?(:cljs aget :clj get) t2 idx))))
res))
(next rels)
Expand Down

0 comments on commit 6d30234

Please sign in to comment.