[m-rev.] for review: format ints with thousand separators

Julien Fischer juliensf at cs.mu.OZ.AU
Thu Feb 3 17:26:43 AEDT 2005


On Thu, 3 Feb 2005, Ian MacLarty wrote:

> > > 	commas as thousand separators.  Add a predicate and function to
> > > 	convert an int to any base with any string between any number of
> > > 	digits.
> > >
> > > tests/general/string_test.exp
> > > tests/general/string_test.m
> > > 	Test the new functionality.
> > >
> > > Index: library/string.m
> > > ===================================================================
> > > RCS file: /home/mercury1/repository/mercury/library/string.m,v
> > > retrieving revision 1.226
> > > diff -u -r1.226 string.m
> > > --- library/string.m	2 Feb 2005 04:28:49 -0000	1.226
> > > +++ library/string.m	3 Feb 2005 05:50:13 -0000
> > > @@ -119,6 +119,13 @@
> > >  :- pred string__int_to_string(int, string).
> > >  :- mode string__int_to_string(in, uo) is det.
> > >
> > > +	% Convert an integer to a string with commas as thousand seperators.
> > > +	%
> > > +:- func string__int_to_string_thousands(int) = string.
> > > +:- mode string__int_to_string_thousands(in) = uo is det.
> > > +:- pred string__int_to_string_thousands(int, string).
> > > +:- mode string__int_to_string_thousands(in, uo) is det.
> > > +
> > Do we really need the predicate version?
> >
>
> Yes, so the interface is consistent with string__int_to_string.  But if you
> feel strongly I'll take the pred version out - I don't really care either way.
>

My feeling on this is that we don't really gain anything from having the
predicate version (it isn't anymore useful with state variables for
example).  I also think the predicate version of string.int_to_string is
redundant, but getting rid of that is another matter - it's quite heavily
used in the compiler for one thing.

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