Skip to content

Add Char.Ascii module#13695

Merged
nojb merged 7 commits intoocaml:trunkfrom
dbuenzli:char-ascii-module
Jan 6, 2025
Merged

Add Char.Ascii module#13695
nojb merged 7 commits intoocaml:trunkfrom
dbuenzli:char-ascii-module

Conversation

@dbuenzli
Copy link
Copy Markdown
Contributor

First this PR adds a few doc cleanups and clarifications to char.mli best read commit by commit. Second it adds an Char.Ascii module to deal with ASCII data.

A rendering of resulting docs for the module can be found here.

As already mentioned before, functions working on ASCII-only remain useful on a wide variety of tasks because they also work on UTF-8 encoded strings and lots of data munging tasks do operate on the ASCII subset of UTF-8.

Predicate definitions

The definitions of predicates are taken from the C standard library in the default "C" locale. More precisely the following definitions are used:

Char.Ascii C
is_upper isupper
is_lower islower
is_letter isalpha
is_alphanum isalnum
is_white isspace
is_blank isblank
is_graphic isgraph
is_print isprint
is_control iscntrl
is_digit isdigit
is_hex_digit isxdigit

Closes #13657

Copy link
Copy Markdown
Contributor

@nojb nojb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, modulo small issue below

A second approval is needed before the PR can be merged.

Copy link
Copy Markdown
Member

@yallop yallop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but with a few small changes proposed.

@dbuenzli
Copy link
Copy Markdown
Contributor Author

Thanks @nojb and @yallop for the approvals and the reviews.

I also changed a few iff into if and only if which had slipped through (at some point it was decided to avoid this jargon in the doc strings of the stdlib).

Copy link
Copy Markdown
Contributor

@nojb nojb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approving following latest changes. @yallop: could you confirm that you are happy with the current state of the PR? Then we can go ahead and merge. Thanks!

@yallop
Copy link
Copy Markdown
Member

yallop commented Jan 6, 2025

Yes, I'm happy with the latest revision

@nojb nojb merged commit 4d2298d into ocaml:trunk Jan 6, 2025
@nojb
Copy link
Copy Markdown
Contributor

nojb commented Jan 6, 2025

Merged. Thanks @dbuenzli!

@dbuenzli
Copy link
Copy Markdown
Contributor Author

dbuenzli commented Jan 6, 2025

Thanks to both! That felt such an easy ride that I felt compelled to open #13696 to suffer a bit :–)

@dbuenzli dbuenzli deleted the char-ascii-module branch January 6, 2025 14:40
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

Successfully merging this pull request may close these issues.

3 participants