[m-dev.] is_digit/1 and digit_to_int/2

Julien Fischer jfischer at opturion.com
Fri Sep 5 16:47:39 AEST 2014



On Fri, 5 Sep 2014, Peter Wang wrote:

>>    :- pred int_to_base_digit/3
>>    :- func det_int_to_base_digit/3
>
> The conventional order would have the base first, but
> `int_to_base_digit' suggests that the base is second like
> string.int_to_base_string.
>
> What about:
>
>    % base_int_to_digit(Base, Int, Char):
>    %
>    % True iff `Char' is a single decimal digit (0-9) or uppercase
>    % letter (A-Z) representing the value `Int' in the given base.
>    % An exception is thrown if Base is not between 2 and 36.
>    %
> :- pred base_int_to_digit(int, int, char).
> :- mode base_int_to_digit(in, in, out) is semidet.
> :- mode base_int_to_digit(in, out, in) is semidet.

Fine with me.

Cheers,
Julien.



More information about the developers mailing list