aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-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
8 files changed, 136 insertions, 207 deletions
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>