diff options
author | Eduardo Julian | 2022-06-16 00:48:19 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-06-16 00:48:19 -0400 |
commit | 9e2f1e76f2c8df01ed7687d934c3210fcf676bd6 (patch) | |
tree | 115fab5bd8a5f53dc0d13ce5453095324a83496f /stdlib/source/library/lux/data/text/unicode | |
parent | f92c806ee8da63f04bbefbf558f6249bacdb47ea (diff) |
De-sigil-ification: suffix : [Part 13]
Diffstat (limited to 'stdlib/source/library/lux/data/text/unicode')
-rw-r--r-- | stdlib/source/library/lux/data/text/unicode/block.lux | 26 | ||||
-rw-r--r-- | stdlib/source/library/lux/data/text/unicode/set.lux | 34 |
2 files changed, 30 insertions, 30 deletions
diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux index 7f3eeb32d..db55002a9 100644 --- a/stdlib/source/library/lux/data/text/unicode/block.lux +++ b/stdlib/source/library/lux/data/text/unicode/block.lux @@ -17,14 +17,14 @@ (primitive .public Block (Interval Char) - (def: .public monoid + (def .public monoid (Monoid Block) (implementation - (def: identity + (def identity (abstraction (interval.between n.enum n#top n#bottom))) - (def: (composite left right) + (def (composite left right) (let [left (representation left) right (representation right)] (abstraction @@ -34,12 +34,12 @@ (n.max (at left top) (at right top)))))))) - (def: .public (block start additional) + (def .public (block start additional) (-> Char Nat Block) (abstraction (interval.between n.enum start (n.+ additional start)))) (with_template [<name> <slot>] - [(def: .public <name> + [(def .public <name> (-> Block Char) (|>> representation (the <slot>)))] @@ -47,34 +47,34 @@ [end interval.top] ) - (def: .public (size block) + (def .public (size block) (-> Block Nat) (let [start (the interval.bottom (representation block)) end (the interval.top (representation block))] (|> end (n.- start) ++))) - (def: .public (within? block char) + (def .public (within? block char) (All (_ a) (-> Block Char Bit)) (interval.within? (representation block) char)) ) -(def: .public equivalence +(def .public equivalence (Equivalence Block) (implementation - (def: (= reference subject) + (def (= reference subject) (and (n.= (..start reference) (..start subject)) (n.= (..end reference) (..end subject)))))) -(def: .public hash +(def .public hash (Hash Block) (implementation - (def: equivalence ..equivalence) - (def: (hash value) + (def equivalence ..equivalence) + (def (hash value) (i64.or (i64.left_shifted 32 (..start value)) (..end value))))) (with_template [<start> <end> <name>] - [(def: .public <name> + [(def .public <name> Block (let [start (hex <start>) end (hex <end>)] diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux index 287c78ca0..1abe5427f 100644 --- a/stdlib/source/library/lux/data/text/unicode/set.lux +++ b/stdlib/source/library/lux/data/text/unicode/set.lux @@ -16,10 +16,10 @@ [// (.only Char)] ["[1][0]" block (.only Block)]]]) -(def: builder +(def builder (tree.builder //block.monoid)) -(def: :@: +(def :@: (by_example [@] (is (tree.Builder @ Block) ..builder) @@ -29,19 +29,19 @@ (primitive .public Set (Tree :@: Block []) - (def: .public (composite left right) + (def .public (composite left right) (-> Set Set Set) (abstraction (at builder branch (representation left) (representation right)))) - (def: (singleton block) + (def (singleton block) (-> Block Set) (abstraction (at builder leaf block []))) - (def: .public (set [head tail]) + (def .public (set [head tail]) (-> [Block (List Block)] Set) (list#mix (is (-> Block Set Set) (function (_ block set) @@ -49,7 +49,7 @@ (..singleton head) tail)) - (def: character/0 + (def character/0 Set (..set [//block.basic_latin (list //block.latin_1_supplement @@ -82,7 +82,7 @@ //block.myanmar //block.georgian)])) - (def: character/1 + (def character/1 Set (..set [//block.hangul_jamo (list //block.ethiopic @@ -116,7 +116,7 @@ //block.enclosed_alphanumerics //block.box_drawing)])) - (def: character/2 + (def character/2 Set (..set [//block.block_elements (list //block.geometric_shapes @@ -150,7 +150,7 @@ //block.hangul_syllables )])) - (def: .public character + (def .public character Set (all ..composite ..character/0 @@ -158,7 +158,7 @@ ..character/2 )) - (def: .public non_character + (def .public non_character Set (..set [//block.high_surrogates (list //block.high_private_use_surrogates @@ -193,26 +193,26 @@ ... //block.tags )])) - (def: .public full + (def .public full Set (all ..composite ..character ..non_character )) - (def: .public start + (def .public start (-> Set Char) (|>> representation tree.tag //block.start)) - (def: .public end + (def .public end (-> Set Char) (|>> representation tree.tag //block.end)) - (def: .public (member? set character) + (def .public (member? set character) (-> Set Char Bit) (loop (again [tree (representation set)]) (if (//block.within? (tree.tag tree) character) @@ -225,16 +225,16 @@ (again right))) false))) - (def: .public equivalence + (def .public equivalence (Equivalence Set) (implementation - (def: (= reference subject) + (def (= reference subject) (set#= (set.of_list //block.hash (tree.tags (representation reference))) (set.of_list //block.hash (tree.tags (representation subject))))))) ) (with_template [<name> <blocks>] - [(def: .public <name> + [(def .public <name> Set (..set <blocks>))] |