Hi Nicholas!
I think the answer you're looking for is best explained by Michał in this
StackOverflow post:
http://stackoverflow.com/questions/3008411/clojure-seq-cons-vs-list-conj
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this grou
this may help:
http://stackoverflow.com/questions/3008411/clojure-seq-cons-vs-list-conj
--
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 - ple
One of the best ways to learn clojure is to take a look at the minimal and
excellent source code:
http://clojuredocs.org/clojure_core/clojure.core/cons
(def
^{:arglists '([x seq])
:doc "Returns a new seq where x is the first element and seq is
the rest."
:added "1.0"
:static true
Hi Nicholas,
cons returns a Cons type, which is printed like a list.
Clojure> (type (cons 1 []))
clojure.lang.Cons
Many functions that deal with collections generally return seq's, which
also print like lists.
See: http://clojure.org/sequences
Thanks,
Ambrose
On Wed, Nov 9, 2011 at 2:21 AM,
Hello,
I'm a new Closure user and I'm wondering why the 'cons' function
applied on a vector returns a list.
Ex:
user=> (def v1 [:one :two])
#'user/v1
user=> (cons :three v1)
(:three :one :two)
user=>
Thanks for your help,
Regards,
Nicolas
--
You received this message because you are subscribed