"Jim - FooBar();" <[email protected]> writes:
>>> Yes. A correct version is
>>>
>>> (defn in? [coll e]
>>> (some (partial = e) coll))
>>
>> If just wrapping 'some' I think this is easier to read
>>
>> (defn in? [coll e]
>> (some #{e} coll))
>>
>> thanks for your time :-)
>
> aaaa sorry...you meant to return boolean not the actual element!
No, my variant also returns nil for "e is not in coll", but the
difference is that my version works for nil and false values:
(in? [nil false] nil) => true
(in? [nil false] false) => true
whereas your version with the hash-set returns nil and false in those
cases.
Bye,
Tassilo
--
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