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 <shen...@gmail.com> wrote:

> 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" "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 there something in clojure or i just go with
>> java Collator ....
>>
>> thanks
>>
>>
>>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate it.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to