[m-rev.] for review: fix behaviour of bimap.from_assoc_list

Julien Fischer juliensf at cs.mu.OZ.AU
Mon Mar 7 15:43:53 AEDT 2005


On Mon, 7 Mar 2005, Ralph Becket wrote:

> Ian MacLarty, Monday,  7 March 2005:
> >
> > It would be better if there were a version that just failed, since then
> > the user wouldn't need to check the bijective property before calling
> > bimap.from_assoc_list.  This would also be more consistent with other
> > conversion predicates like string.to_int which fail if the conversion is
> > not possible.  I suggest the version which throws an exception should
> > have the usual "det_" prefix.
>
> I disagree.  If the user wants to treat the assoc_list as a sequence of
> updates to an empty bimap they should use something like
>
> 	BiMap = foldl(bimap.set, AssocList, BiMap0)
>
In which case the they use the existing function
bimap.set_from_assoc_list/3.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list