For immutable values (including hash-maps containing only immutable
values), I believe the answer is yes, if you are using the same version of
Clojure on the different jvms (at least, I cannot think of any
counterexamples in a few minutes of thinking about it, and I have looked at
the hash function implementations in Clojure in some detail before because
of [1]).  For mutable values (or hash-maps containing mutable values),
there are whatever guarantees Java makes for its .hashCode method.

Most of the hash values computed changed between Clojure 1.5.1 and Clojure
1.6.0 [1] to avoid hash collisions that were common for collections.

There is no guarantee I know of that future versions of Clojure will not
change hash functions again.

These facts prompt me to wonder: Why do you want to know if there is such a
guarantee?  Saving such hash values on disk, for example, will expose you
to possible changes to those values in future versions of Clojure.  Using
them to communicate between different JVMs will limit the application to
running versions of Clojure on those multiple JVMs with the same hash
functions (either the same version of Clojure, or 'hash compatible'
versions of Clojure).

Andy


[1] https://github.com/clojure/clojure/blob/master/changes.md#24-hashing

On Sun, Oct 12, 2014 at 11:04 PM, Sunil S Nandihalli <
sunil.nandiha...@gmail.com> wrote:

> Hi,
> Is the clojure hash function guaranteed to produce the same hash on
> different jvms running on different jvms for the same "data-structure"
> which would satisfy "equality" if checked on a single jvm. The data
> structure is simply a hash-map.
> Thanks,
> Sunil.
>
> --
> 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
> ---
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to