Reading the source code of core.clj, I've just realized that list*
isn't like vec at all: the point of list* is to help the apply
function, and that it doesn't even ever return lists: it always
returns Cons objects (if there are two+ arguments), or a sequence (if
there is one argument). The only time it returns lists is if it's
given a single non-empty list argument.

Why, then, does list*'s doc say that it returns lists? Because lists
are a kind of sequence? But sequences aren't a kind of list:
  Clojure 1.1.0-new-SNAPSHOT
  user=> (type (list* 1 [2 3]))
  clojure.lang.Cons
  user=> (list? (list* 1 [2 3])) ; Danger
  false

I'll just go back to using #(apply list %). But this is very weird: if
list* never returns lists (except when given a single non-empty list
argument), why call it list*? And why say in the doc that it returns
lists?

On Jan 22, 10:36 pm, samppi <rbysam...@gmail.com> wrote:
> @DeSeno: list*'s doc does indeed say that the last element will be
> treated as a seq, but the beginning of the same doc definitely says
> that list* returns a list. The doc is:
>
>   Creates a new list containing the items prepended to the rest, the
> last of which will be treated as a sequence.
>
> "The last of which will be treated as a sequence" refers to the items
> that the new list would contain.
>
> It's not a big deal, but the doc definitely doesn't match with what
> (list* ()) currently is.
>
> @MiltondSilva: Hmm...I don't understand how that explains this. It's
> true that lists are a type of sequence in of themselves. But there is
> a list that is empty—the empty list—and it is not equal to nil. I
> think (list* ()) should return ().
>
> (= (list* ()) nil) isn't the end of the world—getting around it was
> very easy—but it is puzzlingly inconsistent, and contradicts list*'s
> docs.
>
> On Jan 22, 2:44 pm, MiltondSilva <shadowtr...@gmail.com> wrote:
>
>
>
> > See this:
>
> >http://groups.google.com/group/clojure/browse_thread/thread/bc938600d...

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