From: Nicolas C. <war...@fr...> - 2005-06-06 06:57:39
|
> > What do you think of this: > > > > (* default merge = fun x y -> x *) > > val union : ?merge:('b -> 'b -> 'b) -> ('a, 'b) t -> ('a, 'b) t -> ('a, > 'b) t > > > > (* a merge function must be given to inter *) > > val inter : merge:('b -> 'c -> 'd) -> ('a, 'b) t -> ('a, 'c) t -> ('a, 'd) > t > > > > val diff : ('a, 'b) t -> ('a, 'c) t -> ('a, 'b) t > > Why not generalize a little more ? > > val union : merge:('b -> 'c -> 'd) -> ('a,'b) t -> ('a,'c) t -> ('a,'d) t > > The only problem is that we can't use "identity" as default merger. > > Nicolas After a second though I think it's little overweighted to make the user specify a merge function. Why not simply specify that in such cases, the item of the first map is selected ? That seems more reasonable. Nicolas |