diff options
Diffstat (limited to '')
10 files changed, 0 insertions, 355 deletions
diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux index 54a4336fb..91a95d2f9 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux @@ -177,34 +177,6 @@ (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift)) ))) -## [[Arrays]] -(def: (array//new size0) - Unary - (_.make-array/init size0 _.nil)) - -(def: (array//get [arrayO idxO]) - Binary - (runtimeT.array//get arrayO idxO)) - -(def: (array//put [arrayO idxO elemO]) - Trinary - (runtimeT.array//put arrayO idxO elemO)) - -(def: (array//remove [arrayO idxO]) - Binary - (runtimeT.array//put arrayO idxO _.nil)) - -(def: array-procs - Bundle - (<| (prefix "array") - (|> (dict.new text.Hash<Text>) - (install "new" (unary array//new)) - (install "get" (binary array//get)) - (install "put" (trinary array//put)) - (install "remove" (binary array//remove)) - (install "size" (unary _.length)) - ))) - ## [[Numbers]] (host.import: java/lang/Double (#static MIN_VALUE Double) @@ -359,7 +331,6 @@ (dict.merge int-procs) (dict.merge frac-procs) (dict.merge text-procs) - (dict.merge array-procs) (dict.merge io-procs) (dict.merge box-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux index df1be8508..0efdedd4c 100644 --- a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux @@ -164,27 +164,6 @@ [bit//logical-right-shift runtimeT.bit//logical-right-shift] ) -## [[Arrays]] -(def: (array//new sizeJS) - Unary - (self-contained (format "new Array(" runtimeT.int//to-number "(" sizeJS ")" ")"))) - -(def: (array//get [arrayJS idxJS]) - Binary - (format runtimeT.array//get "(" arrayJS "," idxJS ")")) - -(def: (array//put [arrayJS idxJS elemJS]) - Trinary - (format runtimeT.array//put "(" arrayJS "," idxJS "," elemJS ")")) - -(def: (array//remove [arrayJS idxJS]) - Binary - (format runtimeT.array//remove "(" arrayJS "," idxJS ")")) - -(def: (array//size arrayJS) - Unary - (format arrayJS ".length")) - ## [[Numbers]] (host.import: java/lang/Double (#static MIN_VALUE Double) @@ -388,17 +367,6 @@ (install "clip" (trinary text//clip)) ))) -(def: array-procs - Bundle - (<| (prefix "array") - (|> (dict.new text.Hash<Text>) - (install "new" (unary array//new)) - (install "get" (binary array//get)) - (install "put" (trinary array//put)) - (install "remove" (binary array//remove)) - (install "size" (unary array//size)) - ))) - (def: io-procs Bundle (<| (prefix "io") @@ -424,7 +392,6 @@ (dict.merge int-procs) (dict.merge frac-procs) (dict.merge text-procs) - (dict.merge array-procs) (dict.merge io-procs) (dict.merge box-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux index d5abbc150..af47bffce 100644 --- a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux @@ -597,35 +597,6 @@ __text//clip __text//char)) -(runtime: array//get "arrayGet" - (format "(function " @ "(arr,idx) {" - "var temp = arr[" int//to-number "(idx)];" - (format "if(temp !== undefined) {" - (format "return " (some "temp") ";") - "}" - "else {" - (format "return " none ";") - "}") - "})")) - -(runtime: array//put "arrayPut" - (format "(function " @ "(arr,idx,val) {" - "arr[" int//to-number "(idx)] = val;" - "return arr;" - "})")) - -(runtime: array//remove "arrayRemove" - (format "(function " @ "(arr,idx) {" - "delete arr[" int//to-number "(idx)];" - "return arr;" - "})")) - -(def: runtime//array - Runtime - (format __array//get - __array//put - __array//remove)) - (runtime: io//log "log" (format "(function " @ "(message) {" "if(typeof console !== \"undefined\" && console.log) { console.log(message); }" @@ -685,7 +656,6 @@ runtime//bit runtime//int runtime//text - runtime//array runtime//io runtime//js)) diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux index 49b1971f1..2c470c44c 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux @@ -113,15 +113,6 @@ (def: lux-intI $.Inst (|>> _.I2L (_.wrap #$.Long))) (def: jvm-intI $.Inst (|>> (_.unwrap #$.Long) _.L2I)) -(def: (array-writeI arrayI idxI elemI) - (-> $.Inst $.Inst $.Inst - $.Inst) - (|>> arrayI (_.CHECKCAST ($t.descriptor $Object-Array)) - _.DUP - idxI jvm-intI - elemI - _.AASTORE)) - (def: (predicateI tester) (-> (-> $.Label $.Inst) $.Inst) @@ -209,41 +200,6 @@ [bit//logical-right-shift _.LUSHR] ) -## [[Arrays]] -(def: (array//new lengthI) - Unary - (|>> lengthI jvm-intI (_.ANEWARRAY ($t.binary-name "java.lang.Object")))) - -(def: (array//get [arrayI idxI]) - Binary - (<| _.with-label (function (_ @is-null)) - _.with-label (function (_ @end)) - (|>> arrayI (_.CHECKCAST ($t.descriptor $Object-Array)) - idxI jvm-intI - _.AALOAD - _.DUP - (_.IFNULL @is-null) - runtimeT.someI - (_.GOTO @end) - (_.label @is-null) - _.POP - runtimeT.noneI - (_.label @end)))) - -(def: (array//put [arrayI idxI elemI]) - Trinary - (array-writeI arrayI idxI elemI)) - -(def: (array//remove [arrayI idxI]) - Binary - (array-writeI arrayI idxI _.NULL)) - -(def: (array//size arrayI) - Unary - (|>> arrayI (_.CHECKCAST ($t.descriptor $Object-Array)) - _.ARRAYLENGTH - lux-intI)) - ## [[Numbers]] (def: nat-method $.Method @@ -501,17 +457,6 @@ (install "clip" (trinary text//clip)) ))) -(def: array-procs - Bundle - (<| (prefix "array") - (|> (dict.new text.Hash<Text>) - (install "new" (unary array//new)) - (install "get" (binary array//get)) - (install "put" (trinary array//put)) - (install "remove" (binary array//remove)) - (install "size" (unary array//size)) - ))) - (def: io-procs Bundle (<| (prefix "io") @@ -537,7 +482,6 @@ (dict.merge int-procs) (dict.merge frac-procs) (dict.merge text-procs) - (dict.merge array-procs) (dict.merge io-procs) (dict.merge box-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux index 4b128f946..394dd3d34 100644 --- a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux @@ -155,27 +155,6 @@ [bit//logical-right-shift runtimeT.bit//logical-right-shift] ) -## [[Arrays]] -(def: (array//new sizeO) - Unary - (runtimeT.array//new sizeO)) - -(def: (array//get [arrayO idxO]) - Binary - (runtimeT.array//get arrayO idxO)) - -(def: (array//put [arrayO idxO elemO]) - Trinary - (runtimeT.array//put arrayO idxO elemO)) - -(def: (array//remove [arrayO idxO]) - Binary - (runtimeT.array//put arrayO idxO runtimeT.unit)) - -(def: array//size - Unary - lua.length) - ## [[Numbers]] (host.import: java/lang/Double (#static MIN_VALUE Double) @@ -387,17 +366,6 @@ (install "clip" (trinary text//clip)) ))) -(def: array-procs - Bundle - (<| (prefix "array") - (|> (dict.new text.Hash<Text>) - (install "new" (unary array//new)) - (install "get" (binary array//get)) - (install "put" (trinary array//put)) - (install "remove" (binary array//remove)) - (install "size" (unary array//size)) - ))) - (def: io-procs Bundle (<| (prefix "io") @@ -423,7 +391,6 @@ (dict.merge int-procs) (dict.merge frac-procs) (dict.merge text-procs) - (dict.merge array-procs) (dict.merge io-procs) (dict.merge box-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux index 774c28acf..f77a35292 100644 --- a/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux @@ -182,36 +182,6 @@ ## (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift)) ## ))) -## ## [[Arrays]] -## (def: (array//new sizeO) -## Unary -## (|> _.none -## list _.list -## (_.* sizeO))) - -## (def: (array//get [arrayO idxO]) -## Binary -## (runtimeT.array//get arrayO idxO)) - -## (def: (array//put [arrayO idxO elemO]) -## Trinary -## (runtimeT.array//put arrayO idxO elemO)) - -## (def: (array//remove [arrayO idxO]) -## Binary -## (runtimeT.array//put arrayO idxO _.none)) - -## (def: array-procs -## Bundle -## (<| (prefix "array") -## (|> (dict.new text.Hash<Text>) -## (install "new" (unary array//new)) -## (install "get" (binary array//get)) -## (install "put" (trinary array//put)) -## (install "remove" (binary array//remove)) -## (install "size" (unary _.length)) -## ))) - ## ## [[Numbers]] ## (host.import: java/lang/Double ## (#static MIN_VALUE Double) @@ -348,6 +318,5 @@ (dict.merge int-procs) ## (dict.merge frac-procs) ## (dict.merge text-procs) - ## (dict.merge array-procs) ## (dict.merge io-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux index a760dc3a2..430d4b5e7 100644 --- a/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux @@ -182,36 +182,6 @@ (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift)) ))) -## [[Arrays]] -(def: (array//new sizeO) - Unary - (|> python.none - list python.list - (python.* sizeO))) - -(def: (array//get [arrayO idxO]) - Binary - (runtimeT.array//get arrayO idxO)) - -(def: (array//put [arrayO idxO elemO]) - Trinary - (runtimeT.array//put arrayO idxO elemO)) - -(def: (array//remove [arrayO idxO]) - Binary - (runtimeT.array//put arrayO idxO python.none)) - -(def: array-procs - Bundle - (<| (prefix "array") - (|> (dict.new text.Hash<Text>) - (install "new" (unary array//new)) - (install "get" (binary array//get)) - (install "put" (trinary array//put)) - (install "remove" (binary array//remove)) - (install "size" (unary python.length)) - ))) - ## [[Numbers]] (host.import: java/lang/Double (#static MIN_VALUE Double) @@ -388,7 +358,6 @@ (dict.merge int-procs) (dict.merge frac-procs) (dict.merge text-procs) - (dict.merge array-procs) (dict.merge io-procs) (dict.merge box-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux index d8b383ff2..421618890 100644 --- a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux @@ -179,30 +179,6 @@ (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift)) ))) -## [[Arrays]] -(def: (array//get [arrayO idxO]) - Binary - (runtimeT.array//get arrayO idxO)) - -(def: (array//put [arrayO idxO elemO]) - Trinary - (runtimeT.array//put arrayO idxO elemO)) - -(def: (array//remove [arrayO idxO]) - Binary - (runtimeT.array//put arrayO idxO r.null)) - -(def: array-procs - Bundle - (<| (prefix "array") - (|> (dict.new text.Hash<Text>) - (install "new" (unary runtimeT.array//new)) - (install "get" (binary array//get)) - (install "put" (trinary array//put)) - (install "remove" (binary array//remove)) - (install "size" (unary r.length)) - ))) - ## [[Numbers]] (host.import: java/lang/Double (#static MIN_VALUE Double) @@ -380,7 +356,6 @@ (dict.merge int-procs) (dict.merge frac-procs) (dict.merge text-procs) - (dict.merge array-procs) (dict.merge io-procs) (dict.merge box-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux index 1f995b44b..e40f49b80 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux @@ -181,38 +181,6 @@ (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift)) ))) -## [[Arrays]] -(def: (array//new sizeO) - Unary - (ruby.apply "Array.new" (list sizeO))) - -(def: (array//get [arrayO idxO]) - Binary - (runtimeT.array//get arrayO idxO)) - -(def: (array//put [arrayO idxO elemO]) - Trinary - (runtimeT.array//put arrayO idxO elemO)) - -(def: (array//remove [arrayO idxO]) - Binary - (runtimeT.array//put arrayO idxO ruby.nil)) - -(def: array//size - Unary - ruby.length) - -(def: array-procs - Bundle - (<| (prefix "array") - (|> (dict.new text.Hash<Text>) - (install "new" (unary array//new)) - (install "get" (binary array//get)) - (install "put" (trinary array//put)) - (install "remove" (binary array//remove)) - (install "size" (unary array//size)) - ))) - ## [[Numbers]] (host.import: java/lang/Double (#static MIN_VALUE Double) @@ -421,7 +389,6 @@ (dict.merge int-procs) (dict.merge frac-procs) (dict.merge text-procs) - (dict.merge array-procs) (dict.merge io-procs) (dict.merge box-procs) ))) diff --git a/new-luxc/test/test/luxc/lang/translation/common.lux b/new-luxc/test/test/luxc/lang/translation/common.lux index 7fe49fae2..03e56fa18 100644 --- a/new-luxc/test/test/luxc/lang/translation/common.lux +++ b/new-luxc/test/test/luxc/lang/translation/common.lux @@ -274,59 +274,6 @@ #0))) ))) -(def: (array-spec run) - (-> Runner Test) - (do r.Monad<Random> - [size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 1)))) - idx (|> r.nat (:: @ map (n/% size))) - value r.nat - #let [array0S (#synthesis.Extension "lux array new" - (list (synthesis.i64 size))) - array1S (#synthesis.Extension "lux array put" - (list array0S - (synthesis.i64 idx) - (synthesis.i64 value)))]] - ($_ seq - (test "Can get size of array." - (|> (run (#synthesis.Extension "lux array size" - (list array0S))) - (case> (#e.Success valueV) - (n/= size (:coerce Nat valueV)) - - (#e.Error error) - (exec (log! error) - #0)))) - (test "Can get element from array (if it exists)." - (and (|> (run (#synthesis.Extension "lux array get" - (list array0S (synthesis.i64 idx)))) - (case> (^multi (#e.Success valueV) - [(:coerce (Maybe Nat) valueV) #.None]) - #1 - - _ - #0)) - (|> (run (#synthesis.Extension "lux array get" - (list array1S (synthesis.i64 idx)))) - (case> (^multi (#e.Success valueV) - [(:coerce (Maybe Nat) valueV) (#.Some valueV)]) - (n/= value valueV) - - _ - #0)))) - (test "Can remove element from array." - (|> (run (#synthesis.Extension "lux array get" - (list (#synthesis.Extension "lux array remove" - (list array1S - (synthesis.i64 idx))) - (synthesis.i64 idx)))) - (case> (^multi (#e.Success valueV) - [(:coerce (Maybe Nat) valueV) #.None]) - #1 - - _ - #0))) - ))) - (def: (io-spec run) (-> Runner Test) (do r.Monad<Random> @@ -421,7 +368,6 @@ (i64-spec run) (f64-spec run) (text-spec run) - (array-spec run) (io-spec run) (box-spec run) )) |