On Tue, Apr 6, 2010 at 07:16, Alex Osborne <a...@meshy.org> wrote:
> Mark Engelberg <mark.engelb...@gmail.com> writes:
>
>> filter works just as well with a function that returns true and false,
>> so that's not a particularly good example.
>
> Calling the set as if it is a fn is a short-hand for "get", that is
> retrieving an element from the set. Why would you want to do this, when
> to look it up you need to know what element is?

Since you asked: canonicalization. I've wanted this on occasion (in
Java) when canonicalizing (i.e. interning) values. The obvious
alternative is to use a map where each such value maps to itself. This
is no real bother. So, I'm happy that Clojure sets behave as they do.
Being able to use a set as a predicate directly is very handy.

// ben

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