On Mon, Dec 20, 2010 at 2:49 AM, Alex Osborne <a...@meshy.org> wrote: > Ken Wesson <kwess...@gmail.com> writes: > >> Ah. So, like the confused situations you get with Java's mutable >> collections. Two lists are equal if they have the same contents in the >> same order -- but then you use one as a key in a hashmap, and then add >> an item to it, and boom! Clojure separates this stuff out because the >> Clojure vector's immutability makes its value stable given its >> identity. Refs and atoms and agents can encapsulate mutable state, but >> their identity (as defined by = and hash) is fixed rather than >> changing with its state. > > Sort of. Identity (in the Clojure model) is not the same concept as > equality. Nor is it reference equality ("identical?"). The overloading > of terminology is somewhat unfortunate. > > "By identity I mean a stable logical entity associated with a series > of different values over time." -- clojure.org/state > > As Laurent mentioned the usual identities in Clojure are reference > objects: vars, atoms, refs and so on. > >> And some objects (keywords and symbols) exist >> to be almost pure identity, used to label other things. > > Symbols and keywords (and database IDs) aren't identities, they're > identifiers (names).
It seems you're using "identity" a little bit oddly here. In ordinary usage, "identity" would indeed be close to synonymous with "identifier"; the way you're using it here is actually closer to the usual comp-sci concept of a "variable": a holder of mutable state, which can be pointed to a succession of different individual states. So part of this is a confusion arising from slightly odd or idiosyncratic terminology. -- 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