ClojureScript

PersistentArrayMap keys uniqueness

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:

Description

PersistentArrayMap does not check the uniqueness of keys at init.

PersistentHashSet also affected.

cljs.user> (array-map 1 10 2 20 1 100)
{1 10, 2 20, 1 100}

cljs.user> (hash-set 1 1 2 3)
#{1 1 2 3}

Simple (dirty?) workaround - init map by assoc.

(defn array-map
  [& keyvals]
  (apply assoc cljs.core.PersistentArrayMap/EMPTY keyvals))

Activity

Michał Marczyk made changes -
Field Original Value New Value
Assignee Michał Marczyk [ michalmarczyk ]
Michał Marczyk made changes -
Attachment 0001-CLJS-516-make-array-map-work-as-if-by-assoc.patch [ 12236 ]
Michał Marczyk made changes -
Attachment 0001-CLJS-516-make-array-map-work-as-if-by-assoc.patch [ 12236 ]
Michał Marczyk made changes -
David Nolen made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
David Nolen made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: