It's likely that "keys" returns a seq because you might care about the
order in the case that you call it in a sorted map, and you can always
convert it to a set with "into #{}" or whatever.

What bugs me is that "sorted-set-by" needs "apply" to convert a coll into a
sorted set; there's no short-and-pithy "into" for that case, and no
coll-taking and varargs version pair like vec/vector either. There's also
no "sorted-set-on first [[:a :b :c] [:x :y :z] [:a :c :b]]" (output would
put the two :a-beginning vectors together) either -- you need a comparator.
Some other core sort-related fns have versions taking a key-fn, but none
that constructs a sorted set that I could see with a quick apropos of the
documentation...



On Mon, Jul 1, 2013 at 3:58 PM, Mark Engelberg <mark.engelb...@gmail.com>wrote:

> 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(); <jimpil1...@gmail.com>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 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+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
>> 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%2bunsubscr...@googlegroups.com>
>> .
>> 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 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
> ---
> 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+unsubscr...@googlegroups.com.
> For more options, visit 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 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
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to