On Aug 22, 3:59 pm, "Shawn Hoover" <[EMAIL PROTECTED]> wrote:
> While thinking about drewr's map destructuring question on IRC, I found that
> nth doesn't work on maps. Other group emails state this fact but I can't
> find that it's by design. (doc nth) says it works on sequences. Maps do work
> with seq, first, rest, etc, so it seems like nth should accept maps.
>
There is a difference between a sequential view of a collection (i.e.
what you get from seq) and the collection itself. Maps are not
sequential data structures. nth is only supported for sequential data
structures, and that is by design.
If in some situation it makes sense to treat a map as sequential (it
might make some sense with array maps or sorted maps), just use (seq
m), which will serve as an indicator of that special point of view.
Rich
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---