On Jan 23, 6:05 pm, Christian Vest Hansen <karmazi...@gmail.com>
wrote:
> On Fri, Jan 23, 2009 at 11:06 PM, Rich Hickey <richhic...@gmail.com> wrote:
>
> > On Jan 23, 1:47 pm, Christian Vest Hansen <karmazi...@gmail.com>
> > wrote:
> >> I type this expression in the REPL (trunk 1228):
>
> >> user=> (let [s (.keySet {:a 1})] [(set? s) (ifn? s)])
> >> [false false]
>
> >> But I expected it to return [true true].
>
> > Why? keySet is specified to return a java.util.Set, and that is what
> > it does. set? tests for IPersistentSet.
>
> I assumed the persistent properties caried over, and that
> IPersistentSet was a java.util.Set. I also assumed that IPersistentSet
> extended IFn.
>
> Looks like I got the implementation confused with the interfaces and
> was wrong on both accounts.
>
>

Actually most of those things are true, or at least, a Clojure set
implements IFn and java.util.Set. The issue here is that you are
starting with a Clojure *map*, and asking for its keySet. What is
returned is not a Clojure set.

Rich

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

Reply via email to