On Dec 31, 2010, at 5:53 PM, Mike K wrote:

> OK, I understand the difference in behavior between the two maps.  But
> why is chunked-seq? incorrect?
> 
> Also, Chas Emerick stated in another discussion that ranges always
> produce chunked seqs, but the value of (chunked-seq? (range 100))
> seems to belie that.

I was being a little loose in my description.  Ranges always produce chunked 
seqs via seq:

=> (chunked-seq? (range 10))
false
=> (chunked-seq? (seq (range 10)))
true

`range` returns a lazy seq, which "guards" the chunked seq.  Lazy seqs are 
never chunked themselves (otherwise, "proper" laziness would never be possible) 
but the seqs they provide are always aligned with the chunkiness of whatever 
lies beneath the lazy seq:

=> (chunked-seq? (seq (lazy-seq '(1 2 3))))
false
=> (chunked-seq? (seq (lazy-seq [1 2 3])))
true

- Chas

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