From cf519669e82f9694897c94ffb33dc0f502e26904 Mon Sep 17 00:00:00 2001 From: Salim Bou Date: Thu, 28 May 2026 07:16:57 +0100 Subject: [PATCH 1/4] Update numeral_systems.rs Add Arabic abjad numerals --- src/numeral_systems.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/numeral_systems.rs b/src/numeral_systems.rs index 39ce4ac..33ea009 100644 --- a/src/numeral_systems.rs +++ b/src/numeral_systems.rs @@ -408,6 +408,33 @@ declare_named! { /// > ٨, ٩, /// > ١٠, ١١ EasternArabic = "arabic.eastern" ("١"), + + /// Abjad order + /// [Arabic letters](https://en.wikipedia.org/wiki/Abjad). + /// + /// ## Representable Numbers + /// + /// All non-negative integers can be represented. + /// + /// ## Example + /// + /// The first twenty-eight positive integers are represented as follows: + /// + /// > أ, ب, + /// > ج, د, + /// > ه, و, + /// > ز, ح, + /// > ط, ي, + /// > ك, ل + /// > م, ن + /// > س, ع + /// > ف, ص + /// > ق, ر + /// > ش, ت + /// > ث, خ + /// > ذ, ض + /// > ظ, غ + ArabicAbjad = "arabic.abjad" ("أ"), /// Decimal positional notation using the Persian variant of /// [Eastern Arabic numerals](https://en.wikipedia.org/wiki/Eastern_Arabic_numerals#Numerals). @@ -821,6 +848,11 @@ impl NamedNumeralSystem { Self::EasternArabic => NumeralSystem::Positional(&[ '٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩', ]), + + Self::ArabicAbjad => NumeralSystem::Bijective(&[ + 'أ', 'ب', 'ج', 'د', 'ه', 'و', 'ز', 'ح', 'ط', 'ي', 'ك', 'ل', 'م', 'ن', + 'س', 'ع', 'ف', 'ص', 'ق', 'ر', 'ش', 'ت', 'ث', 'خ', 'ذ', 'ض', 'ظ', 'غ', + ]), Self::Persian => NumeralSystem::Positional(&[ '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹', @@ -1435,6 +1467,7 @@ mod tests { NamedNumeralSystem::KoreanJamo => 65477685939649764827530478995838083425, // 21 NamedNumeralSystem::KoreanSyllable => 24217153056183571894327643661698510954, NamedNumeralSystem::EasternArabic => 277754701051910363703826860323053920831, + NamedNumeralSystem::ArabicAbjad => 332217778941065507236060222268877272547, NamedNumeralSystem::Persian => 6232158096065129450489636457808686806, NamedNumeralSystem::Devanagari => 327133969362282954753636774557232534052, NamedNumeralSystem::Tibetan => 87580519645280744681237273097105390953, From 6c2ddee215fa742b730ff674fdb2a7afd5af1ebb Mon Sep 17 00:00:00 2001 From: Salim Bou Date: Fri, 29 May 2026 00:02:40 +0100 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Malo <57839069+MDLC01@users.noreply.github.com> --- src/numeral_systems.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/numeral_systems.rs b/src/numeral_systems.rs index 33ea009..ef24b5d 100644 --- a/src/numeral_systems.rs +++ b/src/numeral_systems.rs @@ -408,7 +408,6 @@ declare_named! { /// > ٨, ٩, /// > ١٠, ١١ EasternArabic = "arabic.eastern" ("١"), - /// Abjad order /// [Arabic letters](https://en.wikipedia.org/wiki/Abjad). /// @@ -418,7 +417,7 @@ declare_named! { /// /// ## Example /// - /// The first twenty-eight positive integers are represented as follows: + /// The first twelve positive integers are represented as follows: /// /// > أ, ب, /// > ج, د, @@ -426,14 +425,6 @@ declare_named! { /// > ز, ح, /// > ط, ي, /// > ك, ل - /// > م, ن - /// > س, ع - /// > ف, ص - /// > ق, ر - /// > ش, ت - /// > ث, خ - /// > ذ, ض - /// > ظ, غ ArabicAbjad = "arabic.abjad" ("أ"), /// Decimal positional notation using the Persian variant of @@ -848,11 +839,11 @@ impl NamedNumeralSystem { Self::EasternArabic => NumeralSystem::Positional(&[ '٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩', ]), - + Self::ArabicAbjad => NumeralSystem::Bijective(&[ 'أ', 'ب', 'ج', 'د', 'ه', 'و', 'ز', 'ح', 'ط', 'ي', 'ك', 'ل', 'م', 'ن', 'س', 'ع', 'ف', 'ص', 'ق', 'ر', 'ش', 'ت', 'ث', 'خ', 'ذ', 'ض', 'ظ', 'غ', - ]), + ]), Self::Persian => NumeralSystem::Positional(&[ '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹', @@ -1467,7 +1458,7 @@ mod tests { NamedNumeralSystem::KoreanJamo => 65477685939649764827530478995838083425, // 21 NamedNumeralSystem::KoreanSyllable => 24217153056183571894327643661698510954, NamedNumeralSystem::EasternArabic => 277754701051910363703826860323053920831, - NamedNumeralSystem::ArabicAbjad => 332217778941065507236060222268877272547, + NamedNumeralSystem::ArabicAbjad => 123668155426332018802773611195413767893, NamedNumeralSystem::Persian => 6232158096065129450489636457808686806, NamedNumeralSystem::Devanagari => 327133969362282954753636774557232534052, NamedNumeralSystem::Tibetan => 87580519645280744681237273097105390953, From bc63e0d61543f9b336902d8d450f9a44df401e6e Mon Sep 17 00:00:00 2001 From: Salim Bou Date: Fri, 29 May 2026 07:32:38 +0100 Subject: [PATCH 3/4] Update src/numeral_systems.rs remove trailing space. Co-authored-by: Malo <57839069+MDLC01@users.noreply.github.com> --- src/numeral_systems.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/numeral_systems.rs b/src/numeral_systems.rs index ef24b5d..af47328 100644 --- a/src/numeral_systems.rs +++ b/src/numeral_systems.rs @@ -841,7 +841,7 @@ impl NamedNumeralSystem { ]), Self::ArabicAbjad => NumeralSystem::Bijective(&[ - 'أ', 'ب', 'ج', 'د', 'ه', 'و', 'ز', 'ح', 'ط', 'ي', 'ك', 'ل', 'م', 'ن', + 'أ', 'ب', 'ج', 'د', 'ه', 'و', 'ز', 'ح', 'ط', 'ي', 'ك', 'ل', 'م', 'ن', 'س', 'ع', 'ف', 'ص', 'ق', 'ر', 'ش', 'ت', 'ث', 'خ', 'ذ', 'ض', 'ظ', 'غ', ]), From 3ce0c400f8786b81bcc66c0cf33d0d1f187c303a Mon Sep 17 00:00:00 2001 From: Salim Bou Date: Fri, 29 May 2026 14:43:36 +0100 Subject: [PATCH 4/4] Fix Arabic letter representation in numeral systems Fix fifth letter appearance. --- src/numeral_systems.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/numeral_systems.rs b/src/numeral_systems.rs index af47328..dd33790 100644 --- a/src/numeral_systems.rs +++ b/src/numeral_systems.rs @@ -421,7 +421,7 @@ declare_named! { /// /// > أ, ب, /// > ج, د, - /// > ه, و, + /// > ه‍, و, /// > ز, ح, /// > ط, ي, /// > ك, ل @@ -841,7 +841,7 @@ impl NamedNumeralSystem { ]), Self::ArabicAbjad => NumeralSystem::Bijective(&[ - 'أ', 'ب', 'ج', 'د', 'ه', 'و', 'ز', 'ح', 'ط', 'ي', 'ك', 'ل', 'م', 'ن', + 'أ', 'ب', 'ج', 'د', 'ه‍', 'و', 'ز', 'ح', 'ط', 'ي', 'ك', 'ل', 'م', 'ن', 'س', 'ع', 'ف', 'ص', 'ق', 'ر', 'ش', 'ت', 'ث', 'خ', 'ذ', 'ض', 'ظ', 'غ', ]),