On Jun 26, 2009, at 11:09 AM, samppi wrote:

I'm considering changing rep+'s documentation to state that it will
return a "collection" rather than a "vector", and then just use cons
without vec.

You might also consider describing it as a "seq". If you use "cons", the object returned will be of type "clojure.lang.Cons" which extends clojure.lang.ASeq. It would be correct to call it either a collection or a seq, but I consider calling it a seq more idiomatic in Clojure.

  user=> (def c (cons 1 [2 3 4]))
  #'user/c
  user=> (class c)
  clojure.lang.Cons
  user=> (coll? c)
  true
  user=> (seq? c)
  true
  user=> (pprint (ancestors (class c)))
  #{java.util.List clojure.lang.IPersistentCollection clojure.lang.Obj
    java.util.Collection clojure.lang.Seqable clojure.lang.IMeta
    clojure.lang.ASeq java.lang.Object clojure.lang.Streamable
    java.lang.Iterable clojure.lang.IObj clojure.lang.Sequential
    clojure.lang.ISeq}
  nil

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to