Skip to content

Support for Unicode Roman Numerals (e.g. Ⅳ, Ⅷ, etc.)#4

Open
vanviethieuanh wants to merge 4 commits into
mipli:masterfrom
vanviethieuanh:master
Open

Support for Unicode Roman Numerals (e.g. Ⅳ, Ⅷ, etc.)#4
vanviethieuanh wants to merge 4 commits into
mipli:masterfrom
vanviethieuanh:master

Conversation

@vanviethieuanh
Copy link
Copy Markdown

@vanviethieuanh vanviethieuanh commented Dec 9, 2025

Hi!

As what we discussed in this discussion I implemented:

  • Unicode support for fn from_char(c: char) -> Result<Vec<Digit>>.
  • Split the feature called archaic because characters like is rarely used.
  • Add more doc tests and change 2 of them mostly because we now return Vec<Digit>.

As suggestion:

Would have to look at adding similar support to the Roman conversions as well

Now Roman::from_str could parse mixing string like XⅦ. However, because Unicode characters like is more than 1 byte using from_byte have to become from_char and result of map become 2D Vec instead. As a result, it ~5 times slower than the original (tested on mmmdcccxciii case) and we have to change most of the code in Roman::from_str.

I tried to use both collect.iter.flatten and for with extend to avoid changing your code. But with this, performance drop even more (~7-10 times slower). This is all I could do to preserve your logic, please let me know if you want to revert what I changed in Roman

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.

1 participant