Sorry, it's my mistake. Because treep map use the comparator to compare keys, and if the comparator returns 1 constantly,it can not find the item that equals the key.
So i can modified the example,and it works: user=> (sorted-map-by #(if (= %1 %2) 0 1) :b 1 :a 2) {:b 1, :a 2} user=> (:a (sorted-map-by #(if (= %1 %2) 0 1) :b 1 :a 2)) 2 user=> (:b (sorted-map-by #(if (= %1 %2) 0 1) :b 1 :a 2)) 1 2013/6/6 dennis zhuang <killme2...@gmail.com> > user=> (sorted-map-by (constantly 1) :b 1 :a 2) > {:b 1, :a 2} > user=> (:a (sorted-map-by (constantly 1) :b 1 :a 2)) > nil > user=> (keys (sorted-map-by (constantly 1) :b 1 :a 2)) > (:b :a) > user=> (count (sorted-map-by (constantly 1) :b 1 :a 2)) > 2 > user=> (:a (sorted-map-by (constantly 1) :b 1 :a 2)) > nil > > It looks so strange.The result map has keys :a and :b,but i can't get > their values. > Why? I try to hack the code,but i can't find the reason. > > > -- > 庄晓丹 > Email: killme2...@gmail.com xzhu...@avos.com > Site: http://fnil.net > Twitter: @killme2008 > > > -- 庄晓丹 Email: killme2...@gmail.com xzhu...@avos.com Site: http://fnil.net Twitter: @killme2008 -- -- 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.