jasongilman / proto-repl

A Clojure Development Environment package for the Atom editor
https://atom.io/packages/proto-repl
MIT License
563 stars 50 forks source link

proto-repl ignores implicit order in priority-map #192

Open carocad opened 7 years ago

carocad commented 7 years ago

When using clojure.data.priority-map, proto-repl ignores the order of the element and always displays them in the same order, regardless of how the structure really is.

(priority-map :a 1 :b 2 :c 3) ;; should show: {:a 1 :b 2 :c 3}
;; instead it shows {:c 3, :b 2, :a 1} 

(str (priority-map :a 1 :b 2 :c 3)) ;; this shows things as they should
;; "([:a 1] [:b 2] [:c 3])"

This is probably due to proto-repl internal interpretation of the sequences in order to prettify them. But I havent check the code ;)

naartjie commented 7 years ago

Same happens with array-map:

(array-map :a 1 :b 2 :c 3)
;; also prints {:c 3, :b 2, :a 1} 

(str (array-map :a 1 :b 2 :c 3))
;; prints "{:a 1, :b 2, :c 3}" 

I'm not sure of the internals of proto-repl, but I remember reading somewhere it's because of the ClojureScript/JS runtime. Planck handles this fine, so I'm wondering if it's worth while how it's implemented there?