function | since v1.9.456 | Edit |
(PersistentArrayMap.createAsIfByAssoc init)
(set! (.-createAsIfByAssoc PersistentArrayMap)
(fn [init]
;; check trailing element
(let [len (alength init)
has-trailing? (== 1 (bit-and len 1))]
(if-not (or has-trailing? (pam-dupes? init))
(PersistentArrayMap. nil (/ len 2) init nil)
(.createAsIfByAssocComplexPath PersistentArrayMap init has-trailing?)))))