Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Map efficiency?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dustin Sallings <dustin@s...>
Subject: Re: [Caml-list] Map efficiency?

On Nov 4, 2003, at 1:39, Christian Lindig wrote:

>> 	Also, is there a particular reason Map is so, um, inaccessible to
>> beginners?  Hashtbl's generic interface is much more inviting than
>> Map's functorial-only interface, especially to those not terribly
>> familiar with the module system.
>
> Map depends on keys to be ordered. This in turn requires to allow for a
> user-defined order: assume sets as keys that are implemented by
> unordered lists. Different lists can represent the same set. Hence, it
> must be possible to provide a user-defined order that would treat those
> lists as equal. The functor argument of Map contains the compare() 
> which
> does just that.

	I'm not suggesting doing away with the functorial interface, just 
providing an additional one that is more accessible.  I mean, something 
like this would be cool (excuse my abuse of syntax):

Map.create ('a -> 'a -> int)

	Then my app would just do this:

Map.create compare;;

-- 
Dustin Sallings

-------------------
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