>> cons is acting according to its documentation.
>
> It's list? that isn't.

That's not strictly true:

user=> (doc list?)
-------------------------
clojure.core/list?
([x])
   Returns true if x implements IPersistentList
nil
user=> (cons 5 '(1 2 3))
(5 1 2 3)
user=> (ancestors (type *1))
#{clojure.lang.IMeta java.lang.Iterable java.util.Collection  
clojure.lang.ISeq java.util.List clojure.lang.Seqable clojure.lang.Obj  
clojure.lang.IObj java.lang.Object clojure.lang.Sequential  
clojure.lang.IPersistentCollection clojure.lang.Streamable  
clojure.lang.ASeq}


... the result of cons does not implement IPersistentList, so list? is  
acting according to its documentation.

Is there a reason why you are testing for listiness rather than for  
some other property, like Sequential? It's generally considered good  
form in Clojure to program against the native abstractions (such as  
sequences) rather than particular concrete types.

-R

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to