One other small thing, you can find out the exact type returned from a
function by calling class.

user=> (class (concat [1 2] [3 4]))
clojure.lang.LazySeq

There are functions that return lazy sequences all over the place, so
keep an eye out ;-).

On Oct 20, 12:56 am, Dmitri <dmitri.sotni...@gmail.com> wrote:
> I notice that certain sequence operations such as concat and cons will
> not retain the original type of sequence, for example if you combine
> two vectors together a list will be returned:
>
> user=> (concat [1 2] [3 4])
> (1 2 3 4)
>
> is this intentional behavior, and would it not be more consistent for
> concat to retain the original type of the data structures, when both
> data structures that were passed in are of the same type. Also, why
> does cons behave differently from conj:
>
> user=> (conj [1 2] 3)
> [1 2 3]
>
> user=> (cons 2  [1 2])
> (2 1 2)
--~--~---------~--~----~------------~-------~--~----~
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