aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--luxc/src/lux/analyser/proc/jvm.clj128
-rw-r--r--luxc/src/lux/compiler/jvm/proc/host.clj118
-rw-r--r--stdlib/source/lux.lux16
-rw-r--r--stdlib/source/lux/control/applicative.lux20
-rw-r--r--stdlib/source/lux/data/coll/array.lux57
-rw-r--r--stdlib/source/lux/data/coll/dict.lux42
-rw-r--r--stdlib/source/lux/data/coll/sequence.lux70
-rw-r--r--stdlib/source/lux/host.jvm.lux94
-rw-r--r--stdlib/source/lux/world/blob.jvm.lux32
-rw-r--r--stdlib/test/test/lux/host.jvm.lux12
10 files changed, 259 insertions, 330 deletions
diff --git a/luxc/src/lux/analyser/proc/jvm.clj b/luxc/src/lux/analyser/proc/jvm.clj
index 760d0cbfd..69d734177 100644
--- a/luxc/src/lux/analyser/proc/jvm.clj
+++ b/luxc/src/lux/analyser/proc/jvm.clj
@@ -391,35 +391,35 @@
_cursor &/cursor]
(return (&/|list (&&/|meta output-type _cursor (&&/$proc (&/T ["jvm" <proc>]) (&/|list =value) (&/|list))))))))
- ^:private analyse-jvm-d2f "d2f" "java.lang.Double" "java.lang.Float"
- ^:private analyse-jvm-d2i "d2i" "java.lang.Double" "java.lang.Integer"
- ^:private analyse-jvm-d2l "d2l" "java.lang.Double" "java.lang.Long"
-
- ^:private analyse-jvm-f2d "f2d" "java.lang.Float" "java.lang.Double"
- ^:private analyse-jvm-f2i "f2i" "java.lang.Float" "java.lang.Integer"
- ^:private analyse-jvm-f2l "f2l" "java.lang.Float" "java.lang.Long"
-
- ^:private analyse-jvm-i2b "i2b" "java.lang.Integer" "java.lang.Byte"
- ^:private analyse-jvm-i2c "i2c" "java.lang.Integer" "java.lang.Character"
- ^:private analyse-jvm-i2d "i2d" "java.lang.Integer" "java.lang.Double"
- ^:private analyse-jvm-i2f "i2f" "java.lang.Integer" "java.lang.Float"
- ^:private analyse-jvm-i2l "i2l" "java.lang.Integer" "java.lang.Long"
- ^:private analyse-jvm-i2s "i2s" "java.lang.Integer" "java.lang.Short"
-
- ^:private analyse-jvm-l2d "l2d" "java.lang.Long" "java.lang.Double"
- ^:private analyse-jvm-l2f "l2f" "java.lang.Long" "java.lang.Float"
- ^:private analyse-jvm-l2i "l2i" "java.lang.Long" "java.lang.Integer"
- ^:private analyse-jvm-l2s "l2s" "java.lang.Long" "java.lang.Short"
- ^:private analyse-jvm-l2b "l2b" "java.lang.Long" "java.lang.Byte"
-
- ^:private analyse-jvm-c2b "c2b" "java.lang.Character" "java.lang.Byte"
- ^:private analyse-jvm-c2s "c2s" "java.lang.Character" "java.lang.Short"
- ^:private analyse-jvm-c2i "c2i" "java.lang.Character" "java.lang.Integer"
- ^:private analyse-jvm-c2l "c2l" "java.lang.Character" "java.lang.Long"
-
- ^:private analyse-jvm-s2l "s2l" "java.lang.Short" "java.lang.Long"
-
- ^:private analyse-jvm-b2l "b2l" "java.lang.Byte" "java.lang.Long"
+ ^:private analyse-jvm-double-to-float "double-to-float" "java.lang.Double" "java.lang.Float"
+ ^:private analyse-jvm-double-to-int "double-to-int" "java.lang.Double" "java.lang.Integer"
+ ^:private analyse-jvm-double-to-long "double-to-long" "java.lang.Double" "java.lang.Long"
+
+ ^:private analyse-jvm-float-to-double "float-to-double" "java.lang.Float" "java.lang.Double"
+ ^:private analyse-jvm-float-to-int "float-to-int" "java.lang.Float" "java.lang.Integer"
+ ^:private analyse-jvm-float-to-long "float-to-long" "java.lang.Float" "java.lang.Long"
+
+ ^:private analyse-jvm-int-to-byte "int-to-byte" "java.lang.Integer" "java.lang.Byte"
+ ^:private analyse-jvm-int-to-char "int-to-char" "java.lang.Integer" "java.lang.Character"
+ ^:private analyse-jvm-int-to-double "int-to-double" "java.lang.Integer" "java.lang.Double"
+ ^:private analyse-jvm-int-to-float "int-to-float" "java.lang.Integer" "java.lang.Float"
+ ^:private analyse-jvm-int-to-long "int-to-long" "java.lang.Integer" "java.lang.Long"
+ ^:private analyse-jvm-int-to-short "int-to-short" "java.lang.Integer" "java.lang.Short"
+
+ ^:private analyse-jvm-long-to-double "long-to-double" "java.lang.Long" "java.lang.Double"
+ ^:private analyse-jvm-long-to-float "long-to-float" "java.lang.Long" "java.lang.Float"
+ ^:private analyse-jvm-long-to-int "long-to-int" "java.lang.Long" "java.lang.Integer"
+ ^:private analyse-jvm-long-to-short "long-to-short" "java.lang.Long" "java.lang.Short"
+ ^:private analyse-jvm-long-to-byte "long-to-byte" "java.lang.Long" "java.lang.Byte"
+
+ ^:private analyse-jvm-char-to-byte "char-to-byte" "java.lang.Character" "java.lang.Byte"
+ ^:private analyse-jvm-char-to-short "char-to-short" "java.lang.Character" "java.lang.Short"
+ ^:private analyse-jvm-char-to-int "char-to-int" "java.lang.Character" "java.lang.Integer"
+ ^:private analyse-jvm-char-to-long "char-to-long" "java.lang.Character" "java.lang.Long"
+
+ ^:private analyse-jvm-short-to-long "short-to-long" "java.lang.Short" "java.lang.Long"
+
+ ^:private analyse-jvm-byte-to-long "byte-to-long" "java.lang.Byte" "java.lang.Long"
)
(do-template [<name> <proc> <v1-class> <v2-class> <to-class>]
@@ -602,7 +602,7 @@
(&&/$proc (&/T ["jvm" "arraylength"]) (&/|list =array) (&/|list))
)))))
-(defn ^:private analyse-jvm-null? [analyse exo-type ?values]
+(defn ^:private analyse-jvm-object-null? [analyse exo-type ?values]
(|do [:let [(&/$Cons object (&/$Nil)) ?values]
=object (&&/analyse-1+ analyse object)
_ (ensure-object (&&/expr-type* =object))
@@ -610,24 +610,24 @@
_ (&type/check exo-type output-type)
_cursor &/cursor]
(return (&/|list (&&/|meta exo-type _cursor
- (&&/$proc (&/T ["jvm" "null?"]) (&/|list =object) (&/|list)))))))
+ (&&/$proc (&/T ["jvm" "object null?"]) (&/|list =object) (&/|list)))))))
-(defn ^:private analyse-jvm-null [analyse exo-type ?values]
+(defn ^:private analyse-jvm-object-null [analyse exo-type ?values]
(|do [:let [(&/$Nil) ?values]
:let [output-type (&/$Primitive &host-type/null-data-tag &/$Nil)]
_ (&type/check exo-type output-type)
_cursor &/cursor]
(return (&/|list (&&/|meta exo-type _cursor
- (&&/$proc (&/T ["jvm" "null"]) (&/|list) (&/|list)))))))
+ (&&/$proc (&/T ["jvm" "object null"]) (&/|list) (&/|list)))))))
-(defn analyse-jvm-synchronized [analyse exo-type ?values]
+(defn analyse-jvm-object-synchronized [analyse exo-type ?values]
(|do [:let [(&/$Cons ?monitor (&/$Cons ?expr (&/$Nil))) ?values]
=monitor (&&/analyse-1+ analyse ?monitor)
_ (ensure-object (&&/expr-type* =monitor))
=expr (&&/analyse-1 analyse exo-type ?expr)
_cursor &/cursor]
(return (&/|list (&&/|meta exo-type _cursor
- (&&/$proc (&/T ["jvm" "synchronized"]) (&/|list =monitor =expr) (&/|list)))))))
+ (&&/$proc (&/T ["jvm" "object synchronized"]) (&/|list =monitor =expr) (&/|list)))))))
(defn ^:private analyse-jvm-throw [analyse exo-type ?values]
(|do [:let [(&/$Cons ?ex (&/$Nil)) ?values]
@@ -804,7 +804,7 @@
(return (&/|list (&&/|meta output-type _cursor
(&&/$proc (&/T ["jvm" "instanceof"]) (&/|list =object) (&/|list class)))))))
-(defn ^:private analyse-jvm-load-class [analyse exo-type ?values]
+(defn ^:private analyse-jvm-object-class [analyse exo-type ?values]
(|do [:let [(&/$Cons [_ (&/$Text _class-name)] (&/$Nil)) ?values]
^ClassLoader class-loader &/loader
_ (try (do (.loadClass class-loader _class-name)
@@ -815,7 +815,7 @@
_ (&type/check exo-type output-type)
_cursor &/cursor]
(return (&/|list (&&/|meta output-type _cursor
- (&&/$proc (&/T ["jvm" "load-class"]) (&/|list) (&/|list _class-name output-type)))))))
+ (&&/$proc (&/T ["jvm" "object class"]) (&/|list) (&/|list _class-name output-type)))))))
(defn ^:private analyse-jvm-interface [analyse compile-interface interface-decl supers =anns =methods]
(|do [module &/get-module-name
@@ -900,11 +900,11 @@
(defn analyse-host [analyse exo-type compilers proc ?values]
(|let [[_ _ _ compile-class compile-interface] compilers]
(try (case proc
- "jvm synchronized" (analyse-jvm-synchronized analyse exo-type ?values)
- "jvm load-class" (analyse-jvm-load-class analyse exo-type ?values)
+ "jvm object synchronized" (analyse-jvm-object-synchronized analyse exo-type ?values)
+ "jvm object class" (analyse-jvm-object-class analyse exo-type ?values)
"jvm throw" (analyse-jvm-throw analyse exo-type ?values)
- "jvm null?" (analyse-jvm-null? analyse exo-type ?values)
- "jvm null" (analyse-jvm-null analyse exo-type ?values)
+ "jvm object null?" (analyse-jvm-object-null? analyse exo-type ?values)
+ "jvm object null" (analyse-jvm-object-null analyse exo-type ?values)
"jvm anewarray" (analyse-jvm-anewarray analyse exo-type ?values)
"jvm aaload" (analyse-jvm-aaload analyse exo-type ?values)
"jvm aastore" (analyse-jvm-aastore analyse exo-type ?values)
@@ -980,29 +980,29 @@
"jvm lshl" (analyse-jvm-lshl analyse exo-type ?values)
"jvm lshr" (analyse-jvm-lshr analyse exo-type ?values)
"jvm lushr" (analyse-jvm-lushr analyse exo-type ?values)
- "jvm d2f" (analyse-jvm-d2f analyse exo-type ?values)
- "jvm d2i" (analyse-jvm-d2i analyse exo-type ?values)
- "jvm d2l" (analyse-jvm-d2l analyse exo-type ?values)
- "jvm f2d" (analyse-jvm-f2d analyse exo-type ?values)
- "jvm f2i" (analyse-jvm-f2i analyse exo-type ?values)
- "jvm f2l" (analyse-jvm-f2l analyse exo-type ?values)
- "jvm i2b" (analyse-jvm-i2b analyse exo-type ?values)
- "jvm i2c" (analyse-jvm-i2c analyse exo-type ?values)
- "jvm i2d" (analyse-jvm-i2d analyse exo-type ?values)
- "jvm i2f" (analyse-jvm-i2f analyse exo-type ?values)
- "jvm i2l" (analyse-jvm-i2l analyse exo-type ?values)
- "jvm i2s" (analyse-jvm-i2s analyse exo-type ?values)
- "jvm l2d" (analyse-jvm-l2d analyse exo-type ?values)
- "jvm l2f" (analyse-jvm-l2f analyse exo-type ?values)
- "jvm l2i" (analyse-jvm-l2i analyse exo-type ?values)
- "jvm l2s" (analyse-jvm-l2s analyse exo-type ?values)
- "jvm l2b" (analyse-jvm-l2b analyse exo-type ?values)
- "jvm c2b" (analyse-jvm-c2b analyse exo-type ?values)
- "jvm c2s" (analyse-jvm-c2s analyse exo-type ?values)
- "jvm c2i" (analyse-jvm-c2i analyse exo-type ?values)
- "jvm c2l" (analyse-jvm-c2l analyse exo-type ?values)
- "jvm b2l" (analyse-jvm-b2l analyse exo-type ?values)
- "jvm s2l" (analyse-jvm-s2l analyse exo-type ?values)
+ "jvm convert double-to-float" (analyse-jvm-double-to-float analyse exo-type ?values)
+ "jvm convert double-to-int" (analyse-jvm-double-to-int analyse exo-type ?values)
+ "jvm convert double-to-long" (analyse-jvm-double-to-long analyse exo-type ?values)
+ "jvm convert float-to-double" (analyse-jvm-float-to-double analyse exo-type ?values)
+ "jvm convert float-to-int" (analyse-jvm-float-to-int analyse exo-type ?values)
+ "jvm convert float-to-long" (analyse-jvm-float-to-long analyse exo-type ?values)
+ "jvm convert int-to-byte" (analyse-jvm-int-to-byte analyse exo-type ?values)
+ "jvm convert int-to-char" (analyse-jvm-int-to-char analyse exo-type ?values)
+ "jvm convert int-to-double" (analyse-jvm-int-to-double analyse exo-type ?values)
+ "jvm convert int-to-float" (analyse-jvm-int-to-float analyse exo-type ?values)
+ "jvm convert int-to-long" (analyse-jvm-int-to-long analyse exo-type ?values)
+ "jvm convert int-to-short" (analyse-jvm-int-to-short analyse exo-type ?values)
+ "jvm convert long-to-double" (analyse-jvm-long-to-double analyse exo-type ?values)
+ "jvm convert long-to-float" (analyse-jvm-long-to-float analyse exo-type ?values)
+ "jvm convert long-to-int" (analyse-jvm-long-to-int analyse exo-type ?values)
+ "jvm convert long-to-short" (analyse-jvm-long-to-short analyse exo-type ?values)
+ "jvm convert long-to-byte" (analyse-jvm-long-to-byte analyse exo-type ?values)
+ "jvm convert char-to-byte" (analyse-jvm-char-to-byte analyse exo-type ?values)
+ "jvm convert char-to-short" (analyse-jvm-char-to-short analyse exo-type ?values)
+ "jvm convert char-to-int" (analyse-jvm-char-to-int analyse exo-type ?values)
+ "jvm convert char-to-long" (analyse-jvm-char-to-long analyse exo-type ?values)
+ "jvm convert byte-to-long" (analyse-jvm-byte-to-long analyse exo-type ?values)
+ "jvm convert short-to-long" (analyse-jvm-short-to-long analyse exo-type ?values)
;; else
(->> (&/fail-with-loc (str "[Analyser Error] Unknown host procedure: " ["jvm" proc]))
(if-let [[_ _def-code] (re-find #"^jvm interface:(.*)$" proc)]
diff --git a/luxc/src/lux/compiler/jvm/proc/host.clj b/luxc/src/lux/compiler/jvm/proc/host.clj
index 3d68bda68..041e72819 100644
--- a/luxc/src/lux/compiler/jvm/proc/host.clj
+++ b/luxc/src/lux/compiler/jvm/proc/host.clj
@@ -518,33 +518,33 @@
<wrap>)]]
(return nil)))
- ^:private compile-jvm-d2f Opcodes/D2F &&/unwrap-double &&/wrap-float
- ^:private compile-jvm-d2i Opcodes/D2I &&/unwrap-double &&/wrap-int
- ^:private compile-jvm-d2l Opcodes/D2L &&/unwrap-double &&/wrap-long
-
- ^:private compile-jvm-f2d Opcodes/F2D &&/unwrap-float &&/wrap-double
- ^:private compile-jvm-f2i Opcodes/F2I &&/unwrap-float &&/wrap-int
- ^:private compile-jvm-f2l Opcodes/F2L &&/unwrap-float &&/wrap-long
-
- ^:private compile-jvm-i2b Opcodes/I2B &&/unwrap-int &&/wrap-byte
- ^:private compile-jvm-i2c Opcodes/I2C &&/unwrap-int &&/wrap-char
- ^:private compile-jvm-i2d Opcodes/I2D &&/unwrap-int &&/wrap-double
- ^:private compile-jvm-i2f Opcodes/I2F &&/unwrap-int &&/wrap-float
- ^:private compile-jvm-i2l Opcodes/I2L &&/unwrap-int &&/wrap-long
- ^:private compile-jvm-i2s Opcodes/I2S &&/unwrap-int &&/wrap-short
-
- ^:private compile-jvm-l2d Opcodes/L2D &&/unwrap-long &&/wrap-double
- ^:private compile-jvm-l2f Opcodes/L2F &&/unwrap-long &&/wrap-float
- ^:private compile-jvm-l2i Opcodes/L2I &&/unwrap-long &&/wrap-int
-
- ^:private compile-jvm-c2b Opcodes/I2B &&/unwrap-char &&/wrap-byte
- ^:private compile-jvm-c2s Opcodes/I2S &&/unwrap-char &&/wrap-short
- ^:private compile-jvm-c2i Opcodes/NOP &&/unwrap-char &&/wrap-int
- ^:private compile-jvm-c2l Opcodes/I2L &&/unwrap-char &&/wrap-long
-
- ^:private compile-jvm-s2l Opcodes/I2L &&/unwrap-short &&/wrap-long
+ ^:private compile-jvm-double-to-float Opcodes/D2F &&/unwrap-double &&/wrap-float
+ ^:private compile-jvm-double-to-int Opcodes/D2I &&/unwrap-double &&/wrap-int
+ ^:private compile-jvm-double-to-long Opcodes/D2L &&/unwrap-double &&/wrap-long
+
+ ^:private compile-jvm-float-to-double Opcodes/F2D &&/unwrap-float &&/wrap-double
+ ^:private compile-jvm-float-to-int Opcodes/F2I &&/unwrap-float &&/wrap-int
+ ^:private compile-jvm-float-to-long Opcodes/F2L &&/unwrap-float &&/wrap-long
+
+ ^:private compile-jvm-int-to-byte Opcodes/I2B &&/unwrap-int &&/wrap-byte
+ ^:private compile-jvm-int-to-char Opcodes/I2C &&/unwrap-int &&/wrap-char
+ ^:private compile-jvm-int-to-double Opcodes/I2D &&/unwrap-int &&/wrap-double
+ ^:private compile-jvm-int-to-float Opcodes/I2F &&/unwrap-int &&/wrap-float
+ ^:private compile-jvm-int-to-long Opcodes/I2L &&/unwrap-int &&/wrap-long
+ ^:private compile-jvm-int-to-short Opcodes/I2S &&/unwrap-int &&/wrap-short
+
+ ^:private compile-jvm-long-to-double Opcodes/L2D &&/unwrap-long &&/wrap-double
+ ^:private compile-jvm-long-to-float Opcodes/L2F &&/unwrap-long &&/wrap-float
+ ^:private compile-jvm-long-to-int Opcodes/L2I &&/unwrap-long &&/wrap-int
+
+ ^:private compile-jvm-char-to-byte Opcodes/I2B &&/unwrap-char &&/wrap-byte
+ ^:private compile-jvm-char-to-short Opcodes/I2S &&/unwrap-char &&/wrap-short
+ ^:private compile-jvm-char-to-int Opcodes/NOP &&/unwrap-char &&/wrap-int
+ ^:private compile-jvm-char-to-long Opcodes/I2L &&/unwrap-char &&/wrap-long
+
+ ^:private compile-jvm-short-to-long Opcodes/I2L &&/unwrap-short &&/wrap-long
- ^:private compile-jvm-b2l Opcodes/I2L &&/unwrap-byte &&/wrap-long
+ ^:private compile-jvm-byte-to-long Opcodes/I2L &&/unwrap-byte &&/wrap-long
)
(do-template [<name> <op> <wrap>]
@@ -559,8 +559,8 @@
<wrap>)]]
(return nil)))
- ^:private compile-jvm-l2s Opcodes/I2S &&/wrap-short
- ^:private compile-jvm-l2b Opcodes/I2B &&/wrap-byte
+ ^:private compile-jvm-long-to-short Opcodes/I2S &&/wrap-short
+ ^:private compile-jvm-long-to-byte Opcodes/I2B &&/wrap-byte
)
(do-template [<name> <op> <unwrap-left> <unwrap-right> <wrap>]
@@ -814,14 +814,14 @@
&&/wrap-long)]]
(return nil)))
-(defn ^:private compile-jvm-null [compile ?values special-args]
+(defn ^:private compile-jvm-object-null [compile ?values special-args]
(|do [:let [;; (&/$Nil) ?values
(&/$Nil) special-args]
^MethodVisitor *writer* &/get-writer
:let [_ (.visitInsn *writer* Opcodes/ACONST_NULL)]]
(return nil)))
-(defn ^:private compile-jvm-null? [compile ?values special-args]
+(defn ^:private compile-jvm-object-null? [compile ?values special-args]
(|do [:let [(&/$Cons ?object (&/$Nil)) ?values
;; (&/$Nil) special-args
]
@@ -838,7 +838,7 @@
(.visitLabel $end))]]
(return nil)))
-(defn compile-jvm-synchronized [compile ?values special-args]
+(defn compile-jvm-object-synchronized [compile ?values special-args]
(|do [:let [(&/$Cons ?monitor (&/$Cons ?expr (&/$Nil))) ?values
;; (&/$Nil) special-args
]
@@ -971,7 +971,7 @@
(.visitMethodInsn Opcodes/INVOKESPECIAL class* "<init>" init-sig))]]
(return nil)))
-(defn ^:private compile-jvm-load-class [compile ?values special-args]
+(defn ^:private compile-jvm-object-class [compile ?values special-args]
(|do [:let [(&/$Cons _class-name (&/$Cons ?output-type (&/$Nil))) special-args]
^MethodVisitor *writer* &/get-writer
:let [_ (doto *writer*
@@ -993,8 +993,8 @@
(defn compile-proc [compile proc-name ?values special-args]
(case proc-name
- "synchronized" (compile-jvm-synchronized compile ?values special-args)
- "load-class" (compile-jvm-load-class compile ?values special-args)
+ "object synchronized" (compile-jvm-object-synchronized compile ?values special-args)
+ "object class" (compile-jvm-object-class compile ?values special-args)
"instanceof" (compile-jvm-instanceof compile ?values special-args)
"new" (compile-jvm-new compile ?values special-args)
"invokestatic" (compile-jvm-invokestatic compile ?values special-args)
@@ -1006,8 +1006,8 @@
"putstatic" (compile-jvm-putstatic compile ?values special-args)
"putfield" (compile-jvm-putfield compile ?values special-args)
"throw" (compile-jvm-throw compile ?values special-args)
- "null?" (compile-jvm-null? compile ?values special-args)
- "null" (compile-jvm-null compile ?values special-args)
+ "object null?" (compile-jvm-object-null? compile ?values special-args)
+ "object null" (compile-jvm-object-null compile ?values special-args)
"anewarray" (compile-jvm-anewarray compile ?values special-args)
"aaload" (compile-jvm-aaload compile ?values special-args)
"aastore" (compile-jvm-aastore compile ?values special-args)
@@ -1083,28 +1083,28 @@
"lshl" (compile-jvm-lshl compile ?values special-args)
"lshr" (compile-jvm-lshr compile ?values special-args)
"lushr" (compile-jvm-lushr compile ?values special-args)
- "d2f" (compile-jvm-d2f compile ?values special-args)
- "d2i" (compile-jvm-d2i compile ?values special-args)
- "d2l" (compile-jvm-d2l compile ?values special-args)
- "f2d" (compile-jvm-f2d compile ?values special-args)
- "f2i" (compile-jvm-f2i compile ?values special-args)
- "f2l" (compile-jvm-f2l compile ?values special-args)
- "i2b" (compile-jvm-i2b compile ?values special-args)
- "i2c" (compile-jvm-i2c compile ?values special-args)
- "i2d" (compile-jvm-i2d compile ?values special-args)
- "i2f" (compile-jvm-i2f compile ?values special-args)
- "i2l" (compile-jvm-i2l compile ?values special-args)
- "i2s" (compile-jvm-i2s compile ?values special-args)
- "l2d" (compile-jvm-l2d compile ?values special-args)
- "l2f" (compile-jvm-l2f compile ?values special-args)
- "l2i" (compile-jvm-l2i compile ?values special-args)
- "l2s" (compile-jvm-l2s compile ?values special-args)
- "l2b" (compile-jvm-l2b compile ?values special-args)
- "c2b" (compile-jvm-c2b compile ?values special-args)
- "c2s" (compile-jvm-c2s compile ?values special-args)
- "c2i" (compile-jvm-c2i compile ?values special-args)
- "c2l" (compile-jvm-c2l compile ?values special-args)
- "s2l" (compile-jvm-s2l compile ?values special-args)
- "b2l" (compile-jvm-b2l compile ?values special-args)
+ "double-to-float" (compile-jvm-double-to-float compile ?values special-args)
+ "double-to-int" (compile-jvm-double-to-int compile ?values special-args)
+ "double-to-long" (compile-jvm-double-to-long compile ?values special-args)
+ "float-to-double" (compile-jvm-float-to-double compile ?values special-args)
+ "float-to-int" (compile-jvm-float-to-int compile ?values special-args)
+ "float-to-long" (compile-jvm-float-to-long compile ?values special-args)
+ "int-to-byte" (compile-jvm-int-to-byte compile ?values special-args)
+ "int-to-char" (compile-jvm-int-to-char compile ?values special-args)
+ "int-to-double" (compile-jvm-int-to-double compile ?values special-args)
+ "int-to-float" (compile-jvm-int-to-float compile ?values special-args)
+ "int-to-long" (compile-jvm-int-to-long compile ?values special-args)
+ "int-to-short" (compile-jvm-int-to-short compile ?values special-args)
+ "long-to-double" (compile-jvm-long-to-double compile ?values special-args)
+ "long-to-float" (compile-jvm-long-to-float compile ?values special-args)
+ "long-to-int" (compile-jvm-long-to-int compile ?values special-args)
+ "long-to-short" (compile-jvm-long-to-short compile ?values special-args)
+ "long-to-byte" (compile-jvm-long-to-byte compile ?values special-args)
+ "char-to-byte" (compile-jvm-char-to-byte compile ?values special-args)
+ "char-to-short" (compile-jvm-char-to-short compile ?values special-args)
+ "char-to-int" (compile-jvm-char-to-int compile ?values special-args)
+ "char-to-long" (compile-jvm-char-to-long compile ?values special-args)
+ "short-to-long" (compile-jvm-short-to-long compile ?values special-args)
+ "byte-to-long" (compile-jvm-byte-to-long compile ?values special-args)
;; else
(&/fail-with-loc (str "[Compiler Error] Unknown host procedure: " ["jvm" proc-name]))))
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index 99cefa854..cf5707996 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -593,14 +593,14 @@
default-def-meta-exported)))
## (type: Module
-## {#module-hash Nat
-## #module-aliases (List [Text Text])
-## #definitions (List [Text Definition])
-## #imports (List Text)
-## #tags (List [Text [Nat (List Ident) Bool Type]])
-## #types (List [Text [(List Ident) Bool Type]])
-## #module-anns (Maybe Code)
-## #module-state Module-State})
+## {#module-hash Nat
+## #module-aliases (List [Text Text])
+## #definitions (List [Text Definition])
+## #imports (List Text)
+## #tags (List [Text [Nat (List Ident) Bool Type]])
+## #types (List [Text [(List Ident) Bool Type]])
+## #module-annotations (Maybe Code)
+## #module-state Module-State})
("lux def" Module
(#Named ["lux" "Module"]
(#Product ## "lux.module-hash"
diff --git a/stdlib/source/lux/control/applicative.lux b/stdlib/source/lux/control/applicative.lux
index a2326cd84..54cef5c45 100644
--- a/stdlib/source/lux/control/applicative.lux
+++ b/stdlib/source/lux/control/applicative.lux
@@ -22,14 +22,14 @@
(def: wrap
(|>> (:: Applicative<G> wrap) (:: Applicative<F> wrap)))
(def: (apply fgf fgx)
- ## (let [fgf' (:: Applicative<F> apply
- ## (:: Applicative<F> wrap (:: Applicative<G> apply))
- ## fgf)]
- ## (:: Applicative<F> apply fgf' fgx))
- (let [applyF (:: Applicative<F> apply)
- applyG (:: Applicative<G> apply)]
- ($_ applyF
- (:: Applicative<F> wrap applyG)
- fgf
- fgx))
+ (let [fgf' (:: Applicative<F> apply
+ (:: Applicative<F> wrap (:: Applicative<G> apply))
+ fgf)]
+ (:: Applicative<F> apply fgf' fgx))
+ ## (let [applyF (:: Applicative<F> apply)
+ ## applyG (:: Applicative<G> apply)]
+ ## ($_ applyF
+ ## (:: Applicative<F> wrap applyG)
+ ## fgf
+ ## fgx))
))
diff --git a/stdlib/source/lux/data/coll/array.lux b/stdlib/source/lux/data/coll/array.lux
index b45cab136..0e4afb4a5 100644
--- a/stdlib/source/lux/data/coll/array.lux
+++ b/stdlib/source/lux/data/coll/array.lux
@@ -67,30 +67,17 @@
(def: #export (filter p xs)
(All [a]
(-> (-> a Bool) (Array a) (Array a)))
- (list/fold (: (-> Nat (Array ($ +0)) (Array ($ +0)))
- (function [idx xs']
- (case (read idx xs)
- #.None
- xs'
-
- (#.Some x)
- (if (p x)
- xs'
- (delete idx xs')))))
+ (list/fold (function [idx xs']
+ (case (read idx xs)
+ #.None
+ xs'
+
+ (#.Some x)
+ (if (p x)
+ xs'
+ (delete idx xs'))))
xs
- (list.indices (size xs)))
- ## (list/fold (function [idx xs']
- ## (case (read idx xs)
- ## #.None
- ## xs'
-
- ## (#.Some x)
- ## (if (p x)
- ## xs'
- ## (delete idx xs'))))
- ## xs
- ## (list.indices (size xs)))
- )
+ (list.indices (size xs))))
(def: #export (find p xs)
(All [a]
@@ -198,25 +185,15 @@
(let [arr-size (size ma)]
(if (n/= +0 arr-size)
(new arr-size)
- (list/fold (: (-> Nat (Array ($ +1)) (Array ($ +1)))
- (function [idx mb]
- (case (read idx ma)
- #.None
- mb
-
- (#.Some x)
- (write idx (f x) mb))))
+ (list/fold (function [idx mb]
+ (case (read idx ma)
+ #.None
+ mb
+
+ (#.Some x)
+ (write idx (f x) mb)))
(new arr-size)
(list.n/range +0 (n/dec arr-size)))
- ## (list/fold (function [idx mb]
- ## (case (read idx ma)
- ## #.None
- ## mb
-
- ## (#.Some x)
- ## (write idx (f x) mb)))
- ## (new arr-size)
- ## (list.n/range +0 (n/dec arr-size)))
))))
(struct: #export _ (Fold Array)
diff --git a/stdlib/source/lux/data/coll/dict.lux b/stdlib/source/lux/data/coll/dict.lux
index 5b61830d5..e00cbb17f 100644
--- a/stdlib/source/lux/data/coll/dict.lux
+++ b/stdlib/source/lux/data/coll/dict.lux
@@ -120,9 +120,7 @@
(def: (insert! idx value old-array)
(All [a] (-> Index a (Array a) (Array a)))
(let [old-size (array.size old-array)]
- (|> ## (array.new (n/inc old-size))
- (: (Array ($ +0))
- (array.new (n/inc old-size)))
+ (|> (array.new (n/inc old-size))
(array.copy idx +0 old-array +0)
(array.write idx value)
(array.copy (n/- idx old-size) idx old-array (n/inc idx)))))
@@ -234,10 +232,7 @@
(array.write insertion-idx (#.Left sub-node) base)]])
)))
[+0 [clean-bitmap
- ## (array.new (n/dec h-size))
- (: (Base ($ +0) ($ +1))
- (array.new (n/dec h-size)))
- ]]
+ (array.new (n/dec h-size))]]
(list.indices (array.size h-array)))))
## When #Base nodes grow too large, they're promoted to #Hierarchy to
@@ -267,10 +262,7 @@
(undefined))]
default))
[+0
- ## (array.new hierarchy-nodes-size)
- (: (Array (Node ($ +0) ($ +1)))
- (array.new hierarchy-nodes-size))
- ]
+ (array.new hierarchy-nodes-size)]
hierarchy-indices)))
## All empty nodes look the same (a #Base node with clean bitmap is
@@ -292,20 +284,12 @@
## a sub-node. If impossible, I introduced a new singleton sub-node.
(#Hierarchy _size hierarchy)
(let [idx (level-index level hash)
- ## [_size' sub-node] (case (array.read idx hierarchy)
- ## (#.Some sub-node)
- ## [_size sub-node]
-
- ## _
- ## [(n/inc _size) empty])
- [_size' sub-node] (: [Nat (Node ($ +0) ($ +1))]
- (case (array.read idx hierarchy)
- (#.Some sub-node)
- [_size sub-node]
-
- _
- [(n/inc _size) empty]))
- ]
+ [_size' sub-node] (case (array.read idx hierarchy)
+ (#.Some sub-node)
+ [_size sub-node]
+
+ _
+ [(n/inc _size) empty])]
(#Hierarchy _size'
(update! idx (put' (level-up level) hash key val Hash<k> sub-node)
hierarchy)))
@@ -339,9 +323,7 @@
## the same, a new
## #Collisions node
## is added.
- (#Collisions hash (|> ## (array.new +2)
- (: (Array [($ +0) ($ +1)])
- (array.new +2))
+ (#Collisions hash (|> (array.new +2)
(array.write +0 [key' val'])
(array.write +1 [key val])))
## Otherwise, I can
@@ -386,9 +368,7 @@
## If the hashes are not equal, I create a new #Base node that
## contains the old #Collisions node, plus the new KV-pair.
(|> (#Base (bit-position level _hash)
- (|> ## (array.new +1)
- (: (Base ($ +0) ($ +1))
- (array.new +1))
+ (|> (array.new +1)
(array.write +0 (#.Left node))))
(put' level hash key val Hash<k>)))
))
diff --git a/stdlib/source/lux/data/coll/sequence.lux b/stdlib/source/lux/data/coll/sequence.lux
index bc9787adf..b65ea1252 100644
--- a/stdlib/source/lux/data/coll/sequence.lux
+++ b/stdlib/source/lux/data/coll/sequence.lux
@@ -74,17 +74,13 @@
(All [a] (-> Level (Base a) (Node a)))
(if (n/= +0 level)
(#Base tail)
- (|> ## (new-hierarchy [])
- (: (Hierarchy ($ +0))
- (new-hierarchy []))
+ (|> (new-hierarchy [])
(array.write +0 (new-path (level-down level) tail))
#Hierarchy)))
(def: (new-tail singleton)
(All [a] (-> a (Base a)))
- (|> ## (array.new +1)
- (: (Base ($ +0))
- (array.new +1))
+ (|> (array.new +1)
(array.write +0 singleton)))
(def: (push-tail size level tail parent)
@@ -112,9 +108,9 @@
(def: (expand-tail val tail)
(All [a] (-> a (Base a) (Base a)))
(let [tail-size (array.size tail)]
- (|> ## (array.new (n/inc tail-size))
- (: (Base ($ +0))
- (array.new (n/inc tail-size)))
+ (|> (array.new (n/inc tail-size))
+ ## (: (Base ($ +0))
+ ## (array.new (n/inc tail-size)))
(array.copy tail-size +0 tail +0)
(array.write tail-size val)
)))
@@ -300,43 +296,21 @@
(maybe.assume
(do maybe.Monad<Maybe>
[new-tail (base-for (n/- +2 vec-size) vec)
- #let [## [level' root'] (let [init-level (get@ #level vec)]
- ## (loop [level init-level
- ## root (maybe.default (new-hierarchy [])
- ## (pop-tail vec-size init-level (get@ #root vec)))
- ## ## root (: (Hierarchy ($ +0))
- ## ## (maybe.default (new-hierarchy [])
- ## ## (pop-tail vec-size init-level (get@ #root vec))))
- ## ]
- ## (if (n/> branching-exponent level)
- ## (case [(array.read +1 root) (array.read +0 root)]
- ## [#.None (#.Some (#Hierarchy sub-node))]
- ## (recur (level-down level) sub-node)
-
- ## ## [#.None (#.Some (#Base _))]
- ## ## (undefined)
-
- ## _
- ## [level root])
- ## [level root])))
- [level' root'] (: [Level (Hierarchy ($ +0))]
- (let [init-level (get@ #level vec)]
- (loop [level init-level
- root (: (Hierarchy ($ +0))
- (maybe.default (new-hierarchy [])
- (pop-tail vec-size init-level (get@ #root vec))))]
- (if (n/> branching-exponent level)
- (case [(array.read +1 root) (array.read +0 root)]
- [#.None (#.Some (#Hierarchy sub-node))]
- (recur (level-down level) sub-node)
-
- [#.None (#.Some (#Base _))]
- (undefined)
-
- _
- [level root])
- [level root]))))
- ]]
+ #let [[level' root'] (let [init-level (get@ #level vec)]
+ (loop [level init-level
+ root (maybe.default (new-hierarchy [])
+ (pop-tail vec-size init-level (get@ #root vec)))]
+ (if (n/> branching-exponent level)
+ (case [(array.read +1 root) (array.read +0 root)]
+ [#.None (#.Some (#Hierarchy sub-node))]
+ (recur (level-down level) sub-node)
+
+ ## [#.None (#.Some (#Base _))]
+ ## (undefined)
+
+ _
+ [level root])
+ [level root])))]]
(wrap (|> vec
(update@ #size n/dec)
(set@ #level level')
@@ -352,9 +326,7 @@
(def: #export (from-list list)
(All [a] (-> (List a) (Sequence a)))
(list/fold add
- ## empty
- (: (Sequence ($ +0))
- empty)
+ empty
list))
(def: #export (member? a/Eq vec val)
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux
index ba556458a..954e55416 100644
--- a/stdlib/source/lux/host.jvm.lux
+++ b/stdlib/source/lux/host.jvm.lux
@@ -28,35 +28,35 @@
(-> (primitive <from>) (primitive <to>))
(<op> value))]
- [b2l "jvm b2l" "java.lang.Byte" "java.lang.Long"]
+ [byte-to-long "jvm convert byte-to-long" "java.lang.Byte" "java.lang.Long"]
- [s2l "jvm s2l" "java.lang.Short" "java.lang.Long"]
+ [short-to-long "jvm convert short-to-long" "java.lang.Short" "java.lang.Long"]
- [d2i "jvm d2i" "java.lang.Double" "java.lang.Integer"]
- [d2l "jvm d2l" "java.lang.Double" "java.lang.Long"]
- [d2f "jvm d2f" "java.lang.Double" "java.lang.Float"]
+ [double-to-int "jvm convert double-to-int" "java.lang.Double" "java.lang.Integer"]
+ [double-to-long "jvm convert double-to-long" "java.lang.Double" "java.lang.Long"]
+ [double-to-float "jvm convert double-to-float" "java.lang.Double" "java.lang.Float"]
- [f2i "jvm f2i" "java.lang.Float" "java.lang.Integer"]
- [f2l "jvm f2l" "java.lang.Float" "java.lang.Long"]
- [f2d "jvm f2d" "java.lang.Float" "java.lang.Double"]
+ [float-to-int "jvm convert float-to-int" "java.lang.Float" "java.lang.Integer"]
+ [float-to-long "jvm convert float-to-long" "java.lang.Float" "java.lang.Long"]
+ [float-to-double "jvm convert float-to-double" "java.lang.Float" "java.lang.Double"]
- [i2b "jvm i2b" "java.lang.Integer" "java.lang.Byte"]
- [i2s "jvm i2s" "java.lang.Integer" "java.lang.Short"]
- [i2l "jvm i2l" "java.lang.Integer" "java.lang.Long"]
- [i2f "jvm i2f" "java.lang.Integer" "java.lang.Float"]
- [i2d "jvm i2d" "java.lang.Integer" "java.lang.Double"]
- [i2c "jvm i2c" "java.lang.Integer" "java.lang.Character"]
-
- [l2b "jvm l2b" "java.lang.Long" "java.lang.Byte"]
- [l2s "jvm l2s" "java.lang.Long" "java.lang.Short"]
- [l2i "jvm l2i" "java.lang.Long" "java.lang.Integer"]
- [l2f "jvm l2f" "java.lang.Long" "java.lang.Float"]
- [l2d "jvm l2d" "java.lang.Long" "java.lang.Double"]
-
- [c2b "jvm c2b" "java.lang.Character" "java.lang.Byte"]
- [c2s "jvm c2s" "java.lang.Character" "java.lang.Short"]
- [c2i "jvm c2i" "java.lang.Character" "java.lang.Integer"]
- [c2l "jvm c2l" "java.lang.Character" "java.lang.Long"]
+ [int-to-byte "jvm convert int-to-byte" "java.lang.Integer" "java.lang.Byte"]
+ [int-to-short "jvm convert int-to-short" "java.lang.Integer" "java.lang.Short"]
+ [int-to-long "jvm convert int-to-long" "java.lang.Integer" "java.lang.Long"]
+ [int-to-float "jvm convert int-to-float" "java.lang.Integer" "java.lang.Float"]
+ [int-to-double "jvm convert int-to-double" "java.lang.Integer" "java.lang.Double"]
+ [int-to-char "jvm convert int-to-char" "java.lang.Integer" "java.lang.Character"]
+
+ [long-to-byte "jvm convert long-to-byte" "java.lang.Long" "java.lang.Byte"]
+ [long-to-short "jvm convert long-to-short" "java.lang.Long" "java.lang.Short"]
+ [long-to-int "jvm convert long-to-int" "java.lang.Long" "java.lang.Integer"]
+ [long-to-float "jvm convert long-to-float" "java.lang.Long" "java.lang.Float"]
+ [long-to-double "jvm convert long-to-double" "java.lang.Long" "java.lang.Double"]
+
+ [char-to-byte "jvm convert char-to-byte" "java.lang.Character" "java.lang.Byte"]
+ [char-to-short "jvm convert char-to-short" "java.lang.Character" "java.lang.Short"]
+ [char-to-int "jvm convert char-to-int" "java.lang.Character" "java.lang.Integer"]
+ [char-to-long "jvm convert char-to-long" "java.lang.Character" "java.lang.Long"]
)
## [Utils]
@@ -1380,7 +1380,7 @@
(syntax: #export (null)
{#.doc (doc "Null object reference."
(null))}
- (wrap (list (` ("jvm null")))))
+ (wrap (list (` ("jvm object null")))))
(def: #export (null? obj)
{#.doc (doc "Test for null object reference."
@@ -1391,7 +1391,7 @@
"=>"
false)}
(-> (primitive "java.lang.Object") Bool)
- ("jvm null?" obj))
+ ("jvm object null?" obj))
(syntax: #export (??? expr)
{#.doc (doc "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it."
@@ -1403,7 +1403,7 @@
(#.Some "YOLO"))}
(with-gensyms [g!temp]
(wrap (list (` (let [(~ g!temp) (~ expr)]
- (if ("jvm null?" (~ g!temp))
+ (if ("jvm object null?" (~ g!temp))
#.None
(#.Some (~ g!temp)))))))))
@@ -1422,7 +1422,7 @@
(~ g!value)
#.None
- ("jvm null")}))))))
+ ("jvm object null")}))))))
(syntax: #export (try expr)
{#.doc (doc "Covers the expression in a try-catch block."
@@ -1456,7 +1456,7 @@
(exec (do-something ___)
(do-something-else ___)
(finish-the-computation ___))))}
- (wrap (list (` ("jvm synchronized" (~ lock) (~ body))))))
+ (wrap (list (` ("jvm object synchronized" (~ lock) (~ body))))))
(syntax: #export (do-to obj [methods (p.some partial-call^)])
{#.doc (doc "Call a variety of methods on an object. Then, return the object."
@@ -1595,16 +1595,16 @@
#AutoPrM
(case output-type
(#GenericClass ["byte" _])
- (` (b2l (~ body)))
+ (` (byte-to-long (~ body)))
(#GenericClass ["short" _])
- (` (s2l (~ body)))
+ (` (short-to-long (~ body)))
(#GenericClass ["int" _])
- (` (i2l (~ body)))
+ (` (int-to-long (~ body)))
(#GenericClass ["float" _])
- (` (f2d (~ body)))
+ (` (float-to-double (~ body)))
_
body)))
@@ -1621,10 +1621,10 @@
(def: (auto-conv [class var])
(-> [Text Code] (List Code))
(case class
- "byte" (list var (` (l2b (~ var))))
- "short" (list var (` (l2s (~ var))))
- "int" (list var (` (l2i (~ var))))
- "float" (list var (` (d2f (~ var))))
+ "byte" (list var (` (long-to-byte (~ var))))
+ "short" (list var (` (long-to-short (~ var))))
+ "int" (list var (` (long-to-int (~ var))))
+ "float" (list var (` (double-to-float (~ var))))
_ (list)))
(def: (with-mode-inputs mode inputs body)
@@ -1647,10 +1647,10 @@
#AutoPrM
(case (simple-class$ (list) class)
- "byte" (` (b2l (~ output)))
- "short" (` (s2l (~ output)))
- "int" (` (i2l (~ output)))
- "float" (` (f2d (~ output)))
+ "byte" (` (byte-to-long (~ output)))
+ "short" (` (short-to-long (~ output)))
+ "int" (` (int-to-long (~ output)))
+ "float" (` (float-to-double (~ output)))
_ output)))
(def: (with-mode-field-set mode class g!input)
@@ -1661,10 +1661,10 @@
#AutoPrM
(case (simple-class$ (list) class)
- "byte" (` (l2b (~ g!input)))
- "short" (` (l2s (~ g!input)))
- "int" (` (l2i (~ g!input)))
- "float" (` (d2f (~ g!input)))
+ "byte" (` (long-to-byte (~ g!input)))
+ "short" (` (long-to-short (~ g!input)))
+ "int" (` (long-to-int (~ g!input)))
+ "float" (` (double-to-float (~ g!input)))
_ g!input)))
(def: (member-def-interop type-params kind class [arg-function-inputs arg-method-inputs arg-classes arg-types] member method-prefix)
@@ -2042,7 +2042,7 @@
[type (generic-type^ imports (list))])
{#.doc (doc "Loads the class as a java.lang.Class object."
(class-for java/lang/String))}
- (wrap (list (` ("jvm load-class" (~ (code.text (simple-class$ (list) type))))))))
+ (wrap (list (` ("jvm object class" (~ (code.text (simple-class$ (list) type))))))))
(def: get-compiler
(Meta Compiler)
diff --git a/stdlib/source/lux/world/blob.jvm.lux b/stdlib/source/lux/world/blob.jvm.lux
index e4b130546..6b04948e3 100644
--- a/stdlib/source/lux/world/blob.jvm.lux
+++ b/stdlib/source/lux/world/blob.jvm.lux
@@ -24,7 +24,7 @@
(def: byte-to-nat
(-> (primitive "java.lang.Byte") Nat)
- (|>> host.b2l (:! Nat) (bit.and byte-mask)))
+ (|>> host.byte-to-long (:! Nat) (bit.and byte-mask)))
(def: #export (create size)
(-> Nat Blob)
@@ -72,7 +72,7 @@
(-> Nat Nat Blob (e.Error Unit))
(if (n/< (host.array-length blob) idx)
(exec (|> blob
- (host.array-write idx (host.l2b (:! Int value))))
+ (host.array-write idx (host.long-to-byte (:! Int value))))
(#e.Success []))
(ex.throw Index-Out-Of-Bounds (%n idx))))
@@ -80,8 +80,8 @@
(-> Nat Nat Blob (e.Error Unit))
(if (n/< (host.array-length blob) (n/+ +1 idx))
(exec (|> blob
- (host.array-write idx (host.l2b (:! Int (bit.shift-right +8 value))))
- (host.array-write (n/+ +1 idx) (host.l2b (:! Int value))))
+ (host.array-write idx (host.long-to-byte (:! Int (bit.shift-right +8 value))))
+ (host.array-write (n/+ +1 idx) (host.long-to-byte (:! Int value))))
(#e.Success []))
(ex.throw Index-Out-Of-Bounds (%n idx))))
@@ -89,10 +89,10 @@
(-> Nat Nat Blob (e.Error Unit))
(if (n/< (host.array-length blob) (n/+ +3 idx))
(exec (|> blob
- (host.array-write idx (host.l2b (:! Int (bit.shift-right +24 value))))
- (host.array-write (n/+ +1 idx) (host.l2b (:! Int (bit.shift-right +16 value))))
- (host.array-write (n/+ +2 idx) (host.l2b (:! Int (bit.shift-right +8 value))))
- (host.array-write (n/+ +3 idx) (host.l2b (:! Int value))))
+ (host.array-write idx (host.long-to-byte (:! Int (bit.shift-right +24 value))))
+ (host.array-write (n/+ +1 idx) (host.long-to-byte (:! Int (bit.shift-right +16 value))))
+ (host.array-write (n/+ +2 idx) (host.long-to-byte (:! Int (bit.shift-right +8 value))))
+ (host.array-write (n/+ +3 idx) (host.long-to-byte (:! Int value))))
(#e.Success []))
(ex.throw Index-Out-Of-Bounds (%n idx))))
@@ -100,14 +100,14 @@
(-> Nat Nat Blob (e.Error Unit))
(if (n/< (host.array-length blob) (n/+ +7 idx))
(exec (|> blob
- (host.array-write idx (host.l2b (:! Int (bit.shift-right +56 value))))
- (host.array-write (n/+ +1 idx) (host.l2b (:! Int (bit.shift-right +48 value))))
- (host.array-write (n/+ +2 idx) (host.l2b (:! Int (bit.shift-right +40 value))))
- (host.array-write (n/+ +3 idx) (host.l2b (:! Int (bit.shift-right +32 value))))
- (host.array-write (n/+ +4 idx) (host.l2b (:! Int (bit.shift-right +24 value))))
- (host.array-write (n/+ +5 idx) (host.l2b (:! Int (bit.shift-right +16 value))))
- (host.array-write (n/+ +6 idx) (host.l2b (:! Int (bit.shift-right +8 value))))
- (host.array-write (n/+ +7 idx) (host.l2b (:! Int value))))
+ (host.array-write idx (host.long-to-byte (:! Int (bit.shift-right +56 value))))
+ (host.array-write (n/+ +1 idx) (host.long-to-byte (:! Int (bit.shift-right +48 value))))
+ (host.array-write (n/+ +2 idx) (host.long-to-byte (:! Int (bit.shift-right +40 value))))
+ (host.array-write (n/+ +3 idx) (host.long-to-byte (:! Int (bit.shift-right +32 value))))
+ (host.array-write (n/+ +4 idx) (host.long-to-byte (:! Int (bit.shift-right +24 value))))
+ (host.array-write (n/+ +5 idx) (host.long-to-byte (:! Int (bit.shift-right +16 value))))
+ (host.array-write (n/+ +6 idx) (host.long-to-byte (:! Int (bit.shift-right +8 value))))
+ (host.array-write (n/+ +7 idx) (host.long-to-byte (:! Int value))))
(#e.Success []))
(ex.throw Index-Out-Of-Bounds (%n idx))))
diff --git a/stdlib/test/test/lux/host.jvm.lux b/stdlib/test/test/lux/host.jvm.lux
index 4ed187c36..a0b44ec62 100644
--- a/stdlib/test/test/lux/host.jvm.lux
+++ b/stdlib/test/test/lux/host.jvm.lux
@@ -70,12 +70,12 @@
(let [capped-sample (|> sample <to> <from>)]
(|> capped-sample <to> <from> (i/= capped-sample)))))]
- [&.l2b &.b2l "Can succesfully convert to/from byte."]
- [&.l2s &.s2l "Can succesfully convert to/from short."]
- [&.l2i &.i2l "Can succesfully convert to/from int."]
- [&.l2f &.f2l "Can succesfully convert to/from float."]
- [&.l2d &.d2l "Can succesfully convert to/from double."]
- [(<| &.i2c &.l2i) (<| &.i2l &.c2i) "Can succesfully convert to/from char."]
+ [&.long-to-byte &.byte-to-long "Can succesfully convert to/from byte."]
+ [&.long-to-short &.short-to-long "Can succesfully convert to/from short."]
+ [&.long-to-int &.int-to-long "Can succesfully convert to/from int."]
+ [&.long-to-float &.float-to-long "Can succesfully convert to/from float."]
+ [&.long-to-double &.double-to-long "Can succesfully convert to/from double."]
+ [(<| &.int-to-char &.long-to-int) (<| &.int-to-long &.char-to-int) "Can succesfully convert to/from char."]
)]
($_ seq
<int-convs>