How about this? Needlessly wordy to make it more search-able... clojure.core/count ([coll]) Returns the length of a list or vector, the number of keys in a map, the size of a string, or the number of items in a sequence or collection. (count nil) returns 0. Also works on Java Collections and Maps.
Rich Hickey wrote: > > On Jan 28, 2:19 pm, Chouser <chou...@gmail.com> wrote: > >> On Wed, Jan 28, 2009 at 2:15 PM, Peter Wolf <opus...@gmail.com> wrote: >> >> >>> How do I get the length of a sequence? Is there some generic way to >>> find the number of elements in something that might be list, map, vector >>> or lazy? >>> >> user=> (doc count) >> ------------------------- >> clojure.core/count >> ([coll]) >> Returns the number of items in the collection. (count nil) returns >> 0. Also works on strings, arrays, and Java Collections and Maps >> >> Note how the name and docs both cleverly avoid use of the words "size" >> or "length", to help the function remain undiscovered by searches >> through the source code and by uses of find-doc. >> >> > > Patch welcome for this - could mention it returns the length of > strings and arrays and the size of Java collections. > > Rich > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---