Hi, On Oct 26, 7:08 am, John Harrop <jharrop...@gmail.com> wrote:
> > (count-nodes "abcde") > > ; 6 > > Yikes. > > Maybe special-casing strings would be best: change (seqable? x) into (and > (seqable? x) (not (string? x))). I don't know if Seqable is synonymous with > that; might there be other seqable?s that aren't Seqables? DOM nodes and > some other Java objects perhaps? Another problematic case might be maps. seq'ing a map gives MapEntries, each with a key and a value. So you also count the MapEntries. Eg. {:a :b :c :d} should give 7 instead of 5. Not tested, though. I'm not sure how MapEntries are handled by sequable? and such. (If they are treated opaque, you should even get 3 instead of 5...) Sincerely Meikel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---