On Apr 10, 12:14 am, Jason Wolfe <jawo...@berkeley.edu> wrote:
...
> Namely, if a map already contains a given key, when you attempt to
> assoc in a version of the key with new metadata this is not recorded.
> It seems that the map always retains the original key:
>...
> Is this desired behavior?  If so, is there a better way to change the
> metadata on a key than first dissoc-ing it out and then assoc-ing it
> back in again with new metadata?

Probably this is expected, since metadata is defined not to affect
equality, and maps rely on equality semantics.  I would recommend
against storing metadata on map keys.  In general, if the metadata
matters for the "value" of an object, then it shouldn't be metadata.

Some alternatives: 1) put the information directly in the map values;
2) store metadata on the map values; 3) use maps as keys.

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