Hello Rich & all!
I am digging into behavior of function 'empty':

user=> (doc empty)
-------------------------
clojure.core/empty
([coll])
  Returns an empty collection of the same category as coll, or nil

(empty [1 2]) => []
(empty (seq [1 2])) => nil

(empty '(1 2)) => ()
(empty (seq '(1 2))) => ()
; ok because of:
(seq '(1 2)) => (1 2)
(class (seq '(1 2))) => clojure.lang.PersistentList
(class '(1 2)) => clojure.lang.PersistentList

One trouble is with nil:
(empty nil) => java.lang.NullPointerException (NO_SOURCE_FILE:0)

Would it make sense to return nil?
(empty nil) => nil

Thank you, Frantisek
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to