Larry Travis <[email protected]> writes:
> user> (source list*)
> (defn list*
> "Creates a new list containing the items prepended to the rest, the
> last of which will be treated as a sequence."
> {:added "1.0"
> :static true}
> ([args] (seq args))
> ([a args] (cons a args))
> ([a b args] (cons a (cons b args)))
> ([a b c args] (cons a (cons b (cons c args))))
> ([a b c d & more]
> (cons a (cons b (cons c (cons d (spread more)))))))
>
> --------------
> What is the function _spread_? It is not in the Clojure API
It's a private function defined in clojure/core.clj directly above
list*.
--8<---------------cut here---------------start------------->8---
(defn spread
{:private true
:static true}
[arglist]
(cond
(nil? arglist) nil
(nil? (next arglist)) (seq (first arglist))
:else (cons (first arglist) (spread (next arglist)))))
--8<---------------cut here---------------end--------------->8---
> and the definition of _list*_ seems to me to be complete without it.
No. It makes
(list* 1 2 3 4 5 [6 7] [8 9]) => (1 2 3 4 5 [6 7] 8 9)
else it would result in (1 2 3 4 5 [6 7] [8 9]), i.e., it implements the
special meaning of list*'s last parameter.
Bye,
Tassilo
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en