Re: Testing to see if an object is an element of a sequence

2010-04-13 Thread Chris Jenkins
Thanks guys :-). I didn't know about some and includes?. On 4/13/10, Stuart Halloway 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

Re: Testing to see if an object is an element of a sequence

2010-04-13 Thread Stuart Halloway
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 fu

Re: Testing to see if an object is an element of a sequence

2010-04-13 Thread Meikel Brandmeyer
Hi, On Apr 13, 4:20 pm, Chris Jenkins wrote: > 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 (

Testing to see if an object is an element of a sequence

2010-04-13 Thread Chris Jenkins
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