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

Paul Bone paul at bone.id.au
Fri Sep 5 15:31:53 AEST 2014


On Fri, Sep 05, 2014 at 03:12:49PM +1000, Julien Fischer wrote:
>
> Hi,
>
> I think it is potentially confusing that char.is_digit/1 and
> char.digit_to_int/2 are true for different inputs.  The former only
> succeeds for 0-9, while the latter succeeds for 0-9a-zA-Z.
>
> At the very least I think we should have is_decimal_digit/1 and
> decimal_digit_to_int/2 that are both only true for 0-9.
>

I would prefer that is_digit remains the same (0-9) and digit_to_int be
changed to work only for 0-9.  And that a new predicate be created to
convert the full range.  Deprecating digit_to_int in this way is going to be
difficult, but I think this will be better in the long term.


-- 
Paul Bone



More information about the developers mailing list