On Thu, Jan 29, 2009 at 5:23 PM, Achim Passen <achim.pas...@gmail.com> wrote:
> Hi!
> Am 29.01.2009 um 23:52 schrieb Mark Volkmann:
>
> I'd like for that to be moved to core so I don't have to load it ...
> which is also verbose for something that is commonly needed.
>
> "includes?" being commonly needed might indicate that people really should
> be using sets instead of lists or vectors in these cases. Sets are the only
> data structures that provide efficient contains?(-value), plus contains?
> works as expected with sets.
> My guess is that the omission of includes? in core is not an oversight after
> all, but an incentive to pick the right data structure for the task at hand.

Embarassingly, I hadn't even considered that option. I'm happy with
the following.

user=> (def s #{"a" "c" "d" "m"})
#'user/s
user=> (contains? s "d")
true
user=> (contains? s "e")
false

You're right. I was using a vector where I should have used a set.

-- 
R. Mark Volkmann
Object Computing, Inc.

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