[m-rev.] for review: add transform_value predicate to map.

Ian MacLarty maclarty at cs.mu.OZ.AU
Wed Jan 12 23:35:58 AEDT 2005


On Wed, Jan 12, 2005 at 08:35:31PM +1100, Julien Fischer wrote:
> 
> On Wed, 12 Jan 2005, Ian MacLarty wrote:
> 
> > On Wed, Jan 12, 2005 at 07:54:04PM +1100, Julien Fischer wrote:
> > >
> > > On Wed, 12 Jan 2005, Ian MacLarty wrote:
> > >
> 
> > >
> > > > Index: NEWS
> > > > ===================================================================
> > > > RCS file: /home/mercury1/repository/mercury/NEWS,v
> > > > retrieving revision 1.360
> > > > diff -u -r1.360 NEWS
> > > > --- NEWS	11 Jan 2005 06:06:14 -0000	1.360
> > > > +++ NEWS	12 Jan 2005 07:32:41 -0000
> > > > @@ -234,7 +234,7 @@
> > > >    variables.  We've also added a function version.
> > > >
> > > >  * We've added some new predicates, map__common_subset, map__foldl3,
> > > > -  and map__overlay_large_map, to map.m.
> > > > +  map__overlay_large_map and map__transform_value, to map.m.
> > > >
> > > >  * We've added a predicate, map_fold, to set.m.
> > > >
> > > This doesn't mention the changes to the rbtree module.
> > >
> >
> > Is that news worthy?  Or is every change to the library supposed to go into the
> > NEWS file?
> >
> I think it's worth mentioning.
> 

Okay:

* We've added a predicate, rbtree__transform_value, to rbtree.m.

> > > > +
> > > > +	% Same as transform_value/4, but aborts instead of failing if the
> > > > +	% key is not found.
> > > > +	%
> > >
> > > I prefer "throws an exception" to "aborts"
> > >
> >
> > "aborts" is used elsewhere in the module to describe the det versions of
> > predicates, so I think that convention should be followed for consistency.
> >
> I suspect "aborts" originated when calling error/1 really did abort
> execution - I think saying it throws an exception is probably more
> accurate now.
> 

I still think it should be "aborts" because otherwise someone reading through
the module might think "aborting" is something different to "throwing an
exception".  Otherwise they should all be updated to "throwing an exception"
which I'm not gonna do now :-)

> > > > +:- pred map__det_transform_value(pred(V, V)::in(pred(in, out) is det), K::in,
> > > > +	map(K, V)::in, map(K, V)::out) is det.
> > > > +:- func map__det_transform_value(func(V) = V, K, map(K, V)) = map(K, V).
> > > > +
> > >
> > > Our current coding standards say that if there is both a predicate
> > > and a function version of a procedure then the :- func declaration
> > > should appear first.
> > >
> >
> > Elsewhere in the module preds appear before functions.
> >
> That's because this module was written way before the above was
> added to the coding standard - feel free to shuffle the others
> around as well ;-)
> 

Maybe some other time...

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