Hi Sean,

The background to this lies in the implementation of lazy sequences -
seq returns an implementation of ISeq for the data structure in
question - nil when there are no elements in the structure. Have a
look at http://clojure.org/sequences and also http://clojure.org/lazy
which gives the full reasoning behind this. It clarifies when to use
next and when to use rest (lazy sequences).

-Hth, Adrian.

On Fri, Jan 15, 2010 at 10:26 AM, Sean Devlin <francoisdev...@gmail.com> wrote:
> Hey everyone,
> I was working with seq today, and I was wondering why I got a certain
> result.
>
> user=> (seq [])
> nil
>
> Why is nil returned, instead of an empty sequence?
>
> Sean
>
> --
> 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
>
-- 
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