On 11 March 2010 20:36, Brian Hurt <bhur...@gmail.com> wrote: > On Thu, Mar 11, 2010 at 2:33 PM, Kevin Downey <redc...@gmail.com> wrote: >> seq is not seq? > No- it's just that empty lists are still seqs (seq? returns true). > > The only thing that is wrong here is the doc comment for empty?- it makes > sense (to me at least) that empty lists are seqs, just like non-empty lists > are. Which means that (seq? x) and (not (empty? x)) are not equivalent bits > of code.
There's a slight misunderstanding going on here in that the docs for empty? mention the function called "seq" and not the one called "seq?" (note the lack of a question mark in the former name). Try using (seq x) (watch your spelling!). By the way, (seq x) and (not (empty? x)) are still not completely equivalent, as the former returns an ISeq (potentially nil) and the latter returns true or false; but they are equivalent in a Boolean context and it's more idiomatic to use (seq x). (Well, strictly speaking, most of the time it's unnecessary to use either...) Sincerely, Michał -- 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