Skip to main content

ClojureHash

Trait ClojureHash 

Source
pub trait ClojureHash {
    // Required method
    fn clojure_hash(&self) -> u32;
}
Expand description

Clojure-compatible hashing.

Clojure uses a specific hash algorithm (based on Murmur3) so that:

  • (hash 1) == (hash 1N) (Long and BigInt with the same value)
  • (hash 1.0) == (hash 1) when the double is a whole number
  • String hashing matches the JVM String.hashCode() algorithm

We implement a simplified but compatible version here. Phase 5 can refine this to byte-exact JVM compatibility if needed.

Required Methods§

Source

fn clojure_hash(&self) -> u32

Implementors§