Hi all,

I have run into the following two issues over the last few days. I
would appreciate insight/help/advice:


1. How come APersistentMap$KeySet doesn't implement IPersistentSet?

(clojure.set/intersection (keys {2 "two" 4 "four"}) #{2 3})

 java.lang.ClassCastException: clojure.lang.APersistentMap$KeySeq
cannot be cast to clojure.lang.IPersistentSet


So one must:

(clojure.set/intersection (set (keys {2 "two" 4 "four"})) #{2 3})

... which is redundant. Is there a better way?


2. I can't get clojure.set/project to work. All of the following throw
an exception:

(clojure.set/project (keys {2 "two" 4 "four"}) #{2 3})
(clojure.set/project (set (keys {2 "two" 4 "four"})) #{2 3})

Caused by: java.lang.ClassCastException: java.lang.Integer cannot be
cast to java.util.Map

... and this one returns a result that I don't understand:

(clojure.set/project {2 "two" 4 "four"} #{2 3})

#{{}}

So perhaps I have misread what "xrel" is supposed to be, in the docs
for clojure.set/project:

clojure.set/project
([xrel ks])
  Returns a rel of the elements of xrel with only the keys in ks

I understand that one should use select-keys to get the submap for a
given set of keys.
But how come the map's key set is not set that plays well with the
rest of clojure sets?



Help very appreciated.

Albert
-- 
http://albert.rierol.net

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

Reply via email to