Hi,

A sequence may be (and commonly is) lazy.
Sequences on collections, strings, arrays are not lazy. Nor are those built
with cons.
Some sequences even have a fast (O(1)) count (eg lists, sequences on
strings...)
However you sould assume the worst case which is a traversal of the whole
sequences -- plus if the sequence is lazy (and not yet realized) the
traversal will cause its realization.

hth,

Christophe


On Fri, Nov 2, 2012 at 1:34 PM, Satoru Logic <satorulo...@gmail.com> wrote:

> Hi, all.
>
> I read the following description of `sequence` in the book <Clojure
> Programming>:
>
>   * Obtaining the length of a seq carries a cost.
>   * The contents of sequences may be computed lazily  and actually
> realized only when the value involved are accessed.
>
> So a sequence is something lazy, right?
>
> I take it that if we don't do something like `(count a-seq)`, contents of
> `a-seq` would not get realized.
>
> Then if `seq` is already "lazy", what does `lazy-seq` mean?
>
> --
> 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




-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.cgrand.net/ (en)

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