caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Diego Olivier Fernandez Pons <Diego.FERNANDEZ_PONS@etu.upmc.fr>
To: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Cc: diego-olivier.fernandez-pons@cicrp.jussieu.fr, <caml-list@inria.fr>
Subject: Re: [Caml-list] Equality/Hashtable for functions (inline help feature)
Date: Thu, 7 Sep 2006 12:31:57 +0200 (DST)	[thread overview]
Message-ID: <Pine.A41.4.44.0609071220520.1466470-100000@ibm1> (raw)
In-Reply-To: <20060907.091948.56533867.garrigue@math.nagoya-u.ac.jp>

    Bonjour,

> Note that you cannot use hashtables, as the default hash function will
> fail on functions, but you can use an association list with physical
> equality.

I dont understand why the hash function fails on functions. When I call
Hashtbl.hash : 'a -> int with a function I get an integer. Does it mean
the integer could change while the program is running ?

# Hashtbl.hash (fun x -> x + 1);;
- : int = 151020553
# Hashtbl.hash (fun x -> x + 2);;
- : int = 151020609
# Hashtbl.hash (fun x y -> x + y);;
- : int = 151020669

I had in mind a reduction of the search space based on the hash value and
an association list with physical equallity test on the functions that
have the same hash (collisions).

        Diego Olivier


  reply	other threads:[~2006-09-07 10:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-06 13:36 make[1]: warning: Clock skew detected. Your build may be incomplete Mattias Waldau
2006-09-06 15:15 ` [Caml-list] " skaller
2006-09-06 16:01 ` Igor Peshansky
2006-09-06 17:19   ` Mattias Waldau
2006-09-06 17:50     ` Equality/Hashtable for functions (inline help feature) Diego Olivier Fernandez Pons
2006-09-07  0:19       ` [Caml-list] " Jacques Garrigue
2006-09-07 10:31         ` Diego Olivier Fernandez Pons [this message]
2006-09-07  0:23     ` [Caml-list] make[1]: warning: Clock skew detected. Your build may be incomplete Jacques Garrigue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.A41.4.44.0609071220520.1466470-100000@ibm1 \
    --to=diego.fernandez_pons@etu.upmc.fr \
    --cc=caml-list@inria.fr \
    --cc=diego-olivier.fernandez-pons@cicrp.jussieu.fr \
    --cc=garrigue@math.nagoya-u.ac.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).