Does Clojure have an analog of Lisp's MEMBER function?
(member 'a '(c a f e b a b e)) => (A F E B A B E)

(I'm more interested in it's use as a predicate rather than the fact  
that it returns a sublist when true.)

"find" and "contains?" are listed under the Maps section of the data  
structures page (http://clojure.org/data_structures#toc17) so no good  
with lists. I can't think of any other synonyms.

The documentation for "some" suggests this:
(some (fn [elt] (= elt 'a)) '(a b c)) => true
That's pretty verbose, and even the shortcut is kinda long:
(some #(= % 'a) '(a b c)) => true

Although this alternative is alright:
(some #{'a} '(a b c)) => a

Is that the Clojure version of MEMBER?

Aloha,
David Sletten


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