As Tim McCormack's helpful web page on Collections and Sequences in
Clojure<http://www.brainonfire.net/files/seqs-and-colls/main.html>says,
"Newcomers to Clojure are often confused by the collection and
sequence abstractions and how they relate to one another." I'd been using
collections and sequences successfully, but was confused about terminology
until I read McCormack's explanation. I have a further question:
Is there are term for collections that are not maps?
Although vectors can function like maps, because they are associative?, and
functions like find and get treat indexes as if they were map keys, from
another perspective vectors are just sequences of single elements, not
sequences of key-val pairs. This difference shows up in contexts such as
map :
(map identity [:a :b]) ; ==> (:a :b)
(map identity {1 :a 2 :b}) ; ==> ([1 :a] [2 :b])
Is there a single term that covers vectors, lists, sets, lazy sequences,
cons's, etc., but not maps?
The only reason that this matters to me is for naming functions,
parameters, and docstrings. Sometimes I write a function that will work in
the intended way only with collections that are not maps. (For example,
suppose I write a function that's supposed to operate on vectors, lists,
sets, or lazy sequences of keywords, what do I call its argument?
"keyw-coll" is too broad, and "keyw-seq" is too narrow.)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.