diff options
Diffstat (limited to 'stdlib/source/unsafe')
-rw-r--r-- | stdlib/source/unsafe/lux/data/binary.lux | 30 | ||||
-rw-r--r-- | stdlib/source/unsafe/lux/data/collection/array.lux | 56 |
2 files changed, 43 insertions, 43 deletions
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 [<size> (.is .Nat size) <jvm> (ffi.array byte <size>) <jvm> (.is ..Binary <jvm>)] - (def: .public empty + (def .public empty (template (empty size) [(is ..Binary (for (~~ (.static @.old)) <jvm> @@ -90,7 +90,7 @@ (`` (with_expansions [<it> (.is ..Binary it) <jvm> (ffi.length <it>)] - (def: .public size + (def .public size (template (size it) [(.is .Nat (.for (~~ (.static @.old)) <jvm> @@ -114,7 +114,7 @@ ... Default (array.size <it>)))])))) -(def: byte_mask +(def byte_mask Nat (i64.mask i64.bits_per_byte)) @@ -126,7 +126,7 @@ <jvm> (.|> <jvm> (.as .I64) ("lux i64 and" <byte_mask>))] - (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 <index> <it>)))))]))) -(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 @@ <jvm_value> <jvm_value> <jvm_value> (ffi.long_to_byte <jvm_value>) <jvm> (ffi.write! <index> <jvm_value> <it>)] - (`` (def: .public has_8! + (`` (def .public has_8! (template (has_8! index value it) [(.is ..Binary (.for (~~ (.static @.old)) <jvm> @@ -239,7 +239,7 @@ ... Default (array.has! <index> (.|> <value> .int ("lux i64 and" (.int <byte>))) <it>)))])))) -(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 @@ <sample> (.is ..Binary sample') <jvm> (java/util/Arrays::equals <reference> <sample>) <jvm> (ffi.of_boolean <jvm>)] - (`` (def: .public = + (`` (def .public = (template (= reference' sample') [(.for (~~ (.static @.old)) <jvm> (~~ (.static @.jvm)) <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 [<jvm> (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))) <jvm> (.let [limit ("lux i64 +" size offset)] <jvm>)] - (inline: .public (slice offset size binary) + (inlined .public (slice offset size binary) (-> .Nat .Nat ..Binary ..Binary) (.for (~~ (.static @.old)) <jvm> (~~ (.static @.jvm)) <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 [<item> <array>] @@ -23,7 +23,7 @@ (with_expansions [<index_type> (.Primitive "java.lang.Long") <item_type> (.Primitive "java.lang.Object")] - (for @.jvm (def: jvm_int + (for @.jvm (def jvm_int (template (jvm_int value) [(.|> value (.as <index_type>) @@ -31,7 +31,7 @@ "jvm conversion long-to-int")])) (these)) - (`` (def: .public empty + (`` (def .public empty (template (empty <size>) [((.is (.All (_ a) (.-> .Nat (..Array a))) (.function (empty size) @@ -52,7 +52,7 @@ (~~ (.static @.scheme)) ("scheme array new" size))))) <size>)]))) - (`` (def: .public size + (`` (def .public size (template (size <array>) [((.is (.All (_ r w) (.-> (..Array' r w) .Nat)) (.function (size array) @@ -75,11 +75,11 @@ (~~ (.static @.scheme)) ("scheme array length" array)))) <array>)]))) - (def: lacks?' + (def lacks?' (template (lacks?' <read!> <null?> index array) [(<null?> (<read!> index array))])) - (`` (def: .public lacks? + (`` (def .public lacks? (template (lacks? <index> <array>) [((.is (.All (_ r w) (.-> .Nat (..Array' r w) .Bit)) @@ -103,11 +103,11 @@ .true)))) <index> <array>)]))) - (def: .public has? + (def .public has? (template (has? index array) [(.not (..lacks? index array))])) - (`` (def: .public item + (`` (def .public item (template (item <index> <array>) [((.is (.All (_ r w) (.-> .Nat (..Array' r w) r)) @@ -127,7 +127,7 @@ (~~ (.static @.scheme)) ("scheme array read" index array))))) <index> <array>)]))) - (`` (def: .public has! + (`` (def .public has! (template (has! <index> <value> <array>) [((.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)))) <index> <value> <array>)]))) - (`` (def: .public lacks! + (`` (def .public lacks! (template (lacks! <index> <array>) [((.is (.All (_ r w) (.-> .Nat (..Array' r w) (..Array' r w))) @@ -171,7 +171,7 @@ <index> <array>)]))) ) -(def: .public revised! +(def .public revised! (template (revised! <index> <$> <array>) [((.is (.All (_ r w) (.-> .Nat (.-> r w) (..Array' r w) (..Array' r w))) @@ -181,7 +181,7 @@ (..has! index ($ (..item index array)) array)))) <index> <$> <array>)])) -(def: .public upsert! +(def .public upsert! (template (upsert! <index> <default> <$> <array>) [((.is (.All (_ r w) (.-> .Nat r (.-> r w) (..Array' r w) (..Array' r w))) @@ -193,7 +193,7 @@ array))) <index> <default> <$> <array>)])) -(def: .public copy! +(def .public copy! (template (copy! <length> <src_start> <src_array> <dest_start> <dest_array>) [((.is (.All (_ r w) (.-> .Nat .Nat (..Array' w .Nothing) .Nat (..Array' r w) @@ -212,7 +212,7 @@ <length> <src_start> <src_array> <dest_start> <dest_array>)])) (with_template [<name> <when_lacks> <when_has>] - [(def: .public <name> + [(def .public <name> (template (<name> <array>) [((.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! <?> <it>) [((.is (.All (_ r w) (.-> (.-> r .Bit) (..Array' r w) (..Array' r w))) @@ -249,7 +249,7 @@ <?> <it>)])) (with_template [<name> <predicate> <test> <type> <term>] - [(def: .public <name> + [(def .public <name> (template (<name> <?> <it>) [((.is (.All (_ r w) (.-> <predicate> (..Array' r w) (.Maybe <type>))) @@ -270,7 +270,7 @@ [example' (.-> Nat r .Bit) (? index it) [Nat r] [index it]] ) -(def: .public clone +(def .public clone (template (clone <it>) [((.is (.All (_ a) (.-> (..Array a) (..Array a))) (.function (clone it) @@ -278,7 +278,7 @@ (..copy! size 0 it 0 (..empty size))))) <it>)])) -(def: .public of_list +(def .public of_list (template (of_list <input>) [((.is (.All (_ a) (.-> (.List a) (..Array a))) (.function (of_list input) @@ -296,11 +296,11 @@ (again ("lux i64 +" 1 index) tail))))))) <input>)])) -(def: underflow +(def underflow Nat (-- 0)) -(`` (def: list|-default +(`` (def list|-default (template (list|-default <empty> <array>) [((.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})))))) <empty> <array>)]))) -(`` (def: list|+default +(`` (def list|+default (template (list|+default <default> <array>) [((.is (.All (_ r w) (.-> r (..Array' r w) (.List r))) (.function (list|+default default array) @@ -330,7 +330,7 @@ output}))))) <default> <array>)]))) -(`` (def: .public list +(`` (def .public list (template (list <default> <array>) [((.is (.All (_ r w) (.-> (.Maybe r) (..Array' r w) (.List r))) (.function (list default array) @@ -342,7 +342,7 @@ (~~ (..list|-default {.#End} array))))) <default> <array>)]))) -(def: .public = +(def .public = (template (= <//#=> <left/*> <right/*>) [((.is (.All (_ r w0 w1) (.-> (.-> r r .Bit) (..Array' r w0) (..Array' r w1) .Bit)) (.function (= //#= left/* right/*) @@ -360,7 +360,7 @@ true)))))) <//#=> <left/*> <right/*>)])) -(def: .public composite +(def .public composite (template (composite <left/*> <right/*>) [((.is (.All (_ a) (.-> (..Array' a .Nothing) (..Array' a .Nothing) (..Array a))) (.function (composite left/* right/*) @@ -371,7 +371,7 @@ (..copy! |right| 0 right/* |left|))))) <left/*> <right/*>)])) -(def: .public mix +(def .public mix (template (mix <$> <init> <it>) [((.is (.All (_ r w s) (.-> (.-> Nat r s s) s (..Array' r w) s)) @@ -386,7 +386,7 @@ so_far))))) <$> <init> <it>)])) -(def: .public each +(def .public each (template (each <$> <input>) [((.is (functor.Functor ..Array) (.function (each $ input) @@ -397,7 +397,7 @@ <$> <input>)])) (with_template [<name> <init> <op>] - [(def: .public <name> + [(def .public <name> (template (<name> <?> <it>) [((.is (.All (_ r w) (.-> (.-> r .Bit) @@ -417,7 +417,7 @@ [any? .false or] ) -(def: .public one +(def .public one (template (one <?> <it>) [((.is (.All (_ r r' w) (.-> (.-> r (.Maybe r')) (..Array' r w) (.Maybe r'))) |