The rarity about the hash code depend essentially how it is computed.
On a project, the string hash codes have been the 2 first letters.


On 12/21/2012 11:04 PM, Stathis Sideris wrote:
Yes that's exactly what I meant, sorry I think I didn't express it very well. Of course I know about hash collissions, but (maybe mistakenly) I always thought that they happened in relatively rare cases. Interestingly, '() has a hash of 1 which is the same as the hash of integer 1!

On Friday, 21 December 2012 20:10:07 UTC, Nicolas Oury wrote:

    I think the intial post was not about the fact that collision was
    a problem but about the fact that 0 and nil are frequent elements,
    so using
    the same hash (if there is no good reason) would result in many
    useless collisions.

    However, there might be a good reason to have nil and 0 having the
    same hash.
    (nil must probably have a hash equal to '() for example)


    On Fri, Dec 21, 2012 at 9:05 AM, Christian Sperandio
    <[email protected] <javascript:>> wrote:

        I write again my post because the previous was bad written and
        I want to respect the Englis language the more as I can.
        With your question, I'm feeling you think each item has a
        different hash code. But it's wrong. You can meet collisions.
        An hash code is not an id, it's a way to find an element.
        So even if it's weird to have the same hash code for 0 and
        nil, this case is useful because it's shown you a case of
        collisions.


        Le jeudi 20 décembre 2012 19:04:06 UTC+1, Stathis Sideris a
        écrit :

            Hello,

            I noticed the following:

            > (hash 0)
            0
            > (hash nil)
            0

            Which is fair enough I suppose. It seems to have the
            following side-effect though:

            > (hash [1 2 3 0])
            955327
            > (hash [1 2 3 nil])
            955327

            Is that the intended behaviour? I suppose it's OK for two
            things to hash to the same value, but IMHO, it would make
            the hash function more useful to avoid this simple case.
            The implementation seems to check for nil specifically and
            to return 0.

            Thanks,

            Stathis

-- You received this message because you are subscribed to the Google
        Groups "Clojure" group.
        To post to this group, send email to [email protected]
        <javascript:>
        Note that posts from new members are moderated - please be
        patient with your first post.
        To unsubscribe from this group, send email to
        [email protected] <javascript:>
        For more options, visit this group at
        http://groups.google.com/group/clojure?hl=en
        <http://groups.google.com/group/clojure?hl=en>




-- Sent from an IBM Model M, 15 August 1989.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your first post.
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

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
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

Reply via email to