seq returns nil when a collection has no items.  According to the
documentation for empty?, empty? is the same as (not (seq coll)) so you
should use seq for expressing the opposite of empty?

On Tue, Jan 13, 2009 at 3:12 AM, GS <gsincl...@gmail.com> wrote:

>
> On Jan 13, 2:59 pm, Chouser <chou...@gmail.com> wrote:
> >
> > It raises a question, though -- how much functionality should a
> > function provide to be worth making everyone who reads the code learn
> > the new vocabulary?  I've written each of these inline when I've
> > needed them.  Are they better as idioms or functions?
>
> I can't comment on which ones I would use: I'm too new to Clojure for
> that.  But I think a rich utility library is good, so long as it's
> clear from a function's name and parameters what it does.  There are
> only a few in the collection above whose purpose I don't understand;
> for most I see it easily.
>
> One question about the collection:
>
> > (defn chunk "Lazily break s into chunks of length n (or less, for the
> > final chunk)."
> >  [n s]
> >  (when (seq s)
> >    (lazy-cons (take n s)
> >               (chunk n (drop n s)))))
>
> Should that "seq" be "seq?".  If not, why not?
>
> The general question it raises for _me_ is this: why is such a basic,
> useful and generally applicable function like 'chunk not included in
> the core?  Or 'random-element?
>
> Final comment: I think collection parameters should be named "coll",
> not "s", so that the docs are consistent with the core functions.
>
> Gavin
> >
>

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