Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [Caml-list] possible to define a type where = is forbidden ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-10-12 (17:53)
From: Thomas Fischbacher <Thomas.Fischbacher@P...>
Subject: Re: [Caml-list] EQ hash tables?

On Wed, 12 Oct 2005, Xavier Leroy wrote:

> Alternatively, you can always put
> unique integers in the data type used as key.

Suppose I define:

type network = Links of network array

and now, I set out to construct a wildly linked such network, which may 
indeed have the property that it "looks the same" from different places. 

Let us assume, for example, that entities of type network represent 
elements of a discrete group that is spawned by two generators, and 
the entries in Links [|a,b,a_inv,b_inv|] are the elements that are reached 
by left-application of the group generators A, B, or their inverses.

How would one write a function that counts the sites in such a network? 
With proper EQ hash tables, it's quite easy.

regards,                   (o_
 Thomas Fischbacher -  //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y)           V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1))                  (Debian GNU)