From 9e2f1e76f2c8df01ed7687d934c3210fcf676bd6 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 16 Jun 2022 00:48:19 -0400 Subject: De-sigil-ification: suffix : [Part 13] --- stdlib/source/unsafe/lux/data/binary.lux | 30 ++++++------ stdlib/source/unsafe/lux/data/collection/array.lux | 56 +++++++++++----------- 2 files changed, 43 insertions(+), 43 deletions(-) (limited to 'stdlib/source/unsafe') diff --git a/stdlib/source/unsafe/lux/data/binary.lux b/stdlib/source/unsafe/lux/data/binary.lux index 1dc9fc96c..a59239afb 100644 --- a/stdlib/source/unsafe/lux/data/binary.lux +++ b/stdlib/source/unsafe/lux/data/binary.lux @@ -5,7 +5,7 @@ ["[0]" ffi] [control [function - [inline (.only inline:)]]] + [inline (.only inlined)]]] [data [collection ["[0]" array @@ -60,7 +60,7 @@ (`` (with_expansions [ (.is .Nat size) (ffi.array byte ) (.is ..Binary )] - (def: .public empty + (def .public empty (template (empty size) [(is ..Binary (for (~~ (.static @.old)) @@ -90,7 +90,7 @@ (`` (with_expansions [ (.is ..Binary it) (ffi.length )] - (def: .public size + (def .public size (template (size it) [(.is .Nat (.for (~~ (.static @.old)) @@ -114,7 +114,7 @@ ... Default (array.size )))])))) -(def: byte_mask +(def byte_mask Nat (i64.mask i64.bits_per_byte)) @@ -126,7 +126,7 @@ (.|> (.as .I64) ("lux i64 and" ))] - (def: .public bits_8 + (def .public bits_8 (template (bits_8 index it) [(.<| (.as .I64) (.is (.I64 .Any)) @@ -154,7 +154,7 @@ (.i64 0) (array.item )))))]))) -(def: .public bits_16 +(def .public bits_16 (template (bits_16 index' it') [(.<| (.let [index (.is Nat index') it (.is ..Binary it')]) @@ -164,7 +164,7 @@ ("lux i64 left-shift" 8 (..bits_8 index it)) (..bits_8 ("lux i64 +" 1 index) it)))])) -(def: .public bits_32 +(def .public bits_32 (template (bits_32 index' it') [(.<| (.let [index (.is Nat index') it (.is ..Binary it')]) @@ -176,7 +176,7 @@ ("lux i64 left-shift" 8 (..bits_8 ("lux i64 +" 2 index) it)) (..bits_8 ("lux i64 +" 3 index) it)))])) -(def: .public bits_64 +(def .public bits_64 (template (bits_64 index' it') [(.<| (.let [index (.is Nat index') it (.is ..Binary it')]) @@ -205,7 +205,7 @@ (ffi.long_to_byte ) (ffi.write! )] - (`` (def: .public has_8! + (`` (def .public has_8! (template (has_8! index value it) [(.is ..Binary (.for (~~ (.static @.old)) @@ -239,7 +239,7 @@ ... Default (array.has! (.|> .int ("lux i64 and" (.int ))) )))])))) -(def: .public has_16! +(def .public has_16! (template (has_16! index' value' it) [(.let [index (.is .Nat index') value (.is (.I64 .Any) value')] @@ -247,7 +247,7 @@ (..has_8! index ("lux i64 right-shift" 8 value)) (..has_8! ("lux i64 +" 1 index) value)))])) -(def: .public has_32! +(def .public has_32! (template (has_32! index' value' it) [(.let [index (.is .Nat index') value (.is (.I64 .Any) value')] @@ -257,7 +257,7 @@ (..has_8! ("lux i64 +" 2 index) ("lux i64 right-shift" 8 value)) (..has_8! ("lux i64 +" 3 index) value)))])) -(`` (def: .public has_64! +(`` (def .public has_64! (template (has_64! index' value' it) [(.let [index (.is .Nat index') value (.is (.I64 .Any) value')] @@ -288,7 +288,7 @@ (.is ..Binary sample') (java/util/Arrays::equals ) (ffi.of_boolean )] - (`` (def: .public = + (`` (def .public = (template (= reference' sample') [(.for (~~ (.static @.old)) (~~ (.static @.jvm)) @@ -305,7 +305,7 @@ (again ("lux i64 +" 1 index))))))))])))) ... TODO: Turn into a template ASAP. -(`` (inline: .public (copy! bytes source_offset source target_offset target) +(`` (inlined .public (copy! bytes source_offset source target_offset target) (-> .Nat .Nat ..Binary Nat ..Binary ..Binary) (with_expansions [ (java/lang/System::arraycopy source (ffi.as_int (.int source_offset)) target (ffi.as_int (.int target_offset)) @@ -332,7 +332,7 @@ (ffi.as_int (.int limit))) (.let [limit ("lux i64 +" size offset)] )] - (inline: .public (slice offset size binary) + (inlined .public (slice offset size binary) (-> .Nat .Nat ..Binary ..Binary) (.for (~~ (.static @.old)) (~~ (.static @.jvm)) diff --git a/stdlib/source/unsafe/lux/data/collection/array.lux b/stdlib/source/unsafe/lux/data/collection/array.lux index d3116b89b..ef81167d2 100644 --- a/stdlib/source/unsafe/lux/data/collection/array.lux +++ b/stdlib/source/unsafe/lux/data/collection/array.lux @@ -10,7 +10,7 @@ [type ["[0]" variance]]]]) -(def: .public type +(def .public type "#Array") (with_template [ ] @@ -23,7 +23,7 @@ (with_expansions [ (.Primitive "java.lang.Long") (.Primitive "java.lang.Object")] - (for @.jvm (def: jvm_int + (for @.jvm (def jvm_int (template (jvm_int value) [(.|> value (.as ) @@ -31,7 +31,7 @@ "jvm conversion long-to-int")])) (these)) - (`` (def: .public empty + (`` (def .public empty (template (empty ) [((.is (.All (_ a) (.-> .Nat (..Array a))) (.function (empty size) @@ -52,7 +52,7 @@ (~~ (.static @.scheme)) ("scheme array new" size))))) )]))) - (`` (def: .public size + (`` (def .public size (template (size ) [((.is (.All (_ r w) (.-> (..Array' r w) .Nat)) (.function (size array) @@ -75,11 +75,11 @@ (~~ (.static @.scheme)) ("scheme array length" array)))) )]))) - (def: lacks?' + (def lacks?' (template (lacks?' index array) [( ( index array))])) - (`` (def: .public lacks? + (`` (def .public lacks? (template (lacks? ) [((.is (.All (_ r w) (.-> .Nat (..Array' r w) .Bit)) @@ -103,11 +103,11 @@ .true)))) )]))) - (def: .public has? + (def .public has? (template (has? index array) [(.not (..lacks? index array))])) - (`` (def: .public item + (`` (def .public item (template (item ) [((.is (.All (_ r w) (.-> .Nat (..Array' r w) r)) @@ -127,7 +127,7 @@ (~~ (.static @.scheme)) ("scheme array read" index array))))) )]))) - (`` (def: .public has! + (`` (def .public has! (template (has! ) [((.is (.All (_ r w) (.-> .Nat w (..Array' r w) (..Array' r w))) @@ -148,7 +148,7 @@ (~~ (.static @.scheme)) ("scheme array write" index (.as_expected value) array)))) )]))) - (`` (def: .public lacks! + (`` (def .public lacks! (template (lacks! ) [((.is (.All (_ r w) (.-> .Nat (..Array' r w) (..Array' r w))) @@ -171,7 +171,7 @@ )]))) ) -(def: .public revised! +(def .public revised! (template (revised! <$> ) [((.is (.All (_ r w) (.-> .Nat (.-> r w) (..Array' r w) (..Array' r w))) @@ -181,7 +181,7 @@ (..has! index ($ (..item index array)) array)))) <$> )])) -(def: .public upsert! +(def .public upsert! (template (upsert! <$> ) [((.is (.All (_ r w) (.-> .Nat r (.-> r w) (..Array' r w) (..Array' r w))) @@ -193,7 +193,7 @@ array))) <$> )])) -(def: .public copy! +(def .public copy! (template (copy! ) [((.is (.All (_ r w) (.-> .Nat .Nat (..Array' w .Nothing) .Nat (..Array' r w) @@ -212,7 +212,7 @@ )])) (with_template [ ] - [(def: .public + [(def .public (template ( ) [((.is (.All (_ r w) (.-> (..Array' r w) .Nat)) (.function (occupancy array) @@ -230,7 +230,7 @@ [vacancy ("lux i64 +" 1 it) it] ) -(def: .public only! +(def .public only! (template (only! ) [((.is (.All (_ r w) (.-> (.-> r .Bit) (..Array' r w) (..Array' r w))) @@ -249,7 +249,7 @@ )])) (with_template [ ] - [(def: .public + [(def .public (template ( ) [((.is (.All (_ r w) (.-> (..Array' r w) (.Maybe ))) @@ -270,7 +270,7 @@ [example' (.-> Nat r .Bit) (? index it) [Nat r] [index it]] ) -(def: .public clone +(def .public clone (template (clone ) [((.is (.All (_ a) (.-> (..Array a) (..Array a))) (.function (clone it) @@ -278,7 +278,7 @@ (..copy! size 0 it 0 (..empty size))))) )])) -(def: .public of_list +(def .public of_list (template (of_list ) [((.is (.All (_ a) (.-> (.List a) (..Array a))) (.function (of_list input) @@ -296,11 +296,11 @@ (again ("lux i64 +" 1 index) tail))))))) )])) -(def: underflow +(def underflow Nat (-- 0)) -(`` (def: list|-default +(`` (def list|-default (template (list|-default ) [((.is (.All (_ r w) (.-> (.List r) (..Array' r w) (.List r))) (.function (list|-default empty array) @@ -314,7 +314,7 @@ {.#Item (..item index array) output})))))) )]))) -(`` (def: list|+default +(`` (def list|+default (template (list|+default ) [((.is (.All (_ r w) (.-> r (..Array' r w) (.List r))) (.function (list|+default default array) @@ -330,7 +330,7 @@ output}))))) )]))) -(`` (def: .public list +(`` (def .public list (template (list ) [((.is (.All (_ r w) (.-> (.Maybe r) (..Array' r w) (.List r))) (.function (list default array) @@ -342,7 +342,7 @@ (~~ (..list|-default {.#End} array))))) )]))) -(def: .public = +(def .public = (template (= ) [((.is (.All (_ r w0 w1) (.-> (.-> r r .Bit) (..Array' r w0) (..Array' r w1) .Bit)) (.function (= //#= left/* right/*) @@ -360,7 +360,7 @@ true)))))) )])) -(def: .public composite +(def .public composite (template (composite ) [((.is (.All (_ a) (.-> (..Array' a .Nothing) (..Array' a .Nothing) (..Array a))) (.function (composite left/* right/*) @@ -371,7 +371,7 @@ (..copy! |right| 0 right/* |left|))))) )])) -(def: .public mix +(def .public mix (template (mix <$> ) [((.is (.All (_ r w s) (.-> (.-> Nat r s s) s (..Array' r w) s)) @@ -386,7 +386,7 @@ so_far))))) <$> )])) -(def: .public each +(def .public each (template (each <$> ) [((.is (functor.Functor ..Array) (.function (each $ input) @@ -397,7 +397,7 @@ <$> )])) (with_template [ ] - [(def: .public + [(def .public (template ( ) [((.is (.All (_ r w) (.-> (.-> r .Bit) @@ -417,7 +417,7 @@ [any? .false or] ) -(def: .public one +(def .public one (template (one ) [((.is (.All (_ r r' w) (.-> (.-> r (.Maybe r')) (..Array' r w) (.Maybe r'))) -- cgit v1.2.3