I ran across this behaviour today:

shackles.examples=> (import '[clojure.lang Seqable])
clojure.lang.Seqable
shackles.examples=> (deftype Foo [] Seqable (seq [this] ()))
shackles.examples.Foo
shackles.examples=> (empty? (Foo.))
false
shackles.examples=> (deftype Bar [] Seqable (seq [this] nil))
shackles.examples.Bar
shackles.examples=> (empty? (Bar.))
true
shackles.examples=> (empty? ())
true

Now I understand why this happens - () is truthy but nil is falsey.
This seems related to the difference between next and rest. Is there
an underlying principle here?

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