On Sunday 21 December 2008 07:51, Mark Volkmann wrote:
> Until this morning I was under the impression that ALL Clojure
> collections are sequences.

Sequences are views of collections (sequential ones, if you can believe 
it!). All collections can be sequenced, but they are not to be equated.


> Now I understand (from the screencast "Clojure Data Structures - Part
> 2") that vectors and maps are not and that you need to call "seq" on
> them to get a sequence representation. What are some situations where
> this is necessary? I'm confused because the following code works.
>
> (def my-map {:a 1 :b 2 :c 3})
> (first my-map) -> [:b 2]
> (rest my-map} -> ([:c 3] [:a 1])

In very many (most? all?) cases, library functions will apply (seq ...) 
as necessary, leaving you able to use sequences or collections 
seemingly interchangeably.


Randall Schulz

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