2011/11/1 Sebastián Galkin <paras...@gmail.com>: > On Tuesday, November 1, 2011 9:33:31 PM UTC-2, David Nolen wrote: >> >> (isa? (type '(:foo :bar)) clojure.lang.IPersistentList) => true >> (isa? (type ()) clojure.lang.IPersistentList) => true >> (isa? (type (list)) clojure.lang.IPersistentList) => true > > oh that's right
There's a larger point here that I think David was making. It is important not to rely on the concrete type of anything, but instead to rely on an interface or protocol that it supports. Choose the right abstraction to allow concrete details to be adjusted without breaking your program. The EmptyList class is a perfect example of an implementation detail that we shouldn't rely on. Nobody promises that it will be there in the future. However, Clojure does promise that '(:foo :bar), () and (list) will all return something for which seq?, list?, coll?, and sequential? will return true, and that () and (list) will return something for which empty? will return true. --Chouser -- 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