[m-rev.] for review: Add integer.to_base_string.
Julien Fischer
jfischer at opturion.com
Mon Feb 16 17:28:17 AEDT 2015
Hi,
On Mon, 16 Feb 2015, Peter Wang wrote:
> Add integer.to_base_string.
>
> library/integer.m:
> Add to_base_string/2 and to_base_string/3.
>
> tests/general/base_string_to_integer.exp:
> tests/general/base_string_to_integer.m:
> Extend test case.
>
> NEWS:
> Announce additions.
>
> diff --git a/NEWS b/NEWS
> index bfa7323..d9c8516 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -106,6 +106,8 @@ Changes to the Mercury standard library:
> - from_base_string/3
> - to_int/2
> - det_to_int/1
> + - to_base_string/2
> + - to_base_string/3
>
> The following functions in the integer module have been deprecated:
>
> diff --git a/library/integer.m b/library/integer.m
> index 49d97f7..ef69f01 100644
> --- a/library/integer.m
> +++ b/library/integer.m
> @@ -50,6 +50,16 @@
> %
> :- func to_string(integer) = string.
>
> + % to_base_string(Integer, Base, String):
> + %
> + % Convert an integer to a string in a given Base.
> + %
> + % Base must be between 2 and 36, both inclusive; if it isn't,
s/isn't/is not/
> + % the predicate will throw an exception.
> + %
> +:- func to_base_string(integer, int) = string.
> +:- pred to_base_string(integer::in, int::in, string::out) is det.
Is it worth providing a predicate version of this?
The rest looks fine.
Cheers,
Julien.
More information about the reviews
mailing list