Skip to content

Commit

Permalink
AbstractMap to handle cons with java Map correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
kachayev committed Mar 31, 2018
1 parent f1a13fd commit 1538d40
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/potemkin/collections.clj
Expand Up @@ -66,8 +66,14 @@
(= x (into {} this))))

(cons [this o]
(if (map? o)
(cond
(map? o)
(reduce #(apply assoc %1 %2) this o)

(instance? java.util.Map o)
(reduce #(apply assoc %1 %2) this (into {} o))

:else
(if-let [[k v] (seq o)]
(assoc this k v)
this)))
Expand Down

0 comments on commit 1538d40

Please sign in to comment.