[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] digit-value

On 2012-07-01, at 3:15 AM, John Cowan wrote:

> Marc Feeley scripsit:
>> What is the rationale for digit-value ?  Its usefullness seems limited.
>> It could be used to parse decimal numbers and convert them to their
>> numerical value.  However, a more general procedure would be useful
>> to parse numbers in any base:
> Its purpose is to determine for any digit character (not merely the
> European digits 0-9) what its numeric value is.  For example,
> (digit-value #\x0663) => 3, because ٣ U+0663 is the Arabic-Indic digit 3.
> Of course, if the implementation does not support this character, that
> won't work.

I understand, but why is this useful?  It seems rather special purpose (for parsing decimal numbers and converting them to their numerical value), but this is the purpose of the string->number procedure.  Digit-value doesn't help me much in parsing hexadecimal.  Perhaps I have missed some other use case.  Moreover, as Peter Bex has pointed out, there is an inconsistency with read and string->number.

As it is currently specified, I prefer not having it in the standard.


Scheme-reports mailing list