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))
The empty list () is an object, and objects are truthy.
`seq` on any empty collection is defined to return nil. So your definition:
(deftype Foo [] Seqable (seq [this] ()))
should return nil instead of the empty list.
`(next x)` is equivalent to `(seq (rest x))`
-S
--
You received