Re: why fn key doesn't do what I want?

2009-02-16 Thread Emeka
Thanks, Meikel

--~--~-~--~~~---~--~~
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
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
-~--~~~~--~~--~--~---



Re: why fn key doesn't do what I want?

2009-02-14 Thread wubbie

thanks!
sun


On Feb 14, 4:34 pm, Brian Doyle brianpdo...@gmail.com wrote:
 On Sat, Feb 14, 2009 at 2:24 PM, wubbie sunj...@gmail.com wrote:

  Hi,

  a quick question:

  user= (keys {:a 1 :b 2})
  (:a :b)

  But
  user= (key {:a 1})
  java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot
  be cast to java.util.Map$Entry (NO_SOURCE_FILE:0)

  I see defn key in core.clj, though.
  What can be the correct usage of fn key, then?

 Here is the correct usage of fn key:

 1:1 user= (key (first {:a 1}))
 :a

 Key only accepts a map entry and not a Map object.

  thanks in advance,
  -sun


--~--~-~--~~~---~--~~
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
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
-~--~~~~--~~--~--~---