From: John Max Skaller <skaller@ozemail.com.au>
To: Francois.Pottier@inria.fr
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Hashtbl iter semantics
Date: Sat, 01 Jun 2002 03:29:11 +1000 [thread overview]
Message-ID: <3CF7B2E7.2030408@ozemail.com.au> (raw)
In-Reply-To: <20020530085315.A24997@pauillac.inria.fr>
Francois Pottier wrote:
>On Thu, May 30, 2002 at 05:01:32AM +1000, John Max Skaller wrote:
>
>>[The replace semantics you describe are unfortunate for me: my unification
>>algorithm keeps a hashtable of variable -> term bindings into which
>>I have to incrementally subtitute while iterating through the table.
>>
>
>Do you need to maintain *several* such substitutions (i.e. tables) with
>the same domain (i.e. the same set of variables)?
>
Don't know. At present, I have a single global table, and the variables
are 'unknowns' rather than
variables: they represent function return types (or components thereof).
So at present,
all the variables must be eliminated, and have a universal value. (and
this is proving
much harder than I thought to get right ..)
However, I am just introducing parametric polymorphism .. in that case
a 'variable'
takes on a new value for each instantiation. On the other hand, the client
will initially have to provide the values explicitly. I will still need
subsumption,
however, to resolve overload ambiguity in favour of the most specialised
matching function.
[Things get really interesting when subtyping is introduced as well ..]
>If not (that is, if
>you only have one hash table), then it is customary to use a mutable
>field, within each variable record, to store the associated term. It's
>simpler and the overhead for access is very small.
>
Yes, I could do that (though it doesn't handle deletion so well .)
>One nice way of doing so is to use a generic union/find algorithm, such
>as the one I am attaching to this message.
>
Thx. I'm using the Robinson algorithm at present: simple, but not efficient.
[And it doesn't match equi-recursive terms correctly .. I can't figure out
a fast way to minimise such a term .. hmmm.. linearise and use a
string matching algorithm ..?]
--
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2002-05-31 17:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-27 19:04 Damien Doligez
2002-05-29 19:01 ` John Max Skaller
2002-05-30 6:53 ` Francois Pottier
2002-05-31 17:29 ` John Max Skaller [this message]
2002-06-03 7:03 ` Francois Pottier
2002-06-03 17:07 ` John Max Skaller
-- strict thread matches above, loose matches on Subject: below --
2002-05-26 15:43 John Max Skaller
2002-05-27 14:38 ` Xavier Leroy
2002-05-27 18:16 ` John Max Skaller
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=3CF7B2E7.2030408@ozemail.com.au \
--to=skaller@ozemail.com.au \
--cc=Francois.Pottier@inria.fr \
--cc=caml-list@inria.fr \
/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