Expanding on what Jim said, you don't usually need to convert the keys of a
map into a set, because the map pretty much acts like a set of its keys if
you use contains?
For example, (contains? {:a 1, :b 2} :a) tests whether :a is among the set
of keys in the map.
I believe that clojure.set's union, intersection, and difference all work
out of the box on maps (acting as if they are sets of keys), but you should
do some testing and/or inspection of the source code to verify this,
especially on maps with nil or false values.
On Mon, Jul 1, 2013 at 12:37 PM, Jim - FooBar(); <[email protected]>wrote:
> On 01/07/13 20:02, Pablo Nussembaum wrote:
>
>> This is pretty strange behavior to me, why is the case that keys
>> function don't return a set like java?
>>
>
> It doesn't need to be, does it?...the map itself ensures that there are no
> duplicate keys anyway. I guess it's one of those 'less is more' cases...
>
> Jim
>
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscribe@**googlegroups.com<clojure%[email protected]>
> For more options, visit this group at
> http://groups.google.com/**group/clojure?hl=en<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+unsubscribe@**googlegroups.com<clojure%[email protected]>
> .
> For more options, visit
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.