Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

char-numeric? and digits #905

Open
soegaard opened this issue Jan 21, 2025 · 2 comments
Open

char-numeric? and digits #905

soegaard opened this issue Jan 21, 2025 · 2 comments

Comments

@soegaard
Copy link

The documentation [1] suggests that char-numeric? is only true for digits:

Image

However, it returns true for unicode symbols that have the numeric property.

Image

That behaviour matches R6RS, so I think the docs needs a little touch up.

However, it might be an idea to add a char-digit?.

[1] https://scheme.com/tspl4/objects.html#./objects:s203

@soegaard
Copy link
Author

A list of unicode characters with the numeric property.

https://www.johndcook.com/unicode_numbers.html

@soegaard
Copy link
Author

Note that R7RS has introduced digit-value to convert a unicode character with the numeric property to a an integer value (as counted from the nearest "zero").

https://small.r7rs.org/ticket/220/

Example from Gambit:

> (digit-value #\u0665)
5
> #\u0665 
#\٥

The odd looking character is an "Arabic-Indic Digit Five".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant