aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library')
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux17
-rw-r--r--stdlib/source/library/lux/ffi.old.lux2
-rw-r--r--stdlib/source/library/lux/ffi/export.jvm.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux73
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux53
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux46
6 files changed, 50 insertions, 143 deletions
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index f5ae643ad..9fc79a2d9 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -1203,7 +1203,7 @@
(Type Class)
(jvm.class "java.lang.Object" (list)))
-(def: .public class:
+(def: .public class
(syntax (_ [.let [! <>.monad]
im inheritance_modifier^
[full_class_name class_vars] (at ! each parser.declaration ..declaration^)
@@ -1656,15 +1656,12 @@
read (list (if _#import_field_static?
(` {.#Right []})
(` {.#Right [(~ g!obj)]}))
- (` ((~' in) (.list (.` (~ getter_body))))))
-
- it (` (def: (~ g!name)
- ((~! syntax) ((~ g!name) [(~ write|read) (~ parser)])
- (case (~ write|read)
- (~+ write)
- (~+ read)))))
- _ ("lux io log" (%.format "[!] " (%.code it)))]
- (list it)))))
+ (` ((~' in) (.list (.` (~ getter_body))))))]
+ (list (` (def: (~ g!name)
+ ((~! syntax) ((~ g!name) [(~ write|read) (~ parser)])
+ (case (~ write|read)
+ (~+ write)
+ (~+ read))))))))))
)))
(def: (member_import$ vars kind class [import_format member])
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 92d7322fd..2fa4e5b7a 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -1202,7 +1202,7 @@
[#super_class_name "java/lang/Object"
#super_class_params (list)])
-(def: .public class:
+(def: .public class
(syntax (_ [im inheritance_modifier^
class_decl ..class_decl^
.let [full_class_name (product.left class_decl)]
diff --git a/stdlib/source/library/lux/ffi/export.jvm.lux b/stdlib/source/library/lux/ffi/export.jvm.lux
index 163c98285..ed68b06d6 100644
--- a/stdlib/source/library/lux/ffi/export.jvm.lux
+++ b/stdlib/source/library/lux/ffi/export.jvm.lux
@@ -76,7 +76,7 @@
_
{.#None}))
exports))]
- (in (list (` (//.class: "final" (~ (code.local api))
+ (in (list (` (//.class "final" (~ (code.local api))
(~+ (list#each (.function (_ it)
(case it
{#Constant [name type term]}
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux
index aa9829172..78d2d4295 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux
@@ -26,46 +26,55 @@
elemT <code>.any])
(in (list (` [(~+ (list.repeated size elemT))])))))
-(type: .public (Nullary of) (-> (Vector 0 of) of))
-(type: .public (Unary of) (-> (Vector 1 of) of))
-(type: .public (Binary of) (-> (Vector 2 of) of))
-(type: .public (Trinary of) (-> (Vector 3 of) of))
-(type: .public (Variadic of) (-> (List of) of))
+(def: Arity
+ (template (_ arity)
+ [(All (_ of)
+ (-> (Vector arity of) of))]))
-(def: arity:
- (syntax (_ [arity <code>.nat
- name <code>.local
- type <code>.any])
- (with_symbols [g!_ g!extension g!name g!phase g!archive g!inputs g!of g!anchor g!expression g!directive]
+(def: arity
+ (syntax (_ [arity <code>.nat])
+ (with_symbols [g!_ g!extension g!name g!phase g!archive g!inputs g!anchor g!expression g!directive]
(do [! meta.monad]
[g!input+ (monad.all ! (list.repeated arity (macro.symbol "input")))]
- (in (list (` (def: .public ((~ (code.local name)) (~ g!extension))
- (All ((~ g!_) (~ g!anchor) (~ g!expression) (~ g!directive))
- (-> ((~ type) (~ g!expression))
- (generation.Handler (~ g!anchor) (~ g!expression) (~ g!directive))))
- (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!archive) (~ g!inputs))
- (case (~ g!inputs)
- (pattern (list (~+ g!input+)))
- (do ///.monad
- [(~+ (|> g!input+
- (list#each (function (_ g!input)
- (list g!input (` ((~ g!phase) (~ g!archive) (~ g!input))))))
- list.together))]
- ((~' in) ((~ g!extension) [(~+ g!input+)])))
+ (in (list (` (is (All ((~ g!_) (~ g!anchor) (~ g!expression) (~ g!directive))
+ (-> ((Arity (~ (code.nat arity))) (~ g!expression))
+ (generation.Handler (~ g!anchor) (~ g!expression) (~ g!directive))))
+ (function ((~ g!_) (~ g!extension))
+ (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!archive) (~ g!inputs))
+ (case (~ g!inputs)
+ (pattern (list (~+ g!input+)))
+ (do ///.monad
+ [(~+ (|> g!input+
+ (list#each (function (_ g!input)
+ (list g!input (` ((~ g!phase) (~ g!archive) (~ g!input))))))
+ list.together))]
+ ((~' in) ((~ g!extension) [(~+ g!input+)])))
- (~ g!_)
- (///.except ///extension.incorrect_arity [(~ g!name) 1 (list.size (~ g!inputs))])))))))))))
+ (~ g!_)
+ (///.except ///extension.incorrect_arity [(~ g!name)
+ (~ (code.nat arity))
+ (list.size (~ g!inputs))]))
+ ))))))))))
-(arity: 0 nullary ..Nullary)
-(arity: 1 unary ..Unary)
-(arity: 2 binary ..Binary)
-(arity: 3 trinary ..Trinary)
+(with_template [<arity> <type> <term>]
+ [(type: .public <type> (Arity <arity>))
+ (def: .public <term> (arity <arity>))]
+
+ [0 Nullary nullary]
+ [1 Unary unary]
+ [2 Binary binary]
+ [3 Trinary trinary]
+ )
+
+(type: .public (Variadic of)
+ (-> (List of) of))
(def: .public (variadic extension)
(All (_ anchor expression directive)
(-> (Variadic expression) (generation.Handler anchor expression directive)))
(function (_ extension_name)
(function (_ phase archive inputsS)
- (do [! ///.monad]
- [inputsI (monad.each ! (phase archive) inputsS)]
- (in (extension inputsI))))))
+ (let [! ///.monad]
+ (|> inputsS
+ (monad.each ! (phase archive))
+ (at ! each extension))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux
index 85f63171f..23f19d400 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux
@@ -34,17 +34,6 @@
(type: .public Bundle
(Dict Text Proc))
-(def: Vector
- (syntax (_ [size <code>.nat
- elemT <code>.any])
- (in (list (` [(~+ (list.repeated size elemT))])))))
-
-(type: .public Nullary (-> (Vector +0 Expression) Expression))
-(type: .public Unary (-> (Vector +1 Expression) Expression))
-(type: .public Binary (-> (Vector +2 Expression) Expression))
-(type: .public Trinary (-> (Vector +3 Expression) Expression))
-(type: .public Variadic (-> (List Expression) Expression))
-
... [Utils]
(def: .public (install name unnamed)
(-> Text (-> Text Proc)
@@ -58,48 +47,6 @@
(list/each (function (_ [key val]) [(format prefix " " key) val]))
(dict.from_list text.Hash<Text>)))
-(def: (wrong_arity proc expected actual)
- (-> Text Nat Nat Text)
- (format "Wrong number of arguments for " (%t proc) "\n"
- "Expected: " (|> expected .int %i) "\n"
- " Actual: " (|> actual .int %i)))
-
-(def: arity:
- (syntax (_ [name s.local
- arity s.nat])
- (with_symbols [g!_ g!proc g!name g!translate g!inputs]
- (do [@ macro.monad]
- [g!input+ (monad.all @ (list.repeated arity (macro.symbol "input")))]
- (in (list (` (def: .public ((~ (code.local name)) (~ g!proc))
- (-> (-> (..Vector (~ (code.nat arity)) Expression) Expression)
- (-> Text ..Proc))
- (function ((~ g!_) (~ g!name))
- (function ((~ g!_) (~ g!translate) (~ g!inputs))
- (case (~ g!inputs)
- (pattern (list (~+ g!input+)))
- (do macro.Monad<Meta>
- [(~+ (|> g!input+
- (list/each (function (_ g!input)
- (list g!input (` ((~ g!translate) (~ g!input))))))
- list.together))]
- ((~' in) ((~ g!proc) [(~+ g!input+)])))
-
- (~' _)
- (macro.failure (wrong_arity (~ g!name) +1 (list.size (~ g!inputs)))))))))))))))
-
-(arity: nullary +0)
-(arity: unary +1)
-(arity: binary +2)
-(arity: trinary +3)
-
-(def: .public (variadic proc)
- (-> Variadic (-> Text Proc))
- (function (_ proc_name)
- (function (_ translate inputsS)
- (do [@ macro.Monad<Meta>]
- [inputsI (monad.each @ translate inputsS)]
- (in (proc inputsI))))))
-
... [Procedures]
... [[Lux]]
(def: (lux//is [leftO rightO])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux
index 3bf0659ba..2ed9653b5 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux
@@ -28,52 +28,6 @@
["[1]/" //
["[1][0]" synthesis (.only Synthesis)]]]])
-(def: Vector
- (syntax (_ [size <code>.nat
- elemT <code>.any])
- (in (list (` [(~+ (list.repeated size elemT))])))))
-
-(type: .public Nullary (-> (Vector 0 Expression) Computation))
-(type: .public Unary (-> (Vector 1 Expression) Computation))
-(type: .public Binary (-> (Vector 2 Expression) Computation))
-(type: .public Trinary (-> (Vector 3 Expression) Computation))
-(type: .public Variadic (-> (List Expression) Computation))
-
-(def: arity:
- (syntax (_ [name <code>.local
- arity <code>.nat])
- (with_symbols [g!_ g!extension g!name g!phase g!inputs]
- (do [! macro.monad]
- [g!input+ (monad.all ! (list.repeated arity (macro.symbol "input")))]
- (in (list (` (def: .public ((~ (code.local name)) (~ g!extension))
- (-> (-> (..Vector (~ (code.nat arity)) Expression) Computation)
- Handler)
- (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!inputs))
- (case (~ g!inputs)
- (pattern (list (~+ g!input+)))
- (do /////.monad
- [(~+ (|> g!input+
- (list#each (function (_ g!input)
- (list g!input (` ((~ g!phase) (~ g!input))))))
- list.together))]
- ((~' in) ((~ g!extension) [(~+ g!input+)])))
-
- (~' _)
- (/////.except /////extension.incorrect_arity [(~ g!name) 1 (list.size (~ g!inputs))])))))))))))
-
-(arity: nullary 0)
-(arity: unary 1)
-(arity: binary 2)
-(arity: trinary 3)
-
-(def: .public (variadic extension)
- (-> Variadic Handler)
- (function (_ extension_name)
- (function (_ phase inputsS)
- (do [! /////.monad]
- [inputsI (monad.each ! phase inputsS)]
- (in (extension inputsI))))))
-
(def: bundle::lux
Bundle
(|> bundle.empty