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

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Feb 3 17:21:16 AEDT 2005


On 03-Feb-2005, Julien Fischer <juliensf at cs.mu.OZ.AU> wrote:
> > +string__int_to_base_string_group_2(NegN, Base, Curr, Period, Sep, Str) :-
> > +	(
> > +		Curr = Period, Period > 0
> > +	->
> > +		string__int_to_base_string_group_2(NegN, Base, 0, Period, Sep,
> > +			Str1),
> > +		string__append(Str1, Sep, Str)

I think you need to document the meaning of the Curr and Period arguments.

> > +		(
> > +			NegN > -Base
> > +		->
> > +			N = -NegN,
> > +			char__det_int_to_digit(N, DigitChar),
> > +			string__char_to_string(DigitChar, Str)
> > +		;
> > +			NegN1 = NegN // Base,
> > +			N10 = (NegN1 * Base) - NegN,
> > +			char__det_int_to_digit(N10, DigitChar),
> > +			string__char_to_string(DigitChar, DigitString),
> > +			string__int_to_base_string_group_2(NegN1, Base,
> > +				Curr + 1, Period, Sep, Str1),
> > +			string__append(Str1, DigitString, Str)
> > +		)
> > +	).

Noting both here and in int_to_base_string that this code is basically
duplicated would be a good idea.

Otherwise, I agree with Julien.

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