diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/unsafe/lux/data/collection/array.lux | 56 |
1 files changed, 28 insertions, 28 deletions
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'))) |