diff options
author | Eduardo Julian | 2019-03-30 21:45:45 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-03-30 21:45:45 -0400 |
commit | 118895081d97279a796cc704e6c23bf92ed79e5e (patch) | |
tree | 1ea654e3f913bfc5f978bba46620c535e7a4a7bc | |
parent | 5009bfaa56119a58e675a1e6008623790b54cc1c (diff) |
Re-named "do-template" to "template".
213 files changed, 990 insertions, 838 deletions
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux index 0a723ec30..fca2ab4ad 100644 --- a/lux-js/source/program.lux +++ b/lux-js/source/program.lux @@ -80,7 +80,7 @@ (import: #long jdk/nashorn/internal/runtime/Undefined) -(do-template [<name>] +(template [<name>] [(interface: <name> (getValue [] java/lang/Object)) @@ -348,14 +348,14 @@ (#.Some _) (exception.throw undefined-has-no-lux-representation []) #.None) - (~~ (do-template [<class>] + (~~ (template [<class>] [(case (host.check <class> js-object) (#.Some js-object) (exception.return js-object) #.None)] [java/lang/Boolean] [java/lang/String])) - (~~ (do-template [<class> <method>] + (~~ (template [<class> <method>] [(case (host.check <class> js-object) (#.Some js-object) (exception.return (<method> js-object)) diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index c888df739..09ab08da5 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -259,7 +259,7 @@ Called by `imenu--generic-function'." ;; Code (code//quotation (altRE "`" "`'" "'" "~" "~\\+" "~!" "~'")) (code//super-quotation (altRE "``" "~~")) - (code//template (altRE "do-template" "template:")) + (code//template (altRE "template" "template:")) ;; Miscellaneous (actor (altRE "actor:" "message:" "on:")) (jvm-host (altRE "class:" "interface:" "import:" "object" "do-to" "synchronized" "class-for")) @@ -440,7 +440,7 @@ This function also returns nil meaning don't specify the indentation." (if 1) (cond 0) (loop 1) - (do-template 'defun) + (template 'defun) (All 'defun) (Ex 'defun) (Rec 'defun) diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux index 5baf9db04..33742d694 100644 --- a/lux-python/source/program.lux +++ b/lux-python/source/program.lux @@ -200,7 +200,7 @@ (def: (read host-object) Translator - (`` (<| (~~ (do-template [<class> <processing>] + (`` (<| (~~ (template [<class> <processing>] [(case (host.check <class> host-object) (#.Some host-object) (#error.Success (<| <processing> host-object)) @@ -217,7 +217,7 @@ [org/python/core/PyArray org/python/core/PyArray::getArray] [(Array java/lang/Object) (|>)] )) - (~~ (do-template [<class> <processing>] + (~~ (template [<class> <processing>] [(case (host.check <class> host-object) (#.Some host-object) (<| <processing> host-object) @@ -289,11 +289,11 @@ (do error.monad [output (org/python/util/PythonInterpreter::eval (_.code input) interpreter)] (..read output)))) - execute! (: (-> Text (_.Statement Any) (Error Nothing)) + execute! (: (-> Text (_.Statement Any) (Error Any)) (function (execute! alias input) (do error.monad [_ (org/python/util/PythonInterpreter::exec (_.code input) interpreter)] - (wrap (:coerce Nothing [])))))] + (wrap []))))] (: Host (structure (def: evaluate! evaluate!) diff --git a/new-luxc/source/luxc/lang/host/common-lisp.lux b/new-luxc/source/luxc/lang/host/common-lisp.lux index 2acc52700..50a942636 100644 --- a/new-luxc/source/luxc/lang/host/common-lisp.lux +++ b/new-luxc/source/luxc/lang/host/common-lisp.lux @@ -102,7 +102,7 @@ (-> Text Expression) (|>> %t :abstraction)) - (do-template [<name> <prefix>] + (template [<name> <prefix>] [(def: #export <name> (-> Text Expression) (|>> (format <prefix>) :abstraction))] @@ -127,7 +127,7 @@ (-> Expression (List Expression) Expression) (form (#.Cons func args))) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export <name> (-> (List Expression) Expression) ($apply (..global <function>)))] @@ -156,7 +156,7 @@ (-> Expression (-> Expression Expression)) (|>> (.list) (..$apply func))) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export <lux-name> (..$apply1 (..global <scheme-name>)))] [length "length"] @@ -204,7 +204,7 @@ (.function (_ _0 _1) (..$apply func (.list _0 _1)))) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export <lux-name> (..$apply2 (..global <scheme-name>)))] [append "append"] @@ -224,7 +224,7 @@ (.function (_ _0 _1 _2) (..$apply func (.list _0 _1 _2)))) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export <lux-name> ($apply3 (..global <scheme-name>)))] [subseq/3 "subseq"] @@ -237,7 +237,7 @@ (-> Expression Expression Expression) (concatenate/3 (..symbol "string"))) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export <lux-name> (-> (List Expression) Expression) (|>> (.list& (..global <scheme-name>)) ..form))] @@ -246,7 +246,7 @@ [and "and"] ) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export (<lux-name> param subject) (-> Expression Expression Expression) (..form (.list (..global <scheme-name>) subject param)))] @@ -273,7 +273,7 @@ [logxor "logxor"] ) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export (<lux-name> bindings body) (-> (List [SVar Expression]) Expression Expression) (..form (.list (..global <scheme-name>) @@ -342,7 +342,7 @@ handler))) handlers)))) - (do-template [<name> <prefix>] + (template [<name> <prefix>] [(def: #export (<name> conditions expression) (-> (List Text) Expression Expression) (case conditions diff --git a/new-luxc/source/luxc/lang/host/jvm.lux b/new-luxc/source/luxc/lang/host/jvm.lux index 32a24452d..71e887d4d 100644 --- a/new-luxc/source/luxc/lang/host/jvm.lux +++ b/new-luxc/source/luxc/lang/host/jvm.lux @@ -96,7 +96,7 @@ (type: #export Host (translation.Host Inst Definition)) -(do-template [<name> <base>] +(template [<name> <base>] [(type: #export <name> (<base> ..Anchor Inst Definition))] diff --git a/new-luxc/source/luxc/lang/host/jvm/def.lux b/new-luxc/source/luxc/lang/host/jvm/def.lux index db6bfe07b..f9b6e5c2d 100644 --- a/new-luxc/source/luxc/lang/host/jvm/def.lux +++ b/new-luxc/source/luxc/lang/host/jvm/def.lux @@ -154,7 +154,7 @@ ## (ClassWriter::COMPUTE_FRAMES) )) -(do-template [<name> <flag>] +(template [<name> <flag>] [(def: #export (<name> version visibility config name parameters super interfaces definitions) (-> $.Version $.Visibility $.Class-Config Text (List $.Parameter) $.Class (List $.Class) $.Def @@ -251,7 +251,7 @@ (FieldVisitor::visitEnd))] writer))) -(do-template [<name> <lux-type> <jvm-type> <prepare>] +(template [<name> <lux-type> <jvm-type> <prepare>] [(def: #export (<name> visibility config name value) (-> $.Visibility $.Field-Config Text <lux-type> $.Def) (function (_ writer) diff --git a/new-luxc/source/luxc/lang/host/jvm/inst.lux b/new-luxc/source/luxc/lang/host/jvm/inst.lux index 5311f39d9..36a020686 100644 --- a/new-luxc/source/luxc/lang/host/jvm/inst.lux +++ b/new-luxc/source/luxc/lang/host/jvm/inst.lux @@ -127,7 +127,7 @@ (-> (-> Label Inst) Inst) (action (Label::new))) -(do-template [<name> <type> <prepare>] +(template [<name> <type> <prepare>] [(def: #export (<name> value) (-> <type> Inst) (function (_ visitor) @@ -151,7 +151,7 @@ (do-to visitor (MethodVisitor::visitInsn (prefix ACONST_NULL))))) -(do-template [<name>] +(template [<name>] [(def: #export <name> Inst (function (_ visitor) @@ -212,7 +212,7 @@ [RETURN] [IRETURN] [LRETURN] [DRETURN] [ARETURN] ) -(do-template [<name>] +(template [<name>] [(def: #export (<name> register) (-> Nat Inst) (function (_ visitor) @@ -223,7 +223,7 @@ [ISTORE] [LSTORE] [ASTORE] ) -(do-template [<name> <inst>] +(template [<name> <inst>] [(def: #export (<name> class field type) (-> Text Text //.Type Inst) (function (_ visitor) @@ -237,7 +237,7 @@ [GETFIELD Opcodes::GETFIELD] ) -(do-template [<name> <inst>] +(template [<name> <inst>] [(def: #export (<name> class) (-> Text Inst) (function (_ visitor) @@ -265,7 +265,7 @@ #//.Double (Opcodes::T_DOUBLE) #//.Char (Opcodes::T_CHAR)))))) -(do-template [<name> <inst>] +(template [<name> <inst>] [(def: #export (<name> class method-name method-signature interface?) (-> Text Text //.Method Bit Inst) (function (_ visitor) @@ -278,7 +278,7 @@ [INVOKEINTERFACE Opcodes::INVOKEINTERFACE] ) -(do-template [<name>] +(template [<name>] [(def: #export (<name> @where) (-> //.Label Inst) (function (_ visitor) diff --git a/new-luxc/source/luxc/lang/host/jvm/type.lux b/new-luxc/source/luxc/lang/host/jvm/type.lux index 523944b44..72a1925b4 100644 --- a/new-luxc/source/luxc/lang/host/jvm/type.lux +++ b/new-luxc/source/luxc/lang/host/jvm/type.lux @@ -8,7 +8,7 @@ ["." //]) ## Types -(do-template [<name> <primitive>] +(template [<name> <primitive>] [(def: #export <name> //.Type (#//.Primitive <primitive>))] [boolean #//.Boolean] diff --git a/new-luxc/source/luxc/lang/host/lua.lux b/new-luxc/source/luxc/lang/host/lua.lux index ec2fa8928..364c05052 100644 --- a/new-luxc/source/luxc/lang/host/lua.lux +++ b/new-luxc/source/luxc/lang/host/lua.lux @@ -144,7 +144,7 @@ (text.join-with ", ")) "}")) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (format "(" subject " " <op> " " param ")"))] @@ -162,7 +162,7 @@ [% "%"] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (format "(" param " " <op> " " subject ")"))] @@ -174,7 +174,7 @@ [bit-xor "~"] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (format "(" subject " " <op> " " param ")"))] diff --git a/new-luxc/source/luxc/lang/host/php.lux b/new-luxc/source/luxc/lang/host/php.lux index 6ab97ee52..878bbaa18 100644 --- a/new-luxc/source/luxc/lang/host/php.lux +++ b/new-luxc/source/luxc/lang/host/php.lux @@ -56,7 +56,7 @@ (text.join-with ", ") (text.enclose ["(" ")"]))) - (do-template [<name> <reference?>] + (template [<name> <reference?>] [(def: #export <name> (-> Var Argument) (|>> [<reference?>]))] @@ -127,7 +127,7 @@ " " uses " " (block (:representation body)))))) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export <name> Computation (..apply (list) (..global <function>)))] @@ -136,7 +136,7 @@ [func-get-args/0 "func_get_args"] ) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> values) (-> (List Expression) Computation) (..apply values (..global <function>)))] @@ -144,7 +144,7 @@ [array/* "array"] ) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> required optionals) (-> Expression (List Expression) Computation) (..apply (list& required optionals) (..global <function>)))] @@ -162,7 +162,7 @@ (text.join-with ", ")) ")"))) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> input0) (-> Expression Computation) (..apply (list input0) (..global <function>)))] @@ -174,7 +174,7 @@ [floatval/1 "floatval"] ) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> input0 input1) (-> Expression Expression Computation) (..apply (list input0 input1) (..global <function>)))] @@ -184,7 +184,7 @@ [array-push/2 "array_push"] ) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> input0 input1 input2) (-> Expression Expression Expression Computation) (..apply (list input0 input1 input2) (..global <function>)))] @@ -213,7 +213,7 @@ (:representation then) " : " (:representation else)))) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Computation) (computation @@ -244,7 +244,7 @@ (-> Computation Computation) (|>> :representation (format "!") :abstraction)) - (do-template [<name> <type> <constructor>] + (template [<name> <type> <constructor>] [(def: #export (<name> var value) (-> Var Expression <type>) (<constructor> (format (:representation var) " = " (:representation value))))] @@ -317,7 +317,7 @@ (format "try " (block (:representation body!)) "\n" (|> excepts (list/map catch!) (text.join-with "\n"))))) - (do-template [<name> <keyword>] + (template [<name> <keyword>] [(def: #export (<name> message) (-> Expression Statement) (statement (format <keyword> " " (:representation message))))] diff --git a/new-luxc/source/luxc/lang/host/r.lux b/new-luxc/source/luxc/lang/host/r.lux index 8cd802df9..6e4c7fb5b 100644 --- a/new-luxc/source/luxc/lang/host/r.lux +++ b/new-luxc/source/luxc/lang/host/r.lux @@ -109,7 +109,7 @@ (composite-literal "list(" ")" (.function (_ [key value]) (format key "=" (:representation value))))) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export <name> (-> (List Expression) Expression) (composite-literal (format <function> "(") ")" expression))] @@ -172,7 +172,7 @@ else (list.reverse clauses))) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (self-contained @@ -203,7 +203,7 @@ (-> Text Expression) (|>> var @@)) - (do-template [<name> <func>] + (template [<name> <func>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (..apply (.list subject param) (..global <func>)))] @@ -219,7 +219,7 @@ (-> Expression Expression) (..apply (.list subject) (..global "bitwNot"))) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export <name> (-> Expression Expression) (|>> :representation (format <op>) self-contained))] @@ -271,7 +271,7 @@ (format "for (" (..name var) " in " (..expression inputs) ")" (.._block (:representation body))))) - (do-template [<name> <keyword>] + (template [<name> <keyword>] [(def: #export (<name> message) (-> Expression Expression) (..apply (.list message) (..global <keyword>)))] diff --git a/new-luxc/source/luxc/lang/host/ruby.lux b/new-luxc/source/luxc/lang/host/ruby.lux index 61e945af0..61c0f8bb5 100644 --- a/new-luxc/source/luxc/lang/host/ruby.lux +++ b/new-luxc/source/luxc/lang/host/ruby.lux @@ -179,7 +179,7 @@ (#.Some name) (format "(" name " = " proc ")")))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (format "(" subject " " <op> " " param ")"))] @@ -197,7 +197,7 @@ [pow "**"] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (format "(" param " " <op> " " subject ")"))] @@ -209,7 +209,7 @@ [bit-xor "^"] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (format "(" subject " " <op> " " param ")"))] diff --git a/new-luxc/source/luxc/lang/translation/common-lisp.lux b/new-luxc/source/luxc/lang/translation/common-lisp.lux index 360a230f9..a9ea2c215 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp.lux @@ -18,7 +18,7 @@ (host ["_" common-lisp #+ Expression])) [".C" io])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] @@ -162,7 +162,7 @@ (function (_ compiler) (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) -(do-template [<name> <field> <outputT>] +(template [<name> <field> <outputT>] [(def: (<name> code) (-> Expression (Meta <outputT>)) (function (_ compiler) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux index 54b77e60d..9f918bdd5 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux @@ -32,7 +32,7 @@ (#e.Error error) (log! error))) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux index 45887cdae..437648fbb 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux @@ -21,7 +21,7 @@ [".T" case] [".T" procedure])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux index b140a11eb..3eaa60821 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux @@ -142,7 +142,7 @@ )) ## [[Bits]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -182,7 +182,7 @@ (#static MIN_VALUE Double) (#static MAX_VALUE Double)) -(do-template [<name> <const> <encode>] +(template [<name> <const> <encode>] [(def: (<name> _) Nullary (<encode> <const>))] @@ -192,7 +192,7 @@ [frac//max Double::MAX_VALUE _.double] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (|> subjectO (<op> paramO)))] @@ -206,7 +206,7 @@ [int//< _.<] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/host.jvm.lux index af82491b6..2793b40e8 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/host.jvm.lux @@ -14,7 +14,7 @@ (/// [".T" runtime]) (// ["@" common])) -## (do-template [<name> <lua>] +## (template [<name> <lua>] ## [(def: (<name> _) @.Nullary <lua>)] ## [lua//nil "nil"] diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/reference.jvm.lux index 6d2a491c6..def77fc35 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/reference.jvm.lux @@ -9,7 +9,7 @@ [//] (// [".T" runtime])) -(do-template [<register> <translation> <prefix>] +(template [<register> <translation> <prefix>] [(def: #export (<register> register) (-> Register SVar) (_.var (format <prefix> (%i (.int register))))) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux index 1f06130e4..5fa6179c7 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux @@ -206,7 +206,7 @@ Runtime (_.progn (list @@bit//logical-right-shift))) -(do-template [<name> <top-cmp>] +(template [<name> <top-cmp>] [(def: (<name> top value) (-> Expression Expression Expression) (_.and (list (|> value (_.>= (_.int 0))) diff --git a/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux index 628edff49..e514fe28a 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux @@ -21,7 +21,7 @@ (if value "TRUE" "FALSE") ($t.class "java.lang.Boolean" (list))))) -(do-template [<name> <type> <load> <wrap>] +(template [<name> <type> <load> <wrap>] [(def: #export (<name> value) (-> <type> (Operation Inst)) (let [loadI (|> value <load>)] diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux index 55cf8a644..faec813e9 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux @@ -118,7 +118,7 @@ #0))) ### Bits -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [maskI inputI]) Binary (|>> inputI (_.unwrap #$.Long) @@ -130,7 +130,7 @@ [bit::xor _.LXOR] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [shiftI inputI]) Binary (|>> inputI (_.unwrap #$.Long) @@ -144,7 +144,7 @@ ) ### Numbers -(do-template [<name> <const> <type>] +(template [<name> <const> <type>] [(def: (<name> _) Nullary (|>> <const> (_.wrap <type>)))] @@ -154,7 +154,7 @@ [frac::max (_.double (Double::MAX_VALUE)) #$.Double] ) -(do-template [<name> <type> <op>] +(template [<name> <type> <op>] [(def: (<name> [subjectI paramI]) Binary (|>> subjectI (_.unwrap <type>) @@ -175,8 +175,8 @@ [frac::% #$.Double _.DREM] ) -(do-template [<eq> <lt> <unwrap> <cmp>] - [(do-template [<name> <reference>] +(template [<eq> <lt> <unwrap> <cmp>] + [(template [<name> <reference>] [(def: (<name> [subjectI paramI]) Binary (|>> subjectI <unwrap> @@ -192,7 +192,7 @@ [frac::= frac::< (_.unwrap #$.Double) _.DCMPG] ) -(do-template [<name> <prepare> <transform>] +(template [<name> <prepare> <transform>] [(def: (<name> inputI) Unary (|>> inputI <prepare> <transform>))] @@ -216,7 +216,7 @@ (_.INVOKEVIRTUAL "java.lang.String" "length" (_t.method (list) (#.Some _t.int) (list)) #0) lux-intI)) -(do-template [<name> <pre-subject> <pre-param> <op> <post>] +(template [<name> <pre-subject> <pre-param> <op> <post>] [(def: (<name> [subjectI paramI]) Binary (|>> subjectI <pre-subject> @@ -237,7 +237,7 @@ lux-intI] ) -(do-template [<name> <pre-subject> <pre-param> <pre-extra> <op>] +(template [<name> <pre-subject> <pre-param> <pre-extra> <op>] [(def: (<name> [subjectI paramI extraI]) Trinary (|>> subjectI <pre-subject> diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux index 483f810e2..624af7ed8 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux @@ -25,7 +25,7 @@ ["ls" synthesis])) (// ["@" common])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] @@ -33,7 +33,7 @@ [Invalid-Syntax-For-Argument-Generation] ) -(do-template [<name> <inst>] +(template [<name> <inst>] [(def: <name> $.Inst <inst>)] @@ -43,7 +43,7 @@ [L2C (|>> _.L2I _.I2C)] ) -(do-template [<name> <unwrap> <conversion> <wrap>] +(template [<name> <unwrap> <conversion> <wrap>] [(def: (<name> inputI) @.Unary (if (is? _.NOP <conversion>) @@ -111,7 +111,7 @@ (@.install "short-to-long" (@.unary convert//short-to-long)) ))) -(do-template [<name> <op> <unwrapX> <unwrapY> <wrap>] +(template [<name> <op> <unwrapX> <unwrapY> <wrap>] [(def: (<name> [xI yI]) @.Binary (|>> xI (_.unwrap <unwrapX>) @@ -159,7 +159,7 @@ (def: falseI (_.GETSTATIC "java.lang.Boolean" "FALSE" boolean-class)) (def: trueI (_.GETSTATIC "java.lang.Boolean" "TRUE" boolean-class)) -(do-template [<name> <op> <unwrapX> <unwrapY> <wrap>] +(template [<name> <op> <unwrapX> <unwrapY> <wrap>] [(def: (<name> [xI yI]) @.Binary (<| _.with-label (function (_ @then)) @@ -180,7 +180,7 @@ [char//< _.IF_ICMPLT #$.Char #$.Char #$.Boolean] ) -(do-template [<name> <op> <reference> <unwrapX> <unwrapY> <wrap>] +(template [<name> <op> <reference> <unwrapX> <unwrapY> <wrap>] [(def: (<name> [xI yI]) @.Binary (<| _.with-label (function (_ @then)) @@ -684,7 +684,7 @@ _ (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) -(do-template [<name> <invoke> <interface?>] +(template [<name> <invoke> <interface?>] [(def: (<name> proc translate inputs) (-> Text @.Proc) (case inputs diff --git a/new-luxc/source/luxc/lang/translation/jvm/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/reference.jvm.lux index fe4a58b36..0a354a929 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/reference.jvm.lux @@ -19,7 +19,7 @@ ["_" inst]]]]] ["." //]) -(do-template [<name> <prefix>] +(template [<name> <prefix>] [(def: #export (<name> idx) (-> Nat Text) (|> idx %n (format <prefix>)))] diff --git a/new-luxc/source/luxc/lang/translation/lua.lux b/new-luxc/source/luxc/lang/translation/lua.lux index e5272a3ea..e79af1048 100644 --- a/new-luxc/source/luxc/lang/translation/lua.lux +++ b/new-luxc/source/luxc/lang/translation/lua.lux @@ -18,7 +18,7 @@ (host [lua #+ Lua Expression Statement])) [".C" io])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux index 18ae10e0a..17596ffa7 100644 --- a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux @@ -11,7 +11,7 @@ (lang (host [lua #+ Lua Expression Statement]))) [//]) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux index 5d6b073fc..6597364bb 100644 --- a/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux @@ -22,7 +22,7 @@ [".T" case] [".T" procedure])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux index 94337001e..2f1b652e3 100644 --- a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux @@ -135,7 +135,7 @@ (loopT.translate-recur translate inputsS)))) ## [[Bits]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -145,7 +145,7 @@ [bit//xor lua.bit-xor] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -163,7 +163,7 @@ (#static POSITIVE_INFINITY Double) (#static NEGATIVE_INFINITY Double)) -(do-template [<name> <const> <encode>] +(template [<name> <const> <encode>] [(def: (<name> _) Nullary (<encode> <const>))] @@ -173,7 +173,7 @@ [frac//max Double::MAX_VALUE lua.float] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -185,7 +185,7 @@ [int//rem lua.%] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -202,7 +202,7 @@ [text//< lua.<] ) -(do-template [<name> <cmp>] +(template [<name> <cmp>] [(def: (<name> [subjectO paramO]) Binary (<cmp> paramO subjectO))] @@ -220,7 +220,7 @@ (lux//try (lua.function (list) (lua.return! (lua.apply "tonumber" (list inputO)))))) -(do-template [<name> <divisor>] +(template [<name> <divisor>] [(def: (<name> inputO) Unary (lua./ <divisor> inputO))] @@ -228,7 +228,7 @@ [int//to-frac (lua.float 1.0)] ) -(do-template [<name> <transform>] +(template [<name> <transform>] [(def: (<name> inputO) Unary (|> inputO <transform>))] @@ -241,7 +241,7 @@ (|>> (list) (lua.apply "string.char"))) ## [[Text]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: <name> Unary (|>> (list) (lua.apply <op>)))] @@ -257,7 +257,7 @@ Binary (runtimeT.text//char subjectO paramO)) -(do-template [<name> <runtime>] +(template [<name> <runtime>] [(def: (<name> [subjectO paramO extraO]) Trinary (<runtime> subjectO paramO extraO))] diff --git a/new-luxc/source/luxc/lang/translation/lua/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/procedure/host.jvm.lux index 2271d354a..f53f3ba05 100644 --- a/new-luxc/source/luxc/lang/translation/lua/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/procedure/host.jvm.lux @@ -14,7 +14,7 @@ (/// [".T" runtime]) (// ["@" common])) -(do-template [<name> <lua>] +(template [<name> <lua>] [(def: (<name> _) @.Nullary <lua>)] [lua//nil "nil"] diff --git a/new-luxc/source/luxc/lang/translation/lua/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/reference.jvm.lux index fac6308a0..ea3f8e604 100644 --- a/new-luxc/source/luxc/lang/translation/lua/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/reference.jvm.lux @@ -9,7 +9,7 @@ [//] (// [".T" runtime])) -(do-template [<register> <translation> <prefix>] +(template [<register> <translation> <prefix>] [(def: #export (<register> register) (-> Register Expression) (format <prefix> (%i (.int register)))) diff --git a/new-luxc/source/luxc/lang/translation/php.lux b/new-luxc/source/luxc/lang/translation/php.lux index db0eeced4..0a694d3e6 100644 --- a/new-luxc/source/luxc/lang/translation/php.lux +++ b/new-luxc/source/luxc/lang/translation/php.lux @@ -19,7 +19,7 @@ (host ["_" php #+ Expression Statement])) [".C" io])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] @@ -159,7 +159,7 @@ (function (_ compiler) (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) -(do-template [<name> <field> <inputT> <outputT>] +(template [<name> <field> <inputT> <outputT>] [(def: (<name> code) (-> <inputT> (Meta <outputT>)) (function (_ compiler) diff --git a/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux index 3bfd5578a..4c4a6c641 100644 --- a/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux @@ -12,7 +12,7 @@ (lang (host ["_" php #+ Expression Statement]))) [//]) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux index 3d7d652bf..c49003c64 100644 --- a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux @@ -22,7 +22,7 @@ [".T" procedure] )) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux index f77a35292..7a44accf2 100644 --- a/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux @@ -146,7 +146,7 @@ ## )) ## ## [[Bits]] -## (do-template [<name> <op>] +## (template [<name> <op>] ## [(def: (<name> [subjectO paramO]) ## Binary ## (<op> paramO subjectO))] @@ -161,7 +161,7 @@ ## (|> (_.bit-shl paramO subjectO) ## runtimeT.bit//64)) -## (do-template [<name> <op>] +## (template [<name> <op>] ## [(def: (<name> [subjectO paramO]) ## Binary ## (<op> paramO subjectO))] @@ -187,7 +187,7 @@ ## (#static MIN_VALUE Double) ## (#static MAX_VALUE Double)) -## (do-template [<name> <const> <encode>] +## (template [<name> <const> <encode>] ## [(def: (<name> _) ## Nullary ## (<encode> <const>))] @@ -197,7 +197,7 @@ ## [frac//max Double::MAX_VALUE _.float] ## ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (|> subjectO @@ -210,7 +210,7 @@ [int//% _.%] ) -## (do-template [<name> <op>] +## (template [<name> <op>] ## [(def: (<name> [subjectO paramO]) ## Binary ## (<op> paramO subjectO))] @@ -227,7 +227,7 @@ ## [text//< _.<] ## ) -(do-template [<name> <cmp>] +(template [<name> <cmp>] [(def: (<name> [subjectO paramO]) Binary (<cmp> paramO subjectO))] diff --git a/new-luxc/source/luxc/lang/translation/php/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/php/procedure/host.jvm.lux index af82491b6..2793b40e8 100644 --- a/new-luxc/source/luxc/lang/translation/php/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/procedure/host.jvm.lux @@ -14,7 +14,7 @@ (/// [".T" runtime]) (// ["@" common])) -## (do-template [<name> <lua>] +## (template [<name> <lua>] ## [(def: (<name> _) @.Nullary <lua>)] ## [lua//nil "nil"] diff --git a/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux index 833fc5e5a..2415963d1 100644 --- a/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux @@ -9,7 +9,7 @@ [//] (// [".T" runtime])) -(do-template [<register> <prefix>] +(template [<register> <prefix>] [(def: #export <register> (-> Register Var) (|>> (:coerce Int) %i (format <prefix>) _.var))] @@ -27,7 +27,7 @@ (-> Name Var) (|>> //.definition-name _.var)) -(do-template [<name> <input> <converter>] +(template [<name> <input> <converter>] [(def: #export <name> (-> <input> (Meta Var)) (|>> <converter> (:: macro.Monad<Meta> wrap)))] diff --git a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux index 3d5ea1775..7c4d9f444 100644 --- a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux @@ -239,7 +239,7 @@ ## (def: inc (|>> (_.+ (_.int 1)))) -## (do-template [<name> <top-cmp>] +## (template [<name> <top-cmp>] ## [(def: (<name> top value) ## (-> Expression Expression Expression) ## (_.and (|> value (_.>= (_.int 0))) diff --git a/new-luxc/source/luxc/lang/translation/r.lux b/new-luxc/source/luxc/lang/translation/r.lux index a013bfd1c..d5a9f35fa 100644 --- a/new-luxc/source/luxc/lang/translation/r.lux +++ b/new-luxc/source/luxc/lang/translation/r.lux @@ -18,7 +18,7 @@ (host [r #+ Expression])) [".C" io])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] @@ -161,7 +161,7 @@ (function (_ compiler) (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) -(do-template [<name> <field> <outputT>] +(template [<name> <field> <outputT>] [(def: (<name> code) (-> Expression (Meta <outputT>)) (function (_ compiler) diff --git a/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux index d838bc332..3c41fbe63 100644 --- a/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux @@ -22,7 +22,7 @@ [".T" procedure]) ) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux index 261e6cfb9..f806805c0 100644 --- a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux @@ -147,7 +147,7 @@ )) ## [[Bits]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -157,7 +157,7 @@ [bit//xor runtimeT.bit//xor] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> (runtimeT.int64-low paramO) subjectO))] @@ -184,7 +184,7 @@ (#static MIN_VALUE Double) (#static MAX_VALUE Double)) -(do-template [<name> <const> <encode>] +(template [<name> <const> <encode>] [(def: (<name> _) Nullary (<encode> <const>))] @@ -194,7 +194,7 @@ [frac//max Double::MAX_VALUE r.float] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (|> subjectO (<op> paramO)))] @@ -206,7 +206,7 @@ [int//rem runtimeT.int//%] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -223,7 +223,7 @@ [text//< r.<] ) -(do-template [<name> <cmp>] +(template [<name> <cmp>] [(def: (<name> [subjectO paramO]) Binary (<cmp> paramO subjectO))] diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/r/procedure/host.jvm.lux index af82491b6..2793b40e8 100644 --- a/new-luxc/source/luxc/lang/translation/r/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/procedure/host.jvm.lux @@ -14,7 +14,7 @@ (/// [".T" runtime]) (// ["@" common])) -## (do-template [<name> <lua>] +## (template [<name> <lua>] ## [(def: (<name> _) @.Nullary <lua>)] ## [lua//nil "nil"] diff --git a/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux index 087b87504..7de1c74ee 100644 --- a/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux @@ -9,7 +9,7 @@ [//] (// [".T" runtime])) -(do-template [<register> <translation> <prefix>] +(template [<register> <translation> <prefix>] [(def: #export (<register> register) (-> Register SVar) (r.var (format <prefix> (%i (.int register))))) diff --git a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux index ce2265a8e..d641041d2 100644 --- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux @@ -163,7 +163,7 @@ (r.named-list (list [//.int-high-field (as-integer (@@ high))] [//.int-low-field (as-integer (@@ low))]))) -(do-template [<name> <value>] +(template [<name> <value>] [(runtime: <name> (..int <value>))] @@ -597,7 +597,7 @@ @@sum//get )) -(do-template [<name> <op>] +(template [<name> <op>] [(runtime: (<name> mask input) (int//new (<op> (int64-high (@@ mask)) (int64-high (@@ input))) @@ -659,7 +659,7 @@ (def: inc (-> Expression Expression) (|>> (r.+ (r.int 1)))) -(do-template [<name> <top-cmp>] +(template [<name> <top-cmp>] [(def: (<name> top value) (-> Expression Expression Expression) (|> (|> value (r.>= (r.int 0))) diff --git a/new-luxc/source/luxc/lang/translation/ruby.lux b/new-luxc/source/luxc/lang/translation/ruby.lux index 501e8e2c1..084c614ec 100644 --- a/new-luxc/source/luxc/lang/translation/ruby.lux +++ b/new-luxc/source/luxc/lang/translation/ruby.lux @@ -18,7 +18,7 @@ (host [ruby #+ Ruby Expression Statement])) [".C" io])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux index 52a261b2a..3742ae467 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux @@ -11,7 +11,7 @@ (lang (host [ruby #+ Ruby Expression Statement]))) [//]) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux index 6023f3a82..3016836b9 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux @@ -21,7 +21,7 @@ [".T" case] [".T" procedure])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux index 9176879b1..c60938d79 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux @@ -145,7 +145,7 @@ )) ## [[Bits]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -160,7 +160,7 @@ (ruby.bit-and "0xFFFFFFFFFFFFFFFF" (ruby.bit-shl paramO subjectO))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -186,7 +186,7 @@ (#static MIN_VALUE Double) (#static MAX_VALUE Double)) -(do-template [<name> <const> <encode>] +(template [<name> <const> <encode>] [(def: (<name> _) Nullary (<encode> <const>))] @@ -196,7 +196,7 @@ [frac//max Double::MAX_VALUE ruby.float] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (ruby.bit-and "0xFFFFFFFFFFFFFFFF" @@ -207,7 +207,7 @@ [int//mul ruby.*] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -216,7 +216,7 @@ [int//rem ruby.%] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -233,7 +233,7 @@ [text//< ruby.<] ) -(do-template [<name> <cmp>] +(template [<name> <cmp>] [(def: (<name> [subjectO paramO]) Binary (<cmp> paramO subjectO))] @@ -291,7 +291,7 @@ (install "decode" (unary frac//decode))))) ## [[Text]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: <name> Unary (ruby.send <op> (list)))] diff --git a/new-luxc/source/luxc/lang/translation/ruby/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/procedure/host.jvm.lux index af82491b6..2793b40e8 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/procedure/host.jvm.lux @@ -14,7 +14,7 @@ (/// [".T" runtime]) (// ["@" common])) -## (do-template [<name> <lua>] +## (template [<name> <lua>] ## [(def: (<name> _) @.Nullary <lua>)] ## [lua//nil "nil"] diff --git a/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux index fb206b127..80e78951b 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux @@ -9,7 +9,7 @@ [//] (// [".T" runtime])) -(do-template [<register> <translation> <prefix>] +(template [<register> <translation> <prefix>] [(def: #export (<register> register) (-> Register Expression) (format <prefix> (%i (.int register)))) diff --git a/new-luxc/source/luxc/lang/translation/scheme.lux b/new-luxc/source/luxc/lang/translation/scheme.lux index 7d261ca04..e509cb8ca 100644 --- a/new-luxc/source/luxc/lang/translation/scheme.lux +++ b/new-luxc/source/luxc/lang/translation/scheme.lux @@ -18,7 +18,7 @@ (host [scheme #+ Expression])) [".C" io])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] @@ -164,7 +164,7 @@ (function (_ compiler) (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) -(do-template [<name> <field> <outputT>] +(template [<name> <field> <outputT>] [(def: (<name> code) (-> Expression (Meta <outputT>)) (function (_ compiler) diff --git a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux index ae4a4151a..db9b25129 100644 --- a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux @@ -13,7 +13,7 @@ (lang (host [scheme #+ Expression]))) [//]) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/test/test/luxc/common.lux b/new-luxc/test/test/luxc/common.lux index f694d81bd..a68e2824c 100644 --- a/new-luxc/test/test/luxc/common.lux +++ b/new-luxc/test/test/luxc/common.lux @@ -52,7 +52,7 @@ (type: #export Runner (-> Synthesis (Error Any))) (type: #export Definer (-> Name Synthesis (Error Any))) -(do-template [<name> <host>] +(template [<name> <host>] [(def: #export <name> (IO State) (:: io.Monad<IO> map translation.state <host>))] diff --git a/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux b/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux index 9d09216b8..f9905c8bc 100644 --- a/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux +++ b/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux @@ -31,7 +31,7 @@ [/// ["_." primitive]]) -(do-template [<name> <success> <failure>] +(template [<name> <success> <failure>] [(def: (<name> procedure params output-type) (-> Text (List Code) Type Bit) (|> (do Monad<Meta> @@ -52,7 +52,7 @@ [failure #0 #1] ) -(do-template [<name> <success> <failure>] +(template [<name> <success> <failure>] [(def: (<name> syntax output-type) (-> Code Type Bit) (|> (do Monad<Meta> @@ -74,7 +74,7 @@ ) (context: "Conversions [double + float]." - (with-expansions [<conversions> (do-template [<procedure> <from> <to>] + (with-expansions [<conversions> (template [<procedure> <from> <to>] [(test (format <procedure> " SUCCESS") (success <procedure> (list (' ("lux coerce" (+0 <from> (+0)) []))) <to>)) (test (format <procedure> " FAILURE") @@ -92,7 +92,7 @@ ))) (context: "Conversions [int]." - (with-expansions [<conversions> (do-template [<procedure> <from> <to>] + (with-expansions [<conversions> (template [<procedure> <from> <to>] [(test (format <procedure> " SUCCESS") (success <procedure> (list (' ("lux coerce" (+0 <from> (+0)) []))) <to>)) (test (format <procedure> " FAILURE") @@ -110,7 +110,7 @@ ))) (context: "Conversions [long]." - (with-expansions [<conversions> (do-template [<procedure> <from> <to>] + (with-expansions [<conversions> (template [<procedure> <from> <to>] [(test (format <procedure> " SUCCESS") (success <procedure> (list (' ("lux coerce" (+0 <from> (+0)) []))) <to>)) (test (format <procedure> " FAILURE") @@ -127,7 +127,7 @@ ))) (context: "Conversions [char + byte + short]." - (with-expansions [<conversions> (do-template [<procedure> <from> <to>] + (with-expansions [<conversions> (template [<procedure> <from> <to>] [(test (format <procedure> " SUCCESS") (success <procedure> (list (' ("lux coerce" (+0 <from> (+0)) []))) <to>)) (test (format <procedure> " FAILURE") @@ -144,9 +144,9 @@ <conversions> ))) -(do-template [<domain> <boxed> <type>] +(template [<domain> <boxed> <type>] [(context: (format "Arithmetic " "[" <domain> "].") - (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] + (with-expansions [<instructions> (template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> (list (' ("lux coerce" (+0 <subject> (+0)) [])) @@ -164,7 +164,7 @@ ))) (context: (format "Order " "[" <domain> "].") - (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] + (with-expansions [<instructions> (template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> (list (' ("lux coerce" (+0 <subject> (+0)) [])) @@ -179,7 +179,7 @@ ))) (context: (format "Bitwise " "[" <domain> "].") - (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] + (with-expansions [<instructions> (template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> (list (' ("lux coerce" (+0 <subject> (+0)) [])) @@ -202,9 +202,9 @@ ["long" "java.lang.Long" hostAE.Long] ) -(do-template [<domain> <boxed> <type>] +(template [<domain> <boxed> <type>] [(context: (format "Arithmetic " "[" <domain> "].") - (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] + (with-expansions [<instructions> (template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> (list (' ("lux coerce" (+0 <subject> (+0)) [])) @@ -222,7 +222,7 @@ ))) (context: (format "Order " "[" <domain> "].") - (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] + (with-expansions [<instructions> (template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> (list (' ("lux coerce" (+0 <subject> (+0)) [])) @@ -241,9 +241,9 @@ ["double" "java.lang.Double" hostAE.Double] ) -(do-template [<domain> <boxed> <type>] +(template [<domain> <boxed> <type>] [(context: (format "Order " "[" <domain> "].") - (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] + (with-expansions [<instructions> (template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> (list (' ("lux coerce" (+0 <subject> (+0)) [])) diff --git a/new-luxc/test/test/luxc/lang/analysis/type.lux b/new-luxc/test/test/luxc/lang/analysis/type.lux index 707565fca..dc1a0fea9 100644 --- a/new-luxc/test/test/luxc/lang/analysis/type.lux +++ b/new-luxc/test/test/luxc/lang/analysis/type.lux @@ -29,7 +29,7 @@ (def: check (r.Random [Code Type Code]) - (with-expansions [<triples> (do-template [<random> <type> <code>] + (with-expansions [<triples> (template [<random> <type> <code>] [(do r.Monad<Random> [value <random>] (wrap [(` <type>) diff --git a/new-luxc/test/test/luxc/lang/translation/case.lux b/new-luxc/test/test/luxc/lang/translation/case.lux index 801d9f1d7..0cee2818a 100644 --- a/new-luxc/test/test/luxc/lang/translation/case.lux +++ b/new-luxc/test/test/luxc/lang/translation/case.lux @@ -4,16 +4,22 @@ [monad (#+ do)] pipe] [data + ["." error] + [text ("text/." Equivalence<Text>) + format] [collection - ["." list]]] + ["." list ("list/." Functor<List> Fold<List>)]]] [math ["r" random (#+ Random)]] [compiler [default ["." reference] - [phase + ["." phase ["." analysis] - ["." synthesis (#+ Path Synthesis)]]]] + ["." synthesis (#+ Path Synthesis) + ["." case] + ["." expression]] + ["." extension/synthesis]]]] test] [test [luxc @@ -39,7 +45,7 @@ [value r.i64] (wrap [(synthesis.i64 value) synthesis.path/pop])) - (~~ (do-template [<gen> <synth> <path>] + (~~ (template [<gen> <synth> <path>] [(do r.Monad<Random> [value <gen>] (wrap [(<synth> value) @@ -58,10 +64,11 @@ (list.concat (list (list.repeat idx unitS) (list subS) (list.repeat (|> size dec (n/- idx)) unitS)))) - caseP (synthesis.path/seq [(if (tail? size idx) - (synthesis.member/right idx) - (synthesis.member/left idx)) - subP])]] + caseP ($_ synthesis.path/seq + (if (tail? size idx) + (synthesis.member/right idx) + (synthesis.member/left idx)) + subP)]] (wrap [caseS caseP])) (do r.Monad<Random> [size ..size @@ -72,11 +79,11 @@ {#analysis.lefts idx #analysis.right? right? #analysis.value subS}) - caseP (synthesis.path/seq - [(if right? - (synthesis.side/right idx) - (synthesis.side/left idx)) - subP])]] + caseP ($_ synthesis.path/seq + (if right? + (synthesis.side/right idx) + (synthesis.side/left idx)) + subP)]] (wrap [caseS caseP])) )))) @@ -111,17 +118,166 @@ (test "Case." (|> (run (synthesis.branch/case [inputS - (synthesis.path/alt [(synthesis.path/seq [pathS - (synthesis.path/then (synthesis.f64 on-success))]) - (synthesis.path/then (synthesis.f64 on-failure))])])) + ($_ synthesis.path/alt + ($_ synthesis.path/seq + pathS + (synthesis.path/then (synthesis.f64 on-success))) + (synthesis.path/then (synthesis.f64 on-failure)))])) (&.check on-success))))) +(def: special-input + Synthesis + (let [_cursor_ (: Synthesis + (synthesis.tuple (list (synthesis.text "lux") + (synthesis.i64 +901) + (synthesis.i64 +13)))) + _code_ (: (-> Synthesis Synthesis) + (function (_ content) + (synthesis.tuple (list _cursor_ content)))) + _nil_ (: Synthesis + (synthesis.variant [0 #0 (synthesis.text "")])) + _cons_ (: (-> Synthesis Synthesis Synthesis) + (function (_ head tail) + (synthesis.variant [0 #1 (synthesis.tuple (list head tail))]))) + _list_ (: (-> (List Synthesis) Synthesis) + (list/fold _cons_ _nil_))] + (let [__tuple__ (: (-> (List Synthesis) Synthesis) + (|>> list.reverse _list_ [9 #0] synthesis.variant _code_)) + __form__ (: (-> (List Synthesis) Synthesis) + (|>> list.reverse _list_ [8 #0] synthesis.variant _code_)) + __text__ (: (-> Text Synthesis) + (function (_ value) + (_code_ (synthesis.variant [5 #0 (synthesis.text value)])))) + __identifier__ (: (-> Name Synthesis) + (function (_ [module short]) + (_code_ (synthesis.variant [6 #0 (synthesis.tuple (list (synthesis.text module) + (synthesis.text short)))])))) + __tag__ (: (-> Name Synthesis) + (function (_ [module short]) + (_code_ (synthesis.variant [7 #0 (synthesis.tuple (list (synthesis.text module) + (synthesis.text short)))])))) + __list__ (: (-> (List Synthesis) Synthesis) + (list/fold (function (_ head tail) + (__form__ (list (__tag__ ["" "Cons"]) head tail))) + (__tag__ ["" "Nil"]))) + __apply__ (: (-> Synthesis Synthesis Synthesis) + (function (_ func arg) + (__form__ (list func arg))))] + (|> _nil_ + (_cons_ (__apply__ (__identifier__ ["" "form$"]) + (__list__ (list (__apply__ (__identifier__ ["" "tag$"]) + (__tuple__ (list (__text__ "lux") + (__text__ "Cons")))) + (__identifier__ ["" "export?-meta"]) + (__identifier__ ["" "tail"]))))) + (_cons_ (__tuple__ (list (__identifier__ ["" "tail"])))) + )))) + +(def: special-path + Path + (let [_nil_ (synthesis.path/side (#.Left 0)) + _cons_ (synthesis.path/side (#.Right 0)) + _head_ (synthesis.path/member (#.Left 0)) + _tail_ (synthesis.path/member (#.Right 0)) + _tuple_ (synthesis.path/side (#.Left 9))] + ($_ synthesis.path/alt + ($_ synthesis.path/seq + _cons_ + _head_ + _head_ (synthesis.path/bind 2) synthesis.path/pop + _tail_ _tuple_ _cons_ + _head_ (synthesis.path/bind 3) synthesis.path/pop + _tail_ (synthesis.path/bind 4) synthesis.path/pop + synthesis.path/pop synthesis.path/pop synthesis.path/pop synthesis.path/pop + _tail_ _cons_ + _head_ (synthesis.path/bind 5) synthesis.path/pop + _tail_ _nil_ + ## THEN + (synthesis.path/then (synthesis.bit #1))) + ($_ synthesis.path/seq + (synthesis.path/bind 2) + ## THEN + (synthesis.path/then (synthesis.bit #0)))))) + +(def: special-pattern + analysis.Pattern + (let [## [_ (#Tuple (#Cons arg args'))] + head (<| analysis.pattern/tuple (list (analysis.pattern/bind 2)) + analysis.pattern/variant [9 #0] + analysis.pattern/variant [0 #1] + analysis.pattern/tuple (list (analysis.pattern/bind 3) + (analysis.pattern/bind 4))) + ## (#Cons body #Nil) + tail (<| analysis.pattern/variant [0 #1] + analysis.pattern/tuple (list (analysis.pattern/bind 5)) + analysis.pattern/variant [0 #0] + (analysis.pattern/unit))] + ## (#Cons <head> <tail>) + (<| analysis.pattern/variant [0 #1] + (analysis.pattern/tuple (list head tail))))) + +(def: special-pattern-path + Path + ($_ synthesis.path/alt + (<| error.assume + (phase.run [extension/synthesis.bundle + synthesis.init]) + (case.path expression.synthesize + special-pattern) + (analysis.bit #1)) + ($_ synthesis.path/seq + (synthesis.path/bind 2) + ## THEN + (synthesis.path/then (synthesis.bit #0))))) + +(def: (special-spec run) + (-> Runner Test) + (do r.Monad<Random> + [] + ($_ seq + (test "===" + (and (text/= (synthesis.%path special-path) + (synthesis.%path special-pattern-path)) + (:: synthesis.Equivalence<Path> = special-path special-pattern-path))) + (test "CODE" + (|> (run special-input) + (case> (#error.Success output) + (exec (log! (|> output (:coerce (List Code)) (%list %code))) + #1) + + (#error.Error error) + (exec (log! error) + #0)))) + (test "PATTERN-MATCHING 0" + (|> (run (synthesis.branch/case [special-input + special-path])) + (case> (#error.Success output) + (exec (log! (format "output 0 = " (%b (:coerce Bit output)))) + #1) + + (#error.Error error) + (exec (log! error) + #0)))) + (test "PATTERN-MATCHING 1" + (|> (run (synthesis.branch/case [special-input + special-pattern-path])) + (case> (#error.Success output) + (exec (log! (format "output 1 = " (%b (:coerce Bit output)))) + #1) + + (#error.Error error) + (exec (log! error) + #0)))) + ))) + (def: (pattern-matching-spec run) (-> Runner Test) ($_ seq - (let-spec run) - (if-spec run) - (case-spec run))) + (special-spec run) + ## (let-spec run) + ## (if-spec run) + ## (case-spec run) + )) (context: "[JVM] Pattern-matching." (<| (times 100) diff --git a/new-luxc/test/test/luxc/lang/translation/common.lux b/new-luxc/test/test/luxc/lang/translation/common.lux index 3005a7588..1e671aa96 100644 --- a/new-luxc/test/test/luxc/lang/translation/common.lux +++ b/new-luxc/test/test/luxc/lang/translation/common.lux @@ -31,7 +31,7 @@ (do r.Monad<Random> [param r.i64 subject r.i64] - (with-expansions [<binary> (do-template [<name> <reference> <param-expr>] + (with-expansions [<binary> (template [<name> <reference> <param-expr>] [(test <name> (|> (run (#synthesis.Extension <name> (list (synthesis.i64 subject) (synthesis.i64 param)))) @@ -70,7 +70,7 @@ [param (|> r.i64 (r.filter (|>> ("lux i64 =" 0) not))) subject r.i64] (`` ($_ seq - (~~ (do-template [<name> <type> <prepare> <comp> <subject-expr>] + (~~ (template [<name> <type> <prepare> <comp> <subject-expr>] [(test <name> (|> (run (#synthesis.Extension <name> (list (synthesis.i64 subject)))) (case> (#error.Success valueT) @@ -86,7 +86,7 @@ (n/% (i64.left-shift 8 1)) (:coerce Int))] )) - (~~ (do-template [<name> <reference> <outputT> <comp>] + (~~ (template [<name> <reference> <outputT> <comp>] [(test <name> (|> (run (#synthesis.Extension <name> (list (synthesis.i64 subject) (synthesis.i64 param)))) @@ -116,7 +116,7 @@ [param (|> ..simple-frac (r.filter (|>> (f/= +0.0) not))) subject ..simple-frac] (`` ($_ seq - (~~ (do-template [<name> <reference> <comp>] + (~~ (template [<name> <reference> <comp>] [(test <name> (|> (run (#synthesis.Extension <name> (list (synthesis.f64 subject) (synthesis.f64 param)))) @@ -128,7 +128,7 @@ ["lux f64 /" f// f/=] ["lux f64 %" f/% f/=] )) - (~~ (do-template [<name> <text>] + (~~ (template [<name> <text>] [(test <name> (|> (run (#synthesis.Extension <name> (list (synthesis.f64 subject) (synthesis.f64 param)))) @@ -142,7 +142,7 @@ ["lux f64 =" f/=] ["lux f64 <" f/<] )) - (~~ (do-template [<name> <reference>] + (~~ (template [<name> <reference>] [(test <name> (|> (run (#synthesis.Extension <name> (list))) (&.check <reference>)))] diff --git a/new-luxc/test/test/luxc/lang/translation/js.lux b/new-luxc/test/test/luxc/lang/translation/js.lux index 8175e82fc..83108c594 100644 --- a/new-luxc/test/test/luxc/lang/translation/js.lux +++ b/new-luxc/test/test/luxc/lang/translation/js.lux @@ -30,7 +30,7 @@ (type: Check (-> (e.Error Any) Bit)) -(do-template [<name> <type> <pre> <=>] +(template [<name> <type> <pre> <=>] [(def: (<name> angle) (-> <type> Check) (|>> (case> (#e.Success valueV) diff --git a/new-luxc/test/test/luxc/lang/translation/jvm.lux b/new-luxc/test/test/luxc/lang/translation/jvm.lux index f31496b08..7c97b1e78 100644 --- a/new-luxc/test/test/luxc/lang/translation/jvm.lux +++ b/new-luxc/test/test/luxc/lang/translation/jvm.lux @@ -29,7 +29,7 @@ (do @ [int-sample (|> r.int (:: @ map (i/% 128))) #let [frac-sample (int-to-frac int-sample)]] - (with-expansions [<2step> (do-template [<step1> <step2> <tag> <sample> <cast> <test>] + (with-expansions [<2step> (template [<step1> <step2> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2>) (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (|> (~ (<tag> <sample>)) <step1> <step2> (`)))] @@ -61,7 +61,7 @@ [int-sample (|> r.int (:: @ map (|>> (i/% 128) int/abs))) #let [frac-sample (int-to-frac int-sample)]] (`` ($_ seq - (~~ (do-template [<step1> <step2> <step3> <tag> <sample> <cast> <test>] + (~~ (template [<step1> <step2> <step3> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2> " / " <step3>) (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> (`)))] @@ -88,7 +88,7 @@ [int-sample (|> r.int (:: @ map (|>> (i/% 128) int/abs))) #let [frac-sample (int-to-frac int-sample)]] (`` ($_ seq - (~~ (do-template [<step1> <step2> <step3> <step4> <tag> <sample> <cast> <test>] + (~~ (template [<step1> <step2> <step3> <step4> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2> " / " <step3>) (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> <step4> (`)))] @@ -121,13 +121,13 @@ (r.Random Frac) (|> gen-int (r/map int-to-frac))) -(do-template [<domain> <generator> <tag> <type> <test> <augmentation> <+> <-> <*> </> <%> <pre> <post>] +(template [<domain> <generator> <tag> <type> <test> <augmentation> <+> <-> <*> </> <%> <pre> <post>] [(context: (format "Arithmetic [" <domain> "]") (<| (times +100) (do @ [param <generator> #let [subject (<augmentation> param)]] - (with-expansions [<tests> (do-template [<procedure> <reference>] + (with-expansions [<tests> (template [<procedure> <reference>] [(test <procedure> (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (<post> ((code.text <procedure>) @@ -159,14 +159,14 @@ ["double" gen-frac code.frac Frac f/= (f/* 10.0) f/+ f/- f/* f// f/% id id] ) -(do-template [<domain> <post> <convert>] +(template [<domain> <post> <convert>] [(context: (format "Bit-wise [" <domain> "] { Combiners ]") (<| (times +100) (do @ [param gen-nat subject gen-nat] (`` ($_ seq - (~~ (do-template [<procedure> <reference>] + (~~ (template [<procedure> <reference>] [(test <procedure> (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (<post> ((code.text <procedure>) @@ -192,7 +192,7 @@ ["long" id id] ) -(do-template [<domain> <post> <convert>] +(template [<domain> <post> <convert>] [(context: (format "Bit-wise [" <domain> "] { Shifters }") (<| (times +100) (do @ @@ -200,7 +200,7 @@ subject gen-nat #let [shift (n/% +10 param)]] (`` ($_ seq - (~~ (do-template [<procedure> <reference> <type> <test> <pre-subject> <pre>] + (~~ (template [<procedure> <reference> <type> <test> <pre-subject> <pre>] [(test <procedure> (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (<post> ((code.text <procedure>) @@ -226,13 +226,13 @@ ["long" id id] ) -(do-template [<domain> <generator> <tag> <=> <<> <pre>] +(template [<domain> <generator> <tag> <=> <<> <pre>] [(context: (format "Order [" <domain> "]") (<| (times +100) (do @ [param <generator> subject <generator>] - (with-expansions [<tests> (do-template [<procedure> <reference>] + (with-expansions [<tests> (template [<procedure> <reference>] [(test <procedure> (|> (do macro.Monad<Meta> [sampleI (expressionT.translate ((code.text <procedure>) @@ -287,7 +287,7 @@ valueF gen-frac valueD r.frac valueC gen-int] - (with-expansions [<array> (do-template [<class> <type> <value> <test> <input> <post>] + (with-expansions [<array> (template [<class> <type> <value> <test> <input> <post>] [(test <class> (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (|> (jvm//array//new +0 <class> size) @@ -335,7 +335,7 @@ valueF gen-frac valueD r.frac valueC gen-int] - (with-expansions [<array> (do-template [<class> <type> <value> <test> <input> <post>] + (with-expansions [<array> (template [<class> <type> <value> <test> <input> <post>] [(test <class> (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (|> (jvm//array//new +0 <class> size) diff --git a/new-luxc/test/test/luxc/lang/translation/primitive.lux b/new-luxc/test/test/luxc/lang/translation/primitive.lux index ee8e53d5e..f3c6c8fc3 100644 --- a/new-luxc/test/test/luxc/lang/translation/primitive.lux +++ b/new-luxc/test/test/luxc/lang/translation/primitive.lux @@ -34,7 +34,7 @@ |f64| r.frac |text| (r.ascii 5)] (`` ($_ seq - (~~ (do-template [<desc> <type> <synthesis> <sample> <test>] + (~~ (template [<desc> <type> <synthesis> <sample> <test>] [(test (format "Can translate " <desc> ".") (|> (run (<synthesis> <sample>)) (case> (#error.Success valueT) diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index ebdf57efb..2c550ebd9 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -2263,11 +2263,11 @@ #1 ("lux i64 =" test subject))) -(macro:' #export (do-template tokens) +(macro:' #export (template tokens) (list [(tag$ ["lux" "doc"]) (text$ ($_ "lux text concat" "## By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary." __paragraph - "(do-template [<name> <diff>]" ..new-line + "(template [<name> <diff>]" ..new-line " " "[(def: #export <name> (-> Int Int) (i/+ <diff>))]" __paragraph " " "[inc +1]" ..new-line " " "[dec -1]"))]) @@ -2281,15 +2281,15 @@ (|> data' (join-map (compose apply (make-env bindings'))) return) - (fail "Irregular arguments tuples for do-template."))) + (fail "Irregular arguments tuples for template."))) _ - (fail "Wrong syntax for do-template")} + (fail "Wrong syntax for template")} [(monad@map maybe-monad get-short bindings) (monad@map maybe-monad tuple->list data)]) _ - (fail "Wrong syntax for do-template")} + (fail "Wrong syntax for template")} tokens)) (def:''' #export (r/= test subject) @@ -2328,7 +2328,7 @@ #1 ("lux i64 =" test subject))) -(do-template [<type> +(template [<type> <eq-proc> <lt-proc> <eq-name> <lt-name> <lte-name> <gt-name> <gte-name> <eq-doc> <<-doc> <<=-doc> <>-doc> <>=-doc>] [(def:''' #export (<eq-name> test subject) @@ -2412,7 +2412,7 @@ ("lux coerce" Int param))] ("lux i64 -" subject flat))) -(do-template [<type> <name> <op> <doc>] +(template [<type> <name> <op> <doc>] [(def:''' #export (<name> param subject) (list [(tag$ ["lux" "doc"]) (text$ <doc>)]) @@ -2426,7 +2426,7 @@ [ Rev r/- "lux i64 -" "Rev(olution) substraction."] ) -(do-template [<type> <name> <op> <doc>] +(template [<type> <name> <op> <doc>] [(def:''' #export (<name> param subject) (list [(tag$ ["lux" "doc"]) (text$ <doc>)]) @@ -2525,7 +2525,7 @@ _ ("lux i64 left-shift" (n/- trailing-zeroes 64) 1)} trailing-zeroes))))) -(do-template [<name> <type> <test> <doc>] +(template [<name> <type> <test> <doc>] [(def:''' #export (<name> left right) (list [(tag$ ["lux" "doc"]) (text$ <doc>)]) @@ -2876,7 +2876,7 @@ _ #0} xs)) -(do-template [<name> <type> <value>] +(template [<name> <type> <value>] [(def:''' (<name> xy) #Nil (All [a b] (-> (& a b) <type>)) @@ -3569,7 +3569,7 @@ (#Some y) (#Some y)))) -(do-template [<name> <form> <message> <doc-msg>] +(template [<name> <form> <message> <doc-msg>] [(macro: #export (<name> tokens) {#.doc <doc-msg>} (case (list@reverse tokens) @@ -3740,7 +3740,7 @@ _ #None)) -(do-template [<name> <tag>] +(template [<name> <tag>] [(def: (<name> type) (-> Type (List Type)) (case type @@ -4046,7 +4046,7 @@ (fail "Wrong syntax for type:")) )) -(do-template [<name> <to>] +(template [<name> <to>] [(def: #export (<name> value) (-> (I64 Any) <to>) (:coerce <to> value))] @@ -5110,7 +5110,7 @@ (macro: #export (^template tokens) {#.doc (text$ ($_ "lux text concat" - "## It's similar to do-template, but meant to be used during pattern-matching." ..new-line + "## It's similar to template, but meant to be used during pattern-matching." ..new-line "(def: (beta-reduce env type)" ..new-line " (-> (List Type) Type Type)" ..new-line " (case type" ..new-line @@ -5167,7 +5167,7 @@ _ (fail "Wrong syntax for ^template"))) -(do-template [<name> <from> <to> <proc>] +(template [<name> <from> <to> <proc>] [(def: #export (<name> n) (-> <from> <to>) (<proc> [n]))] @@ -5220,7 +5220,7 @@ (-> Text Text) ($_ text@compose ..double-quote original ..double-quote)) -(do-template [<name> <extension> <doc>] +(template [<name> <extension> <doc>] [(def: #export (<name> value) {#.doc <doc>} (All [s] (-> (I64 s) (I64 s))) @@ -5522,7 +5522,7 @@ "Wherever a binding appears, the bound codes will be spliced in there." (test: "Code operations & structures" (with-expansions - [<tests> (do-template [<expr> <text> <pattern>] + [<tests> (template [<expr> <text> <pattern>] [(compare <pattern> <expr>) (compare <text> (:: Code/encode encode <expr>)) (compare #1 (:: equivalence = <expr> <expr>))] @@ -5748,7 +5748,7 @@ _ (fail (..wrong-syntax-error ["lux" "name-of"])))) -(do-template [<type> <even> <odd> <%> <=> <0> <2>] +(template [<type> <even> <odd> <%> <=> <0> <2>] [(def: #export (<even> n) (-> <type> Bit) (<=> <0> (<%> <2> n))) @@ -5961,7 +5961,7 @@ )) (macro: #export (template: tokens) - {#.doc (doc "Define macros in the style of do-template and ^template." + {#.doc (doc "Define macros in the style of template and ^template." "For simple macros that do not need any fancy features." (template: (square x) (i/* x x)))} @@ -6049,7 +6049,7 @@ _ (fail (..wrong-syntax-error (name-of ..for)))))) -(do-template [<name> <type> <output>] +(template [<name> <type> <output>] [(def: (<name> xy) (All [a b] (-> [a b] <type>)) (let [[x y] xy] @@ -6200,7 +6200,7 @@ (|> raw (shift param))) raw))) -(do-template [<type> </%> </> <%>] +(template [<type> </%> </> <%>] [(def: #export (</%> param subject) (-> <type> <type> [<type> <type>]) [(</> param subject) @@ -6242,7 +6242,7 @@ (nat@encode column))] ($_ "lux text concat" "[" fields "]"))) -(do-template [<zero> <one>] +(template [<zero> <one>] [(def: #export <zero> #0) (def: #export <one> #1)] diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux index caae325a2..2ec99fe8f 100644 --- a/stdlib/source/lux/control/concatenative.lux +++ b/stdlib/source/lux/control/concatenative.lux @@ -199,7 +199,7 @@ (function (_ [stack r]) [stack (1 r)])) -(do-template [<input> <output> <word> <func>] +(template [<input> <output> <word> <func>] [(def: #export <word> (=> [<input> <input>] [<output>]) (function (_ [[stack subject] param]) diff --git a/stdlib/source/lux/control/concurrency/actor.lux b/stdlib/source/lux/control/concurrency/actor.lux index 92cf0207e..133144a83 100644 --- a/stdlib/source/lux/control/concurrency/actor.lux +++ b/stdlib/source/lux/control/concurrency/actor.lux @@ -158,7 +158,7 @@ (promise.resolved (ex.throw ..poisoned []))) actor)) -(do-template [<with> <resolve> <tag> <desc>] +(template [<with> <resolve> <tag> <desc>] [(def: #export (<with> name) (-> Name cs.Annotations cs.Annotations) (|>> (#.Cons [(name-of <tag>) @@ -184,7 +184,7 @@ (p.either (s.form (p.and s.local-identifier (p.some s.local-identifier))) (p.and s.local-identifier (:: p.monad wrap (list))))) -(do-template [<name> <desc>] +(template [<name> <desc>] [(def: #export <name> (-> Text Text) (|>> (format <desc> "@")))] diff --git a/stdlib/source/lux/control/concurrency/promise.lux b/stdlib/source/lux/control/concurrency/promise.lux index 72fe34bcb..fa8acc6d9 100644 --- a/stdlib/source/lux/control/concurrency/promise.lux +++ b/stdlib/source/lux/control/concurrency/promise.lux @@ -126,7 +126,7 @@ (All [a b] (-> (Promise a) (Promise b) (Promise (| a b)))) (let [[a|b resolve] (..promise [])] (with-expansions - [<sides> (do-template [<promise> <tag>] + [<sides> (template [<promise> <tag>] [(io.run (await (|>> <tag> resolve) <promise>))] [left #.Left] @@ -139,7 +139,7 @@ {#.doc "Homogeneous alternative combinator."} (All [a] (-> (Promise a) (Promise a) (Promise a))) (let [[left||right resolve] (..promise [])] - (`` (exec (~~ (do-template [<promise>] + (`` (exec (~~ (template [<promise>] [(io.run (await resolve <promise>))] [left] diff --git a/stdlib/source/lux/control/concurrency/semaphore.lux b/stdlib/source/lux/control/concurrency/semaphore.lux index ddc73b300..2bc5be651 100644 --- a/stdlib/source/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/lux/control/concurrency/semaphore.lux @@ -125,7 +125,7 @@ (recur (inc step))) (:: promise.monad wrap [])))) - (do-template [<phase> <update> <goal> <turnstile>] + (template [<phase> <update> <goal> <turnstile>] [(def: (<phase> (^:representation barrier)) (-> Barrier (Promise Any)) (do promise.monad diff --git a/stdlib/source/lux/control/interval.lux b/stdlib/source/lux/control/interval.lux index 60e452c54..046f5b77d 100644 --- a/stdlib/source/lux/control/interval.lux +++ b/stdlib/source/lux/control/interval.lux @@ -28,7 +28,7 @@ (def: bottom elem) (def: top elem))) -(do-template [<name> <comp>] +(template [<name> <comp>] [(def: #export (<name> interval) (All [a] (-> (Interval a) Bit)) (let [(^open ".") interval] @@ -54,7 +54,7 @@ (and (= bottom elem) (= top elem))))) -(do-template [<name> <limit>] +(template [<name> <limit>] [(def: #export (<name> elem interval) (All [a] (-> a (Interval a) Bit)) (let [(^open ".") interval] @@ -111,7 +111,7 @@ (or (meets? reference sample) (meets? sample reference))) -(do-template [<name> <eq-side> <ineq> <ineq-side>] +(template [<name> <eq-side> <ineq> <ineq-side>] [(def: #export (<name> reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) (let [(^open ".") reference] @@ -122,7 +122,7 @@ [finishes? top >= bottom] ) -(do-template [<name> <comp>] +(template [<name> <comp>] [(def: #export (<name> reference sample) (All [a] (-> a (Interval a) Bit)) (let [(^open ".") sample] diff --git a/stdlib/source/lux/control/number.lux b/stdlib/source/lux/control/number.lux index 3fc8faabf..b3a314ba5 100644 --- a/stdlib/source/lux/control/number.lux +++ b/stdlib/source/lux/control/number.lux @@ -4,11 +4,11 @@ (`` (signature: #export (Number n) {#.doc "Everything that should be expected of a number type."} - (~~ (do-template [<name>] + (~~ (template [<name>] [(: (-> n n n) <name>)] [+] [-] [*] [/] [%])) - (~~ (do-template [<name>] + (~~ (template [<name>] [(: (-> n n) <name>)] [negate] [signum] [abs])) )) diff --git a/stdlib/source/lux/control/order.lux b/stdlib/source/lux/control/order.lux index a56f512cb..68573b326 100644 --- a/stdlib/source/lux/control/order.lux +++ b/stdlib/source/lux/control/order.lux @@ -12,7 +12,7 @@ (: (Equivalence a) &equivalence) - (~~ (do-template [<name>] + (~~ (template [<name>] [(: (-> a a Bit) <name>)] [<] [<=] [>] [>=] @@ -37,7 +37,7 @@ (or (> test subject) (:: equivalence = test subject)))))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> order x y) (All [a] (-> (Order a) a a a)) @@ -52,7 +52,7 @@ (structure (def: &equivalence (:: equivalence.contravariant map-1 f (:: order &equivalence))) - (~~ (do-template [<name>] + (~~ (template [<name>] [(def: (<name> reference sample) (:: order <name> (f reference) (f sample)))] diff --git a/stdlib/source/lux/control/predicate.lux b/stdlib/source/lux/control/predicate.lux index 605426da4..7d6433f33 100644 --- a/stdlib/source/lux/control/predicate.lux +++ b/stdlib/source/lux/control/predicate.lux @@ -8,7 +8,7 @@ (type: #export (Predicate a) (-> a Bit)) -(do-template [<identity-name> <identity-value> <composition-name> <composition>] +(template [<identity-name> <identity-value> <composition-name> <composition>] [(def: #export <identity-name> (All [a] (Predicate a)) (function.constant <identity-value>)) @@ -23,7 +23,7 @@ [all #1 intersection and] ) -(do-template [<name> <identity> <composition>] +(template [<name> <identity> <composition>] [(structure: #export <name> (All [a] (Monoid (Predicate a))) (def: identity <identity>) (def: compose <composition>))] diff --git a/stdlib/source/lux/control/remember.lux b/stdlib/source/lux/control/remember.lux index 22488c4e2..34bb38001 100644 --- a/stdlib/source/lux/control/remember.lux +++ b/stdlib/source/lux/control/remember.lux @@ -51,7 +51,7 @@ (list))) (macro.fail (ex.construct must-remember [message focus]))))) -(do-template [<name> <message>] +(template [<name> <message>] [(syntax: #export (<name> {deadline ..deadline} {message s.text} {focus (p.maybe s.any)}) (wrap (list (` (..remember (~ (code.text (date@encode deadline))) (~ (code.text (format <message> " " message))) diff --git a/stdlib/source/lux/data/bit.lux b/stdlib/source/lux/data/bit.lux index ab8c24a8e..72cfc096e 100644 --- a/stdlib/source/lux/data/bit.lux +++ b/stdlib/source/lux/data/bit.lux @@ -20,7 +20,7 @@ #1 1 #0 0))) -(do-template [<name> <identity> <op>] +(template [<name> <identity> <op>] [(structure: #export <name> (Monoid Bit) (def: identity <identity>) (def: (compose x y) (<op> x y)))] diff --git a/stdlib/source/lux/data/collection/array.lux b/stdlib/source/lux/data/collection/array.lux index d135b06d9..55e0ceb2b 100644 --- a/stdlib/source/lux/data/collection/array.lux +++ b/stdlib/source/lux/data/collection/array.lux @@ -271,7 +271,7 @@ (recur (f value so-far) (inc idx))) so-far))))) -(do-template [<name> <init> <op>] +(template [<name> <init> <op>] [(def: #export (<name> predicate array) (All [a] (-> (Predicate a) (Array a) Bit)) diff --git a/stdlib/source/lux/data/collection/bits.lux b/stdlib/source/lux/data/collection/bits.lux index 93158c54c..95732fe15 100644 --- a/stdlib/source/lux/data/collection/bits.lux +++ b/stdlib/source/lux/data/collection/bits.lux @@ -54,7 +54,7 @@ (|> bits (array.read idx) (maybe.default empty-chunk)) empty-chunk)) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> index input) (-> Nat Bits Bits) (let [[chunk-index bit-index] (n//% chunk-size index)] @@ -124,7 +124,7 @@ (recur (dec size|output))) output)))))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Bits Bits Bits) (case (n/max (array.size param) diff --git a/stdlib/source/lux/data/collection/dictionary.lux b/stdlib/source/lux/data/collection/dictionary.lux index 9a9663228..a9c53ea18 100644 --- a/stdlib/source/lux/data/collection/dictionary.lux +++ b/stdlib/source/lux/data/collection/dictionary.lux @@ -613,7 +613,7 @@ (new Hash<k>) kvs)) -(do-template [<name> <elem-type> <side>] +(template [<name> <elem-type> <side>] [(def: #export (<name> dict) (All [k v] (-> (Dictionary k v) (List <elem-type>))) (|> dict entries (list@map <side>)))] diff --git a/stdlib/source/lux/data/collection/dictionary/ordered.lux b/stdlib/source/lux/data/collection/dictionary/ordered.lux index e2d0f21fd..5bd957364 100644 --- a/stdlib/source/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/lux/data/collection/dictionary/ordered.lux @@ -26,7 +26,7 @@ #left (Maybe (Node k v)) #right (Maybe (Node k v))}) -(do-template [<create> <color>] +(template [<create> <color>] [(def: (<create> key value left right) (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) {#color <color> @@ -91,7 +91,7 @@ (recur (get@ #left node)) (recur (get@ #right node))))))))) -(do-template [<name> <side>] +(template [<name> <side>] [(def: #export (<name> dict) (All [k v] (-> (Dictionary k v) (Maybe v))) (case (get@ #root dict) @@ -111,7 +111,7 @@ [max #right] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> dict) (All [k v] (-> (Dictionary k v) Nat)) (loop [node (get@ #root dict)] @@ -127,7 +127,7 @@ [depth n/max] ) -(do-template [<name> <other-color> <self-color> <no-change>] +(template [<name> <other-color> <self-color> <no-change>] [(def: (<name> self) (All [k v] (-> (Node k v) (Node k v))) (case (get@ #color self) @@ -256,7 +256,7 @@ (#.Some root) (let [reference (get@ #key root)] - (`` (cond (~~ (do-template [<comp> <tag> <add>] + (`` (cond (~~ (template [<comp> <tag> <add>] [(<comp> reference key) (let [side-root (get@ <tag> root) outcome (recur side-root)] @@ -537,7 +537,7 @@ (new Order<l>) list)) -(do-template [<name> <type> <output>] +(template [<name> <type> <output>] [(def: #export (<name> dict) (All [k v] (-> (Dictionary k v) (List <type>))) (loop [node (get@ #root dict)] diff --git a/stdlib/source/lux/data/collection/dictionary/plist.lux b/stdlib/source/lux/data/collection/dictionary/plist.lux index 269c8bd02..2e08d72f2 100644 --- a/stdlib/source/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/lux/data/collection/dictionary/plist.lux @@ -20,7 +20,7 @@ (#.Some v') (get key properties')))) -(do-template [<name> <type> <access>] +(template [<name> <type> <access>] [(def: #export <name> (All [a] (-> (PList a) (List <type>))) (list;map <access>))] diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux index 46042d1d7..b2da3337b 100644 --- a/stdlib/source/lux/data/collection/list.lux +++ b/stdlib/source/lux/data/collection/list.lux @@ -68,7 +68,7 @@ _ #.Nil)) -(do-template [<name> <then> <else>] +(template [<name> <then> <else>] [(def: #export (<name> n xs) (All [a] (-> Nat (List a) (List a))) @@ -85,7 +85,7 @@ [drop (drop (dec n) xs') xs] ) -(do-template [<name> <then> <else>] +(template [<name> <then> <else>] [(def: #export (<name> predicate xs) (All [a] (-> (Predicate a) (List a) (List a))) @@ -235,7 +235,7 @@ (All [a] (-> (List a) Nat)) (fold (function (_ _ acc) (n/+ 1 acc)) 0 list)) -(do-template [<name> <init> <op>] +(template [<name> <init> <op>] [(def: #export (<name> predicate xs) (All [a] (-> (Predicate a) (List a) Bit)) @@ -335,7 +335,7 @@ xs')] ($_ compose (sort < pre) (list x) (sort < post))))) -(do-template [<name> <type> <lt> <gt>] +(template [<name> <type> <lt> <gt>] [(def: #export (<name> from to) {#.doc "Generates an inclusive interval of values [from, to]."} (-> <type> <type> (List <type>)) @@ -365,7 +365,7 @@ (#.Cons x' xs') (or (:: eq = x x') (member? eq xs' x)))) -(do-template [<name> <output> <side> <doc>] +(template [<name> <output> <side> <doc>] [(def: #export (<name> xs) {#.doc <doc>} (All [a] (-> (List a) (Maybe <output>))) diff --git a/stdlib/source/lux/data/collection/row.lux b/stdlib/source/lux/data/collection/row.lux index 16ad5b51a..d56da4b79 100644 --- a/stdlib/source/lux/data/collection/row.lux +++ b/stdlib/source/lux/data/collection/row.lux @@ -40,7 +40,7 @@ Level 0) -(do-template [<name> <op>] +(template [<name> <op>] [(def: <name> (-> Level Level) (<op> branching-exponent))] @@ -428,7 +428,7 @@ (All [a] (-> (Row a) (Row a))) (|>> ..to-list list.reverse (list@fold add ..empty))) -(do-template [<name> <array> <init> <op>] +(template [<name> <array> <init> <op>] [(def: #export <name> (All [a] (-> (Predicate a) (Row a) Bit)) diff --git a/stdlib/source/lux/data/collection/sequence.lux b/stdlib/source/lux/data/collection/sequence.lux index bff7b621e..720515c2d 100644 --- a/stdlib/source/lux/data/collection/sequence.lux +++ b/stdlib/source/lux/data/collection/sequence.lux @@ -51,7 +51,7 @@ (#.Cons x xs') (#.Some (cycle' x xs' x xs')))) -(do-template [<name> <return> <part>] +(template [<name> <return> <part>] [(def: #export (<name> s) (All [a] (-> (Sequence a) <return>)) (let [[h t] (continuation.run s)] @@ -67,7 +67,7 @@ (nth (dec idx) t) h))) -(do-template [<taker> <dropper> <splitter> <pred-type> <pred-test> <pred-step>] +(template [<taker> <dropper> <splitter> <pred-type> <pred-test> <pred-step>] [(def: #export (<taker> pred xs) (All [a] (-> <pred-type> (Sequence a) (List a))) diff --git a/stdlib/source/lux/data/collection/set/ordered.lux b/stdlib/source/lux/data/collection/set/ordered.lux index 1be73506b..4d607ce15 100644 --- a/stdlib/source/lux/data/collection/set/ordered.lux +++ b/stdlib/source/lux/data/collection/set/ordered.lux @@ -24,7 +24,7 @@ (All [a] (-> (Set a) a Bit)) (|> set :representation (/.contains? elem))) - (do-template [<name> <alias>] + (template [<name> <alias>] [(def: #export <name> (All [a] (-> (Set a) (Maybe a))) (|>> :representation <alias>))] @@ -33,7 +33,7 @@ [max /.max] ) - (do-template [<name> <alias>] + (template [<name> <alias>] [(def: #export <name> (-> (Set Any) Nat) (|>> :representation <alias>))] diff --git a/stdlib/source/lux/data/collection/tree/rose/parser.lux b/stdlib/source/lux/data/collection/tree/rose/parser.lux index ba24cd908..17cee8931 100644 --- a/stdlib/source/lux/data/collection/tree/rose/parser.lux +++ b/stdlib/source/lux/data/collection/tree/rose/parser.lux @@ -31,7 +31,7 @@ (exception: #export cannot-move-further) -(do-template [<name> <direction>] +(template [<name> <direction>] [(def: #export <name> (All [t] (Parser t [])) (function (_ zipper) diff --git a/stdlib/source/lux/data/collection/tree/rose/zipper.lux b/stdlib/source/lux/data/collection/tree/rose/zipper.lux index 9472d7d26..1a8ed4d5c 100644 --- a/stdlib/source/lux/data/collection/tree/rose/zipper.lux +++ b/stdlib/source/lux/data/collection/tree/rose/zipper.lux @@ -117,7 +117,7 @@ zipper (start ancestor)))) -(do-template [<one> <all> <side> <op-side>] +(template [<one> <all> <side> <op-side>] [(def: #export (<one> zipper) (All [a] (-> (Zipper a) (Zipper a))) (case (get@ <side> zipper) @@ -239,7 +239,7 @@ (set@ #lefts side) (set@ #node next))))) -(do-template [<name> <side>] +(template [<name> <side>] [(def: #export (<name> value zipper) (All [a] (-> a (Zipper a) (Maybe (Zipper a)))) (case (get@ #parent zipper) diff --git a/stdlib/source/lux/data/color.lux b/stdlib/source/lux/data/color.lux index 7ca1764aa..bd02c4087 100644 --- a/stdlib/source/lux/data/color.lux +++ b/stdlib/source/lux/data/color.lux @@ -254,7 +254,7 @@ #green top #blue top})) -(do-template [<name> <target>] +(template [<name> <target>] [(def: #export (<name> ratio color) (-> Frac Color Color) (interpolate ratio <target> color))] @@ -271,7 +271,7 @@ #green (adjust green) #blue (adjust blue)}))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> ratio color) (-> Frac Color Color) (let [[hue saturation luminance] (to-hsl color)] @@ -292,7 +292,7 @@ +0.0 luminance]))) -(do-template [<name> <1> <2>] +(template [<name> <1> <2>] [(def: #export (<name> color) (-> Color [Color Color Color]) (let [[hue saturation luminance] (to-hsl color)] @@ -309,7 +309,7 @@ [split-complement (|> +1.0 (f// +5.0)) (|> +3.0 (f// +5.0))] ) -(do-template [<name> <1> <2> <3>] +(template [<name> <1> <2> <3>] [(def: #export (<name> color) (-> Color [Color Color Color Color]) (let [[hue saturation luminance] (to-hsl color)] diff --git a/stdlib/source/lux/data/color/named.lux b/stdlib/source/lux/data/color/named.lux index 76b8545f1..09e021727 100644 --- a/stdlib/source/lux/data/color/named.lux +++ b/stdlib/source/lux/data/color/named.lux @@ -4,152 +4,152 @@ [number (#+ hex)]]] ["." // (#+ Color)]) -(do-template [<name> <red> <green> <blue>] +(template [<red> <green> <blue> <name>] [(def: #export <name> Color (//.from-rgb {#//.red (hex <red>) #//.green (hex <green>) #//.blue (hex <blue>)}))] - [alice-blue "F0" "F8" "FF"] - [antique-white "FA" "EB" "D7"] - [aqua "00" "FF" "FF"] - [aquamarine "7F" "FF" "D4"] - [azure "F0" "FF" "FF"] - [beige "F5" "F5" "DC"] - [bisque "FF" "E4" "C4"] - [black "00" "00" "00"] - [blanched-almond "FF" "EB" "CD"] - [blue "00" "00" "FF"] - [blue-violet "8A" "2B" "E2"] - [brown "A5" "2A" "2A"] - [burly-wood "DE" "B8" "87"] - [cadet-blue "5F" "9E" "A0"] - [chartreuse "7F" "FF" "00"] - [chocolate "D2" "69" "1E"] - [coral "FF" "7F" "50"] - [cornflower-blue "64" "95" "ED"] - [cornsilk "FF" "F8" "DC"] - [crimson "DC" "14" "3C"] - [cyan "00" "FF" "FF"] - [dark-blue "00" "00" "8B"] - [dark-cyan "00" "8B" "8B"] - [dark-goldenrod "B8" "86" "0B"] - [dark-gray "A9" "A9" "A9"] - [dark-green "00" "64" "00"] - [dark-khaki "BD" "B7" "6B"] - [dark-magenta "8B" "00" "8B"] - [dark-olive-green "55" "6B" "2F"] - [dark-orange "FF" "8C" "00"] - [dark-orchid "99" "32" "CC"] - [dark-red "8B" "00" "00"] - [dark-salmon "E9" "96" "7A"] - [dark-sea-green "8F" "BC" "8F"] - [dark-slate-blue "48" "3D" "8B"] - [dark-slate-gray "2F" "4F" "4F"] - [dark-turquoise "00" "CE" "D1"] - [dark-violet "94" "00" "D3"] - [deep-pink "FF" "14" "93"] - [deep-sky-blue "00" "BF" "FF"] - [dim-gray "69" "69" "69"] - [dodger-blue "1E" "90" "FF"] - [fire-brick "B2" "22" "22"] - [floral-white "FF" "FA" "F0"] - [forest-green "22" "8B" "22"] - [fuchsia "FF" "00" "FF"] - [gainsboro "DC" "DC" "DC"] - [ghost-white "F8" "F8" "FF"] - [gold "FF" "D7" "00"] - [goldenrod "DA" "A5" "20"] - [gray "80" "80" "80"] - [green "00" "80" "00"] - [green-yellow "AD" "FF" "2F"] - [honey-dew "F0" "FF" "F0"] - [hot-pink "FF" "69" "B4"] - [indian-red "CD" "5C" "5C"] - [indigo "4B" "00" "82"] - [ivory "FF" "FF" "F0"] - [khaki "F0" "E6" "8C"] - [lavender "E6" "E6" "FA"] - [lavender-blush "FF" "F0" "F5"] - [lawn-green "7C" "FC" "00"] - [lemon-chiffon "FF" "FA" "CD"] - [light-blue "AD" "D8" "E6"] - [light-coral "F0" "80" "80"] - [light-cyan "E0" "FF" "FF"] - [light-goldenrod-yellow "FA" "FA" "D2"] - [light-gray "D3" "D3" "D3"] - [light-green "90" "EE" "90"] - [light-pink "FF" "B6" "C1"] - [light-salmon "FF" "A0" "7A"] - [light-sea-green "20" "B2" "AA"] - [light-sky-blue "87" "CE" "FA"] - [light-slate-gray "77" "88" "99"] - [light-steel-blue "B0" "C4" "DE"] - [light-yellow "FF" "FF" "E0"] - [lime "00" "FF" "00"] - [lime-green "32" "CD" "32"] - [linen "FA" "F0" "E6"] - [magenta "FF" "00" "FF"] - [maroon "80" "00" "00"] - [medium-aquamarine "66" "CD" "AA"] - [medium-blue "00" "00" "CD"] - [medium-orchid "BA" "55" "D3"] - [medium-purple "93" "70" "DB"] - [medium-sea-green "3C" "B3" "71"] - [medium-slate-blue "7B" "68" "EE"] - [medium-spring-green "00" "FA" "9A"] - [medium-turquoise "48" "D1" "CC"] - [medium-violet-red "C7" "15" "85"] - [midnight-blue "19" "19" "70"] - [mint-cream "F5" "FF" "FA"] - [misty-rose "FF" "E4" "E1"] - [moccasin "FF" "E4" "B5"] - [navajo-white "FF" "DE" "AD"] - [navy "00" "00" "80"] - [old-lace "FD" "F5" "E6"] - [olive "80" "80" "00"] - [olive-drab "6B" "8E" "23"] - [orange "FF" "A5" "00"] - [orange-red "FF" "45" "00"] - [orchid "DA" "70" "D6"] - [pale-goldenrod "EE" "E8" "AA"] - [pale-green "98" "FB" "98"] - [pale-turquoise "AF" "EE" "EE"] - [pale-violet-red "DB" "70" "93"] - [papaya-whip "FF" "EF" "D5"] - [peach-puff "FF" "DA" "B9"] - [peru "CD" "85" "3F"] - [pink "FF" "C0" "CB"] - [plum "DD" "A0" "DD"] - [powder-blue "B0" "E0" "E6"] - [purple "80" "00" "80"] - [rebecca-purple "66" "33" "99"] - [red "FF" "00" "00"] - [rosy-brown "BC" "8F" "8F"] - [royal-blue "41" "69" "E1"] - [saddle-brown "8B" "45" "13"] - [salmon "FA" "80" "72"] - [sandy-brown "F4" "A4" "60"] - [sea-green "2E" "8B" "57"] - [sea-shell "FF" "F5" "EE"] - [sienna "A0" "52" "2D"] - [silver "C0" "C0" "C0"] - [sky-blue "87" "CE" "EB"] - [slate-blue "6A" "5A" "CD"] - [slate-gray "70" "80" "90"] - [snow "FF" "FA" "FA"] - [spring-green "00" "FF" "7F"] - [steel-blue "46" "82" "B4"] - [tan "D2" "B4" "8C"] - [teal "00" "80" "80"] - [thistle "D8" "BF" "D8"] - [tomato "FF" "63" "47"] - [turquoise "40" "E0" "D0"] - [violet "EE" "82" "EE"] - [wheat "F5" "DE" "B3"] - [white "FF" "FF" "FF"] - [white-smoke "F5" "F5" "F5"] - [yellow "FF" "FF" "00"] - [yellow-green "9A" "CD" "32"] + ["F0" "F8" "FF" alice-blue] + ["FA" "EB" "D7" antique-white] + ["00" "FF" "FF" aqua] + ["7F" "FF" "D4" aquamarine] + ["F0" "FF" "FF" azure] + ["F5" "F5" "DC" beige] + ["FF" "E4" "C4" bisque] + ["00" "00" "00" black] + ["FF" "EB" "CD" blanched-almond] + ["00" "00" "FF" blue] + ["8A" "2B" "E2" blue-violet] + ["A5" "2A" "2A" brown] + ["DE" "B8" "87" burly-wood] + ["5F" "9E" "A0" cadet-blue] + ["7F" "FF" "00" chartreuse] + ["D2" "69" "1E" chocolate] + ["FF" "7F" "50" coral] + ["64" "95" "ED" cornflower-blue] + ["FF" "F8" "DC" cornsilk] + ["DC" "14" "3C" crimson] + ["00" "FF" "FF" cyan] + ["00" "00" "8B" dark-blue] + ["00" "8B" "8B" dark-cyan] + ["B8" "86" "0B" dark-goldenrod] + ["A9" "A9" "A9" dark-gray] + ["00" "64" "00" dark-green] + ["BD" "B7" "6B" dark-khaki] + ["8B" "00" "8B" dark-magenta] + ["55" "6B" "2F" dark-olive-green] + ["FF" "8C" "00" dark-orange] + ["99" "32" "CC" dark-orchid] + ["8B" "00" "00" dark-red] + ["E9" "96" "7A" dark-salmon] + ["8F" "BC" "8F" dark-sea-green] + ["48" "3D" "8B" dark-slate-blue] + ["2F" "4F" "4F" dark-slate-gray] + ["00" "CE" "D1" dark-turquoise] + ["94" "00" "D3" dark-violet] + ["FF" "14" "93" deep-pink] + ["00" "BF" "FF" deep-sky-blue] + ["69" "69" "69" dim-gray] + ["1E" "90" "FF" dodger-blue] + ["B2" "22" "22" fire-brick] + ["FF" "FA" "F0" floral-white] + ["22" "8B" "22" forest-green] + ["FF" "00" "FF" fuchsia] + ["DC" "DC" "DC" gainsboro] + ["F8" "F8" "FF" ghost-white] + ["FF" "D7" "00" gold] + ["DA" "A5" "20" goldenrod] + ["80" "80" "80" gray] + ["00" "80" "00" green] + ["AD" "FF" "2F" green-yellow] + ["F0" "FF" "F0" honey-dew] + ["FF" "69" "B4" hot-pink] + ["CD" "5C" "5C" indian-red] + ["4B" "00" "82" indigo] + ["FF" "FF" "F0" ivory] + ["F0" "E6" "8C" khaki] + ["E6" "E6" "FA" lavender] + ["FF" "F0" "F5" lavender-blush] + ["7C" "FC" "00" lawn-green] + ["FF" "FA" "CD" lemon-chiffon] + ["AD" "D8" "E6" light-blue] + ["F0" "80" "80" light-coral] + ["E0" "FF" "FF" light-cyan] + ["FA" "FA" "D2" light-goldenrod-yellow] + ["D3" "D3" "D3" light-gray] + ["90" "EE" "90" light-green] + ["FF" "B6" "C1" light-pink] + ["FF" "A0" "7A" light-salmon] + ["20" "B2" "AA" light-sea-green] + ["87" "CE" "FA" light-sky-blue] + ["77" "88" "99" light-slate-gray] + ["B0" "C4" "DE" light-steel-blue] + ["FF" "FF" "E0" light-yellow] + ["00" "FF" "00" lime] + ["32" "CD" "32" lime-green] + ["FA" "F0" "E6" linen] + ["FF" "00" "FF" magenta] + ["80" "00" "00" maroon] + ["66" "CD" "AA" medium-aquamarine] + ["00" "00" "CD" medium-blue] + ["BA" "55" "D3" medium-orchid] + ["93" "70" "DB" medium-purple] + ["3C" "B3" "71" medium-sea-green] + ["7B" "68" "EE" medium-slate-blue] + ["00" "FA" "9A" medium-spring-green] + ["48" "D1" "CC" medium-turquoise] + ["C7" "15" "85" medium-violet-red] + ["19" "19" "70" midnight-blue] + ["F5" "FF" "FA" mint-cream] + ["FF" "E4" "E1" misty-rose] + ["FF" "E4" "B5" moccasin] + ["FF" "DE" "AD" navajo-white] + ["00" "00" "80" navy] + ["FD" "F5" "E6" old-lace] + ["80" "80" "00" olive] + ["6B" "8E" "23" olive-drab] + ["FF" "A5" "00" orange] + ["FF" "45" "00" orange-red] + ["DA" "70" "D6" orchid] + ["EE" "E8" "AA" pale-goldenrod] + ["98" "FB" "98" pale-green] + ["AF" "EE" "EE" pale-turquoise] + ["DB" "70" "93" pale-violet-red] + ["FF" "EF" "D5" papaya-whip] + ["FF" "DA" "B9" peach-puff] + ["CD" "85" "3F" peru] + ["FF" "C0" "CB" pink] + ["DD" "A0" "DD" plum] + ["B0" "E0" "E6" powder-blue] + ["80" "00" "80" purple] + ["66" "33" "99" rebecca-purple] + ["FF" "00" "00" red] + ["BC" "8F" "8F" rosy-brown] + ["41" "69" "E1" royal-blue] + ["8B" "45" "13" saddle-brown] + ["FA" "80" "72" salmon] + ["F4" "A4" "60" sandy-brown] + ["2E" "8B" "57" sea-green] + ["FF" "F5" "EE" sea-shell] + ["A0" "52" "2D" sienna] + ["C0" "C0" "C0" silver] + ["87" "CE" "EB" sky-blue] + ["6A" "5A" "CD" slate-blue] + ["70" "80" "90" slate-gray] + ["FF" "FA" "FA" snow] + ["00" "FF" "7F" spring-green] + ["46" "82" "B4" steel-blue] + ["D2" "B4" "8C" tan] + ["00" "80" "80" teal] + ["D8" "BF" "D8" thistle] + ["FF" "63" "47" tomato] + ["40" "E0" "D0" turquoise] + ["EE" "82" "EE" violet] + ["F5" "DE" "B3" wheat] + ["FF" "FF" "FF" white] + ["F5" "F5" "F5" white-smoke] + ["FF" "FF" "00" yellow] + ["9A" "CD" "32" yellow-green] ) diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux index be2e105ee..b794fe029 100644 --- a/stdlib/source/lux/data/format/binary.lux +++ b/stdlib/source/lux/data/format/binary.lux @@ -99,7 +99,7 @@ (let [[valueS valueT] ((get@ #writer format) value)] (|> valueS binary.create (valueT 0)))) -(do-template [<name> <size> <read> <write>] +(template [<name> <size> <read> <write>] [(def: #export <name> (Format (I64 Any)) {#reader (function (_ [offset binary]) @@ -215,7 +215,7 @@ {#reader (:: parser.monad map frac.bits-to-frac reader) #writer (|>> frac.frac-to-bits writer)})) -(do-template [<name> <bits> <size> <write>] +(template [<name> <bits> <size> <write>] [(def: #export <name> (Format Binary) (let [mask (..mask <size>)] @@ -243,7 +243,7 @@ [binary/64 ..bits/64 ..size/64 binary.write/64] ) -(do-template [<name> <binary>] +(template [<name> <binary>] [(def: #export <name> (Format Text) (let [(^open "binary/.") <binary>] @@ -260,7 +260,7 @@ (def: #export text ..utf8/64) -(do-template [<name> <with-offset> <bits> <size> <write>] +(template [<name> <with-offset> <bits> <size> <write>] [(def: #export (<with-offset> extra-count valueF) (All [v] (-> Nat (Format v) (Format (Row v)))) {#reader (do parser.monad diff --git a/stdlib/source/lux/data/format/css.lux b/stdlib/source/lux/data/format/css.lux index 736a5e6f3..2bee92189 100644 --- a/stdlib/source/lux/data/format/css.lux +++ b/stdlib/source/lux/data/format/css.lux @@ -116,7 +116,7 @@ (!compose (..rule selector style) (..alter combinator selector inner))) - (do-template [<name> <combinator>] + (template [<name> <combinator>] [(def: #export <name> (-> (Selector Any) Style (CSS Common) (CSS Common)) (..dependent <combinator>))] diff --git a/stdlib/source/lux/data/format/css/property.lux b/stdlib/source/lux/data/format/css/property.lux index b9e178ede..214a2f3c7 100644 --- a/stdlib/source/lux/data/format/css/property.lux +++ b/stdlib/source/lux/data/format/css/property.lux @@ -60,8 +60,8 @@ (-> (Property Any) Text) (|>> :representation)) - (do-template [<brand> <alias>+ <property>+] - [(`` (do-template [<alias> <property>] + (template [<brand> <alias>+ <property>+] + [(`` (template [<alias> <property>] [(def: #export <alias> (Property <brand>) (:abstraction <property>))] @@ -69,7 +69,7 @@ (~~ (template.splice <alias>+)))) (with-expansions [<rows> (template.splice <property>+)] - (do-template [<property>] + (template [<property>] [(`` (def: #export (~~ (text-identifier <property>)) (Property <brand>) (:abstraction <property>)))] diff --git a/stdlib/source/lux/data/format/css/query.lux b/stdlib/source/lux/data/format/css/query.lux index 1fb1b74bb..92dea7d19 100644 --- a/stdlib/source/lux/data/format/css/query.lux +++ b/stdlib/source/lux/data/format/css/query.lux @@ -29,7 +29,7 @@ (-> Media Text) (|>> :representation)) - (do-template [<media>] + (template [<media>] [(`` (def: #export (~~ (text-identifier <media>)) Media (:abstraction <media>)))] @@ -49,7 +49,7 @@ (-> Feature Text) (|>> :representation)) - (do-template [<feature> <brand>] + (template [<feature> <brand>] [(`` (def: #export ((~~ (text-identifier <feature>)) input) (-> (Value <brand>) Feature) (:abstraction (format "(" <feature> ": " (//value.value input) ")"))))] @@ -111,7 +111,7 @@ (-> Query Text) (|>> :representation)) - (do-template [<name> <operator>] + (template [<name> <operator>] [(def: #export <name> (-> Media Query) (|>> ..media (format <operator>) :abstraction))] @@ -124,7 +124,7 @@ (-> Feature Query) (|>> ..feature (format "not ") :abstraction)) - (do-template [<name> <operator>] + (template [<name> <operator>] [(def: #export (<name> left right) (-> Query Query Query) (:abstraction (format (:representation left) diff --git a/stdlib/source/lux/data/format/css/selector.lux b/stdlib/source/lux/data/format/css/selector.lux index 7b80e4973..3c01a76a3 100644 --- a/stdlib/source/lux/data/format/css/selector.lux +++ b/stdlib/source/lux/data/format/css/selector.lux @@ -18,7 +18,7 @@ (abstract: #export (Generic brand) {} Any) -(do-template [<generic> <brand>] +(template [<generic> <brand>] [(abstract: <brand> {} Any) (type: #export <generic> (Generic <brand>))] @@ -47,7 +47,7 @@ (-> Tag (Selector Cannot-Chain)) (|>> :abstraction)) - (do-template [<name> <type> <prefix> <kind>] + (template [<name> <type> <prefix> <kind>] [(def: #export <name> (-> <type> (Selector <kind>)) (|>> (format <prefix>) :abstraction))] @@ -56,8 +56,8 @@ [class Class "." Can-Chain] ) - (do-template [<right> <left> <combo> <combinator>+] - [(`` (do-template [<combinator> <name>] + (template [<right> <left> <combo> <combinator>+] + [(`` (template [<combinator> <name>] [(def: #export (<name> right left) (-> (Selector <right>) (Selector <left>) (Selector <combo>)) (:abstraction (format (:representation left) @@ -87,7 +87,7 @@ (-> Attribute (Selector Can-Chain)) (:abstraction (format "[" attribute "]"))) - (do-template [<check> <name>] + (template [<check> <name>] [(def: #export (<name> attribute value) (-> Attribute Text (Selector Can-Chain)) (:abstraction (format "[" attribute <check> value "]")))] @@ -100,8 +100,8 @@ ["*=" contains?] ) - (do-template [<kind> <pseudo>+] - [(`` (do-template [<name> <pseudo>] + (template [<kind> <pseudo>+] + [(`` (template [<name> <pseudo>] [(def: #export <name> (Selector Can-Chain) (:abstraction <pseudo>))] @@ -170,7 +170,7 @@ (-> Nat Index) (|>> %n :abstraction)) - (do-template [<name> <index>] + (template [<name> <index>] [(def: #export <name> Index (:abstraction <index>))] [odd "odd"] @@ -189,7 +189,7 @@ (%n (.nat variable))) (%i constant))))) - (do-template [<name> <pseudo>] + (template [<name> <pseudo>] [(def: #export (<name> index) (-> Index (Selector Can-Chain)) (|> (:representation index) diff --git a/stdlib/source/lux/data/format/css/value.lux b/stdlib/source/lux/data/format/css/value.lux index 8967ed90a..1dae87811 100644 --- a/stdlib/source/lux/data/format/css/value.lux +++ b/stdlib/source/lux/data/format/css/value.lux @@ -34,7 +34,7 @@ (-> <abstraction> <representation>) (|>> :representation)) - (`` (do-template [<name> <value>] + (`` (template [<name> <value>] [(def: #export <name> <abstraction> (:abstraction <value>))] (~~ (template.splice <sample>+)) @@ -65,7 +65,7 @@ (-> (Value Any) Text) (|>> :representation)) - (do-template [<name> <value>] + (template [<name> <value>] [(def: #export <name> Value (:abstraction <value>))] [initial "initial"] @@ -73,10 +73,10 @@ [unset "unset"] ) - (do-template [<brand> <alias>+ <value>+] + (template [<brand> <alias>+ <value>+] [(abstract: #export <brand> {} Any) - (`` (do-template [<name> <value>] + (`` (template [<name> <value>] [(def: #export <name> (Value <brand>) (:abstraction <value>))] @@ -84,7 +84,7 @@ (~~ (template.splice <alias>+)))) (with-expansions [<rows> (template.splice <value>+)] - (do-template [<value>] + (template [<value>] [(`` (def: #export (~~ (text-identifier <value>)) (Value <brand>) (:abstraction <value>)))] @@ -800,7 +800,7 @@ (list;map %number) (..apply "cubic-bezier"))) - (do-template [<name> <brand>] + (template [<name> <brand>] [(def: #export <name> (-> Nat (Value <brand>)) (|>> %n :abstraction))] @@ -833,7 +833,7 @@ "1.0" (format "0" (%r alpha))))))) - (do-template [<name> <suffix>] + (template [<name> <suffix>] [(def: #export (<name> value) (-> Frac (Value Length)) (:abstraction (format (%number value) <suffix>)))] @@ -862,7 +862,7 @@ (%i value) (%n (.nat value)))) - (do-template [<name> <suffix>] + (template [<name> <suffix>] [(def: #export (<name> value) (-> Int (Value Time)) (:abstraction (format (if (i/< +0 value) @@ -948,7 +948,7 @@ (-> Nat Angle) (:abstraction (format (%n (n/% ..degree-limit value)) "deg"))) - (do-template [<degree> <name>] + (template [<degree> <name>] [(def: #export <name> Angle (..degree <degree>))] [000 to-top] @@ -957,7 +957,7 @@ [270 to-left] ) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> angle start next) (-> Angle Stop (List/1 [(Maybe Hint) Stop]) (Value Image)) (let [[now after] next] @@ -994,8 +994,8 @@ (:abstraction Value (format (:representation horizontal) ..slice-separator (:representation vertical)))) - (do-template [<input> <pre> <function>+] - [(`` (do-template [<name> <function>] + (template [<input> <pre> <function>+] + [(`` (template [<name> <function>] [(def: #export <name> (-> <input> (Value Filter)) (|>> <pre> (list) (..apply <function>)))] @@ -1039,7 +1039,7 @@ (def: length-separator " ") - (do-template [<name> <type>] + (template [<name> <type>] [(def: #export (<name> horizontal vertical) (-> (Value Length) (Value Length) (Value <type>)) (:abstraction (format (:representation horizontal) @@ -1074,7 +1074,7 @@ [farthest-corner "farthest-corner"]] []) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> shape extent location start next) (-> Shape (Maybe Extent) (Value Location) Stop (List/1 [(Maybe Hint) Stop]) @@ -1121,7 +1121,7 @@ (def: #export (clip rectangle) (-> Rectangle (Value Clip)) - (`` (..apply "rect" (list (~~ (do-template [<side>] + (`` (..apply "rect" (list (~~ (template [<side>] [(:representation (get@ <side> rectangle))] [#top] [#right] [#bottom] [#left])))))) @@ -1261,7 +1261,7 @@ (list;map %number) (..apply "matrix3d"))) - (do-template [<name> <function> <input-types> <input-values>] + (template [<name> <function> <input-types> <input-values>] [(`` (def: #export (<name> [(~~ (template.splice <input-values>))]) (-> [(~~ (template.splice <input-types>))] (Value Transform)) (|> (list (~~ (template.splice <input-values>))) @@ -1283,7 +1283,7 @@ [perspective "perspective" [Frac] [value]] ) - (do-template [<name> <function> <input-types> <input-values>] + (template [<name> <function> <input-types> <input-values>] [(`` (def: #export (<name> [(~~ (template.splice <input-values>))]) (-> [(~~ (template.splice <input-types>))] (Value Transform)) (|> (list (~~ (template.splice <input-values>))) diff --git a/stdlib/source/lux/data/format/html.lux b/stdlib/source/lux/data/format/html.lux index 206485991..01b7d9df1 100644 --- a/stdlib/source/lux/data/format/html.lux +++ b/stdlib/source/lux/data/format/html.lux @@ -80,7 +80,7 @@ Text - (do-template [<name> <brand>] + (template [<name> <brand>] [(abstract: #export <brand> {} Any) (type: #export <name> (HTML <brand>))] @@ -98,11 +98,11 @@ [Document Document'] ) - (do-template [<super> <super-raw> <sub>+] + (template [<super> <super-raw> <sub>+] [(abstract: #export (<super-raw> brand) {} Any) (type: #export <super> (HTML (<super-raw> Any))) - (`` (do-template [<sub> <sub-raw>] + (`` (template [<sub> <sub-raw>] [(abstract: #export <sub-raw> {} Any) (type: #export <sub> (HTML (<super-raw> <sub-raw>)))] @@ -157,7 +157,7 @@ content (..close tag)))) - (do-template [<name> <tag> <brand>] + (template [<name> <tag> <brand>] [(def: #export <name> (-> Attributes <brand>) (..simple <tag>))] @@ -197,7 +197,7 @@ (|>> ..sanitize :abstraction)) - (do-template [<tag> <alias> <name>] + (template [<tag> <alias> <name>] [(def: #export <name> Element (..simple <tag> (list))) @@ -264,7 +264,7 @@ (#Circle Circle) (#Polygon Polygon)) - (do-template [<name> <shape> <type> <format>] + (template [<name> <shape> <type> <format>] [(def: (<name> attributes shape) (-> Attributes <type> (HTML Any)) (..simple "area" (list& ["shape" <shape>] @@ -300,7 +300,7 @@ (..tag "map" attributes (list@fold (function.flip ..and) head tail))))) - (do-template [<name> <tag> <type>] + (template [<name> <tag> <type>] [(def: #export <name> (-> Attributes <type>) (..empty <tag>))] @@ -312,7 +312,7 @@ [track "track" Track] ) - (do-template [<name> <tag>] + (template [<name> <tag>] [(def: #export (<name> attributes media on-unsupported) (-> Attributes Media (Maybe Content) Element) (..tag <tag> attributes @@ -336,7 +336,7 @@ (-> ID Input) (|>> ["for"] list (..empty "label"))) - (do-template [<name> <container-tag> <description-tag> <type>] + (template [<name> <container-tag> <description-tag> <type>] [(def: #export (<name> description attributes content) (-> (Maybe Content) Attributes <type> <type>) (..tag <container-tag> attributes @@ -354,7 +354,7 @@ [figure "figure" "figcaption" Element] ) - (do-template [<name> <tag> <type>] + (template [<name> <tag> <type>] [(def: #export (<name> attributes content) (-> Attributes (Maybe Content) <type>) (|> content @@ -367,7 +367,7 @@ (type: #export Phrase (-> Attributes Content Element)) - (do-template [<name> <tag>] + (template [<name> <tag>] [(def: #export <name> Phrase (..tag <tag>))] @@ -423,7 +423,7 @@ (type: #export Composite (-> Attributes Element Element)) - (do-template [<name> <tag>] + (template [<name> <tag>] [(def: #export <name> Composite (..tag <tag>))] @@ -441,7 +441,7 @@ [span "span"] ) - (do-template [<tag> <name> <input>] + (template [<tag> <name> <input>] [(def: <name> (-> <input> (HTML Any)) (..tag <tag> (list)))] @@ -466,7 +466,7 @@ (def: #export p ..paragraph) - (do-template [<name> <tag> <input> <output>] + (template [<name> <tag> <input> <output>] [(def: #export <name> (-> Attributes <input> <output>) (..tag <tag>))] @@ -485,7 +485,7 @@ [object "object" Parameter Element] ) - (do-template [<name> <tag> <input> <output>] + (template [<name> <tag> <input> <output>] [(def: #export <name> (-> <input> <output>) (..tag <tag> (list)))] @@ -499,7 +499,7 @@ [body "body" Element Body] ) - (do-template [<name> <tag> <input> <output>] + (template [<name> <tag> <input> <output>] [(def: <name> (-> <input> <output>) (..tag <tag> (list)))] @@ -546,7 +546,7 @@ (..tag "table" attributes content))) - (do-template [<name> <doc-type>] + (template [<name> <doc-type>] [(def: #export <name> (-> Head Body Document) (let [doc-type <doc-type>] diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 64064fb1f..b03cb5ae9 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -26,7 +26,7 @@ ["s" syntax (#+ syntax:)] ["." code]]]) -(do-template [<name> <type>] +(template [<name> <type>] [(type: #export <name> <type>)] [Null Any] @@ -43,7 +43,7 @@ (#Array (Row JSON)) (#Object (Dictionary String JSON))) -(do-template [<name> <type>] +(template [<name> <type>] [(type: #export <name> <type>)] [Array (Row JSON)] @@ -130,7 +130,7 @@ _ (#error.Failure ($_ text@compose "Cannot set field '" key "' of a non-object.")))) -(do-template [<name> <tag> <type> <desc>] +(template [<name> <tag> <type> <desc>] [(def: #export (<name> key json) {#.doc (code.text ($_ text@compose "A JSON object field getter for " <desc> "."))} (-> Text JSON (Error <type>)) @@ -211,7 +211,7 @@ (def: (show-null _) (-> Null Text) "null") -(do-template [<name> <type> <codec>] +(template [<name> <type> <codec>] [(def: <name> (-> <type> Text) <codec>)] [show-boolean Boolean ..encode-boolean] @@ -290,7 +290,7 @@ (#.Cons head tail) (#error.Success [tail head])))) -(do-template [<name> <type> <tag> <desc>] +(template [<name> <type> <tag> <desc>] [(def: #export <name> {#.doc (code.text ($_ text@compose "Reads a JSON value as " <desc> "."))} (Reader <type>) @@ -309,7 +309,7 @@ [string Text #String "string"] ) -(do-template [<test> <check> <type> <eq> <encoder> <tag> <desc>] +(template [<test> <check> <type> <eq> <encoder> <tag> <desc>] [(def: #export (<test> test) {#.doc (code.text ($_ text@compose "Asks whether a JSON value is a " <desc> "."))} (-> <type> (Reader Bit)) @@ -448,7 +448,7 @@ [_ (l.this "null")] (wrap []))) -(do-template [<name> <token> <value>] +(template [<name> <token> <value>] [(def: <name> (l.Lexer Boolean) (do p.monad @@ -527,7 +527,7 @@ value (json~ [])] (wrap [key value]))) -(do-template [<name> <type> <open> <close> <elem-parser> <prep>] +(template [<name> <type> <open> <close> <elem-parser> <prep>] [(def: (<name> json~) (-> (-> Any (l.Lexer JSON)) (l.Lexer <type>)) (do p.monad diff --git a/stdlib/source/lux/data/format/markdown.lux b/stdlib/source/lux/data/format/markdown.lux index 81c7118e7..b5dcbc46f 100644 --- a/stdlib/source/lux/data/format/markdown.lux +++ b/stdlib/source/lux/data/format/markdown.lux @@ -48,7 +48,7 @@ (def: blank-line (format text.new-line text.new-line)) - (do-template [<name> <prefix>] + (template [<name> <prefix>] [(def: #export (<name> content) (-> Text Markdown) (:abstraction (format <prefix> " " (..sanitize content) ..blank-line)))] @@ -73,7 +73,7 @@ (Markdown Span) (:abstraction (format " " text.new-line))) - (do-template [<name> <wrapper>] + (template [<name> <wrapper>] [(def: #export <name> (-> (Markdown Span) (Markdown Span)) (|>> :representation @@ -158,7 +158,7 @@ (type: #export Email Text) - (do-template [<name> <type>] + (template [<name> <type>] [(def: #export <name> (-> <type> (Markdown Span)) (|>> (text.enclose ["<" ">"]) :abstraction))] @@ -167,7 +167,7 @@ [email Email] ) - (do-template [<name> <brand> <infix>] + (template [<name> <brand> <infix>] [(def: #export (<name> pre post) (-> (Markdown <brand>) (Markdown <brand>) (Markdown <brand>)) (:abstraction (format (:representation pre) <infix> (:representation post))))] diff --git a/stdlib/source/lux/data/name.lux b/stdlib/source/lux/data/name.lux index 0c658678b..286071169 100644 --- a/stdlib/source/lux/data/name.lux +++ b/stdlib/source/lux/data/name.lux @@ -12,7 +12,7 @@ ## [Text Text]) ## [Functions] -(do-template [<name> <side>] +(template [<name> <side>] [(def: #export (<name> [module short]) (-> Name Text) <side>)] diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index eb3946fab..b4408518e 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -40,7 +40,7 @@ (-> Text Text) (text.replace-all "," "")) -(do-template [<macro> <nat> <int> <rev> <frac> <error> <doc>] +(template [<macro> <nat> <int> <rev> <frac> <error> <doc>] [(macro: #export (<macro> tokens state) {#.doc <doc>} (case tokens diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux index d8c365bd5..d8334d104 100644 --- a/stdlib/source/lux/data/number/complex.lux +++ b/stdlib/source/lux/data/number/complex.lux @@ -48,7 +48,7 @@ (f/= (get@ #imaginary param) (get@ #imaginary input)))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param input) (-> Complex Complex Complex) {#real (<op> (get@ #real param) @@ -220,7 +220,7 @@ {#real (|> subject ..abs (get@ #real) math.log) #imaginary (math.atan2 real imaginary)})) -(do-template [<name> <type> <op>] +(template [<name> <type> <op>] [(def: #export (<name> param input) (-> <type> Complex Complex) (|> input log (<op> param) exp))] diff --git a/stdlib/source/lux/data/number/frac.lux b/stdlib/source/lux/data/number/frac.lux index 02f7b4d88..924831dcf 100644 --- a/stdlib/source/lux/data/number/frac.lux +++ b/stdlib/source/lux/data/number/frac.lux @@ -45,7 +45,7 @@ +1.0)) ) -(do-template [<name> <compose> <identity>] +(template [<name> <compose> <identity>] [(structure: #export <name> (Monoid Frac) (def: identity <identity>) (def: compose <compose>))] @@ -56,7 +56,7 @@ [minimum f/min ("lux frac max")] ) -(do-template [<name> <numerator> <doc>] +(template [<name> <numerator> <doc>] [(def: #export <name> {#.doc <doc>} Frac @@ -92,7 +92,7 @@ #.None (#error.Failure "Could not decode Frac")))) -(do-template [<struct> <int> <base> <char-set> <error>] +(template [<struct> <int> <base> <char-set> <error>] [(structure: #export <struct> (Codec Text Frac) (def: (encode value) (let [whole (frac-to-int value) @@ -248,7 +248,7 @@ (#.Cons x xs') ("lux text concat" x (re-join-chunks xs')))) -(do-template [<from> <from-translator> <to> <to-translator> <base-bits>] +(template [<from> <from-translator> <to> <to-translator> <base-bits>] [(def: (<from> on-left? input) (-> Bit Text Text) (let [max-num-chars (n// <base-bits> 64) @@ -281,7 +281,7 @@ [binary-to-octal bin-segment-to-octal octal-to-binary octal-segment-to-bin 3] ) -(do-template [<struct> <error> <from> <to>] +(template [<struct> <error> <from> <to>] [(structure: #export <struct> (Codec Text Frac) (def: (encode value) (let [sign (:: ..number signum value) @@ -336,7 +336,7 @@ (def: mantissa-size Nat 52) (def: exponent-size Nat 11) -(do-template [<hex> <name>] +(template [<hex> <name>] [(def: <name> (|> <hex> (:: //nat.hex decode) error.assume .i64))] ["7FF7FFFFFFFFFFFF" not-a-number-bits] @@ -385,7 +385,7 @@ (//i64.clear mantissa-size mantissa-bits))) ))) -(do-template [<getter> <mask> <size> <offset>] +(template [<getter> <mask> <size> <offset>] [(def: <mask> (|> 1 (//i64.left-shift <size>) dec (//i64.left-shift <offset>))) (def: (<getter> input) (-> (I64 Any) I64) diff --git a/stdlib/source/lux/data/number/i64.lux b/stdlib/source/lux/data/number/i64.lux index 6f30bcb44..321c628e9 100644 --- a/stdlib/source/lux/data/number/i64.lux +++ b/stdlib/source/lux/data/number/i64.lux @@ -12,7 +12,7 @@ (n/* bits-per-byte bytes-per-i64)) -(do-template [<name> <op> <doc>] +(template [<name> <op> <doc>] [(def: #export (<name> param subject) {#.doc <doc>} (All [s] (-> (I64 Any) (I64 s) (I64 s))) @@ -42,7 +42,7 @@ (def: compose ..and) ) -(do-template [<name> <op> <doc>] +(template [<name> <op> <doc>] [(def: #export (<name> param subject) {#.doc <doc>} (All [s] (-> Nat (I64 s) (I64 s))) @@ -83,7 +83,7 @@ (All [s] (-> Nat (I64 s) (I64 s))) (|> idx flag ..not (..and input))) -(do-template [<name> <op> <doc>] +(template [<name> <op> <doc>] [(def: #export (<name> idx input) {#.doc <doc>} (All [s] (-> Nat (I64 s) (I64 s))) @@ -97,7 +97,7 @@ (-> Nat (I64 Any) Bit) (|> input (:coerce I64) (..and (flag idx)) (n/= 0) .not)) -(do-template [<name> <main> <comp>] +(template [<name> <main> <comp>] [(def: #export (<name> distance input) (All [s] (-> Nat (I64 s) (I64 s))) (let [backwards-distance (n/- (n/% width distance) width)] diff --git a/stdlib/source/lux/data/number/int.lux b/stdlib/source/lux/data/number/int.lux index 679147008..9a2ce2b9b 100644 --- a/stdlib/source/lux/data/number/int.lux +++ b/stdlib/source/lux/data/number/int.lux @@ -54,7 +54,7 @@ +1)) ) -(do-template [<name> <compose> <identity>] +(template [<name> <compose> <identity>] [(structure: #export <name> (Monoid Int) (def: identity <identity>) (def: compose <compose>))] @@ -97,7 +97,7 @@ (|> output (i/* <base>) (i/+ (.int digit-value))))) (#error.Success (i/* sign output))))) -(do-template [<struct> <base> <to-character> <to-value> <error>] +(template [<struct> <base> <to-character> <to-value> <error>] [(structure: #export <struct> (Codec Text Int) (def: (encode value) (if (i/= +0 value) diff --git a/stdlib/source/lux/data/number/nat.lux b/stdlib/source/lux/data/number/nat.lux index 70f8df0bd..fb47d2460 100644 --- a/stdlib/source/lux/data/number/nat.lux +++ b/stdlib/source/lux/data/number/nat.lux @@ -48,7 +48,7 @@ 0 0 _ 1))) -(do-template [<name> <compose> <identity>] +(template [<name> <compose> <identity>] [(structure: #export <name> (Monoid Nat) (def: identity <identity>) (def: compose <compose>))] @@ -171,7 +171,7 @@ (^or (^ (char "f")) (^ (char "F"))) (#.Some 15) _ #.None)) -(do-template [<struct> <base> <to-character> <to-value> <error>] +(template [<struct> <base> <to-character> <to-value> <error>] [(structure: #export <struct> (Codec Text Nat) (def: (encode value) (loop [input value diff --git a/stdlib/source/lux/data/number/ratio.lux b/stdlib/source/lux/data/number/ratio.lux index 9c7baaab8..49ce1f194 100644 --- a/stdlib/source/lux/data/number/ratio.lux +++ b/stdlib/source/lux/data/number/ratio.lux @@ -48,7 +48,7 @@ (`` (structure: #export order (Order Ratio) (def: &equivalence ..equivalence) - (~~ (do-template [<name> <op>] + (~~ (template [<name> <op>] [(def: (<name> parameter subject) (let [[parameter' subject'] (..equalize parameter subject)] (<op> parameter' subject')))] @@ -60,7 +60,7 @@ )) )) -(do-template [<name> <comp>] +(template [<name> <comp>] [(def: #export (<name> left right) (-> Ratio Ratio Ratio) (if (:: ..order <comp> left right) @@ -142,7 +142,7 @@ #..denominator (~ (maybe.default (' 1) ?denominator))}))))) -(do-template [<identity> <compose> <name>] +(template [<identity> <compose> <name>] [(structure: #export <name> (Monoid Ratio) diff --git a/stdlib/source/lux/data/number/rev.lux b/stdlib/source/lux/data/number/rev.lux index 7a8fe53da..fa79f597d 100644 --- a/stdlib/source/lux/data/number/rev.lux +++ b/stdlib/source/lux/data/number/rev.lux @@ -40,7 +40,7 @@ (def: top (.rev -1)) (def: bottom (.rev 0))) -(do-template [<name> <compose> <identity>] +(template [<name> <compose> <identity>] [(structure: #export <name> (Monoid Rev) (def: identity (:: interval <identity>)) (def: compose <compose>))] @@ -54,7 +54,7 @@ (-> Text Text) ("lux text clip" input 1 ("lux text size" input))) -(do-template [<struct> <codec> <char-bit-size> <error>] +(template [<struct> <codec> <char-bit-size> <error>] [(with-expansions [<error-output> (as-is (#error.Failure ("lux text concat" <error> repr)))] (structure: #export <struct> (Codec Text Rev) (def: (encode value) diff --git a/stdlib/source/lux/data/product.lux b/stdlib/source/lux/data/product.lux index 257ac8ec2..baa78dd45 100644 --- a/stdlib/source/lux/data/product.lux +++ b/stdlib/source/lux/data/product.lux @@ -3,7 +3,7 @@ lux) ## [Functions] -(do-template [<name> <type> <output>] +(template [<name> <type> <output>] [(def: #export (<name> xy) (All [a b] (-> [a b] <type>)) (let [[x y] xy] diff --git a/stdlib/source/lux/data/sum.lux b/stdlib/source/lux/data/sum.lux index edb9d19fd..2f7624113 100644 --- a/stdlib/source/lux/data/sum.lux +++ b/stdlib/source/lux/data/sum.lux @@ -2,7 +2,7 @@ {#.doc "Functionality for working with variants (particularly 2-variants)."} lux) -(do-template [<name> <type> <index>] +(template [<name> <type> <index>] [(def: #export (<name> value) (All [a b] (-> <type> (| a b))) (<index> value))] @@ -28,7 +28,7 @@ (0 l) (0 (fl l)) (1 r) (1 (fr r))))) -(do-template [<name> <side> <tag>] +(template [<name> <side> <tag>] [(def: #export (<name> es) (All [a b] (-> (List (| a b)) (List <side>))) (case es diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index 00ad654e2..110afd81d 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -25,7 +25,7 @@ (-> Char Text) (|>> (:coerce Int) "lux int char")) -(do-template [<name> <code>] +(template [<name> <code>] [(def: #export <name> (from-code <code>))] [null 0] diff --git a/stdlib/source/lux/data/text/encoding.lux b/stdlib/source/lux/data/text/encoding.lux index 55cb06ef3..8f59bd530 100644 --- a/stdlib/source/lux/data/text/encoding.lux +++ b/stdlib/source/lux/data/text/encoding.lux @@ -20,7 +20,7 @@ Text - (do-template [<name> <encoding>] + (template [<name> <encoding>] [(def: #export <name> Encoding (:abstraction <encoding>))] [ascii "ASCII"] diff --git a/stdlib/source/lux/data/text/format.lux b/stdlib/source/lux/data/text/format.lux index b96606cdc..0becf8633 100644 --- a/stdlib/source/lux/data/text/format.lux +++ b/stdlib/source/lux/data/text/format.lux @@ -40,7 +40,7 @@ {#.doc "A way to produce readable text from values."} (-> a Text)) -(do-template [<name> <type> <formatter>] +(template [<name> <type> <formatter>] [(def: #export <name> (Format <type>) <formatter>)] @@ -81,10 +81,6 @@ (def: #export (%list formatter) (All [a] (-> (Format a) (Format (List a)))) - (function (_ values) - (case values - #.Nil - "(list)" - - _ - (format "(list " (text.join-with " " (list@map formatter values)) ")")))) + (|>> (list@map (|>> formatter (format " "))) + (text.join-with "") + (text.enclose ["(list" ")"]))) diff --git a/stdlib/source/lux/data/text/lexer.lux b/stdlib/source/lux/data/text/lexer.lux index 923fb91a8..e5f19edf6 100644 --- a/stdlib/source/lux/data/text/lexer.lux +++ b/stdlib/source/lux/data/text/lexer.lux @@ -85,7 +85,7 @@ {#basis offset #distance 1}]))) -(do-template [<name> <type> <any>] +(template [<name> <type> <any>] [(def: #export (<name> p) {#.doc "Produce a character if the lexer fails."} (All [a] (-> (Lexer a) (Lexer <type>))) @@ -169,7 +169,7 @@ (n/<= top char')))] (wrap char))) -(do-template [<name> <bottom> <top> <desc>] +(template [<name> <bottom> <top> <desc>] [(def: #export <name> {#.doc (code.text ($_ //;compose "Only lex " <desc> " characters."))} (Lexer Text) @@ -199,7 +199,7 @@ (range (char "a") (char "f")) (range (char "A") (char "F")))) -(do-template [<name> <description-modifier> <modifier>] +(template [<name> <description-modifier> <modifier>] [(def: #export (<name> options) {#.doc (code.text ($_ //;compose "Only lex characters that are" <description-modifier> " part of a piece of text."))} (-> Text (Lexer Text)) @@ -220,7 +220,7 @@ [none-of " not" .not] ) -(do-template [<name> <description-modifier> <modifier>] +(template [<name> <description-modifier> <modifier>] [(def: #export (<name> options) {#.doc (code.text ($_ //;compose "Only lex characters that are" <description-modifier> " part of a piece of text."))} (-> Text (Lexer Slice)) @@ -275,7 +275,7 @@ [right::basis right::distance] right] (wrap [left::basis ("lux i64 +" left::distance right::distance)]))) -(do-template [<name> <base> <doc-modifier>] +(template [<name> <base> <doc-modifier>] [(def: #export (<name> lexer) {#.doc (code.text ($_ //;compose "Lex " <doc-modifier> " characters as a single continuous text."))} (-> (Lexer Text) (Lexer Text)) @@ -285,7 +285,7 @@ [many p.many "many"] ) -(do-template [<name> <base> <doc-modifier>] +(template [<name> <base> <doc-modifier>] [(def: #export (<name> lexer) {#.doc (code.text ($_ //;compose "Lex " <doc-modifier> " characters as a single continuous text."))} (-> (Lexer Slice) (Lexer Slice)) @@ -295,7 +295,7 @@ [many! p.many "many"] ) -(do-template [<name> <base> <doc-modifier>] +(template [<name> <base> <doc-modifier>] [(def: #export (<name> amount lexer) {#.doc (code.text ($_ //;compose "Lex " <doc-modifier> " N characters."))} (-> Nat (Lexer Text) (Lexer Text)) @@ -306,7 +306,7 @@ [at-least p.at-least "at least"] ) -(do-template [<name> <base> <doc-modifier>] +(template [<name> <base> <doc-modifier>] [(def: #export (<name> amount lexer) {#.doc (code.text ($_ //;compose "Lex " <doc-modifier> " N characters."))} (-> Nat (Lexer Slice) (Lexer Slice)) diff --git a/stdlib/source/lux/data/text/unicode.lux b/stdlib/source/lux/data/text/unicode.lux index 951bfe761..11a98b358 100644 --- a/stdlib/source/lux/data/text/unicode.lux +++ b/stdlib/source/lux/data/text/unicode.lux @@ -36,7 +36,7 @@ (-> Char Char Segment) (:abstraction (interval.between nat.enum (n/min start end) (n/max start end)))) - (do-template [<name> <slot>] + (template [<name> <slot>] [(def: #export <name> (-> Segment Char) (|>> :representation (get@ <slot>)))] @@ -56,7 +56,7 @@ (interval.within? (:representation segment) char)) ) -(do-template [<name> <start> <end>] +(template [<name> <start> <end>] [(def: #export <name> Segment (..segment (hex <start>) (hex <end>)))] ## Normal segments @@ -347,7 +347,7 @@ Set (finger.branch (set half/0) (set half/1))) -(do-template [<name> <segments>] +(template [<name> <segments>] [(def: #export <name> Set (set <segments>))] [ascii (list basic-latin)] diff --git a/stdlib/source/lux/host.js.lux b/stdlib/source/lux/host.js.lux index 7c182f363..bf24adc38 100644 --- a/stdlib/source/lux/host.js.lux +++ b/stdlib/source/lux/host.js.lux @@ -10,7 +10,7 @@ ["." code] ["s" syntax (#+ syntax: Syntax)]]]) -(do-template [<name> <type>] +(template [<name> <type>] [(type: #export <name> (#.Primitive <type> #.Nil))] [Object "object"] @@ -19,7 +19,7 @@ [Undefined "undefined"] ) -(do-template [<name> <type>] +(template [<name> <type>] [(type: #export <name> <type>)] [String Text] @@ -62,7 +62,7 @@ (wrap (list (` (:coerce (~ (default (' ..Object) type)) ("js ref" (~ (code.text name)))))))) -(do-template [<name> <proc> <doc>] +(template [<name> <proc> <doc>] [(syntax: #export (<name>) {#.doc (doc <doc> (<name>))} diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index cdef88e92..e4891f56b 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -22,7 +22,7 @@ ["s" syntax (#+ syntax: Syntax)]] ["." io]]) -(do-template [<name> <op> <from> <to>] +(template [<name> <op> <from> <to>] [(def: #export (<name> value) {#.doc (doc "Type converter." (: <to> @@ -594,7 +594,7 @@ (wrap (`' ((~ (code.text (format "jvm invokestatic" ":" class-name ":" method-name ":" (text.join-with "," arg-decls')))) (~+ args)))))) -(do-template [<name> <jvm-op>] +(template [<name> <jvm-op>] [(def: (<name> params class-name method-name arg-decls) (-> (List Type-Paramameter) Text Text (List ArgDecl) (Syntax Code)) (do p.monad @@ -1561,7 +1561,7 @@ _ return-term)) -(do-template [<name> <tag> <term-trans>] +(template [<name> <tag> <term-trans>] [(def: (<name> member return-term) (-> Import-Member-Declaration Code Code) (case member @@ -1587,7 +1587,7 @@ (-> Type-Paramameter Code) (code.identifier ["" name])) -(do-template [<name> <byte> <short> <int> <float>] +(template [<name> <byte> <short> <int> <float>] [(def: (<name> mode [class expression]) (-> Primitive-Mode [Text Code] Code) (case mode diff --git a/stdlib/source/lux/host/js.lux b/stdlib/source/lux/host/js.lux index be8759a35..756530817 100644 --- a/stdlib/source/lux/host/js.lux +++ b/stdlib/source/lux/host/js.lux @@ -24,7 +24,7 @@ (-> (Code Any) Text) (|>> :representation)) - (do-template [<type> <brand> <super>+] + (template [<type> <brand> <super>+] [(abstract: #export (<brand> brand) {} Any) (`` (type: #export <type> (|> Any <brand> (~~ (template.splice <super>+)))))] @@ -34,7 +34,7 @@ [Statement Statement' [Code]] ) - (do-template [<type> <brand> <super>+] + (template [<type> <brand> <super>+] [(abstract: #export <brand> {} Any) (`` (type: #export <type> (|> <brand> (~~ (template.splice <super>+)))))] @@ -44,7 +44,7 @@ [Label Label' [Code]] ) - (do-template [<name> <literal>] + (template [<name> <literal>] [(def: #export <name> Computation (|> <literal> ..argument :abstraction))] [null "null"] @@ -68,7 +68,7 @@ (def: sanitize (-> Text Text) - (`` (|>> (~~ (do-template [<find> <replace>] + (`` (|>> (~~ (template [<find> <replace>] [(text.replace-all <find> <replace>)] ["\" "\\"] @@ -187,7 +187,7 @@ ..argument :abstraction)) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Computation) (|> (format (:representation subject) " " <op> " " (:representation param)) @@ -217,7 +217,7 @@ [bit-and "&"] ) - (do-template [<name> <prefix>] + (template [<name> <prefix>] [(def: #export <name> (-> Expression Computation) (|>> :representation (text.prefix <prefix>) ..argument :abstraction))] @@ -227,7 +227,7 @@ [negate "-"] ) - (do-template [<name> <input> <format>] + (template [<name> <input> <format>] [(def: #export (<name> value) {#.doc "A 32-bit integer expression."} (-> <input> Computation) @@ -339,7 +339,7 @@ (-> Label Loop Statement) (:abstraction (format (:representation label) ": " (:representation loop)))) - (do-template [<keyword> <0> <1>] + (template [<keyword> <0> <1>] [(def: #export <0> Statement (:abstraction (format <keyword> ..statement-suffix))) @@ -352,7 +352,7 @@ ["continue" continue continue-at] ) - (do-template [<name> <js>] + (template [<name> <js>] [(def: #export <name> (-> Location Expression) (|>> :representation @@ -375,13 +375,13 @@ else! (list.reverse clauses))) -(do-template [<apply> <arg>+ <type>+ <function>+] +(template [<apply> <arg>+ <type>+ <function>+] [(`` (def: #export (<apply> function) (-> Expression (~~ (template.splice <type>+)) Computation) (.function (_ (~~ (template.splice <arg>+))) (..apply/* function (list (~~ (template.splice <arg>+))))))) - (`` (do-template [<definition> <function>] + (`` (template [<definition> <function>] [(def: #export <definition> (<apply> (..var <function>)))] (~~ (template.splice <function>+))))] diff --git a/stdlib/source/lux/host/jvm/constant.lux b/stdlib/source/lux/host/jvm/constant.lux index 0d6bbcbfe..d9fcc2731 100644 --- a/stdlib/source/lux/host/jvm/constant.lux +++ b/stdlib/source/lux/host/jvm/constant.lux @@ -68,7 +68,7 @@ (|>> :representation) Equivalence<kind>)) - (do-template [<constructor> <type> <marker>] + (template [<constructor> <type> <marker>] [(type: #export <type> (Value <marker>)) (def: #export <constructor> @@ -82,7 +82,7 @@ [string String (Index UTF8)] ) - (do-template [<name> <type> <read> <write> <base>] + (template [<name> <type> <read> <write> <base>] [(def: <name> (Format <type>) (binary.adapt (|>> <read> :abstraction) @@ -103,7 +103,7 @@ {#class (Index Class) #name-and-type (Index Name-And-Type)}) -(do-template [<type> <equivalence> <format>] +(template [<type> <equivalence> <format>] [(def: #export <equivalence> (Equivalence <type>) ($_ equivalence.product @@ -173,7 +173,7 @@ )] {#binary.reader (do parser.monad [tag (get@ #binary.reader /tag.format)] - (`` (cond (~~ (do-template [<case> <tag> <format>] + (`` (cond (~~ (template [<case> <tag> <format>] [(/tag;= <tag> tag) (:: @ map (|>> <case>) (get@ #binary.reader <format>))] diff --git a/stdlib/source/lux/host/jvm/constant/tag.lux b/stdlib/source/lux/host/jvm/constant/tag.lux index 3862f5158..0339489f9 100644 --- a/stdlib/source/lux/host/jvm/constant/tag.lux +++ b/stdlib/source/lux/host/jvm/constant/tag.lux @@ -20,7 +20,7 @@ (u1/= (:representation reference) (:representation sample)))) - (do-template [<code> <name>] + (template [<code> <name>] [(def: #export <name> Tag (:abstraction (encoding.to-u1 <code>)))] diff --git a/stdlib/source/lux/host/jvm/descriptor.lux b/stdlib/source/lux/host/jvm/descriptor.lux index 1647e32ea..d350cec65 100644 --- a/stdlib/source/lux/host/jvm/descriptor.lux +++ b/stdlib/source/lux/host/jvm/descriptor.lux @@ -28,14 +28,14 @@ (type: #export (Value kind) (Return (Value' kind))) (type: #export Void (Return Void')) - (do-template [<refined> <raw>] + (template [<refined> <raw>] [(type: #export <refined> (Value <raw>))] [Base Base'] [Object Object'] [Array Array']) - (do-template [<sigil> <name> <kind>] + (template [<sigil> <name> <kind>] [(def: #export <name> (Descriptor <kind>) (:abstraction <sigil>))] diff --git a/stdlib/source/lux/host/jvm/encoding.lux b/stdlib/source/lux/host/jvm/encoding.lux index 08213e268..7d7fb636d 100644 --- a/stdlib/source/lux/host/jvm/encoding.lux +++ b/stdlib/source/lux/host/jvm/encoding.lux @@ -11,7 +11,7 @@ [type abstract]]) -(do-template [<bytes> <name> <size> <to> <from> <equivalence>] +(template [<bytes> <name> <size> <to> <from> <equivalence>] [(abstract: #export <name> {} @@ -40,7 +40,7 @@ [4 U4 u4-bytes to-u4 from-u4 u4-equivalence] ) -(do-template [<name> <type> <format> <pre-write> <post-read>] +(template [<name> <type> <format> <pre-write> <post-read>] [(def: #export <name> (Format <type>) (binary.adapt <post-read> <pre-write> <format>))] diff --git a/stdlib/source/lux/host/jvm/modifier.lux b/stdlib/source/lux/host/jvm/modifier.lux index cb535a96b..e25e14b78 100644 --- a/stdlib/source/lux/host/jvm/modifier.lux +++ b/stdlib/source/lux/host/jvm/modifier.lux @@ -53,7 +53,7 @@ (abstract.:abstraction (//encoding.to-u2 (i64.and (//encoding.from-u2 (abstract.:representation (~ g!parameter))) (//encoding.from-u2 (abstract.:representation (~ g!subject))))))) - (.do-template [(~ g!<code>) (~ g!<name>)] + (.template [(~ g!<code>) (~ g!<name>)] [(.def: (~' #export) (~ g!<name>) (~ g!name) (.|> ((~! number.hex) (~ g!<code>)) //encoding.to-u2 abstract.:abstraction))] diff --git a/stdlib/source/lux/host/jvm/version.lux b/stdlib/source/lux/host/jvm/version.lux index 8641dd393..dd76a594d 100644 --- a/stdlib/source/lux/host/jvm/version.lux +++ b/stdlib/source/lux/host/jvm/version.lux @@ -14,23 +14,23 @@ (-> Nat Version) //encoding.to-u2) -(do-template [<name> <number>] +(template [<number> <name>] [(def: #export <name> Major (..version <number>))] - [v1_1 45] - [v1_2 46] - [v1_3 47] - [v1_4 48] - [v5_0 49] - [v6_0 50] - [v7 51] - [v8 52] - [v9 53] - [v10 54] - [v11 55] - [v12 56] + [45 v1_1] + [46 v1_2] + [47 v1_3] + [48 v1_4] + [49 v5_0] + [50 v6_0] + [51 v7] + [52 v8] + [53 v9] + [54 v10] + [55 v11] + [56 v12] ) (def: #export format diff --git a/stdlib/source/lux/host/python.lux b/stdlib/source/lux/host/python.lux index 134e35798..322ac261e 100644 --- a/stdlib/source/lux/host/python.lux +++ b/stdlib/source/lux/host/python.lux @@ -36,7 +36,7 @@ (-> (Code Any) Text) (|>> :representation)) - (do-template [<type> <super>] + (template [<type> <super>] [(with-expansions [<brand> (template.identifier [<type> "'"])] (`` (abstract: #export (<brand> brand) {} Any)) (`` (type: #export (<type> brand) @@ -49,7 +49,7 @@ [Statement Code] ) - (do-template [<type> <super>] + (template [<type> <super>] [(with-expansions [<brand> (template.identifier [<type> "'"])] (`` (abstract: #export <brand> {} Any)) (`` (type: #export <type> (<super> <brand>))))] @@ -72,7 +72,7 @@ (-> Text SVar) (|>> :abstraction)) - (do-template [<name> <brand> <prefix>] + (template [<name> <brand> <prefix>] [(def: #export <name> (-> SVar (Var <brand>)) (|>> :representation (format <prefix>) :abstraction))] @@ -101,7 +101,7 @@ (def: #export float (-> Frac Literal) - (`` (|>> (cond> (~~ (do-template [<lux> <python>] + (`` (|>> (cond> (~~ (template [<lux> <python>] [[(f/= <lux>)] [(new> (format "float(" text.double-quote <python> text.double-quote ")") [])]] @@ -116,7 +116,7 @@ (def: sanitize (-> Text Text) - (`` (|>> (~~ (do-template [<find> <replace>] + (`` (|>> (~~ (template [<find> <replace>] [(text.replace-all <find> <replace>)] ["\" "\\"] @@ -150,7 +150,7 @@ (text.join-with ", ")) right-delimiter)))) - (do-template [<name> <pre> <post>] + (template [<name> <pre> <post>] [(def: #export <name> (-> (List (Expression Any)) Literal) (composite-literal <pre> <post> ..code))] @@ -181,7 +181,7 @@ ..expression (format (:representation func) "(" (text.join-with ", " (list@map ..code args)) ")"))) - (do-template [<name> <brand> <prefix>] + (template [<name> <brand> <prefix>] [(def: (<name> var) (-> (Expression Any) Text) (format <prefix> (:representation var)))] @@ -190,7 +190,7 @@ [splat-keyword Keyword "**"] ) - (do-template [<name> <splat>] + (template [<name> <splat>] [(def: #export (<name> args extra func) (-> (List (Expression Any)) (Expression Any) (Expression Any) (Computation Any)) (<| :abstraction @@ -213,7 +213,7 @@ (-> Text (List (Expression Any)) (Expression Any) (Computation Any)) (..apply/* (..the method object) args)) - (do-template [<name> <apply>] + (template [<name> <apply>] [(def: #export (<name> args extra method) (-> (List (Expression Any)) (Expression Any) Text (-> (Expression Any) (Computation Any))) @@ -233,7 +233,7 @@ ..expression (format (:representation then) " if " (:representation test) " else " (:representation else)))) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export (<name> param subject) (-> (Expression Any) (Expression Any) (Computation Any)) (<| :abstraction @@ -307,7 +307,7 @@ text.new-line (:representation post!)))) - (do-template [<keyword> <0>] + (template [<keyword> <0>] [(def: #export <0> Statement (:abstraction <keyword>))] @@ -354,7 +354,7 @@ (..nest (:representation catch!))))) (text.join-with ""))))) - (do-template [<name> <keyword>] + (template [<name> <keyword>] [(def: #export (<name> message) (-> (Expression Any) (Statement Any)) (:abstraction @@ -399,7 +399,7 @@ (syntax: (arity-types {arity s.nat}) (wrap (list.repeat arity (` (Expression Any))))) -(do-template [<arity> <function>+] +(template [<arity> <function>+] [(with-expansions [<apply> (template.identifier ["apply/" <arity>]) <inputs> (arity-inputs <arity>) <types> (arity-types <arity>) @@ -408,7 +408,7 @@ (-> (Expression Any) <types> (Computation Any)) (..apply/* function (.list <inputs>))) - (do-template [<function>] + (template [<function>] [(`` (def: #export (~~ (template.identifier [<function> "/" <arity>])) (<apply> (..var <function>))))] diff --git a/stdlib/source/lux/host/scheme.lux b/stdlib/source/lux/host/scheme.lux index 5a8741c78..af8e0b954 100644 --- a/stdlib/source/lux/host/scheme.lux +++ b/stdlib/source/lux/host/scheme.lux @@ -20,14 +20,14 @@ Text - (do-template [<type> <brand> <super>+] + (template [<type> <brand> <super>+] [(abstract: #export (<brand> brand) {} Any) (`` (type: #export <type> (|> Any <brand> (~~ (template.splice <super>+)))))] [Expression Expression' [Code]] ) - (do-template [<type> <brand> <super>+] + (template [<type> <brand> <super>+] [(abstract: #export <brand> {} Any) (`` (type: #export <type> (|> <brand> (~~ (template.splice <super>+)))))] @@ -102,7 +102,7 @@ (def: sanitize (-> Text Text) - (`` (|>> (~~ (do-template [<find> <replace>] + (`` (|>> (~~ (template [<find> <replace>] [(text.replace-all <find> <replace>)] [text.alarm "\a"] @@ -138,7 +138,7 @@ (-> Expression (List Expression) Computation) (:abstraction (..form (#.Cons func args)))) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export <name> (-> (List Expression) Computation) (apply/* (..global <function>)))] @@ -151,19 +151,19 @@ (-> Expression Computation) (..apply/* func (list))) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export <lux-name> (apply/0 (..global <scheme-name>)))] [newline/0 "newline"] ) - (do-template [<apply> <arg>+ <type>+ <function>+] + (template [<apply> <arg>+ <type>+ <function>+] [(`` (def: #export (<apply> function) (-> Expression (~~ (template.splice <type>+)) Computation) (.function (_ (~~ (template.splice <arg>+))) (..apply/* function (list (~~ (template.splice <arg>+))))))) - (`` (do-template [<definition> <function>] + (`` (template [<definition> <function>] [(def: #export <definition> (<apply> (..global <function>)))] (~~ (template.splice <function>+))))] @@ -207,7 +207,7 @@ [[vector-copy!/5 "vector-copy!"]]] ) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export (<lux-name> param subject) (-> Expression Expression Computation) (..apply/2 (..global <scheme-name>) subject param))] @@ -235,7 +235,7 @@ [bit-xor/2 "bitwise-xor"] ) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export <lux-name> (-> (List Expression) Computation) (|>> (list& (..global <scheme-name>)) ..form :abstraction))] @@ -244,7 +244,7 @@ [and "and"] ) - (do-template [<lux-name> <scheme-name> <var> <pre>] + (template [<lux-name> <scheme-name> <var> <pre>] [(def: #export (<lux-name> bindings body) (-> (List [<var> Expression]) Expression Computation) (:abstraction diff --git a/stdlib/source/lux/locale/language.lux b/stdlib/source/lux/locale/language.lux index 57857fcc3..1cfa9dd82 100644 --- a/stdlib/source/lux/locale/language.lux +++ b/stdlib/source/lux/locale/language.lux @@ -20,9 +20,9 @@ (-> Language Text) (|>> :representation)) - (do-template [<code> <name> <alias>+] + (template [<code> <name> <alias>+] [(def: #export <name> Language (:abstraction <code>)) - (`` (do-template [<alias>] + (`` (template [<alias>] [(def: #export <alias> Language <name>)] (~~ (template.splice <alias>+))))] diff --git a/stdlib/source/lux/locale/territory.lux b/stdlib/source/lux/locale/territory.lux index d2cd5b347..b37148bb2 100644 --- a/stdlib/source/lux/locale/territory.lux +++ b/stdlib/source/lux/locale/territory.lux @@ -19,7 +19,7 @@ #long Text #code Nat} - (do-template [<name> <field> <type>] + (template [<name> <field> <type>] [(def: #export <name> (-> Territory <type>) (|>> :representation @@ -31,7 +31,7 @@ [numeric-code #code Nat] ) - (do-template [<short> <long> <number> <name> <main> <neighbor>+] + (template [<short> <long> <number> <name> <main> <neighbor>+] [(def: #export <main> Territory (:abstraction {#name <name> @@ -39,7 +39,7 @@ #long <long> #code <number>})) - (`` (do-template [<neighbor>] + (`` (template [<neighbor>] [(def: #export <neighbor> Territory <main>)] (~~ (template.splice <neighbor>+))))] diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index e44efeb6c..059351420 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -164,7 +164,7 @@ _ #.None)) -(do-template [<name> <tag> <type>] +(template [<name> <tag> <type>] [(def: #export (<name> tag anns) (-> Name Code (Maybe <type>)) (case (get-ann tag anns) @@ -195,7 +195,7 @@ (-> Name Code Bit) (maybe.default #0 (get-bit-ann flag-name anns))) -(do-template [<name> <tag> <desc>] +(template [<name> <tag> <desc>] [(def: #export <name> {#.doc (code.text ($_ text;compose "Checks whether a definition is " <desc> "."))} (-> Code Bit) @@ -218,7 +218,7 @@ #.None #0)) -(do-template [<name> <tag> <type>] +(template [<name> <tag> <type>] [(def: (<name> input) (-> Code (Maybe <type>)) (case input @@ -232,7 +232,7 @@ [parse-text #.Text Text] ) -(do-template [<name> <tag> <desc>] +(template [<name> <tag> <desc>] [(def: #export (<name> anns) {#.doc <desc>} (-> Code (List Text)) @@ -699,7 +699,7 @@ (function (_ compiler) (#error.Success [compiler (get@ #.type-context compiler)]))) -(do-template [<macro> <func>] +(template [<macro> <func>] [(macro: #export (<macro> tokens) {#.doc (doc "Performs a macro-expansion and logs the resulting code." "You can either use the resulting code, or omit them." diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux index b986c02f4..84f08e5f1 100644 --- a/stdlib/source/lux/macro/code.lux +++ b/stdlib/source/lux/macro/code.lux @@ -31,7 +31,7 @@ (def: _cursor Cursor ["" 0 0]) -(do-template [<name> <type> <tag>] +(template [<name> <type> <tag>] [(def: #export (<name> x) (-> <type> Code) [_cursor (<tag> x)])] @@ -49,7 +49,7 @@ [record (List [Code Code]) #.Record] ) -(do-template [<name> <tag> <doc>] +(template [<name> <tag> <doc>] [(def: #export (<name> name) {#.doc <doc>} (-> Text Code) diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux index aefdea082..4f5cd09a0 100644 --- a/stdlib/source/lux/macro/poly.lux +++ b/stdlib/source/lux/macro/poly.lux @@ -29,7 +29,7 @@ ["." type ("#;." equivalence) ["." check]]]) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {type Type}) (%type type))] @@ -45,7 +45,7 @@ [not-tuple] ) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {expected Type} {actual Type}) (ex.report ["Expected" (%type expected)] ["Actual" (%type actual)]))] @@ -147,7 +147,7 @@ (#error.Success [[_ inputs'] output]) (#error.Success [[env inputs'] [g!var output]]))))) -(do-template [<name> <flattener> <tag> <exception>] +(template [<name> <flattener> <tag> <exception>] [(def: #export (<name> poly) (All [a] (-> (Poly a) (Poly a))) (do p.monad @@ -226,7 +226,7 @@ (p.fail (ex.construct not-application headT)) (local (#.Cons funcT paramsT) poly)))) -(do-template [<name> <test>] +(template [<name> <test>] [(def: #export (<name> expected) (-> Type (Poly Any)) (do p.monad diff --git a/stdlib/source/lux/macro/poly/equivalence.lux b/stdlib/source/lux/macro/poly/equivalence.lux index 91b3c6c64..cc0b79234 100644 --- a/stdlib/source/lux/macro/poly/equivalence.lux +++ b/stdlib/source/lux/macro/poly/equivalence.lux @@ -48,7 +48,7 @@ (` ((~! eq.Equivalence) (~ (poly.to-code *env* type))))))]] ($_ p.either ## Basic types - (~~ (do-template [<matcher> <eq>] + (~~ (template [<matcher> <eq>] [(do @ [_ <matcher>] (wrap (` (: (~ (@Equivalence inputT)) @@ -62,7 +62,7 @@ [(poly.sub Frac) (~! frac.equivalence)] [(poly.sub Text) (~! text.equivalence)])) ## Composite types - (~~ (do-template [<name> <eq>] + (~~ (template [<name> <eq>] [(do @ [[_ argC] (poly.apply (p.and (poly.exactly <name>) equivalence))] @@ -85,7 +85,7 @@ (wrap (` (: (~ (@Equivalence inputT)) ((~! dictionary.equivalence) (~ valC)))))) ## Models - (~~ (do-template [<type> <eq>] + (~~ (template [<type> <eq>] [(do @ [_ (poly.exactly <type>)] (wrap (` (: (~ (@Equivalence inputT)) diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index 6cf596049..cc5f3b5c9 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -89,7 +89,7 @@ (poly: #export codec//encode (with-expansions - [<basic> (do-template [<matcher> <encoder>] + [<basic> (template [<matcher> <encoder>] [(do @ [#let [g!_ (code.local-identifier "_______")] _ <matcher>] @@ -102,7 +102,7 @@ [(poly.sub Int) (:: (~! ..int-codec) (~' encode))] [(poly.sub Frac) (|>> #/.Number)] [(poly.sub Text) (|>> #/.String)]) - <time> (do-template [<type> <codec>] + <time> (template [<type> <codec>] [(do @ [_ (poly.exactly <type>)] (wrap (` (: (~ (@JSON//encode inputT)) @@ -206,7 +206,7 @@ (poly: #export codec//decode (with-expansions - [<basic> (do-template [<matcher> <decoder>] + [<basic> (template [<matcher> <decoder>] [(do @ [_ <matcher>] (wrap (` (: (~ (@JSON//decode inputT)) @@ -218,7 +218,7 @@ [(poly.sub Int) (p.codec ..int-codec /.any)] [(poly.sub Frac) /.number] [(poly.sub Text) /.string]) - <time> (do-template [<type> <codec>] + <time> (template [<type> <codec>] [(do @ [_ (poly.exactly <type>)] (wrap (` (: (~ (@JSON//decode inputT)) diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index 7afc3a8a6..08bb3c978 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -43,7 +43,7 @@ #.Nil (#error.Failure "There are no tokens to parse!") (#.Cons [t tokens']) (#error.Success [tokens' t])))) -(do-template [<get-name> <type> <tag> <eq> <desc>] +(template [<get-name> <type> <tag> <eq> <desc>] [(def: #export <get-name> {#.doc (code.text ($_ text;compose "Parses the next " <desc> " input Code."))} (Syntax <type>) @@ -94,7 +94,7 @@ _ (#error.Failure "There are no tokens to parse!")))) -(do-template [<name> <tag> <desc>] +(template [<name> <tag> <desc>] [(def: #export <name> {#.doc (code.text ($_ text;compose "Parse a local " <desc> " (a " <desc> " that has no module prefix)."))} (Syntax Text) @@ -110,7 +110,7 @@ [ local-tag #.Tag "tag"] ) -(do-template [<name> <tag> <desc>] +(template [<name> <tag> <desc>] [(def: #export (<name> p) {#.doc (code.text ($_ text;compose "Parse inside the contents of a " <desc> " as if they were the input Codes."))} (All [a] diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux index fc4de3940..6ad2e4d46 100644 --- a/stdlib/source/lux/macro/syntax/common/reader.lux +++ b/stdlib/source/lux/macro/syntax/common/reader.lux @@ -73,7 +73,7 @@ tail (s.local (list tail) (flat-list^ []))] (wrap (#.Cons head tail)))))) -(do-template [<name> <type> <tag> <then>] +(template [<name> <type> <tag> <then>] [(def: <name> (Syntax <type>) (<| s.tuple diff --git a/stdlib/source/lux/macro/template.lux b/stdlib/source/lux/macro/template.lux index d0e9714a2..a69d656f6 100644 --- a/stdlib/source/lux/macro/template.lux +++ b/stdlib/source/lux/macro/template.lux @@ -52,7 +52,7 @@ (syntax: #export (text {simple ..part}) (wrap (list (|> simple (text.join-with "") code.text)))) -(do-template [<name> <simple> <complex>] +(template [<name> <simple> <complex>] [(syntax: #export (<name> {simple ..part} {complex (p.maybe ..part)}) (case complex #.None diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux index d4650426f..747f1337f 100644 --- a/stdlib/source/lux/math.lux +++ b/stdlib/source/lux/math.lux @@ -2,7 +2,7 @@ [lux #*]) ## [Values] -(do-template [<name> <value> <doc>] +(template [<name> <value> <doc>] [(def: #export <name> {#.doc <doc>} Frac @@ -13,7 +13,7 @@ [tau +6.28318530717958647692 "The ratio of a circle's circumference to its radius."] ) -(do-template [<name> <method>] +(template [<name> <method>] [(def: #export (<name> input) (-> Frac Frac) (<method> input))] @@ -88,7 +88,7 @@ (pow +0.5 (f/+ (pow +2.0 catA) (pow +2.0 catB)))) -(do-template [<type> <mod> <gcd> <lcm> <zero> <*> </> <->] +(template [<type> <mod> <gcd> <lcm> <zero> <*> </> <->] [(def: #export (<gcd> a b) {#.doc "Greatest Common Divisor."} (-> <type> <type> <type>) @@ -113,7 +113,7 @@ ## Hyperbolic functions ## https://en.wikipedia.org/wiki/Hyperbolic_function#Definitions -(do-template [<name> <comp> <inverse>] +(template [<name> <comp> <inverse>] [(def: #export (<name> x) (-> Frac Frac) (|> (exp x) (<comp> (exp (f/* -1.0 x))) (f// +2.0))) @@ -126,7 +126,7 @@ [cosh f/+ sech] ) -(do-template [<name> <top> <bottom>] +(template [<name> <top> <bottom>] [(def: #export (<name> x) (-> Frac Frac) (let [e+ (exp x) @@ -140,7 +140,7 @@ ) ## https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions#Definitions_in_terms_of_logarithms -(do-template [<name> <comp>] +(template [<name> <comp>] [(def: #export (<name> x) (-> Frac Frac) (|> x (pow +2.0) (<comp> +1.0) (pow +0.5) (f/+ x) log))] @@ -149,7 +149,7 @@ [acosh f/-] ) -(do-template [<name> <base> <diff>] +(template [<name> <base> <diff>] [(def: #export (<name> x) (-> Frac Frac) (let [x+ (|> <base> (f/+ <diff>)) @@ -160,7 +160,7 @@ [acoth x +1.0] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> x) (-> Frac Frac) (let [x^2 (|> x (pow +2.0))] diff --git a/stdlib/source/lux/math/logic/continuous.lux b/stdlib/source/lux/math/logic/continuous.lux index 453761aea..2faa761b3 100644 --- a/stdlib/source/lux/math/logic/continuous.lux +++ b/stdlib/source/lux/math/logic/continuous.lux @@ -7,7 +7,7 @@ (def: #export true Rev rev@top) (def: #export false Rev rev@bottom) -(do-template [<name> <chooser>] +(template [<name> <chooser>] [(def: #export <name> (-> Rev Rev Rev) <chooser>)] diff --git a/stdlib/source/lux/math/modular.lux b/stdlib/source/lux/math/modular.lux index 2d2c6dee7..866d3c99f 100644 --- a/stdlib/source/lux/math/modular.lux +++ b/stdlib/source/lux/math/modular.lux @@ -112,7 +112,7 @@ #modulus reference-modulus})) (ex.throw cannot-equalize-moduli [reference-modulus sample-modulus])))) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export (<name> reference sample) (All [m] (-> (Mod m) (Mod m) Bit)) (let [[reference _] (:representation reference) @@ -126,7 +126,7 @@ [m/>= i/>=] ) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export (<name> param subject) (All [m] (-> (Mod m) (Mod m) (Mod m))) (let [[param modulus] (:representation param) diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux index c9c91408a..47ddb7fa2 100644 --- a/stdlib/source/lux/math/random.lux +++ b/stdlib/source/lux/math/random.lux @@ -99,7 +99,7 @@ (i64.left-shift 32) ("lux i64 +" right))]))) -(do-template [<name> <type> <cast>] +(template [<name> <type> <cast>] [(def: #export <name> (Random <type>) (:: ..monad map <cast> ..i64))] @@ -146,7 +146,7 @@ xs (text char-gen (dec size))] (wrap (text;compose (text.from-code x) xs))))) -(do-template [<name> <set>] +(template [<name> <set>] [(def: #export <name> (-> Nat (Random Text)) (text (char <set>)))] @@ -158,7 +158,7 @@ [ascii/lower-alpha unicode.ascii/lower-alpha] ) -(do-template [<name> <type> <ctor> <gen>] +(template [<name> <type> <ctor> <gen>] [(def: #export <name> (Random <type>) (do ..monad @@ -217,7 +217,7 @@ (wrap (#.Some value))) (wrap #.None)))) -(do-template [<name> <type> <zero> <plus>] +(template [<name> <type> <zero> <plus>] [(def: #export (<name> size value-gen) (All [a] (-> Nat (Random a) (Random (<type> a)))) (if (n/> 0 size) @@ -231,7 +231,7 @@ [row Row row.empty row.add] ) -(do-template [<name> <type> <ctor>] +(template [<name> <type> <ctor>] [(def: #export (<name> size value-gen) (All [a] (-> Nat (Random a) (Random (<type> a)))) (do ..monad diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index 14d783c9b..9f261dbc8 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -32,7 +32,7 @@ {#successes 0 #failures 0}) -(do-template [<name> <category>] +(template [<name> <category>] [(def: <name> Counters (update@ <category> .inc start))] [success #successes] diff --git a/stdlib/source/lux/time/day.lux b/stdlib/source/lux/time/day.lux index 2288111d7..53aa37483 100644 --- a/stdlib/source/lux/time/day.lux +++ b/stdlib/source/lux/time/day.lux @@ -44,7 +44,7 @@ (`` (structure: #export order (Order Day) (def: &equivalence ..equivalence) - (~~ (do-template [<name> <comp>] + (~~ (template [<name> <comp>] [(def: (<name> reference sample) (<comp> (day-to-nat reference) (day-to-nat sample)))] diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index a24dc1844..cbad3c694 100644 --- a/stdlib/source/lux/time/duration.lux +++ b/stdlib/source/lux/time/duration.lux @@ -29,7 +29,7 @@ (-> Duration Int) (|>> :representation)) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export (<name> param subject) (-> Duration Duration Duration) (:abstraction (<op> (:representation param) (:representation subject))))] @@ -38,7 +38,7 @@ [frame i/%] ) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export (<name> scalar) (-> Nat Duration Duration) (|>> :representation (<op> (.int scalar)) :abstraction))] @@ -65,7 +65,7 @@ (`` (structure: #export order (Order Duration) (def: &equivalence ..equivalence) - (~~ (do-template [<name> <op>] + (~~ (template [<name> <op>] [(def: (<name> param subject) (<op> (:representation param) (:representation subject)))] @@ -77,7 +77,7 @@ (open: "duration;." ..order) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export (<name> left right) (-> Duration Duration Duration) (if (<op> left right) @@ -88,7 +88,7 @@ [min duration;<] ) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export <name> (-> Duration Bit) (|>> :representation (<op> +0)))] @@ -102,7 +102,7 @@ (def: #export empty (from-millis +0)) (def: #export milli-second (from-millis +1)) -(do-template [<name> <scale> <base>] +(template [<name> <scale> <base>] [(def: #export <name> (scale-up <scale> <base>))] [second 1,000 milli-second] diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 64c8d674e..4231cc6c1 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -60,7 +60,7 @@ (`` (structure: #export order (Order Instant) (def: &equivalence ..equivalence) - (~~ (do-template [<name>] + (~~ (template [<name>] [(def: (<name> param subject) (:: int.order <name> (:representation param) (:representation subject)))] @@ -69,7 +69,7 @@ (`` (structure: #export enum (Enum Instant) (def: &order ..order) - (~~ (do-template [<name>] + (~~ (template [<name>] [(def: <name> (|>> :representation (:: int.enum <name>) :abstraction))] diff --git a/stdlib/source/lux/time/month.lux b/stdlib/source/lux/time/month.lux index 203f5c6cb..2863220da 100644 --- a/stdlib/source/lux/time/month.lux +++ b/stdlib/source/lux/time/month.lux @@ -59,7 +59,7 @@ (`` (structure: #export order (Order Month) (def: &equivalence ..equivalence) - (~~ (do-template [<name> <comp>] + (~~ (template [<name> <comp>] [(def: (<name> reference sample) (<comp> (number reference) (number sample)))] diff --git a/stdlib/source/lux/tool/compiler/analysis.lux b/stdlib/source/lux/tool/compiler/analysis.lux index a8ad548d9..c2a6d0cb7 100644 --- a/stdlib/source/lux/tool/compiler/analysis.lux +++ b/stdlib/source/lux/tool/compiler/analysis.lux @@ -68,14 +68,14 @@ (type: #export Match (Match' Analysis)) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> content) (<tag> content))] [control/case #..Case] ) -(do-template [<name> <type> <tag>] +(template [<name> <type> <tag>] [(def: #export <name> (-> <type> Analysis) (|>> <tag> #..Primitive))] @@ -121,7 +121,7 @@ _ [abstraction inputs]))) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> content) (.<| #..Reference <tag> @@ -131,7 +131,7 @@ [constant #reference.Constant] ) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> content) (.<| #..Complex <tag> @@ -141,7 +141,7 @@ [pattern/tuple #..Tuple] ) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> content) (.<| #..Structure <tag> @@ -154,7 +154,7 @@ (template: #export (pattern/unit) (#..Simple #..Unit)) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> content) (#..Simple (<tag> content)))] @@ -233,7 +233,7 @@ (format (%t name) " ") (text.enclose ["(" ")"])))) -(do-template [<special> <general>] +(template [<special> <general>] [(type: #export <special> (<general> .Lux Code Analysis))] @@ -305,7 +305,7 @@ (#error.Failure (format "@ " (%cursor cursor) text.new-line error))))))) -(do-template [<name> <type> <field> <value>] +(template [<name> <type> <field> <value>] [(def: #export (<name> value) (-> <type> (Operation Any)) (extension.update (set@ <field> <value>)))] diff --git a/stdlib/source/lux/tool/compiler/default/syntax.lux b/stdlib/source/lux/tool/compiler/default/syntax.lux index 8eaf3a558..5f894622b 100644 --- a/stdlib/source/lux/tool/compiler/default/syntax.lux +++ b/stdlib/source/lux/tool/compiler/default/syntax.lux @@ -57,7 +57,7 @@ (type: Char Nat) -(do-template [<name> <extension> <diff>] +(template [<name> <extension> <diff>] [(template: (<name> value) (<extension> value <diff>))] @@ -69,7 +69,7 @@ (template: (!clip from to text) ("lux text clip" text from to)) -(do-template [<name> <extension>] +(template [<name> <extension>] [(template: (<name> reference subject) (<extension> subject reference))] @@ -77,7 +77,7 @@ [!i/< "lux int <"] ) -(do-template [<name> <extension>] +(template [<name> <extension>] [(template: (<name> param subject) (<extension> subject param))] @@ -180,7 +180,7 @@ ## else <cannot-close>)))))))) -(do-template [<name> <close> <tag> <context>] +(template [<name> <close> <tag> <context>] [(`` (def: (<name> parse source) (-> Parser Parser) (let [[_ _ source-code] source @@ -267,7 +267,7 @@ (or (!digit? char) ("lux i64 =" (.char (~~ (static ..digit-separator))) char)))) -(with-expansions [<clauses> (do-template [<char>] +(with-expansions [<clauses> (template [<char>] [("lux i64 =" (.char (~~ (static <char>))) char) #0] @@ -345,7 +345,7 @@ ## else <int-output>)))))) -(do-template [<name> <codec> <tag>] +(template [<name> <codec> <tag>] [(template: (<name> source-code//size start where offset source-code) (loop [g!end offset] (<| (!with-char+ source-code//size source-code g!end g!char (!number-output start g!end <codec> <tag>)) @@ -512,7 +512,7 @@ _ <end-of-file>) - (~~ (do-template [<char> <bit>] + (~~ (template [<char> <bit>] [[<char>] (#error.Success [[(update@ #.column (|>> !inc/2) where) (!inc offset/1) diff --git a/stdlib/source/lux/tool/compiler/host.lux b/stdlib/source/lux/tool/compiler/host.lux index 218de67a4..71158e724 100644 --- a/stdlib/source/lux/tool/compiler/host.lux +++ b/stdlib/source/lux/tool/compiler/host.lux @@ -3,7 +3,7 @@ (type: #export Host Text) -(do-template [<name> <value>] +(template [<name> <value>] [(def: #export <name> Host <value>)] [common-lisp "Common Lisp"] diff --git a/stdlib/source/lux/tool/compiler/meta/cache.lux b/stdlib/source/lux/tool/compiler/meta/cache.lux index 45b33f4f7..382ca7bfd 100644 --- a/stdlib/source/lux/tool/compiler/meta/cache.lux +++ b/stdlib/source/lux/tool/compiler/meta/cache.lux @@ -41,7 +41,7 @@ ["Expected" (//archive.describe expected)] ["Actual" (//archive.describe actual)])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/stdlib/source/lux/tool/compiler/meta/io/context.lux b/stdlib/source/lux/tool/compiler/meta/io/context.lux index 40dd5bd7d..c9f52cc76 100644 --- a/stdlib/source/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/lux/tool/compiler/meta/io/context.lux @@ -21,7 +21,7 @@ ["#/" // (#+ Input) ["#." host]]]]) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {module Module}) (ex.report ["Module" module]))] diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/inference.lux b/stdlib/source/lux/tool/compiler/phase/analysis/inference.lux index d677d4222..57b9ed357 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/inference.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/inference.lux @@ -40,7 +40,7 @@ (ex.report ["Expected" (%i (.int expected))] ["Actual" (%i (.int actual))])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {type Type}) (%type type))] diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/module.lux b/stdlib/source/lux/tool/compiler/phase/analysis/module.lux index 0d69f524c..db02af343 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/module.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/module.lux @@ -27,7 +27,7 @@ (ex.report ["Module" module] ["Tag" tag])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {tags (List Text)} {owner Type}) (ex.report ["Tags" (text.join-with " " tags)] ["Type" (%type owner)]))] @@ -156,7 +156,7 @@ module (///extension.lift (macro.find-module name))] (wrap [module output]))) -(do-template [<setter> <asker> <tag>] +(template [<setter> <asker> <tag>] [(def: #export (<setter> module-name) (-> Text (Operation Any)) (///extension.lift @@ -196,7 +196,7 @@ [set-cached cached? #.Cached] ) -(do-template [<name> <tag> <type>] +(template [<name> <tag> <type>] [(def: (<name> module-name) (-> Text (Operation <type>)) (///extension.lift diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/primitive.lux b/stdlib/source/lux/tool/compiler/phase/analysis/primitive.lux index 60e3392e6..b42065f8f 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/primitive.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/primitive.lux @@ -8,7 +8,7 @@ [// ["/" analysis (#+ Analysis Operation)]]]]) -(do-template [<name> <type> <tag>] +(template [<name> <type> <tag>] [(def: #export (<name> value) (-> <type> (Operation Analysis)) (do ///.monad diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/scope.lux b/stdlib/source/lux/tool/compiler/phase/analysis/scope.lux index 9033344b3..8383ae615 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/scope.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/scope.lux @@ -137,7 +137,7 @@ (ex.throw cannot-create-local-binding-without-a-scope [])) )) -(do-template [<name> <val-type>] +(template [<name> <val-type>] [(def: <name> (Bindings Text [Type <val-type>]) {#.counter 0 diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/structure.lux b/stdlib/source/lux/tool/compiler/phase/analysis/structure.lux index 9d78121d5..da8f0dee4 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/structure.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/structure.lux @@ -34,7 +34,7 @@ ["Tag" (%n tag)] ["Expression" (%code code)])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {type Type} {members (List Code)}) (ex.report ["Type" (%type type)] ["Expression" (%code (` [(~+ members)]))]))] @@ -46,7 +46,7 @@ (exception: #export (not-a-quantified-type {type Type}) (%type type)) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {type Type} {tag Tag} {code Code}) (ex.report ["Type" (%type type)] ["Tag" (%n tag)] @@ -60,7 +60,7 @@ (ex.report ["Key" (%code key)] ["Record" (%code (code.record record))])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {key Name} {record (List [Name Code])}) (ex.report ["Tag" (%code (code.tag key))] ["Record" (%code (code.record (list;map (function (_ [keyI valC]) diff --git a/stdlib/source/lux/tool/compiler/phase/extension.lux b/stdlib/source/lux/tool/compiler/phase/extension.lux index 653d3e011..7ce75f6e5 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension.lux @@ -37,7 +37,7 @@ (type: #export (Phase s i o) (//.Phase (State s i o) i o)) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {name Name}) (ex.report ["Extension" (%t name)]))] diff --git a/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux b/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux index bff1d8527..18ac68d99 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux @@ -95,7 +95,7 @@ _ (////.throw ///.invalid-syntax [extension-name])))) -(do-template [<name> <type>] +(template [<name> <type>] [(def: (<name> eval) (-> Eval Handler) (function (_ extension-name analyse args) diff --git a/stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux b/stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux index 428bffd66..abace9a94 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux @@ -38,7 +38,7 @@ (import: #long java/lang/reflect/Type (getTypeName [] String)) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {jvm-type java/lang/reflect/Type}) (ex.report ["JVM Type" (java/lang/reflect/Type::getTypeName jvm-type)]))] @@ -48,7 +48,7 @@ [cannot-convert-to-a-lux-type] ) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {type Type}) (%type type))] @@ -57,7 +57,7 @@ [non-jvm-type] ) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {name Text}) name)] @@ -65,7 +65,7 @@ [non-throwable] ) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] @@ -89,7 +89,7 @@ [cannot-correspond-type-with-a-class] ) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {class Text} {method Text} {hints (List Method-Signature)}) @@ -103,7 +103,7 @@ [too-many-candidates] ) -(do-template [<name> <class>] +(template [<name> <class>] [(def: #export <name> Type (#.Primitive <class> (list)))] ## Boxes @@ -157,7 +157,7 @@ (///bundle.install "short-to-long" (//common.unary Short Long)) ))) -(do-template [<name> <prefix> <type>] +(template [<name> <prefix> <type>] [(def: <name> Bundle (<| (///bundle.prefix <prefix>) @@ -181,7 +181,7 @@ [bundle::long "long" Long] ) -(do-template [<name> <prefix> <type>] +(template [<name> <prefix> <type>] [(def: <name> Bundle (<| (///bundle.prefix <prefix>) @@ -1060,7 +1060,7 @@ (#Hint Method-Signature) #Fail) -(do-template [<name> <tag>] +(template [<name> <tag>] [(def: <name> (-> Evaluation (Maybe Method-Signature)) (|>> (case> (<tag> output) diff --git a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux index 4f36ef89f..ecba5d158 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux @@ -214,7 +214,7 @@ _ (///.throw //.invalid-syntax [extension-name])))) -(do-template [<mame> <type> <scope>] +(template [<mame> <type> <scope>] [(def: <mame> (All [anchor expression statement] (Handler anchor expression statement)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation.lux b/stdlib/source/lux/tool/compiler/phase/generation.lux index 882e1127f..f0609d666 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation.lux @@ -36,7 +36,7 @@ ["Old Host Name" old-host-name] ["New Host Name" new-host-name])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {name Name}) (exception.report ["Output" (%name name)]))] @@ -52,7 +52,7 @@ (signature: #export (Host expression statement) (: (-> Text expression (Error Any)) evaluate!) - (: (-> Text statement (Error Nothing)) + (: (-> Text statement (Error Any)) execute!) (: (-> Name expression (Error [Text Any statement])) define!)) @@ -69,7 +69,7 @@ #counter Nat #name-cache (Dictionary Name Text)}) -(do-template [<special> <general>] +(template [<special> <general>] [(type: #export (<special> anchor expression statement) (<general> (State anchor expression statement) Synthesis expression))] @@ -116,7 +116,7 @@ (def: #export empty-buffer Buffer row.empty) -(do-template [<tag> +(template [<tag> <with-declaration> <with-type> <with-value> <set> <get> <get-type> <exception>] [(exception: #export <exception>) @@ -184,7 +184,7 @@ (-> Text (Operation anchor expression statement Text))) (:: //.monad map (|>> %n (format prefix)) ..next)) -(do-template [<name> <inputT>] +(template [<name> <inputT>] [(def: #export (<name> label code) (All [anchor expression statement] (-> Text <inputT> (Operation anchor expression statement Any))) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux b/stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux index 2e661dc29..9a065a73e 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux @@ -20,7 +20,7 @@ ## [Procedures] ## [[Bits]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [paramG subjectG]) (Binary Expression) (<op> subjectG (///runtime.i64//to-number paramG)))] @@ -35,7 +35,7 @@ (#static MIN_VALUE Double) (#static MAX_VALUE Double)) -(do-template [<name> <const>] +(template [<name> <const>] [(def: (<name> _) (Nullary Expression) (///primitive.f64 <const>))] @@ -64,7 +64,7 @@ (Binary Expression) (|> subjectG (_.do "concat" (list paramG)))) -(do-template [<name> <runtime>] +(template [<name> <runtime>] [(def: (<name> [subjectG paramG extraG]) (Trinary Expression) (<runtime> subjectG paramG extraG))] diff --git a/stdlib/source/lux/tool/compiler/phase/generation/js/extension/host.lux b/stdlib/source/lux/tool/compiler/phase/generation/js/extension/host.lux index aed6c4711..70f581d69 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/js/extension/host.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/js/extension/host.lux @@ -19,7 +19,7 @@ ["#/" // #_ ["#." synthesis]]]]]) -(do-template [<name> <js>] +(template [<name> <js>] [(def: (<name> _) (Nullary Expression) <js>)] [js//null _.null] diff --git a/stdlib/source/lux/tool/compiler/phase/generation/js/runtime.lux b/stdlib/source/lux/tool/compiler/phase/generation/js/runtime.lux index 0e3864bd0..8dcdb866a 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/js/runtime.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/js/runtime.lux @@ -23,7 +23,7 @@ ["." synthesis]]]] ) -(do-template [<name> <base>] +(template [<name> <base>] [(type: #export <name> (<base> Var Expression Statement))] @@ -320,7 +320,7 @@ (_.bit-or (up-16 x16) x00))) )))) -(do-template [<name> <op>] +(template [<name> <op>] [(runtime: (<name> subject parameter) (_.return (i64//new (<op> (_.the ..i64-high-field subject) (_.the ..i64-high-field parameter)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/python/extension/common.lux b/stdlib/source/lux/tool/compiler/phase/generation/python/extension/common.lux index 4cfc7a1e6..43ebd105f 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/python/extension/common.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/python/extension/common.lux @@ -44,7 +44,7 @@ (#static MIN_VALUE Double) (#static MAX_VALUE Double)) -(do-template [<name> <const>] +(template [<name> <const>] [(def: (<name> _) (Nullary (Expression Any)) (_.float <const>))] diff --git a/stdlib/source/lux/tool/compiler/phase/generation/python/runtime.lux b/stdlib/source/lux/tool/compiler/phase/generation/python/runtime.lux index 564bbdb35..a8f601922 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/python/runtime.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/python/runtime.lux @@ -23,7 +23,7 @@ ["." synthesis]]]] ) -(do-template [<name> <base>] +(template [<name> <base>] [(type: #export <name> (<base> SVar (Expression Any) (Statement Any)))] @@ -295,7 +295,7 @@ (def: inc (|>> (_.+ (_.int +1)))) -(do-template [<name> <top-cmp>] +(template [<name> <top-cmp>] [(def: (<name> top value) (-> (Expression Any) (Expression Any) (Computation Any)) (_.and (|> value (_.>= (_.int +0))) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.jvm.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.jvm.lux index 950a32e1d..0de327e23 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.jvm.lux @@ -73,7 +73,7 @@ (bundle.install "is?" (binary (product.uncurry _.eq?/2))) (bundle.install "try" (unary ///runtime.lux//try)))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -113,7 +113,7 @@ (#static MIN_VALUE Double) (#static MAX_VALUE Double)) -(do-template [<name> <const> <encode>] +(template [<name> <const> <encode>] [(def: (<name> _) Nullary (<encode> <const>))] @@ -123,7 +123,7 @@ [frac::max (Double::MAX_VALUE) _.float] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (|> subjectO (<op> paramO)))] @@ -135,7 +135,7 @@ [int::% _.remainder/2] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -152,7 +152,7 @@ [text::< _.string<?/2] ) -(do-template [<name> <cmp>] +(template [<name> <cmp>] [(def: (<name> [subjectO paramO]) Binary (<cmp> paramO subjectO))] diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/primitive.jvm.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/primitive.jvm.lux index d53a0691e..5405e4c55 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/primitive.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/primitive.jvm.lux @@ -3,7 +3,7 @@ [host ["_" scheme (#+ Expression)]]]) -(do-template [<name> <type> <code>] +(template [<name> <type> <code>] [(def: #export <name> (-> <type> Expression) <code>)] diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/runtime.jvm.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/runtime.jvm.lux index 62245a659..d3c949df1 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/runtime.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/runtime.jvm.lux @@ -22,7 +22,7 @@ ["#." name] ["#." synthesis]]]]) -(do-template [<name> <base>] +(template [<name> <base>] [(type: #export <name> (<base> Var Expression Expression))] diff --git a/stdlib/source/lux/tool/compiler/reference.lux b/stdlib/source/lux/tool/compiler/reference.lux index a20691986..7022b2496 100644 --- a/stdlib/source/lux/tool/compiler/reference.lux +++ b/stdlib/source/lux/tool/compiler/reference.lux @@ -39,7 +39,7 @@ (#Foreign register) (n/* 2 register)))) -(do-template [<name> <family> <tag>] +(template [<name> <family> <tag>] [(template: #export (<name> content) (<| <family> <tag> @@ -49,7 +49,7 @@ [foreign #..Variable #..Foreign] ) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> content) (<| <tag> content))] diff --git a/stdlib/source/lux/tool/compiler/statement.lux b/stdlib/source/lux/tool/compiler/statement.lux index 49fd51c7b..441b47f83 100644 --- a/stdlib/source/lux/tool/compiler/statement.lux +++ b/stdlib/source/lux/tool/compiler/statement.lux @@ -45,7 +45,7 @@ {#imports (list;compose (get@ #imports left) (get@ #imports right)) #referrals (list;compose (get@ #referrals left) (get@ #referrals right))}) -(do-template [<special> <general>] +(template [<special> <general>] [(type: #export (<special> anchor expression statement) (<general> (..State anchor expression statement) Code Requirements))] @@ -56,7 +56,7 @@ [Bundle extension.Bundle] ) -(do-template [<name> <component> <operation>] +(template [<name> <component> <operation>] [(def: #export (<name> operation) (All [anchor expression statement output] (-> (<operation> output) diff --git a/stdlib/source/lux/tool/compiler/synthesis.lux b/stdlib/source/lux/tool/compiler/synthesis.lux index 71abfee04..6b147ffae 100644 --- a/stdlib/source/lux/tool/compiler/synthesis.lux +++ b/stdlib/source/lux/tool/compiler/synthesis.lux @@ -94,7 +94,7 @@ (#Control (Control Synthesis)) (#Extension (Extension Synthesis))) -(do-template [<special> <general>] +(template [<special> <general>] [(type: #export <special> (<general> ..State Analysis Synthesis))] @@ -112,7 +112,7 @@ Path #Pop) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> content) (#..Test (<tag> content)))] @@ -122,7 +122,7 @@ [path/text #..Text] ) -(do-template [<name> <kind>] +(template [<name> <kind>] [(template: #export (<name> content) (.<| #..Access <kind> @@ -132,7 +132,7 @@ [path/member #..Member] ) -(do-template [<name> <kind> <side>] +(template [<name> <kind> <side>] [(template: #export (<name> content) (.<| #..Access <kind> @@ -145,7 +145,7 @@ [member/right #..Member #.Right] ) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> content) (<tag> content))] @@ -153,7 +153,7 @@ [path/then #..Then] ) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> left right) (<tag> [left right]))] @@ -169,7 +169,7 @@ (def: #export unit Text "") -(do-template [<name> <type> <tag>] +(template [<name> <type> <tag>] [(def: #export (<name> value) (-> <type> (All [a] (-> (Operation a) (Operation a)))) (extension.temporary (set@ <tag> value)))] @@ -182,7 +182,7 @@ (All [a] (-> (Operation a) (Operation a)))) (extension.with-state {#locals arity})) -(do-template [<name> <tag> <type>] +(template [<name> <tag> <type>] [(def: #export <name> (Operation <type>) (extension.read (get@ <tag>)))] @@ -196,7 +196,7 @@ [locals ..locals]) (..with-locals (inc locals)))) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> content) (#..Primitive (<tag> content)))] @@ -206,7 +206,7 @@ [text #..Text] ) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> content) (<| #..Structure <tag> @@ -216,7 +216,7 @@ [tuple #//analysis.Tuple] ) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> content) (.<| #..Reference <tag> @@ -226,7 +226,7 @@ [variable/foreign //reference.foreign] ) -(do-template [<name> <tag>] +(template [<name> <tag>] [(template: #export (<name> content) (.<| #..Reference <tag> @@ -236,7 +236,7 @@ [constant //reference.constant] ) -(do-template [<name> <family> <tag>] +(template [<name> <family> <tag>] [(template: #export (<name> content) (.<| #..Control <family> diff --git a/stdlib/source/lux/tool/interpreter/type.lux b/stdlib/source/lux/tool/interpreter/type.lux index f6a66a76a..19f94af1b 100644 --- a/stdlib/source/lux/tool/interpreter/type.lux +++ b/stdlib/source/lux/tool/interpreter/type.lux @@ -36,7 +36,7 @@ [_ (poly.exactly Any)] (wrap (function.constant "[]"))) - (~~ (do-template [<type> <formatter>] + (~~ (template [<type> <formatter>] [(do p.monad [_ (poly.sub <type>)] (wrap (|>> (:coerce <type>) <formatter>)))] @@ -51,7 +51,7 @@ (def: (special-representation representation) (-> (Poly Representation) (Poly Representation)) (`` ($_ p.either - (~~ (do-template [<type> <formatter>] + (~~ (template [<type> <formatter>] [(do p.monad [_ (poly.sub <type>)] (wrap (|>> (:coerce <type>) <formatter>)))] diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux index 5cc89acb5..217b22abc 100644 --- a/stdlib/source/lux/type.lux +++ b/stdlib/source/lux/type.lux @@ -89,7 +89,7 @@ #0 ))) -(do-template [<name> <tag>] +(template [<name> <tag>] [(def: #export (<name> type) (-> Type [Nat Type]) (loop [num-args 0 @@ -125,7 +125,7 @@ _ [type (list)])) -(do-template [<name> <tag>] +(template [<name> <tag>] [(def: #export (<name> type) (-> Type (List Type)) (case type @@ -265,7 +265,7 @@ _ type)) -(do-template [<name> <base> <ctor>] +(template [<name> <base> <ctor>] [(def: #export (<name> types) (-> (List Type) Type) (case types @@ -300,7 +300,7 @@ (#.Cons param params') (application params' (#.Apply param quant)))) -(do-template [<name> <tag>] +(template [<name> <tag>] [(def: #export (<name> size body) (-> Nat Type Type) (case size diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux index 6190c6dab..1a45c6e56 100644 --- a/stdlib/source/lux/type/abstract.lux +++ b/stdlib/source/lux/type/abstract.lux @@ -138,7 +138,7 @@ (p.either (p.and (p.maybe s.local-identifier) s.any) (p.and (p;wrap #.None) s.any))) -(do-template [<name> <from> <to>] +(template [<name> <from> <to>] [(syntax: #export (<name> {[scope value] cast}) (do @ [[name type-vars abstraction representation] (peek! scope)] diff --git a/stdlib/source/lux/type/check.lux b/stdlib/source/lux/type/check.lux index ce0545caa..7f5fc1f36 100644 --- a/stdlib/source/lux/type/check.lux +++ b/stdlib/source/lux/type/check.lux @@ -171,7 +171,7 @@ (#error.Success [(update@ #.ex-counter inc context) [id (#.Ex id)]])))) -(do-template [<name> <outputT> <fail> <succeed>] +(template [<name> <outputT> <fail> <succeed>] [(def: #export (<name> id) (-> Var (Check <outputT>)) (function (_ context) diff --git a/stdlib/source/lux/type/quotient.lux b/stdlib/source/lux/type/quotient.lux index b5efe0957..e5eac8280 100644 --- a/stdlib/source/lux/type/quotient.lux +++ b/stdlib/source/lux/type/quotient.lux @@ -27,7 +27,7 @@ (:abstraction {#value value #label ((:representation Class class) value)})) - (do-template [<name> <output> <slot>] + (template [<name> <output> <slot>] [(def: #export <name> (All [t c q] (-> (Quotient t c q) <output>)) (|>> :representation (get@ <slot>)))] diff --git a/stdlib/source/lux/type/refinement.lux b/stdlib/source/lux/type/refinement.lux index d39677778..2444878b4 100644 --- a/stdlib/source/lux/type/refinement.lux +++ b/stdlib/source/lux/type/refinement.lux @@ -24,7 +24,7 @@ #predicate predicate})) #.None))) - (do-template [<name> <output> <slot>] + (template [<name> <output> <slot>] [(def: #export (<name> refined) (All [t r] (-> (Refined t r) <output>)) (|> refined :representation (get@ <slot>)))] diff --git a/stdlib/source/lux/type/resource.lux b/stdlib/source/lux/type/resource.lux index 6cc8cc3ec..affcf4cfc 100644 --- a/stdlib/source/lux/type/resource.lux +++ b/stdlib/source/lux/type/resource.lux @@ -53,7 +53,7 @@ [[keysT value] (input keysI)] ((f value) keysT))))) -(do-template [<name> <m> <monad> <execute> <lift>] +(template [<name> <m> <monad> <execute> <lift>] [(def: #export <name> (IxMonad (Procedure <m>)) (..indexed <monad>)) @@ -83,7 +83,7 @@ (abstract: #export (Key mode key) {} [] - (do-template [<name> <mode>] + (template [<name> <mode>] [(def: <name> (Ex [k] (-> [] (Key <mode> k))) (|>> :abstraction))] @@ -99,7 +99,7 @@ {#.doc "A value locked by a key."} value - (do-template [<name> <m> <monad> <mode> <key>] + (template [<name> <m> <monad> <mode> <key>] [(def: #export (<name> value) (All [v] (Ex [k] (-> v (Affine <m> (Key <mode> k) (Res k v))))) (function (_ keys) @@ -112,7 +112,7 @@ [commutative-pure Identity identity.monad Commutative commutative-key] [commutative-async Promise promise.monad Commutative commutative-key]) - (do-template [<name> <m> <monad>] + (template [<name> <m> <monad>] [(def: #export (<name> resource) (All [v k m] (-> (Res k v) (Relevant <m> (Key m k) v))) @@ -146,7 +146,7 @@ (All [m] (-> (Monad m) (Linear m Any))) (function (_ context) (:: Monad<m> wrap [context []]))) -(do-template [<name> <m> <monad>] +(template [<name> <m> <monad>] [(syntax: #export (<name> {swaps ..indices}) (macro.with-gensyms [g!_ g!context] (case swaps @@ -188,7 +188,7 @@ (n/> 0 raw))] (wrap raw))) -(do-template [<name> <m> <monad> <from> <to>] +(template [<name> <m> <monad> <from> <to>] [(syntax: #export (<name> {amount ..amount}) (macro.with-gensyms [g!_ g!context] (do macro.monad diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux index ab971a4d7..d28f3e841 100644 --- a/stdlib/source/lux/type/unit.lux +++ b/stdlib/source/lux/type/unit.lux @@ -58,7 +58,7 @@ (-> Int Pure) in) -(do-template [<name> <tag>] +(template [<name> <tag>] [(def: <name> (-> Text Text) (|>> (format "{" kind "@" module "}") @@ -116,7 +116,7 @@ [(~ (code.nat numerator)) (~ (code.nat denominator))]))) )))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (All [unit] (-> (Qty unit) (Qty unit) (Qty unit))) (|> subject out (<op> (out param)) in))] @@ -172,7 +172,7 @@ (`` (structure: #export order (All [unit] (Order (Qty unit))) (def: &equivalence ..equivalence) - (~~ (do-template [<name> <func>] + (~~ (template [<name> <func>] [(def: (<name> reference sample) (<func> (out reference) (out sample)))] diff --git a/stdlib/source/lux/world/binary.lux b/stdlib/source/lux/world/binary.lux index 72d1775c4..e373937b9 100644 --- a/stdlib/source/lux/world/binary.lux +++ b/stdlib/source/lux/world/binary.lux @@ -19,7 +19,7 @@ (ex.report ["Size" (%n size)] ["Index" (%n index)])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {size Nat} {from Nat} {to Nat}) (ex.report ["Size" (%n size)] ["From" (%n from)] diff --git a/stdlib/source/lux/world/console.lux b/stdlib/source/lux/world/console.lux index 88ddf8a8d..0e996cb5a 100644 --- a/stdlib/source/lux/world/console.lux +++ b/stdlib/source/lux/world/console.lux @@ -17,7 +17,7 @@ [compiler ["." host]]]]) -(do-template [<name>] +(template [<name>] [(exception: #export (<name>) "")] @@ -46,7 +46,7 @@ (def: #export (async console) (-> (Console IO) (Console Promise)) - (`` (structure (~~ (do-template [<capability> <forge>] + (`` (structure (~~ (template [<capability> <forge>] [(def: <capability> (<forge> (|>> (!.use (:: console <capability>)) promise.future)))] diff --git a/stdlib/source/lux/world/db/jdbc.jvm.lux b/stdlib/source/lux/world/db/jdbc.jvm.lux index b91bb2a72..8fd0ecf4c 100644 --- a/stdlib/source/lux/world/db/jdbc.jvm.lux +++ b/stdlib/source/lux/world/db/jdbc.jvm.lux @@ -61,7 +61,7 @@ #input (Input input) #value input}) -(do-template [<name> <forge> <output>] +(template [<name> <forge> <output>] [(capability: #export (<name> ! i) (<forge> (Statement i) (! (Error <output>))))] @@ -102,7 +102,7 @@ (def: #export (async db) (-> (DB IO) (DB Promise)) (`` (structure - (~~ (do-template [<name> <forge>] + (~~ (template [<name> <forge>] [(def: <name> (<forge> (|>> (!.use (:: db <name>)) promise.future)))] [execute can-execute] diff --git a/stdlib/source/lux/world/db/jdbc/input.jvm.lux b/stdlib/source/lux/world/db/jdbc/input.jvm.lux index dc6ef141c..68045b058 100644 --- a/stdlib/source/lux/world/db/jdbc/input.jvm.lux +++ b/stdlib/source/lux/world/db/jdbc/input.jvm.lux @@ -16,7 +16,7 @@ (import: #long java/lang/String) -(do-template [<class>] +(template [<class>] [(import: #long <class> (new [long]))] @@ -24,7 +24,7 @@ ) (`` (import: #long java/sql/PreparedStatement - (~~ (do-template [<name> <type>] + (~~ (template [<name> <type>] [(<name> [int <type>] #try void)] [setBoolean boolean] @@ -71,7 +71,7 @@ (function (_ value context) (#error.Success context))) -(do-template [<function> <type> <setter>] +(template [<function> <type> <setter>] [(def: #export <function> (Input <type>) (function (_ value [idx statement]) @@ -93,7 +93,7 @@ [bytes Binary java/sql/PreparedStatement::setBytes] ) -(do-template [<function> <setter> <constructor>] +(template [<function> <setter> <constructor>] [(def: #export <function> (Input Instant) (function (_ value [idx statement]) diff --git a/stdlib/source/lux/world/db/jdbc/output.jvm.lux b/stdlib/source/lux/world/db/jdbc/output.jvm.lux index 7a45011f5..39c4cb92b 100644 --- a/stdlib/source/lux/world/db/jdbc/output.jvm.lux +++ b/stdlib/source/lux/world/db/jdbc/output.jvm.lux @@ -24,7 +24,7 @@ (import: #long java/sql/Timestamp) (`` (import: #long java/sql/ResultSet - (~~ (do-template [<method-name> <return-class>] + (~~ (template [<method-name> <return-class>] [(<method-name> [int] #try <return-class>)] [getBoolean boolean] @@ -106,7 +106,7 @@ =right right] (wrap [=left =right]))) -(do-template [<func-name> <method-name> <type>] +(template [<func-name> <method-name> <type>] [(def: #export <func-name> (Output <type>) (function (_ [idx result-set]) @@ -131,7 +131,7 @@ [bytes java/sql/ResultSet::getBytes Binary] ) -(do-template [<func-name> <method-name>] +(template [<func-name> <method-name>] [(def: #export <func-name> (Output Instant) (function (_ [idx result-set]) diff --git a/stdlib/source/lux/world/db/sql.lux b/stdlib/source/lux/world/db/sql.lux index 94563bdf1..c91c2f226 100644 --- a/stdlib/source/lux/world/db/sql.lux +++ b/stdlib/source/lux/world/db/sql.lux @@ -15,7 +15,7 @@ (text.enclose ["(" ")"])) ## Kind -(do-template [<declaration>] +(template [<declaration>] [(abstract: #export <declaration> {} Any)] [Literal'] @@ -62,7 +62,7 @@ Text ## SQL - (do-template [<declaration> <kind>] + (template [<declaration> <kind>] [(type: #export <declaration> (SQL <kind>))] [Literal (Value' Literal')] @@ -135,7 +135,7 @@ (..parenthesize (..enumerate parameters))))) ## Condition - (do-template [<name> <sql-op>] + (template [<name> <sql-op>] [(def: #export (<name> reference sample) (-> Value Value Condition) (:abstraction @@ -170,7 +170,7 @@ " IN " (..parenthesize (enumerate options))))) - (do-template [<func-name> <sql-op>] + (template [<func-name> <sql-op>] [(def: #export (<func-name> left right) (-> Condition Condition Condition) (:abstraction @@ -182,7 +182,7 @@ [or "OR"] ) - (do-template [<name> <type> <sql>] + (template [<name> <type> <sql>] [(def: #export <name> (-> <type> Condition) (|>> :representation ..parenthesize (format <sql> " ") :abstraction))] @@ -192,7 +192,7 @@ ) ## Query - (do-template [<name> <type> <decoration>] + (template [<name> <type> <decoration>] [(def: #export <name> (-> <type> Source) (|>> :representation <decoration> :abstraction))] @@ -202,7 +202,7 @@ [from-query Any-Query ..parenthesize] ) - (do-template [<func-name> <op>] + (template [<func-name> <op>] [(def: #export (<func-name> columns source) (-> (List [Column Alias]) Source Base-Query) (:abstraction @@ -226,7 +226,7 @@ [select-distinct "SELECT DISTINCT"] ) - (do-template [<name> <join-text>] + (template [<name> <join-text>] [(def: #export (<name> table condition prev) (-> Table Condition Base-Query Base-Query) (:abstraction @@ -241,7 +241,7 @@ [full-outer-join "FULL OUTER JOIN"] ) - (do-template [<function> <sql-op>] + (template [<function> <sql-op>] [(def: #export (<function> left right) (-> Any-Query Any-Query (Query Without-Where Without-Having No-Order No-Group No-Limit No-Offset)) (:abstraction @@ -254,7 +254,7 @@ [intersect "INTERSECT"] ) - (do-template [<name> <sql> <variables> <input> <output>] + (template [<name> <sql> <variables> <input> <output>] [(def: #export (<name> value query) (All <variables> (-> Nat <input> <output>)) @@ -272,7 +272,7 @@ (Query where having order group limit With-Offset)] ) - (do-template [<name> <sql>] + (template [<name> <sql>] [(def: #export <name> Order (:abstraction <sql>))] @@ -365,7 +365,7 @@ (-> Text (Schema Value)) (|>> :abstraction)) - (do-template [<name> <attr>] + (template [<name> <attr>] [(def: #export (<name> attr) (-> (Schema Value) (Schema Value)) (:abstraction @@ -405,7 +405,7 @@ (:abstraction (format "CREATE TABLE " (:representation table) " AS " (:representation query)))) - (do-template [<name> <sql>] + (template [<name> <sql>] [(def: #export (<name> table) (-> Table Definition) (:abstraction @@ -425,7 +425,7 @@ (:abstraction (format "ALTER TABLE " (:representation table) " DROP COLUMN " (:representation column)))) - (do-template [<name> <type>] + (template [<name> <type>] [(def: #export (<name> name) (-> Text <type>) (:abstraction name))] @@ -437,7 +437,7 @@ [db DB] ) - (do-template [<name> <type> <sql>] + (template [<name> <type> <sql>] [(def: #export <name> (-> <type> Definition) (|>> :representation (format <sql> " ") :abstraction))] @@ -447,7 +447,7 @@ [drop-view View "DROP VIEW"] ) - (do-template [<name> <sql>] + (template [<name> <sql>] [(def: #export (<name> view query) (-> View Any-Query Definition) (:abstraction diff --git a/stdlib/source/lux/world/file.lux b/stdlib/source/lux/world/file.lux index 0f35422b7..1ee35cd6f 100644 --- a/stdlib/source/lux/world/file.lux +++ b/stdlib/source/lux/world/file.lux @@ -43,7 +43,7 @@ (can-delete [] (! (Error Any)))) (`` (signature: #export (File !) - (~~ (do-template [<name> <output>] + (~~ (template [<name> <output>] [(: (Can-Query ! <output>) <name>)] @@ -56,7 +56,7 @@ (: (Can-Open ! File) move) - (~~ (do-template [<name> <input>] + (~~ (template [<name> <input>] [(: (Can-Modify ! <input>) <name>)] @@ -80,7 +80,7 @@ discard)) (`` (signature: #export (System !) - (~~ (do-template [<name> <capability>] + (~~ (template [<name> <capability>] [(: (Can-Open ! <capability>) <name>)] @@ -97,9 +97,9 @@ (def: (async-file file) (-> (File IO) (File Promise)) (`` (structure - (~~ (do-template [<forge> <name>+] + (~~ (template [<forge> <name>+] [(with-expansions [<rows> (template.splice <name>+)] - (do-template [<name>] + (template [<name>] [(def: <name> (<forge> (|>> (!.use (:: file <name>)) promise.future)))] <rows>))] @@ -118,7 +118,7 @@ (def: (async-directory directory) (-> (Directory IO) (Directory Promise)) - (`` (structure (~~ (do-template [<name> <async>] + (`` (structure (~~ (template [<name> <async>] [(def: <name> (..can-query (|>> (!.use (:: directory <name>)) (io;map (error;map (list;map <async>))) @@ -133,7 +133,7 @@ (def: #export (async system) (-> (System IO) (System Promise)) (`` (structure - (~~ (do-template [<name> <async>] + (~~ (template [<name> <async>] [(def: <name> (..can-open (|>> (!.use (:: system <name>)) (io;map (error;map <async>)) promise.future)))] @@ -159,7 +159,7 @@ (All [!] (-> (System !) [Path Text] Path)) (format parent (:: system separator) child)) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {file Path}) (ex.report ["Path" file]))] @@ -196,7 +196,7 @@ (`` (for {(~~ (static host.jvm)) (as-is (import: #long java/io/File (new [String]) - (~~ (do-template [<name>] + (~~ (template [<name>] [(<name> [] #io #try boolean)] [createNewFile] [mkdir] @@ -231,7 +231,7 @@ (structure: (file path) (-> Path (File IO)) - (~~ (do-template [<name> <flag>] + (~~ (template [<name> <flag>] [(def: <name> (..can-modify (function (<name> data) @@ -316,7 +316,7 @@ (structure: (directory path) (-> Path (Directory IO)) - (~~ (do-template [<name> <method> <capability>] + (~~ (template [<name> <method> <capability>] [(def: <name> (..can-query (function (<name> _) @@ -343,7 +343,7 @@ (!delete path cannot-discard-directory))))) (structure: #export system (System IO) - (~~ (do-template [<name> <method> <capability> <exception>] + (~~ (template [<name> <method> <capability> <exception>] [(def: <name> (..can-open (function (<name> path) @@ -367,7 +367,7 @@ )) })) -(do-template [<get> <signature> <create> <find> <exception>] +(template [<get> <signature> <create> <find> <exception>] [(def: #export (<get> monad system path) (All [!] (-> (Monad !) (System !) Path (! (Error (<signature> !))))) (do monad diff --git a/stdlib/source/lux/world/input/keyboard.lux b/stdlib/source/lux/world/input/keyboard.lux index 99ed5b2cc..a918ba635 100644 --- a/stdlib/source/lux/world/input/keyboard.lux +++ b/stdlib/source/lux/world/input/keyboard.lux @@ -6,7 +6,7 @@ (type: #export Key Nat) -(do-template [<name> <code>] +(template [<name> <code>] [(def: #export <name> Key <code>)] [caps-lock 20] diff --git a/stdlib/source/lux/world/net/http/cookie.lux b/stdlib/source/lux/world/net/http/cookie.lux index 8bb3285ad..4806b9714 100644 --- a/stdlib/source/lux/world/net/http/cookie.lux +++ b/stdlib/source/lux/world/net/http/cookie.lux @@ -35,7 +35,7 @@ (%i seconds) (%n (.nat seconds))))))) -(do-template [<name> <prefix>] +(template [<name> <prefix>] [(def: #export (<name> value) (-> Text Directive) (..directive (format <prefix> "=" value)))] @@ -44,7 +44,7 @@ [path "Path"] ) -(do-template [<name> <tag>] +(template [<name> <tag>] [(def: #export <name> Directive (..directive <tag>))] diff --git a/stdlib/source/lux/world/net/http/mime.lux b/stdlib/source/lux/world/net/http/mime.lux index 272fd1f60..035ff0364 100644 --- a/stdlib/source/lux/world/net/http/mime.lux +++ b/stdlib/source/lux/world/net/http/mime.lux @@ -22,7 +22,7 @@ ) ## https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types -(do-template [<name> <type>] +(template [<name> <type>] [(def: #export <name> MIME (..mime <type>))] [aac-audio "audio/aac"] diff --git a/stdlib/source/lux/world/net/http/response.lux b/stdlib/source/lux/world/net/http/response.lux index 3be1e1454..f1b0b1978 100644 --- a/stdlib/source/lux/world/net/http/response.lux +++ b/stdlib/source/lux/world/net/http/response.lux @@ -62,7 +62,7 @@ (-> MIME Binary Response) (content status.ok)) -(do-template [<name> <type> <mime> <pre>] +(template [<name> <type> <mime> <pre>] [(def: #export <name> (-> <type> Response) (|>> <pre> encoding.to-utf8 (..ok <mime>)))] diff --git a/stdlib/source/lux/world/net/http/route.lux b/stdlib/source/lux/world/net/http/route.lux index b3e3c3639..766d28fa5 100644 --- a/stdlib/source/lux/world/net/http/route.lux +++ b/stdlib/source/lux/world/net/http/route.lux @@ -11,7 +11,7 @@ ["#." status] ["#." response]]) -(do-template [<scheme> <name>] +(template [<scheme> <name>] [(def: #export (<name> server) (-> Server Server) (function (_ (^@ request [identification protocol resource message])) @@ -26,7 +26,7 @@ [#//.HTTPS https] ) -(do-template [<method> <name>] +(template [<method> <name>] [(def: #export (<name> server) (-> Server Server) (function (_ (^@ request [identification protocol resource message])) diff --git a/stdlib/source/lux/world/net/http/status.lux b/stdlib/source/lux/world/net/http/status.lux index fef607b73..a89a5de82 100644 --- a/stdlib/source/lux/world/net/http/status.lux +++ b/stdlib/source/lux/world/net/http/status.lux @@ -3,7 +3,7 @@ [// (#+ Status)]) ## https://en.wikipedia.org/wiki/List_of_HTTP_status_codes -(do-template [<status> <name>] +(template [<status> <name>] [(def: #export <name> Status <status>)] ## 1xx Informational response diff --git a/stdlib/source/lux/world/net/http/version.lux b/stdlib/source/lux/world/net/http/version.lux index a53b96b70..4a693766d 100644 --- a/stdlib/source/lux/world/net/http/version.lux +++ b/stdlib/source/lux/world/net/http/version.lux @@ -2,7 +2,7 @@ [lux #*] [// (#+ Version)]) -(do-template [<name> <version>] +(template [<name> <version>] [(def: #export <name> Version <version>)] [v0_9 "0.9"] diff --git a/stdlib/source/lux/world/net/tcp.jvm.lux b/stdlib/source/lux/world/net/tcp.jvm.lux index 7ff25d6ee..d72e24763 100644 --- a/stdlib/source/lux/world/net/tcp.jvm.lux +++ b/stdlib/source/lux/world/net/tcp.jvm.lux @@ -55,7 +55,7 @@ (def: #export (async tcp) (-> (TCP IO) (TCP Promise)) - (`` (structure (~~ (do-template [<capability> <forge>] + (`` (structure (~~ (template [<capability> <forge>] [(def: <capability> (<forge> (|>> (!.use (:: tcp <capability>)) promise.future)))] [read //.can-read] diff --git a/stdlib/source/lux/world/net/udp.jvm.lux b/stdlib/source/lux/world/net/udp.jvm.lux index f7228aed3..01eb4772a 100644 --- a/stdlib/source/lux/world/net/udp.jvm.lux +++ b/stdlib/source/lux/world/net/udp.jvm.lux @@ -66,7 +66,7 @@ (def: #export (async udp) (-> (UDP IO) (UDP Promise)) - (`` (structure (~~ (do-template [<name> <forge>] + (`` (structure (~~ (template [<name> <forge>] [(def: <name> (<forge> (|>> (!.use (:: udp <name>)) promise.future)))] [read //.can-read] diff --git a/stdlib/source/lux/world/output/video/resolution.lux b/stdlib/source/lux/world/output/video/resolution.lux index 77089d37f..01a7e4c3a 100644 --- a/stdlib/source/lux/world/output/video/resolution.lux +++ b/stdlib/source/lux/world/output/video/resolution.lux @@ -6,7 +6,7 @@ #height Nat}) ## https://en.wikipedia.org/wiki/Display_resolution#Common_display_resolutions -(do-template [<name> <width> <height>] +(template [<name> <width> <height>] [(def: #export <name> Resolution {#width <width> diff --git a/stdlib/source/program/compositor/cli.lux b/stdlib/source/program/compositor/cli.lux index e08c83c7e..5c8e697a1 100644 --- a/stdlib/source/program/compositor/cli.lux +++ b/stdlib/source/program/compositor/cli.lux @@ -19,7 +19,7 @@ (#Compilation Configuration) (#Interpretation Configuration)) -(do-template [<name> <long>] +(template [<name> <long>] [(def: #export <name> (CLI Text) (cli.named <long> cli.any))] diff --git a/stdlib/source/program/licentia/document.lux b/stdlib/source/program/licentia/document.lux index c04cd9d72..1fd0189eb 100644 --- a/stdlib/source/program/licentia/document.lux +++ b/stdlib/source/program/licentia/document.lux @@ -27,7 +27,7 @@ (|>> (list;map ..sentence) (text.join-with text.new-line))) -(do-template [<name> <word>] +(template [<name> <word>] [(def: #export <name> (-> (List Text) Text) (text.join-with (format ", " <word> " ")))] diff --git a/stdlib/source/program/licentia/license/definition.lux b/stdlib/source/program/licentia/license/definition.lux index 681f521e7..fea7b91f4 100644 --- a/stdlib/source/program/licentia/license/definition.lux +++ b/stdlib/source/program/licentia/license/definition.lux @@ -43,7 +43,7 @@ (def: covered-work-description "work of authorship") -(do-template [<name> <term> <meaning>] +(template [<name> <term> <meaning>] [(def: #export <name> Definition {#term <term> diff --git a/stdlib/source/program/licentia/license/term.lux b/stdlib/source/program/licentia/license/term.lux index 9e81cf666..31b3e4b5d 100644 --- a/stdlib/source/program/licentia/license/term.lux +++ b/stdlib/source/program/licentia/license/term.lux @@ -6,7 +6,7 @@ [// ["." definition]]) -(do-template [<term> <definition>] +(template [<term> <definition>] [(def: #export <term> Text (get@ #definition.term <definition>))] diff --git a/stdlib/source/program/licentia/output.lux b/stdlib/source/program/licentia/output.lux index 29d61dd42..43080697e 100644 --- a/stdlib/source/program/licentia/output.lux +++ b/stdlib/source/program/licentia/output.lux @@ -43,7 +43,7 @@ (def: #export (grant termination) (-> Termination Text) - (`` (format (~~ (do-template [<title> <content>] + (`` (format (~~ (template [<title> <content>] [($.block ($.section {#$.title <title> #$.content <content>}))] @@ -65,7 +65,7 @@ (def: #export limitation Text - (`` (format (~~ (do-template [<title> <content>] + (`` (format (~~ (template [<title> <content>] [($.block ($.section {#$.title <title> #$.content <content>}))] @@ -80,7 +80,7 @@ (def: #export assurance Text - (`` (format (~~ (do-template [<title> <content>] + (`` (format (~~ (template [<title> <content>] [($.block ($.section {#$.title <title> #$.content <content>}))] @@ -92,7 +92,7 @@ (def: #export (liability value) (-> Liability Text) - (`` (format (~~ (do-template [<title> <condition> <content>] + (`` (format (~~ (template [<title> <condition> <content>] [(if <condition> ($.block ($.section {#$.title <title> #$.content <content>})) @@ -120,7 +120,7 @@ (def: #export (distribution distribution) (-> Distribution Text) - (`` (format (~~ (do-template [<title> <condition> <content>] + (`` (format (~~ (template [<title> <condition> <content>] [(if <condition> ($.block ($.section {#$.title <title> #$.content <content>})) @@ -141,7 +141,7 @@ (def: #export (commercial value) (-> Commercial Text) - (`` (format (~~ (do-template [<title> <condition> <content>] + (`` (format (~~ (template [<title> <condition> <content>] [(if <condition> ($.block ($.section {#$.title <title> #$.content <content>})) @@ -168,7 +168,7 @@ #.None [false ""])] - (`` (format (~~ (do-template [<condition> <title> <content>] + (`` (format (~~ (template [<condition> <title> <content>] [(if <condition> ($.block ($.section {#$.title <title> #$.content <content>})) @@ -210,7 +210,7 @@ (def: #export (miscellaneous identified?) (-> Bit Text) - (`` (format (~~ (do-template [<title> <condition> <content>] + (`` (format (~~ (template [<title> <condition> <content>] [(if <condition> ($.block ($.section {#$.title <title> #$.content <content>})) diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux index defca9477..23b1d575b 100644 --- a/stdlib/source/program/scriptum.lux +++ b/stdlib/source/program/scriptum.lux @@ -46,7 +46,7 @@ (Sequence Text) (|> 0 (sequence.iterate inc) (sequence;map parameter-type-name))) -(do-template [<name> <partition>] +(template [<name> <partition>] [(def: (<name> id) (-> Nat Bit) (<partition> id))] @@ -408,7 +408,7 @@ (list;fold (function.flip md.then) (md.heading/2 "Macros")))) -(do-template [<singular> <plural> <header>] +(template [<singular> <plural> <header>] [(def: (<singular> module type) (-> Text Type (Markdown Block)) (md.code (pprint-type (dec 0) "?" module type))) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index f830f8215..4caf29c32 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -280,17 +280,17 @@ false)))) )) -(template: (hypotenuse cat0 cat1) +(template: (quadrance cat0 cat1) (n/+ (n/* cat0 cat0) (n/* cat1 cat1))) -(def: template +(def: templates Test (do r.monad [cat0 r.nat cat1 r.nat] (_.test "Template application is a stand-in for the templated code." (n/= (n/+ (n/* cat0 cat0) (n/* cat1 cat1)) - (hypotenuse cat0 cat1))))) + (quadrance cat0 cat1))))) (def: cross-platform-support Test @@ -324,7 +324,7 @@ (..even-or-odd r.int i/even? i/odd?)))) (<| (_.context "Minimum and maximum.") (`` ($_ _.and - (~~ (do-template [<=> <lt> <min> <gt> <max> <gen> <context>] + (~~ (template [<=> <lt> <min> <gt> <max> <gen> <context>] [(<| (_.context <context>) (..minimum-and-maximum <gen> <=> [<lt> <min>] [<gt> <max>]))] @@ -335,7 +335,7 @@ ))))) (<| (_.context "Conversion.") (`` ($_ _.and - (~~ (do-template [<=> <forward> <backward> <gen>] + (~~ (template [<=> <forward> <backward> <gen>] [(<| (_.context (format (%name (name-of <forward>)) " " (%name (name-of <backward>)))) (..conversion <gen> <forward> <backward> <=>))] @@ -349,7 +349,7 @@ (<| (_.context "Prelude macros.") ..prelude-macros) (<| (_.context "Templates.") - ..template) + ..templates) (<| (_.context "Cross-platform support.") ..cross-platform-support) /cli.test diff --git a/stdlib/source/test/lux/compiler/default/phase/analysis/primitive.lux b/stdlib/source/test/lux/compiler/default/phase/analysis/primitive.lux index 0c716dd3f..e60a7c40c 100644 --- a/stdlib/source/test/lux/compiler/default/phase/analysis/primitive.lux +++ b/stdlib/source/test/lux/compiler/default/phase/analysis/primitive.lux @@ -40,7 +40,7 @@ (def: #export primitive (r.Random [Type Code]) (`` ($_ r.either - (~~ (do-template [<type> <code-wrapper> <value-gen>] + (~~ (template [<type> <code-wrapper> <value-gen>] [(r.and (r;wrap <type>) (r;map <code-wrapper> <value-gen>))] [Any code.tuple (r.list 0 ..unit)] @@ -80,7 +80,7 @@ #0))) (<| (times 100) (`` ($_ seq - (~~ (do-template [<desc> <type> <tag> <random> <constructor>] + (~~ (template [<desc> <type> <tag> <random> <constructor>] [(do @ [sample <random>] (test (format "Can analyse " <desc> ".") diff --git a/stdlib/source/test/lux/compiler/default/phase/analysis/procedure/common.lux b/stdlib/source/test/lux/compiler/default/phase/analysis/procedure/common.lux index 7d83f00c8..8b5308a5d 100644 --- a/stdlib/source/test/lux/compiler/default/phase/analysis/procedure/common.lux +++ b/stdlib/source/test/lux/compiler/default/phase/analysis/procedure/common.lux @@ -29,7 +29,7 @@ [/// ["_." primitive]]) -(do-template [<name> <success> <failure>] +(template [<name> <success> <failure>] [(def: (<name> procedure params output-type) (-> Text (List Code) Type Bit) (|> (scope.with-scope "" diff --git a/stdlib/source/test/lux/compiler/default/phase/analysis/reference.lux b/stdlib/source/test/lux/compiler/default/phase/analysis/reference.lux index 4cf1f9da0..a73e6c3cb 100644 --- a/stdlib/source/test/lux/compiler/default/phase/analysis/reference.lux +++ b/stdlib/source/test/lux/compiler/default/phase/analysis/reference.lux @@ -30,7 +30,7 @@ (type: Check (-> (Error Any) Bit)) -(do-template [<name> <on-success> <on-failure>] +(template [<name> <on-success> <on-failure>] [(def: <name> Check (|>> (case> (#error.Success _) diff --git a/stdlib/source/test/lux/compiler/default/phase/analysis/structure.lux b/stdlib/source/test/lux/compiler/default/phase/analysis/structure.lux index 6d575fd08..186c961e9 100644 --- a/stdlib/source/test/lux/compiler/default/phase/analysis/structure.lux +++ b/stdlib/source/test/lux/compiler/default/phase/analysis/structure.lux @@ -33,7 +33,7 @@ [// ["_." primitive]]) -(do-template [<name> <on-success> <on-error>] +(template [<name> <on-success> <on-error>] [(def: #export <name> (All [a] (-> (Operation a) Bit)) (|>> (phase.run _primitive.state) diff --git a/stdlib/source/test/lux/compiler/default/phase/synthesis/primitive.lux b/stdlib/source/test/lux/compiler/default/phase/synthesis/primitive.lux index 87dccc9f5..d6bb57789 100644 --- a/stdlib/source/test/lux/compiler/default/phase/synthesis/primitive.lux +++ b/stdlib/source/test/lux/compiler/default/phase/synthesis/primitive.lux @@ -77,7 +77,7 @@ |frac| r.frac |text| (r.unicode 5)] (`` ($_ seq - (~~ (do-template [<desc> <analysis> <synthesis> <sample>] + (~~ (template [<desc> <analysis> <synthesis> <sample>] [(test (format "Can synthesize " <desc> ".") (|> (#analysis.Primitive (<analysis> <sample>)) expression.phase diff --git a/stdlib/source/test/lux/control/interval.lux b/stdlib/source/test/lux/control/interval.lux index a32333ba1..7502f88bc 100644 --- a/stdlib/source/test/lux/control/interval.lux +++ b/stdlib/source/test/lux/control/interval.lux @@ -22,7 +22,7 @@ [control ["$." equivalence]]]]}) -(do-template [<name> <cmp>] +(template [<name> <cmp>] [(def: #export <name> (Random (Interval Nat)) (do r.monad diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index 091506613..cca103eac 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -18,7 +18,7 @@ (exception: oops) -(do-template [<name> <success> <error>] +(template [<name> <success> <error>] [(def: (<name> result) (All [a] (-> (Error a) Bit)) (case result @@ -34,7 +34,7 @@ (def: #export test Test - (<| (_.context (%name (name-of /.Region))) + (<| (_.context (%name (name-of /._))) (do r.monad [expected-clean-ups (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1))))] ($_ _.and diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux index ed69ddf7c..f3db0c6f7 100644 --- a/stdlib/source/test/lux/data/color.lux +++ b/stdlib/source/test/lux/data/color.lux @@ -40,7 +40,7 @@ (def: black (/.from-rgb [0 0 0])) (def: white (/.from-rgb [255 255 255])) -(do-template [<field>] +(template [<field>] [(def: (<field> color) (-> Color Frac) (let [[hue saturation luminance] (/.to-hsl color)] diff --git a/stdlib/source/test/lux/data/number/frac.lux b/stdlib/source/test/lux/data/number/frac.lux index 87b937a93..89ff72749 100644 --- a/stdlib/source/test/lux/data/number/frac.lux +++ b/stdlib/source/test/lux/data/number/frac.lux @@ -25,14 +25,14 @@ ($equivalence.spec /.equivalence gen-frac) ($order.spec /.order gen-frac) ($number.spec /.order /.number gen-frac) - (~~ (do-template [<monoid>] + (~~ (template [<monoid>] [(<| (_.context (%name (name-of <monoid>))) ($monoid.spec /.equivalence <monoid> gen-frac))] [/.addition] [/.multiplication] [/.minimum] [/.maximum] )) ## TODO: Uncomment ASAP - ## (~~ (do-template [<codec>] + ## (~~ (template [<codec>] ## [(<| (_.context (%name (name-of /.binary))) ## ($codec.spec /.equivalence <codec> gen-frac))] diff --git a/stdlib/source/test/lux/data/number/int.lux b/stdlib/source/test/lux/data/number/int.lux index b9ed4f856..e11685580 100644 --- a/stdlib/source/test/lux/data/number/int.lux +++ b/stdlib/source/test/lux/data/number/int.lux @@ -28,13 +28,13 @@ ($number.spec /.order /.number (:: r.monad map (i/% +1,000,000) r.int)) ($enum.spec /.enum r.int) ($interval.spec /.interval r.int) - (~~ (do-template [<monoid>] + (~~ (template [<monoid>] [(<| (_.context (%name (name-of <monoid>))) ($monoid.spec /.equivalence <monoid> r.int))] [/.addition] [/.multiplication] [/.minimum] [/.maximum] )) - (~~ (do-template [<codec>] + (~~ (template [<codec>] [(<| (_.context (%name (name-of /.binary))) ($codec.spec /.equivalence <codec> r.int))] diff --git a/stdlib/source/test/lux/data/number/nat.lux b/stdlib/source/test/lux/data/number/nat.lux index 17ee0503b..9616e9bd6 100644 --- a/stdlib/source/test/lux/data/number/nat.lux +++ b/stdlib/source/test/lux/data/number/nat.lux @@ -28,13 +28,13 @@ ($number.spec /.order /.number (:: r.monad map (n/% 1,000,000) r.nat)) ($enum.spec /.enum r.nat) ($interval.spec /.interval r.nat) - (~~ (do-template [<monoid>] + (~~ (template [<monoid>] [(<| (_.context (%name (name-of <monoid>))) ($monoid.spec /.equivalence <monoid> r.nat))] [/.addition] [/.multiplication] [/.minimum] [/.maximum] )) - (~~ (do-template [<codec>] + (~~ (template [<codec>] [(<| (_.context (%name (name-of /.binary))) ($codec.spec /.equivalence <codec> r.nat))] diff --git a/stdlib/source/test/lux/data/number/ratio.lux b/stdlib/source/test/lux/data/number/ratio.lux index 5b74956c4..c3c67c317 100644 --- a/stdlib/source/test/lux/data/number/ratio.lux +++ b/stdlib/source/test/lux/data/number/ratio.lux @@ -34,7 +34,7 @@ ($equivalence.spec /.equivalence ..ratio) ($order.spec /.order ..ratio) ($number.spec /.order /.number ..ratio) - (~~ (do-template [<monoid>] + (~~ (template [<monoid>] [(<| (_.context (%name (name-of <monoid>))) ($monoid.spec /.equivalence <monoid> ..ratio))] diff --git a/stdlib/source/test/lux/data/number/rev.lux b/stdlib/source/test/lux/data/number/rev.lux index dba639ae9..15b98ffe6 100644 --- a/stdlib/source/test/lux/data/number/rev.lux +++ b/stdlib/source/test/lux/data/number/rev.lux @@ -31,13 +31,13 @@ ($order.spec /.order r.rev) ($enum.spec /.enum r.rev) ($interval.spec /.interval r.rev) - (~~ (do-template [<monoid>] + (~~ (template [<monoid>] [(<| (_.context (%name (name-of <monoid>))) ($monoid.spec /.equivalence <monoid> r.rev))] [/.addition] [/.minimum] [/.maximum] )) - (~~ (do-template [<codec>] + (~~ (template [<codec>] [(<| (_.context (%name (name-of /.binary))) ($codec.spec /.equivalence <codec> r.rev))] diff --git a/stdlib/source/test/lux/host.jvm.lux b/stdlib/source/test/lux/host.jvm.lux index 20530d923..9bd0f5399 100644 --- a/stdlib/source/test/lux/host.jvm.lux +++ b/stdlib/source/test/lux/host.jvm.lux @@ -64,7 +64,7 @@ (do r.monad [sample r.int] (`` ($_ _.and - (~~ (do-template [<to> <from> <message>] + (~~ (template [<to> <from> <message>] [(_.test <message> (or (|> sample <to> <from> (i/= sample)) (let [capped-sample (|> sample <to> <from>)] diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index 5ec12e6e2..c400bf206 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -29,7 +29,7 @@ module (r.ascii/alpha 10) #let [name [module short]]] (`` ($_ _.and - (~~ (do-template [<desc> <code> <text>] + (~~ (template [<desc> <code> <text>] [(let [code <code>] (_.test (format "Can produce " <desc> " code node.") (and (text@= <text> (/.to-text code)) diff --git a/stdlib/source/test/lux/macro/syntax.lux b/stdlib/source/test/lux/macro/syntax.lux index e9f0428a1..60dd38b6e 100644 --- a/stdlib/source/test/lux/macro/syntax.lux +++ b/stdlib/source/test/lux/macro/syntax.lux @@ -69,7 +69,7 @@ (def: simple-values Test (`` ($_ _.and - (~~ (do-template [<assertion> <value> <ctor> <Equivalence> <get>] + (~~ (template [<assertion> <value> <ctor> <Equivalence> <get>] [(_.test <assertion> (and (equals? <Equivalence> <value> <get> (list (<ctor> <value>))) (found? (/.this? (<ctor> <value>)) (list (<ctor> <value>))) @@ -101,7 +101,7 @@ (def: complex-values Test (`` ($_ _.and - (~~ (do-template [<type> <parser> <ctor>] + (~~ (template [<type> <parser> <ctor>] [(_.test (format "Can parse " <type> " syntax.") (and (match [#1 +123] (p.run (list (<ctor> (list (code.bit #1) (code.int +123)))) diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index c74540bd9..e75268bf0 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -17,7 +17,7 @@ [// ["//" continuous]]]}) -(do-template [<name> <desc> <hash> <gen> <triangle> <lt> <lte> <gt> <gte>] +(template [<name> <desc> <hash> <gen> <triangle> <lt> <lte> <gt> <gte>] [(def: <name> Test (<| (_.context (%name (name-of <triangle>))) @@ -56,7 +56,7 @@ [rev-triangles "Rev" rev.hash r.rev /.triangle r/< r/<= r/> r/>=] ) -(do-template [<name> <desc> <hash> <gen> <trapezoid> <lt> <lte> <gt> <gte>] +(template [<name> <desc> <hash> <gen> <trapezoid> <lt> <lte> <gt> <gte>] [(def: <name> Test (<| (_.context (%name (name-of <trapezoid>))) diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 1fcc7e3e9..96478b077 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -96,7 +96,7 @@ #let [(^open "/@.") /.equivalence (^open "list@.") (list.equivalence /.equivalence)]] (`` ($_ _.and - (~~ (do-template [<desc> <ctor> <dtor> <unit>] + (~~ (template [<desc> <ctor> <dtor> <unit>] [(_.test (format "Can build and tear-down " <desc> " types.") (let [flat (|> members <ctor> <dtor>)] (or (list@= members flat) @@ -142,7 +142,7 @@ #1)))) #let [(^open "/@.") /.equivalence]] (`` ($_ _.and - (~~ (do-template [<desc> <ctor> <dtor>] + (~~ (template [<desc> <ctor> <dtor>] [(_.test (format "Can build and tear-down " <desc> " types.") (let [[flat-size flat-body] (|> extra (<ctor> size) <dtor>)] (and (n/= size flat-size) |