Re: Debugging a custom reader literal for a sorted-set

2013-08-09 Thread Jozef Wagner
This ticket may be related, http://dev.clojure.org/jira/browse/CLJ-1093 On Friday, August 9, 2013 12:08:06 AM UTC+2, Jozef Wagner wrote: > > It may be a bug somewhere in a Compiler. I've lost track at > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6624 > > af

Re: Debugging a custom reader literal for a sorted-set

2013-08-08 Thread Jozef Wagner
It may be a bug somewhere in a Compiler. I've lost track at https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6624 after debugging this: user> (def x `(quote ~(list 1 (clojure.lang.PersistentTreeMap/create (seq [1 2 3 4]) #'user/x user> x (quote (1 #sorted-m

Re: Debugging a custom reader literal for a sorted-set

2013-08-08 Thread David James
I'd really appreciate if others could take a look. I wonder if it may be a Clojure reader bug. On Thu, Aug 8, 2013 at 3:55 PM, Jozef Wagner wrote: > It seems there is something else in data reader which causes this change. > > user=> (class '#foo/sm (1 2 3 4)) > clojure.lang.PersistentArrayMap >

Re: Debugging a custom reader literal for a sorted-set

2013-08-08 Thread Jozef Wagner
It seems there is something else in data reader which causes this change. user=> (class '#foo/sm (1 2 3 4)) clojure.lang.PersistentArrayMap user=> (class (read-string "#foo/sm (1 2 3 4)")) clojure.lang.PersistentTreeMap It's quite puzzling. In both cases the evaluation does not take place, but s

Re: Debugging a custom reader literal for a sorted-set

2013-08-08 Thread David James
That's a good point about: user=> eval (to-sorted-map '(1 2 3 4))) {1 2, 3 4} But this should work, right? user=> (assoc #sorted-map (:a 1 :b 2) :c 3) {:c 3, :a 1, :b 2} ; incorrect -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: Debugging a custom reader literal for a sorted-set

2013-08-08 Thread Jozef Wagner
The problem is the evaluation. PersistentTreeMap evaluates to the PersistentArrayMap (or PersistentHashMap). user=> (class (to-sorted-map '(1 2 3 4))) clojure.lang.PersistentTreeMap user=> (class #sorted-map (1 2 3 4)) clojure.lang.PersistentArrayMap user=> (class #sorted-map (1 2 3 4 5 6 7 8 9 0

Debugging a custom reader literal for a sorted-set

2013-08-08 Thread David James
I am having trouble with an implementation of a custom reader literal called #sorted-set. Please see my short code first: https://github.com/xpe/sorted-map-literal Why does this work correctly: (to-sorted-map '(1 2 3 4)) #sorted-map (1 2 3 4) ; correct While this does not? #sorted-map (1 2 3 4)