On Mon, Jul 27, 2009 at 1:49 PM, Sean Devlin<francoisdev...@gmail.com> wrote: > > There have been a few times in this thread that people have tried to > determine if a function was seqable, and used the following code > > (seq? a-collection) > > While this code is great for determining if a-collection is a > sequence, it is sometimes not what people want. Often the following > code is meant to be used: > > (instance? clojure.lang.Seqable a-collection)
I think the only thing that currently extends Seqable is IPersistentCollection, which is testable with 'coll?' > (defn seqable? > "Returns true if (seq x) should work. That is, it tests if x > implements clojure.lang.Seqable" > [x] > (instance? clojure.lang.Seqable x)) Note however that seq works on things that are not IPersistentCollections nor Seqable, like java collections, strings, etc. user=> (filter #(Character/isUpperCase %) "Works For Me") (\W \F \M) user=> (seq (java.util.HashMap. {:a 1, :b 2, :c 3})) (#<Entry :c=3> #<Entry :b=2> #<Entry :a=1>) > PS - Sorry if this isn't the right avenue for feature requests. No worries -- you're going about this exactly the right way. :-) --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---