On 26 November 2012 21:11, Herwig Hochleitner <hhochleit...@gmail.com> wrote: > seq?, sequential? and coll? are the predicates for ISeq, Sequential and > IPersistentCollection, respectively. > > Sequential is just a marker interface which doesn't promise anything but a > defined order of elements. > Since ISeq already is a seq and IPersistentCollection derives from Sequable, > both will succeed in a seq call.
A Seqable isn't necessarily a seq: user=> (seq? []) false user=> (contains? (ancestors (class [])) clojure.lang.Seqable) true > Additionally, seq does some coercion for native types: > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L471 > There is a predicate in contrib to conclusively test whether it will > succeed: > https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L77 > > > 2012/11/26 Sean Corfield <seancorfi...@gmail.com> >> >> A colleague showed me this page recently which seems like a nice quick >> reference: >> >> http://www.brainonfire.net/files/seqs-and-colls/main.html >> >> >> On Mon, Nov 26, 2012 at 6:01 AM, Mark Engelberg <mark.engelb...@gmail.com> >> wrote: >>> >>> I understand that these functions test for different interfaces, but I >>> don't have a clear sense for which things respond differently to these >>> predicates. Has anyone compiled a little table of what things satisfy which >>> predicates? >>> >>> So far, I've figured out that although lists, strings, vectors, and sets >>> all can seq: >>> lists are seq?, sequential? and coll? >>> vectors are not seq?, are sequential? and coll? >>> sets are not seq? and not sequential?, but are coll? >>> strings are not seq?, sequential? or coll? >>> >>> From these examples, it appears that: >>> All seq? are sequential? >>> All sequential? are coll? >>> >>> Is this really true, or have I just not found enough edge cases? >>> >>> Thanks. >>> >>> -- >>> 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 >> >> >> >> >> -- >> Sean A Corfield -- (904) 302-SEAN >> An Architect's View -- http://corfield.org/ >> World Singles, LLC. -- http://worldsingles.com/ >> >> "Perfection is the enemy of the good." >> -- Gustave Flaubert, French realist novelist (1821-1880) >> >> -- >> 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 -- 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