I'll take a whack at it.

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

Because keys and vals are designed to return (lazy) sequences.  More
important, these two functions return those two sequences in the same
order.  The laziness avoids having to incur the overhead of creating
the set structure, though if you want that you can just call (set
(keys map)) as in your example.


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

Yeah, I found the doc confusing as well.  Here's an example:

user> (ns user (:use clojure.set))
nil
user> (project [{1 2, 2 4, 3 6}, {1 3, 2 6}] [1])
#{{1 3} {1 2}}

So project seems to take a collection of maps, and "projects", or
restricts them all on to the values specified in the second argument.

Cheers
Rob

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