Re: dictionary sort in sortedmap

2013-02-04 Thread AtKaaZ
so, something like this? => (sorted-map-by (fn [key1 key2] (compare (Integer/parseInt key1) (Integer/parseInt key2))) "1" "A" "2" "B" "11" "C" "3" "D") {"1" "A", "2" "B", "3" "D", "11" "C"} On Mon, Feb 4, 2013 at 3:55 PM, Feng Shen wrote: > Hi, "11" < "2" if string, > 11 > 2 if intege

Re: dictionary sort in sortedmap

2013-02-04 Thread Feng Shen
Hi, "11" < "2" if string, 11 > 2 if integer. Your keys are string, convert to integer if need numeric order. On Monday, February 4, 2013 6:37:13 PM UTC+8, Amir Wasim wrote: > > I want to sort a map by its keys according to dictionary when i do the > following > > (into (sorted-map) {"1" "A"

Re: dictionary sort in sortedmap

2013-02-04 Thread Dave Sann
http://clojuredocs.org/clojure_core/clojure.core/sorted-map-by On Monday, 4 February 2013 21:37:13 UTC+11, Amir Wasim wrote: > > I want to sort a map by its keys according to dictionary when i do the > following > > (into (sorted-map) {"1" "A" "2" "B" "11" "C" "3" "D"}) > > the result is > > {

dictionary sort in sortedmap

2013-02-04 Thread Amir Wasim
I want to sort a map by its keys according to dictionary when i do the following (into (sorted-map) {"1" "A" "2" "B" "11" "C" "3" "D"}) the result is {"1" "A", "11" "C", "2" "B", "3" "D"} which is expected result but what i expect is dictionary sort, {"1" "A", "2" "B", 3 "D", "11" "C"}. is