aboutsummaryrefslogtreecommitdiff
path: root/source/lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/lux/host/jvm.lux14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/lux/host/jvm.lux b/source/lux/host/jvm.lux
index c1e122bb6..ba29925a7 100644
--- a/source/lux/host/jvm.lux
+++ b/source/lux/host/jvm.lux
@@ -7,9 +7,9 @@
(lux (control (monoid #as m)
(functor #as F)
(monad #as M #refer (#only do)))
- (data (list #as l #refer #all #open ("" List/Functor))
- (text #as text)
- number/int)
+ (data (list #refer #all #open ("" List/Functor List/Fold))
+ (number/int #refer #all #open ("i:" Int/Ord))
+ maybe)
(meta lux
ast
syntax)))
@@ -107,3 +107,11 @@
(emit (@list (` (;_jvm_try (#;Right (~ expr))
(~ (' (_jvm_catch "java.lang.Exception" e
(#;Left (_jvm_invokevirtual "java.lang.Throwable" "getMessage" [] e []))))))))))
+
+(defsyntax #export (Array [dimensions (?^ int^)] type)
+ (let [dimensions (? 1 dimensions)]
+ (if (i:> dimensions 0)
+ (emit (@list (foldL (lambda [inner _] (` (#;DataT "Array" (@list (~ inner)))))
+ type
+ (repeat dimensions []))))
+ (fail "Array must have positive dimension."))))