Thanks guys :-). I didn't know about some and includes?.

On 4/13/10, Stuart Halloway <stuart.hallo...@gmail.com> wrote:
> Hi Chris,
>
> includes? is in clojure.contrib.seq. Note that it runs in linear time.
>
> This will feature prominently in the FAQ when I update it. :-)
>
> Stu
>
>> Hi,
>>
>> Is there a standard function to test to see if an object is an
>> element of a sequence? I'm looking for an equivalent of Haskell's
>> elem function.
>>
>> I wrote my own (badly)...
>>
>> (defn elem? [obj l]
>>   (if (empty? l)
>>     false
>>     (if (= obj (first l))
>>       true
>>       (elem? obj (rest l)))))
>>
>> ...but it strikes me that there must be a standard function to do
>> this.
>>
>> Cheers,
>>
>> Chris
>>
>>
>> --
>> 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 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
>
> To unsubscribe, reply using "remove me" as the subject.
>

-- 
Sent from my mobile device

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