diff options
Diffstat (limited to 'stdlib/source/library/lux/data/text/unicode/set.lux')
-rw-r--r-- | stdlib/source/library/lux/data/text/unicode/set.lux | 402 |
1 files changed, 200 insertions, 202 deletions
diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux index bab5bf9ae..b47505a09 100644 --- a/stdlib/source/library/lux/data/text/unicode/set.lux +++ b/stdlib/source/library/lux/data/text/unicode/set.lux @@ -27,212 +27,210 @@ @)) (abstract: .public Set - {} - (Tree :@: Block []) - (def: .public (composite left right) - (-> Set Set Set) - (:abstraction - (\ builder branch - (:representation left) - (:representation right)))) - - (def: (singleton block) - (-> Block Set) - (:abstraction - (\ builder leaf block []))) - - (def: .public (set [head tail]) - (-> [Block (List Block)] Set) - (list\mix (: (-> Block Set Set) - (function (_ block set) - (..composite (..singleton block) set))) - (..singleton head) - tail)) - - (def: character/0 - Set - (..set [//block.basic_latin - (list //block.latin_1_supplement - //block.latin_extended_a - //block.latin_extended_b - //block.ipa_extensions - //block.spacing_modifier_letters - //block.combining_diacritical_marks - //block.greek_and_coptic - //block.cyrillic - //block.cyrillic_supplementary - //block.armenian - //block.hebrew - //block.arabic - //block.syriac - //block.thaana - //block.devanagari - //block.bengali - //block.gurmukhi - //block.gujarati - //block.oriya - //block.tamil - //block.telugu - //block.kannada - //block.malayalam - //block.sinhala - //block.thai - //block.lao - //block.tibetan - //block.myanmar - //block.georgian)])) - - (def: character/1 - Set - (..set [//block.hangul_jamo - (list //block.ethiopic - //block.cherokee - //block.unified_canadian_aboriginal_syllabics - //block.ogham - //block.runic - //block.tagalog - //block.hanunoo - //block.buhid - //block.tagbanwa - //block.khmer - //block.mongolian - //block.limbu - //block.tai_le - //block.khmer_symbols - //block.phonetic_extensions - //block.latin_extended_additional - //block.greek_extended - //block.general_punctuation - //block.superscripts_and_subscripts - //block.currency_symbols - //block.combining_diacritical_marks_for_symbols - //block.letterlike_symbols - //block.number_forms - //block.arrows - //block.mathematical_operators - //block.miscellaneous_technical - //block.control_pictures - //block.optical_character_recognition - //block.enclosed_alphanumerics - //block.box_drawing)])) - - (def: character/2 - Set - (..set [//block.block_elements - (list //block.geometric_shapes - //block.miscellaneous_symbols - //block.dingbats - //block.miscellaneous_mathematical_symbols_a - //block.supplemental_arrows_a - //block.braille_patterns - //block.supplemental_arrows_b - //block.miscellaneous_mathematical_symbols_b - //block.supplemental_mathematical_operators - //block.miscellaneous_symbols_and_arrows - //block.cjk_radicals_supplement - //block.kangxi_radicals - //block.ideographic_description_characters - //block.cjk_symbols_and_punctuation - //block.hiragana - //block.katakana - //block.bopomofo - //block.hangul_compatibility_jamo - //block.kanbun - //block.bopomofo_extended - //block.katakana_phonetic_extensions - //block.enclosed_cjk_letters_and_months - //block.cjk_compatibility - //block.cjk_unified_ideographs_extension_a - //block.yijing_hexagram_symbols - //block.cjk_unified_ideographs - //block.yi_syllables - //block.yi_radicals - //block.hangul_syllables - )])) - - (def: .public character - Set - ($_ ..composite - ..character/0 - ..character/1 - ..character/2 - )) - - (def: .public non_character - Set - (..set [//block.high_surrogates - (list //block.high_private_use_surrogates - //block.low_surrogates - //block.private_use_area - //block.cjk_compatibility_ideographs - //block.alphabetic_presentation_forms - //block.arabic_presentation_forms_a - //block.variation_selectors - //block.combining_half_marks - //block.cjk_compatibility_forms - //block.small_form_variants - //block.arabic_presentation_forms_b - //block.halfwidth_and_fullwidth_forms - //block.specials - ... //block.linear_b_syllabary - ... //block.linear_b_ideograms - ... //block.aegean_numbers - ... //block.old_italic - ... //block.gothic - ... //block.ugaritic - ... //block.deseret - ... //block.shavian - ... //block.osmanya - ... //block.cypriot_syllabary - ... //block.byzantine_musical_symbols - ... //block.musical_symbols - ... //block.tai_xuan_jing_symbols - ... //block.mathematical_alphanumeric_symbols - ... //block.cjk_unified_ideographs_extension_b - ... //block.cjk_compatibility_ideographs_supplement - ... //block.tags + [(def: .public (composite left right) + (-> Set Set Set) + (:abstraction + (\ builder branch + (:representation left) + (:representation right)))) + + (def: (singleton block) + (-> Block Set) + (:abstraction + (\ builder leaf block []))) + + (def: .public (set [head tail]) + (-> [Block (List Block)] Set) + (list\mix (: (-> Block Set Set) + (function (_ block set) + (..composite (..singleton block) set))) + (..singleton head) + tail)) + + (def: character/0 + Set + (..set [//block.basic_latin + (list //block.latin_1_supplement + //block.latin_extended_a + //block.latin_extended_b + //block.ipa_extensions + //block.spacing_modifier_letters + //block.combining_diacritical_marks + //block.greek_and_coptic + //block.cyrillic + //block.cyrillic_supplementary + //block.armenian + //block.hebrew + //block.arabic + //block.syriac + //block.thaana + //block.devanagari + //block.bengali + //block.gurmukhi + //block.gujarati + //block.oriya + //block.tamil + //block.telugu + //block.kannada + //block.malayalam + //block.sinhala + //block.thai + //block.lao + //block.tibetan + //block.myanmar + //block.georgian)])) + + (def: character/1 + Set + (..set [//block.hangul_jamo + (list //block.ethiopic + //block.cherokee + //block.unified_canadian_aboriginal_syllabics + //block.ogham + //block.runic + //block.tagalog + //block.hanunoo + //block.buhid + //block.tagbanwa + //block.khmer + //block.mongolian + //block.limbu + //block.tai_le + //block.khmer_symbols + //block.phonetic_extensions + //block.latin_extended_additional + //block.greek_extended + //block.general_punctuation + //block.superscripts_and_subscripts + //block.currency_symbols + //block.combining_diacritical_marks_for_symbols + //block.letterlike_symbols + //block.number_forms + //block.arrows + //block.mathematical_operators + //block.miscellaneous_technical + //block.control_pictures + //block.optical_character_recognition + //block.enclosed_alphanumerics + //block.box_drawing)])) + + (def: character/2 + Set + (..set [//block.block_elements + (list //block.geometric_shapes + //block.miscellaneous_symbols + //block.dingbats + //block.miscellaneous_mathematical_symbols_a + //block.supplemental_arrows_a + //block.braille_patterns + //block.supplemental_arrows_b + //block.miscellaneous_mathematical_symbols_b + //block.supplemental_mathematical_operators + //block.miscellaneous_symbols_and_arrows + //block.cjk_radicals_supplement + //block.kangxi_radicals + //block.ideographic_description_characters + //block.cjk_symbols_and_punctuation + //block.hiragana + //block.katakana + //block.bopomofo + //block.hangul_compatibility_jamo + //block.kanbun + //block.bopomofo_extended + //block.katakana_phonetic_extensions + //block.enclosed_cjk_letters_and_months + //block.cjk_compatibility + //block.cjk_unified_ideographs_extension_a + //block.yijing_hexagram_symbols + //block.cjk_unified_ideographs + //block.yi_syllables + //block.yi_radicals + //block.hangul_syllables )])) - (def: .public full - Set - ($_ ..composite - ..character - ..non_character - )) - - (def: .public start - (-> Set Char) - (|>> :representation - tree.tag - //block.start)) - - (def: .public end - (-> Set Char) - (|>> :representation - tree.tag - //block.end)) - - (def: .public (member? set character) - (-> Set Char Bit) - (loop [tree (:representation set)] - (if (//block.within? (tree.tag tree) character) - (case (tree.root tree) - (0 #0 _) - true - - (0 #1 left right) - (or (recur left) - (recur right))) - false))) - - (implementation: .public equivalence - (Equivalence Set) - - (def: (= reference subject) - (set\= (set.of_list //block.hash (tree.tags (:representation reference))) - (set.of_list //block.hash (tree.tags (:representation subject)))))) + (def: .public character + Set + ($_ ..composite + ..character/0 + ..character/1 + ..character/2 + )) + + (def: .public non_character + Set + (..set [//block.high_surrogates + (list //block.high_private_use_surrogates + //block.low_surrogates + //block.private_use_area + //block.cjk_compatibility_ideographs + //block.alphabetic_presentation_forms + //block.arabic_presentation_forms_a + //block.variation_selectors + //block.combining_half_marks + //block.cjk_compatibility_forms + //block.small_form_variants + //block.arabic_presentation_forms_b + //block.halfwidth_and_fullwidth_forms + //block.specials + ... //block.linear_b_syllabary + ... //block.linear_b_ideograms + ... //block.aegean_numbers + ... //block.old_italic + ... //block.gothic + ... //block.ugaritic + ... //block.deseret + ... //block.shavian + ... //block.osmanya + ... //block.cypriot_syllabary + ... //block.byzantine_musical_symbols + ... //block.musical_symbols + ... //block.tai_xuan_jing_symbols + ... //block.mathematical_alphanumeric_symbols + ... //block.cjk_unified_ideographs_extension_b + ... //block.cjk_compatibility_ideographs_supplement + ... //block.tags + )])) + + (def: .public full + Set + ($_ ..composite + ..character + ..non_character + )) + + (def: .public start + (-> Set Char) + (|>> :representation + tree.tag + //block.start)) + + (def: .public end + (-> Set Char) + (|>> :representation + tree.tag + //block.end)) + + (def: .public (member? set character) + (-> Set Char Bit) + (loop [tree (:representation set)] + (if (//block.within? (tree.tag tree) character) + (case (tree.root tree) + (0 #0 _) + true + + (0 #1 left right) + (or (recur left) + (recur right))) + false))) + + (implementation: .public equivalence + (Equivalence Set) + + (def: (= reference subject) + (set\= (set.of_list //block.hash (tree.tags (:representation reference))) + (set.of_list //block.hash (tree.tags (:representation subject))))))] ) (template [<name> <blocks>] |