[plt-scheme] Re: User data structures and equality
On 4/10/07, Paulo J. Matos <pocm at soton.ac.uk> wrote:
> Hello all,
>
> I want to define a bijective function f: D -> N, where D is a finite
> collection of user data structures which have a known equality
> procedure that given two elements of D know if they are equal or not.
> Implementing this with alists is trivial, however, computing f and
> f^-1 is done in linear time. The 'good' way would be hash-tables but I
> can't since I have no hash-function for the data structures, only the
> equality procedure [there is no obvious ordering between the user
> structures since I don't really know what they are].
>
Agrh, I always forget something... Another way (better) would be to
use a simple vector. Computing f^-1 is constant, f is linear but I'm
still hoping for a better solution.
> Any suggestions?
>
> Cheers,
> --
> Paulo Jorge Matos - pocm at soton.ac.uk
> http://www.personal.soton.ac.uk/pocm
> PhD Student @ ECS
> University of Southampton, UK
>
--
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK