> > So, either: > > > 1. My experiment was wrong, and seq? is not a valid stand-in > > for seq in the above code. > > Right on the first try! :-)
Well, that's something :) > user=> (seq-chunk 2 [1 2 3 4 5]) > ((1 2) (3 4) (5)) > user=> (seq?-chunk 2 [1 2 3 4 5]) > nil > > This is because a vector is not itself a seq, though it is seq-able. > Thus 'seq?' returns false, which 'seq' returns a sequence as long as > the vector is not empty. Sigh, I wish the API docs were more helpful in this case. clojure.core/seq? ([x]) Return true if x implements ISeq It's asking a lot from me to know whether vectors implement ISeq. > > 2. My intuition is wrong, and 'seq? is not more efficient than 'seq. > > Both are usually very fast -- fast enough to not worry about them, and > certainly fast enough that you should use the correct one rather than > the fast one. :-) Yeah, not a bad idea :) Thanks for your help, as always. Gavin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---