aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/tool/compiler
diff options
context:
space:
mode:
authorEduardo Julian2022-06-11 00:10:52 -0400
committerEduardo Julian2022-06-11 00:10:52 -0400
commit5b36c00da8a21c5d70adec4b50ef573e12dc5cf8 (patch)
treea1549d05cce57d20745c0835ea2419858fc30a4e /stdlib/source/library/lux/tool/compiler
parentf21ca0dc1956a47b8f7ac6e0ea67d7d246c55280 (diff)
De-sigil-ification: : [Part 2]
Diffstat (limited to 'stdlib/source/library/lux/tool/compiler')
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux11
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux102
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux52
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux96
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux106
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux108
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux98
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux52
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux98
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux116
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux50
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux96
12 files changed, 504 insertions, 481 deletions
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
index 7274cbe00..b3c99bdbf 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
@@ -20,7 +20,7 @@
[collection
["[0]" list (.open: "[1]#[0]" functor mix)]]]
[macro
- [syntax (.only syntax:)]]
+ [syntax (.only syntax)]]
[math
[number
["n" nat]
@@ -170,10 +170,11 @@
[abstraction inputs])))
(template [<name> <tag>]
- [(syntax: .public (<name> [content <code>.any])
- (in (list (` (.<| {..#Reference}
- <tag>
- (~ content))))))]
+ [(def: .public <name>
+ (syntax (_ [content <code>.any])
+ (in (list (` (.<| {..#Reference}
+ <tag>
+ (~ content)))))))]
[variable {reference.#Variable}]
[constant {reference.#Constant}]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
index 1257c661a..bb9c5681f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
@@ -17,7 +17,7 @@
["[0]" list (.open: "[1]#[0]" functor monoid)]
["[0]" sequence]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
[number (.only hex)
@@ -87,55 +87,57 @@
(-> (Expression Any) (Computation Any))
(|>> [1 #1] ..variant))
-(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local))
- body <code>.any])
- (do [! meta.monad]
- [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
- (in (list (` (let [(~+ (|> vars
- (list.zipped_2 ids)
- (list#each (function (_ [id var])
- (list (code.local var)
- (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.together))]
- (~ body)))))))
-
-(syntax: (runtime: [declaration (<>.or <code>.local
- (<code>.form (<>.and <code>.local
- (<>.some <code>.local))))
- code <code>.any])
- (do meta.monad
- [runtime_id meta.seed]
- (macro.with_symbols [g!_]
- (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
- runtime_name (` (_.var (~ (code.text (%.code runtime)))))]
- (case declaration
- {.#Left name}
- (let [g!name (code.local name)
- code_nameC (code.local (format "@" name))]
- (in (list (` (def: .public (~ g!name)
- _.Var/1
- (~ runtime_name)))
-
- (` (def: (~ code_nameC)
- (_.Expression Any)
- (_.defparameter (~ runtime_name) (~ code)))))))
-
- {.#Right [name inputs]}
- (let [g!name (code.local name)
- code_nameC (code.local (format "@" name))
-
- inputsC (list#each code.local inputs)
- inputs_typesC (list#each (function.constant (` (_.Expression Any)))
- inputs)]
- (in (list (` (def: .public ((~ g!name) (~+ inputsC))
- (-> (~+ inputs_typesC) (_.Computation Any))
- (_.call/* (~ runtime_name) (list (~+ inputsC)))))
-
- (` (def: (~ code_nameC)
- (_.Expression Any)
- (..with_vars [(~+ inputsC)]
- (_.defun (~ runtime_name) (_.args (list (~+ inputsC)))
- (~ code)))))))))))))
+(def: .public with_vars
+ (syntax (_ [vars (<code>.tuple (<>.some <code>.local))
+ body <code>.any])
+ (do [! meta.monad]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
+ (in (list (` (let [(~+ (|> vars
+ (list.zipped_2 ids)
+ (list#each (function (_ [id var])
+ (list (code.local var)
+ (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
+ list.together))]
+ (~ body))))))))
+
+(def: runtime:
+ (syntax (_ [declaration (<>.or <code>.local
+ (<code>.form (<>.and <code>.local
+ (<>.some <code>.local))))
+ code <code>.any])
+ (do meta.monad
+ [runtime_id meta.seed]
+ (macro.with_symbols [g!_]
+ (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
+ runtime_name (` (_.var (~ (code.text (%.code runtime)))))]
+ (case declaration
+ {.#Left name}
+ (let [g!name (code.local name)
+ code_nameC (code.local (format "@" name))]
+ (in (list (` (def: .public (~ g!name)
+ _.Var/1
+ (~ runtime_name)))
+
+ (` (def: (~ code_nameC)
+ (_.Expression Any)
+ (_.defparameter (~ runtime_name) (~ code)))))))
+
+ {.#Right [name inputs]}
+ (let [g!name (code.local name)
+ code_nameC (code.local (format "@" name))
+
+ inputsC (list#each code.local inputs)
+ inputs_typesC (list#each (function.constant (` (_.Expression Any)))
+ inputs)]
+ (in (list (` (def: .public ((~ g!name) (~+ inputsC))
+ (-> (~+ inputs_typesC) (_.Computation Any))
+ (_.call/* (~ runtime_name) (list (~+ inputsC)))))
+
+ (` (def: (~ code_nameC)
+ (_.Expression Any)
+ (..with_vars [(~+ inputsC)]
+ (_.defun (~ runtime_name) (_.args (list (~+ inputsC)))
+ (~ code))))))))))))))
(runtime: (lux//try op)
(with_vars [error]
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 317114afc..8f5c9db8a 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
@@ -12,7 +12,7 @@
["[0]" meta]
["[0]" macro (.only with_symbols)
["[0]" code]
- [syntax (.only syntax:)]]]]
+ [syntax (.only syntax)]]]]
["[0]" ///
["[1][0]" extension]
[//
@@ -21,9 +21,10 @@
[///
["[1]" phase]]]])
-(syntax: (Vector [size <code>.nat
- elemT <code>.any])
- (in (list (` [(~+ (list.repeated size elemT))]))))
+(def: Vector
+ (syntax (_ [size <code>.nat
+ 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))
@@ -31,28 +32,29 @@
(type: .public (Trinary of) (-> (Vector 3 of) of))
(type: .public (Variadic of) (-> (List of) of))
-(syntax: (arity: [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]
- (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+)])))
+(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]
+ (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+)])))
- (~' _)
- (///.except ///extension.incorrect_arity [(~ g!name) 1 (list.size (~ g!inputs))]))))))))))
+ (~' _)
+ (///.except ///extension.incorrect_arity [(~ g!name) 1 (list.size (~ g!inputs))])))))))))))
(arity: 0 nullary ..Nullary)
(arity: 1 unary ..Unary)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
index c8f77a38e..444254018 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
@@ -18,7 +18,7 @@
["[0]" list (.open: "[1]#[0]" functor)]
["[0]" sequence]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
[number (.only hex)
@@ -81,52 +81,54 @@
(-> Var (-> Var Expression) Statement)
(_.define name (definition name)))
-(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local))
- body <code>.any])
- (do [! meta.monad]
- [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
- (in (list (` (let [(~+ (|> vars
- (list.zipped_2 ids)
- (list#each (function (_ [id var])
- (list (code.local var)
- (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.together))]
- (~ body)))))))
-
-(syntax: (runtime: [declaration (<>.or <code>.local
- (<code>.form (<>.and <code>.local
- (<>.some <code>.local))))
- code <code>.any])
- (macro.with_symbols [g!_ runtime]
- (let [runtime_name (` (_.var (~ (code.text (%.code runtime)))))]
- (case declaration
- {.#Left name}
- (let [g!name (code.local name)]
- (in (list (` (def: .public (~ g!name)
- Var
- (~ runtime_name)))
-
- (` (def: (~ (code.local (format "@" name)))
- Statement
- (..feature (~ runtime_name)
- (function ((~ g!_) (~ g!name))
- (~ code))))))))
-
- {.#Right [name inputs]}
- (let [g!name (code.local name)
- inputsC (list#each code.local inputs)
- inputs_typesC (list#each (function.constant (` _.Expression)) inputs)]
- (in (list (` (def: .public ((~ g!name) (~+ inputsC))
- (-> (~+ inputs_typesC) Computation)
- (_.apply (~ runtime_name) (list (~+ inputsC)))))
-
- (` (def: (~ (code.local (format "@" name)))
- Statement
- (..feature (~ runtime_name)
- (function ((~ g!_) (~ g!_))
- (..with_vars [(~+ inputsC)]
- (_.function (~ g!_) (list (~+ inputsC))
- (~ code))))))))))))))
+(def: .public with_vars
+ (syntax (_ [vars (<code>.tuple (<>.some <code>.local))
+ body <code>.any])
+ (do [! meta.monad]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
+ (in (list (` (let [(~+ (|> vars
+ (list.zipped_2 ids)
+ (list#each (function (_ [id var])
+ (list (code.local var)
+ (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
+ list.together))]
+ (~ body))))))))
+
+(def: runtime:
+ (syntax (_ [declaration (<>.or <code>.local
+ (<code>.form (<>.and <code>.local
+ (<>.some <code>.local))))
+ code <code>.any])
+ (macro.with_symbols [g!_ runtime]
+ (let [runtime_name (` (_.var (~ (code.text (%.code runtime)))))]
+ (case declaration
+ {.#Left name}
+ (let [g!name (code.local name)]
+ (in (list (` (def: .public (~ g!name)
+ Var
+ (~ runtime_name)))
+
+ (` (def: (~ (code.local (format "@" name)))
+ Statement
+ (..feature (~ runtime_name)
+ (function ((~ g!_) (~ g!name))
+ (~ code))))))))
+
+ {.#Right [name inputs]}
+ (let [g!name (code.local name)
+ inputsC (list#each code.local inputs)
+ inputs_typesC (list#each (function.constant (` _.Expression)) inputs)]
+ (in (list (` (def: .public ((~ g!name) (~+ inputsC))
+ (-> (~+ inputs_typesC) Computation)
+ (_.apply (~ runtime_name) (list (~+ inputsC)))))
+
+ (` (def: (~ (code.local (format "@" name)))
+ Statement
+ (..feature (~ runtime_name)
+ (function ((~ g!_) (~ g!_))
+ (..with_vars [(~+ inputsC)]
+ (_.function (~ g!_) (list (~+ inputsC))
+ (~ code)))))))))))))))
(def: length
(-> Expression Computation)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
index a286396f4..93f3cb980 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
@@ -18,7 +18,7 @@
["[0]" list (.open: "[1]#[0]" functor)]
["[0]" sequence]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
[number (.only hex)
@@ -103,61 +103,63 @@
(-> Var (-> Var Statement) Statement)
(definition name))
-(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local))
- body <code>.any])
- (do [! meta.monad]
- [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
- (in (list (` (let [(~+ (|> vars
- (list.zipped_2 ids)
- (list#each (function (_ [id var])
- (list (code.local var)
- (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.together))]
- (~ body)))))))
+(def: .public with_vars
+ (syntax (_ [vars (<code>.tuple (<>.some <code>.local))
+ body <code>.any])
+ (do [! meta.monad]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
+ (in (list (` (let [(~+ (|> vars
+ (list.zipped_2 ids)
+ (list#each (function (_ [id var])
+ (list (code.local var)
+ (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
+ list.together))]
+ (~ body))))))))
(def: module_id
0)
-(syntax: (runtime: [declaration (<>.or <code>.local
- (<code>.form (<>.and <code>.local
- (<>.some <code>.local))))
- code <code>.any])
- (do meta.monad
- [runtime_id meta.seed]
- (macro.with_symbols [g!_]
- (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
- runtime_name (` (_.var (~ (code.text (%.code runtime)))))]
- (case declaration
- {.#Left name}
- (macro.with_symbols [g!_]
- (let [g!name (code.local name)]
- (in (list (` (def: .public (~ g!name)
- Var
- (~ runtime_name)))
-
- (` (def: (~ (code.local (format "@" name)))
- Statement
- (..feature (~ runtime_name)
- (function ((~ g!_) (~ g!name))
- (_.set (~ g!name) (~ code))))))))))
-
- {.#Right [name inputs]}
- (macro.with_symbols [g!_]
- (let [g!name (code.local name)
- inputsC (list#each code.local inputs)
- inputs_typesC (list#each (function.constant (` _.Expression))
- inputs)]
- (in (list (` (def: .public ((~ g!name) (~+ inputsC))
- (-> (~+ inputs_typesC) Computation)
- (_.apply (list (~+ inputsC)) (~ runtime_name))))
-
- (` (def: (~ (code.local (format "@" name)))
- Statement
- (..feature (~ runtime_name)
- (function ((~ g!_) (~ g!_))
- (..with_vars [(~+ inputsC)]
- (_.function (~ g!_) (list (~+ inputsC))
- (~ code))))))))))))))))
+(def: runtime:
+ (syntax (_ [declaration (<>.or <code>.local
+ (<code>.form (<>.and <code>.local
+ (<>.some <code>.local))))
+ code <code>.any])
+ (do meta.monad
+ [runtime_id meta.seed]
+ (macro.with_symbols [g!_]
+ (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
+ runtime_name (` (_.var (~ (code.text (%.code runtime)))))]
+ (case declaration
+ {.#Left name}
+ (macro.with_symbols [g!_]
+ (let [g!name (code.local name)]
+ (in (list (` (def: .public (~ g!name)
+ Var
+ (~ runtime_name)))
+
+ (` (def: (~ (code.local (format "@" name)))
+ Statement
+ (..feature (~ runtime_name)
+ (function ((~ g!_) (~ g!name))
+ (_.set (~ g!name) (~ code))))))))))
+
+ {.#Right [name inputs]}
+ (macro.with_symbols [g!_]
+ (let [g!name (code.local name)
+ inputsC (list#each code.local inputs)
+ inputs_typesC (list#each (function.constant (` _.Expression))
+ inputs)]
+ (in (list (` (def: .public ((~ g!name) (~+ inputsC))
+ (-> (~+ inputs_typesC) Computation)
+ (_.apply (list (~+ inputsC)) (~ runtime_name))))
+
+ (` (def: (~ (code.local (format "@" name)))
+ Statement
+ (..feature (~ runtime_name)
+ (function ((~ g!_) (~ g!_))
+ (..with_vars [(~+ inputsC)]
+ (_.function (~ g!_) (list (~+ inputsC))
+ (~ code)))))))))))))))))
(def: (item index table)
(-> Expression Expression Location)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
index cb5b3c882..5c22acced 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
@@ -18,7 +18,7 @@
["[0]" list (.open: "[1]#[0]" functor)]
["[0]" sequence]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
[number (.only hex)
@@ -70,62 +70,64 @@
(-> Constant (-> Constant Statement) Statement)
(definition name))
-(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local))
- body <code>.any])
- (do [! meta.monad]
- [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
- (in (list (` (let [(~+ (|> vars
- (list.zipped_2 ids)
- (list#each (function (_ [id var])
- (list (code.local var)
- (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.together))]
- (~ body)))))))
+(def: .public with_vars
+ (syntax (_ [vars (<code>.tuple (<>.some <code>.local))
+ body <code>.any])
+ (do [! meta.monad]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
+ (in (list (` (let [(~+ (|> vars
+ (list.zipped_2 ids)
+ (list#each (function (_ [id var])
+ (list (code.local var)
+ (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
+ list.together))]
+ (~ body))))))))
(def: module_id
0)
-(syntax: (runtime: [declaration (<>.or <code>.local
- (<code>.form (<>.and <code>.local
- (<>.some <code>.local))))
- code <code>.any])
- (do meta.monad
- [runtime_id meta.seed]
- (macro.with_symbols [g!_]
- (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
- runtime_name (` (_.constant (~ (code.text (%.code runtime)))))]
- (case declaration
- {.#Left name}
- (macro.with_symbols [g!_]
- (let [g!name (code.local name)]
- (in (list (` (def: .public (~ g!name)
- Var
- (~ runtime_name)))
-
- (` (def: (~ (code.local (format "@" name)))
- Statement
- (..feature (~ runtime_name)
- (function ((~ g!_) (~ g!name))
- (_.define (~ g!name) (~ code))))))))))
-
- {.#Right [name inputs]}
- (macro.with_symbols [g!_]
- (let [g!name (code.local name)
- inputsC (list#each code.local inputs)
- inputs_typesC (list#each (function.constant (` _.Expression))
- inputs)]
- (in (list (` (def: .public ((~ g!name) (~+ inputsC))
- (-> (~+ inputs_typesC) Computation)
- (_.apply (list (~+ inputsC)) (~ runtime_name))))
-
- (` (def: (~ (code.local (format "@" name)))
- Statement
- (..feature (~ runtime_name)
- (function ((~ g!_) (~ g!_))
- (..with_vars [(~+ inputsC)]
- (_.define_function (~ g!_)
- (list (~+ (list#each (|>> (~) [false] (`)) inputsC)))
- (~ code))))))))))))))))
+(def: runtime:
+ (syntax (_ [declaration (<>.or <code>.local
+ (<code>.form (<>.and <code>.local
+ (<>.some <code>.local))))
+ code <code>.any])
+ (do meta.monad
+ [runtime_id meta.seed]
+ (macro.with_symbols [g!_]
+ (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
+ runtime_name (` (_.constant (~ (code.text (%.code runtime)))))]
+ (case declaration
+ {.#Left name}
+ (macro.with_symbols [g!_]
+ (let [g!name (code.local name)]
+ (in (list (` (def: .public (~ g!name)
+ Var
+ (~ runtime_name)))
+
+ (` (def: (~ (code.local (format "@" name)))
+ Statement
+ (..feature (~ runtime_name)
+ (function ((~ g!_) (~ g!name))
+ (_.define (~ g!name) (~ code))))))))))
+
+ {.#Right [name inputs]}
+ (macro.with_symbols [g!_]
+ (let [g!name (code.local name)
+ inputsC (list#each code.local inputs)
+ inputs_typesC (list#each (function.constant (` _.Expression))
+ inputs)]
+ (in (list (` (def: .public ((~ g!name) (~+ inputsC))
+ (-> (~+ inputs_typesC) Computation)
+ (_.apply (list (~+ inputsC)) (~ runtime_name))))
+
+ (` (def: (~ (code.local (format "@" name)))
+ Statement
+ (..feature (~ runtime_name)
+ (function ((~ g!_) (~ g!_))
+ (..with_vars [(~+ inputsC)]
+ (_.define_function (~ g!_)
+ (list (~+ (list#each (|>> (~) [false] (`)) inputsC)))
+ (~ code)))))))))))))))))
(runtime: (io//log! message)
(all _.then
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
index 1530c23eb..8ed7f8bb8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
@@ -17,7 +17,7 @@
["[0]" list (.open: "[1]#[0]" functor)]
["[0]" sequence]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
[number (.only hex)
@@ -109,53 +109,55 @@
(-> SVar (-> SVar (Statement Any)) (Statement Any))
(definition name))
-(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local))
- body <code>.any])
- (do [! meta.monad]
- [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
- (in (list (` (let [(~+ (|> vars
- (list.zipped_2 ids)
- (list#each (function (_ [id var])
- (list (code.local var)
- (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.together))]
- (~ body)))))))
-
-(syntax: (runtime: [declaration (<>.or <code>.local
- (<code>.form (<>.and <code>.local
- (<>.some <code>.local))))
- code <code>.any])
- (case declaration
- {.#Left name}
- (macro.with_symbols [g!_]
- (let [nameC (code.local name)
- code_nameC (code.local (format "@" name))
- runtime_nameC (` (runtime_name (~ (code.text name))))]
- (in (list (` (def: .public (~ nameC) SVar (~ runtime_nameC)))
- (` (def: (~ code_nameC)
- (Statement Any)
- (..feature (~ runtime_nameC)
- (function ((~ g!_) (~ g!_))
- (_.set (list (~ g!_)) (~ code))))))))))
-
- {.#Right [name inputs]}
- (macro.with_symbols [g!_]
- (let [nameC (code.local name)
- code_nameC (code.local (format "@" name))
- runtime_nameC (` (runtime_name (~ (code.text name))))
- inputsC (list#each code.local inputs)
- inputs_typesC (list#each (function.constant (` (_.Expression Any)))
- inputs)]
- (in (list (` (def: .public ((~ nameC) (~+ inputsC))
- (-> (~+ inputs_typesC) (Computation Any))
- (_.apply (list (~+ inputsC)) (~ runtime_nameC))))
- (` (def: (~ code_nameC)
- (Statement Any)
- (..feature (~ runtime_nameC)
- (function ((~ g!_) (~ g!_))
- (..with_vars [(~+ inputsC)]
- (_.def (~ g!_) (list (~+ inputsC))
- (~ code)))))))))))))
+(def: .public with_vars
+ (syntax (_ [vars (<code>.tuple (<>.some <code>.local))
+ body <code>.any])
+ (do [! meta.monad]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
+ (in (list (` (let [(~+ (|> vars
+ (list.zipped_2 ids)
+ (list#each (function (_ [id var])
+ (list (code.local var)
+ (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
+ list.together))]
+ (~ body))))))))
+
+(def: runtime:
+ (syntax (_ [declaration (<>.or <code>.local
+ (<code>.form (<>.and <code>.local
+ (<>.some <code>.local))))
+ code <code>.any])
+ (case declaration
+ {.#Left name}
+ (macro.with_symbols [g!_]
+ (let [nameC (code.local name)
+ code_nameC (code.local (format "@" name))
+ runtime_nameC (` (runtime_name (~ (code.text name))))]
+ (in (list (` (def: .public (~ nameC) SVar (~ runtime_nameC)))
+ (` (def: (~ code_nameC)
+ (Statement Any)
+ (..feature (~ runtime_nameC)
+ (function ((~ g!_) (~ g!_))
+ (_.set (list (~ g!_)) (~ code))))))))))
+
+ {.#Right [name inputs]}
+ (macro.with_symbols [g!_]
+ (let [nameC (code.local name)
+ code_nameC (code.local (format "@" name))
+ runtime_nameC (` (runtime_name (~ (code.text name))))
+ inputsC (list#each code.local inputs)
+ inputs_typesC (list#each (function.constant (` (_.Expression Any)))
+ inputs)]
+ (in (list (` (def: .public ((~ nameC) (~+ inputsC))
+ (-> (~+ inputs_typesC) (Computation Any))
+ (_.apply (list (~+ inputsC)) (~ runtime_nameC))))
+ (` (def: (~ code_nameC)
+ (Statement Any)
+ (..feature (~ runtime_nameC)
+ (function ((~ g!_) (~ g!_))
+ (..with_vars [(~+ inputsC)]
+ (_.def (~ g!_) (list (~+ inputsC))
+ (~ code))))))))))))))
(runtime: (lux::try op)
(with_vars [exception]
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 8b5adc004..025abf8f6 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
@@ -12,7 +12,7 @@
(dictionary ["dict" unordered (.only Dict)])))
[macro (.only with_symbols)]
(macro [code]
- ["s" syntax (.only syntax:)])
+ ["s" syntax (.only syntax)])
[host])
(luxc ["&" lang]
(lang ["la" analysis]
@@ -34,9 +34,10 @@
(type: .public Bundle
(Dict Text Proc))
-(syntax: (Vector [size <code>.nat
- elemT <code>.any])
- (in (list (` [(~+ (list.repeated size elemT))]))))
+(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))
@@ -63,27 +64,28 @@
"Expected: " (|> expected .int %i) "\n"
" Actual: " (|> actual .int %i)))
-(syntax: (arity: [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))))))))))))))
+(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)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
index 8e4686a3d..e44c646d7 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
@@ -18,7 +18,7 @@
["[0]" list (.open: "[1]#[0]" functor)]
["[0]" sequence]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
[number (.only hex)
@@ -76,53 +76,55 @@
... else
(.int input)))
-(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local))
- body <code>.any])
- (do [! meta.monad]
- [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
- (in (list (` (let [(~+ (|> vars
- (list.zipped_2 ids)
- (list#each (function (_ [id var])
- (list (code.local var)
- (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.together))]
- (~ body)))))))
-
-(syntax: (runtime: [declaration (<>.or <code>.local
- (<code>.form (<>.and <code>.local
- (<>.some <code>.local))))
- code <code>.any])
- (do meta.monad
- [runtime_id meta.seed]
- (macro.with_symbols [g!_]
- (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
- runtime_name (` (_.var (~ (code.text (%.code runtime)))))]
- (case declaration
- {.#Left name}
- (let [g!name (code.local name)]
- (in (list (` (def: .public (~ g!name)
- _.SVar
- (~ runtime_name)))
-
- (` (def: (~ (code.local (format "@" name)))
- _.Expression
- (_.set! (~ runtime_name) (~ code)))))))
-
- {.#Right [name inputs]}
- (let [g!name (code.local name)
- inputsC (list#each code.local inputs)
- inputs_typesC (list#each (function.constant (` _.Expression))
- inputs)]
- (in (list (` (def: .public ((~ g!name) (~+ inputsC))
- (-> (~+ inputs_typesC) _.Expression)
- (_.apply (list (~+ inputsC)) (~ runtime_name))))
-
- (` (def: (~ (code.local (format "@" name)))
- _.Expression
- (..with_vars [(~+ inputsC)]
- (_.set! (~ runtime_name)
- (_.function (list (~+ inputsC))
- (~ code))))))))))))))
+(def: .public with_vars
+ (syntax (_ [vars (<code>.tuple (<>.some <code>.local))
+ body <code>.any])
+ (do [! meta.monad]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
+ (in (list (` (let [(~+ (|> vars
+ (list.zipped_2 ids)
+ (list#each (function (_ [id var])
+ (list (code.local var)
+ (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
+ list.together))]
+ (~ body))))))))
+
+(def: runtime:
+ (syntax (_ [declaration (<>.or <code>.local
+ (<code>.form (<>.and <code>.local
+ (<>.some <code>.local))))
+ code <code>.any])
+ (do meta.monad
+ [runtime_id meta.seed]
+ (macro.with_symbols [g!_]
+ (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
+ runtime_name (` (_.var (~ (code.text (%.code runtime)))))]
+ (case declaration
+ {.#Left name}
+ (let [g!name (code.local name)]
+ (in (list (` (def: .public (~ g!name)
+ _.SVar
+ (~ runtime_name)))
+
+ (` (def: (~ (code.local (format "@" name)))
+ _.Expression
+ (_.set! (~ runtime_name) (~ code)))))))
+
+ {.#Right [name inputs]}
+ (let [g!name (code.local name)
+ inputsC (list#each code.local inputs)
+ inputs_typesC (list#each (function.constant (` _.Expression))
+ inputs)]
+ (in (list (` (def: .public ((~ g!name) (~+ inputsC))
+ (-> (~+ inputs_typesC) _.Expression)
+ (_.apply (list (~+ inputsC)) (~ runtime_name))))
+
+ (` (def: (~ (code.local (format "@" name)))
+ _.Expression
+ (..with_vars [(~+ inputsC)]
+ (_.set! (~ runtime_name)
+ (_.function (list (~+ inputsC))
+ (~ code)))))))))))))))
(def: .public variant_tag_field "luxVT")
(def: .public variant_flag_field "luxVF")
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
index f21273b23..85a7286c1 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
@@ -18,7 +18,7 @@
["[0]" list (.open: "[1]#[0]" functor mix)]
["[0]" sequence]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
[number (.only hex)
@@ -68,17 +68,18 @@
..unit
_.nil))
-(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local))
- body <code>.any])
- (do [! meta.monad]
- [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
- (in (list (` (let [(~+ (|> vars
- (list.zipped_2 ids)
- (list#each (function (_ [id var])
- (list (code.local var)
- (` (_.local (~ (code.text (format "v" (%.nat id)))))))))
- list.together))]
- (~ body)))))))
+(def: .public with_vars
+ (syntax (_ [vars (<code>.tuple (<>.some <code>.local))
+ body <code>.any])
+ (do [! meta.monad]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
+ (in (list (` (let [(~+ (|> vars
+ (list.zipped_2 ids)
+ (list#each (function (_ [id var])
+ (list (code.local var)
+ (` (_.local (~ (code.text (format "v" (%.nat id)))))))))
+ list.together))]
+ (~ body))))))))
(def: module_id
0)
@@ -102,54 +103,55 @@
... (_.do "const_defined?" (list (_.string "Encoding")) {.#None}))
)
-(syntax: (runtime: [declaration (<>.or <code>.local
- (<code>.form (<>.and <code>.local
- (<>.some <code>.local))))
- conditional_implementations (<>.some (<code>.tuple (<>.and <code>.any <code>.any)))
- default_implementation <code>.any])
- (do meta.monad
- [runtime_id meta.seed]
- (macro.with_symbols [g!_]
- (case declaration
- {.#Left name}
- (macro.with_symbols [g!_]
- (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
- runtime_name (` (_.constant (~ (code.text (%.code runtime)))))
- g!name (code.local name)]
- (in (list (` (def: .public (~ g!name) _.CVar (~ runtime_name)))
- (` (def: (~ (code.local (format "@" name)))
- Statement
- (~ (list#mix (function (_ [when then] else)
- (` (_.if (~ when)
- (_.set (list (~ runtime_name)) (~ then))
- (~ else))))
- (` (_.set (list (~ runtime_name)) (~ default_implementation)))
- conditional_implementations))))))))
-
- {.#Right [name inputs]}
- (macro.with_symbols [g!_]
- (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
- runtime_name (` (_.local (~ (code.text (%.code runtime)))))
- g!name (code.local name)
- inputsC (list#each code.local inputs)
- inputs_typesC (list#each (function.constant (` _.Expression))
- inputs)]
- (in (list (` (def: .public ((~ g!name) (~+ inputsC))
- (-> (~+ inputs_typesC) Computation)
- (_.apply (list (~+ inputsC)) {.#None}
- (~ runtime_name))))
-
- (` (def: (~ (code.local (format "@" name)))
- Statement
- (..with_vars [(~+ inputsC)]
+(def: runtime:
+ (syntax (_ [declaration (<>.or <code>.local
+ (<code>.form (<>.and <code>.local
+ (<>.some <code>.local))))
+ conditional_implementations (<>.some (<code>.tuple (<>.and <code>.any <code>.any)))
+ default_implementation <code>.any])
+ (do meta.monad
+ [runtime_id meta.seed]
+ (macro.with_symbols [g!_]
+ (case declaration
+ {.#Left name}
+ (macro.with_symbols [g!_]
+ (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
+ runtime_name (` (_.constant (~ (code.text (%.code runtime)))))
+ g!name (code.local name)]
+ (in (list (` (def: .public (~ g!name) _.CVar (~ runtime_name)))
+ (` (def: (~ (code.local (format "@" name)))
+ Statement
(~ (list#mix (function (_ [when then] else)
(` (_.if (~ when)
- (_.function (~ runtime_name) (list (~+ inputsC))
- (~ then))
+ (_.set (list (~ runtime_name)) (~ then))
(~ else))))
- (` (_.function (~ runtime_name) (list (~+ inputsC))
- (~ default_implementation)))
- conditional_implementations)))))))))))))
+ (` (_.set (list (~ runtime_name)) (~ default_implementation)))
+ conditional_implementations))))))))
+
+ {.#Right [name inputs]}
+ (macro.with_symbols [g!_]
+ (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
+ runtime_name (` (_.local (~ (code.text (%.code runtime)))))
+ g!name (code.local name)
+ inputsC (list#each code.local inputs)
+ inputs_typesC (list#each (function.constant (` _.Expression))
+ inputs)]
+ (in (list (` (def: .public ((~ g!name) (~+ inputsC))
+ (-> (~+ inputs_typesC) Computation)
+ (_.apply (list (~+ inputsC)) {.#None}
+ (~ runtime_name))))
+
+ (` (def: (~ (code.local (format "@" name)))
+ Statement
+ (..with_vars [(~+ inputsC)]
+ (~ (list#mix (function (_ [when then] else)
+ (` (_.if (~ when)
+ (_.function (~ runtime_name) (list (~+ inputsC))
+ (~ then))
+ (~ else))))
+ (` (_.function (~ runtime_name) (list (~+ inputsC))
+ (~ default_implementation)))
+ conditional_implementations))))))))))))))
(def: tuple_size
(_.the "length"))
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 f74911bc3..0de2a275a 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
@@ -17,7 +17,7 @@
["dict" dictionary (.only Dictionary)]]]
["[0]" macro (.only with_symbols)
["[0]" code]
- [syntax (.only syntax:)]]
+ [syntax (.only syntax)]]
[target
["_" scheme (.only Expression Computation)]]]]
["[0]" ///
@@ -28,9 +28,10 @@
["[1]/" //
["[1][0]" synthesis (.only Synthesis)]]]])
-(syntax: (Vector [size <code>.nat
- elemT <code>.any])
- (in (list (` [(~+ (list.repeated size elemT))]))))
+(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))
@@ -38,26 +39,27 @@
(type: .public Trinary (-> (Vector 3 Expression) Computation))
(type: .public Variadic (-> (List Expression) Computation))
-(syntax: (arity: [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))]))))))))))
+(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)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
index c147bf10a..63c9ae0ab 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
@@ -18,7 +18,7 @@
["[0]" list (.open: "[1]#[0]" functor)]
["[0]" sequence]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
[number (.only hex)
@@ -58,52 +58,54 @@
(def: .public unit
(_.string /////synthesis.unit))
-(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local))
- body <code>.any])
- (do [! meta.monad]
- [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
- (in (list (` (let [(~+ (|> vars
- (list.zipped_2 ids)
- (list#each (function (_ [id var])
- (list (code.local var)
- (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.together))]
- (~ body)))))))
-
-(syntax: (runtime: [declaration (<>.or <code>.local
- (<code>.form (<>.and <code>.local
- (<>.some <code>.local))))
- code <code>.any])
- (do meta.monad
- [runtime_id meta.seed]
- (macro.with_symbols [g!_]
- (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
- runtime_name (` (_.var (~ (code.text (%.code runtime)))))]
- (case declaration
- {.#Left name}
- (let [g!name (code.local name)]
- (in (list (` (def: .public (~ g!name)
- Var
- (~ runtime_name)))
-
- (` (def: (~ (code.local (format "@" name)))
- _.Computation
- (_.define_constant (~ runtime_name) (~ code)))))))
-
- {.#Right [name inputs]}
- (let [g!name (code.local name)
- inputsC (list#each code.local inputs)
- inputs_typesC (list#each (function.constant (` _.Expression))
- inputs)]
- (in (list (` (def: .public ((~ g!name) (~+ inputsC))
- (-> (~+ inputs_typesC) _.Computation)
- (_.apply (list (~+ inputsC)) (~ runtime_name))))
-
- (` (def: (~ (code.local (format "@" name)))
- _.Computation
- (..with_vars [(~+ inputsC)]
- (_.define_function (~ runtime_name) [(list (~+ inputsC)) {.#None}]
- (~ code)))))))))))))
+(def: .public with_vars
+ (syntax (_ [vars (<code>.tuple (<>.some <code>.local))
+ body <code>.any])
+ (do [! meta.monad]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
+ (in (list (` (let [(~+ (|> vars
+ (list.zipped_2 ids)
+ (list#each (function (_ [id var])
+ (list (code.local var)
+ (` (_.var (~ (code.text (format "v" (%.nat id)))))))))
+ list.together))]
+ (~ body))))))))
+
+(def: runtime:
+ (syntax (_ [declaration (<>.or <code>.local
+ (<code>.form (<>.and <code>.local
+ (<>.some <code>.local))))
+ code <code>.any])
+ (do meta.monad
+ [runtime_id meta.seed]
+ (macro.with_symbols [g!_]
+ (let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
+ runtime_name (` (_.var (~ (code.text (%.code runtime)))))]
+ (case declaration
+ {.#Left name}
+ (let [g!name (code.local name)]
+ (in (list (` (def: .public (~ g!name)
+ Var
+ (~ runtime_name)))
+
+ (` (def: (~ (code.local (format "@" name)))
+ _.Computation
+ (_.define_constant (~ runtime_name) (~ code)))))))
+
+ {.#Right [name inputs]}
+ (let [g!name (code.local name)
+ inputsC (list#each code.local inputs)
+ inputs_typesC (list#each (function.constant (` _.Expression))
+ inputs)]
+ (in (list (` (def: .public ((~ g!name) (~+ inputsC))
+ (-> (~+ inputs_typesC) _.Computation)
+ (_.apply (list (~+ inputsC)) (~ runtime_name))))
+
+ (` (def: (~ (code.local (format "@" name)))
+ _.Computation
+ (..with_vars [(~+ inputsC)]
+ (_.define_function (~ runtime_name) [(list (~+ inputsC)) {.#None}]
+ (~ code))))))))))))))
(def: last_index
(-> Expression Computation)