From: Nicolas C. <war...@fr...> - 2005-06-07 07:23:04
|
> If you want to provide a generic point-wise binary combinator for maps, > the type should be something like: > > (key -> 'a option -> 'b option -> 'c option) -> > 'a t -> 'b t -> 'c t > > The first argument is never called with two None arguments, and > you might prefer to use exception to signal elements to remove, instead > of a None result, so another type could be: > > (key -> 'a -> 'c) -> (key -> 'a -> 'b -> 'c) -> (key -> 'b -> 'c) -> > 'a -> 'b t -> 'c t > > > In my experience, having such a generic point-wise combinator on > map-like structures is really useful. Maybe you also want special cases > (as a convenience for the user but also to optimize the implementation), > but I really believe a generic version should be offered in the interface. > > -- Alain I agree too. One generic function for specific uses plus some specific functions merge / union / diff for fast (no boxing, no callback) and easy usage. Nicolas |