aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorEduardo Julian2021-05-30 11:13:56 -0400
committerEduardo Julian2021-05-30 11:13:56 -0400
commit6154b0d4a09b96c9092309917a0379d491181c79 (patch)
treee1e662343c92b04870da90ed0a3fdd863efc21a2 /stdlib
parent0415afc6a1cac2cbcb5525d4102021a598bb39cf (diff)
lux/macro/template.with can now produce multiple outputs.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/debug.lux2
-rw-r--r--stdlib/source/lux/macro/template.lux6
-rw-r--r--stdlib/source/test/lux/data/text/escape.lux10
-rw-r--r--stdlib/source/test/lux/macro/template.lux10
4 files changed, 14 insertions, 14 deletions
diff --git a/stdlib/source/lux/debug.lux b/stdlib/source/lux/debug.lux
index a076942bc..912cc38d7 100644
--- a/stdlib/source/lux/debug.lux
+++ b/stdlib/source/lux/debug.lux
@@ -258,7 +258,7 @@
@.ruby
(template.with [(class_of <literal>)
- (Object::type (:coerce ..Object <literal>))]
+ [(Object::type (:coerce ..Object <literal>))]]
(let [value_class (Object::type (:coerce ..Object value))]
(`` (cond (~~ (template [<literal> <type> <format>]
[(is? (class_of <literal>) value_class)
diff --git a/stdlib/source/lux/macro/template.lux b/stdlib/source/lux/macro/template.lux
index f7094f25f..a76b1d989 100644
--- a/stdlib/source/lux/macro/template.lux
+++ b/stdlib/source/lux/macro/template.lux
@@ -129,7 +129,7 @@
(type: Local
{#name Text
#parameters (List Text)
- #template Code})
+ #template (List Code)})
(exception: #export (irregular_arguments {expected Nat} {actual Nat})
(exception.report
@@ -145,7 +145,7 @@
(let [environment (: Environment
(|> (list.zip/2 parameters inputs)
(dictionary.from_list text.hash)))]
- (#.Right [compiler (list (..apply environment template))]))
+ (#.Right [compiler (list\map (..apply environment) template)]))
(exception.throw ..irregular_arguments [parameters_count inputs_count])))))
(def: local
@@ -153,7 +153,7 @@
(do <>.monad
[[name parameters] (<code>.form (<>.and <code>.local_identifier
(<>.many <code>.local_identifier)))
- template <code>.any]
+ template (<code>.tuple (<>.some <code>.any))]
(wrap {#name name
#parameters parameters
#template template})))
diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux
index de8e77510..e58413ac6 100644
--- a/stdlib/source/test/lux/data/text/escape.lux
+++ b/stdlib/source/test/lux/data/text/escape.lux
@@ -142,12 +142,12 @@
(#try.Success _) false))))]
(_.cover [/.invalid_unicode_escape]
(template.with [(!invalid <code>)
- (case (/.un_escape (format "\u" <code>))
- (#try.Success _)
- false
+ [(case (/.un_escape (format "\u" <code>))
+ (#try.Success _)
+ false
- (#try.Failure error)
- (exception.match? /.invalid_unicode_escape error))]
+ (#try.Failure error)
+ (exception.match? /.invalid_unicode_escape error))]]
(and (!invalid (\ n.hex encode too_short))
(!invalid code)))))
(_.cover [/.escaped]
diff --git a/stdlib/source/test/lux/macro/template.lux b/stdlib/source/test/lux/macro/template.lux
index 9032453c5..8f85ff3ea 100644
--- a/stdlib/source/test/lux/macro/template.lux
+++ b/stdlib/source/test/lux/macro/template.lux
@@ -20,7 +20,7 @@
["." /]})
(/.with [(!pow/2 <scalar>)
- (nat.* <scalar> <scalar>)]
+ [(nat.* <scalar> <scalar>)]]
(def: pow/2
(-> Nat Nat)
(|>> !pow/2)))
@@ -88,10 +88,10 @@
(..pow/2 scalar))]
(and can_use_with_statements!
(/.with [(pow/3 <scalar>)
- ($_ nat.* <scalar> <scalar> <scalar>)
+ [($_ nat.* <scalar> <scalar> <scalar>)]
(pow/9 <scalar>)
- (pow/3 (pow/3 <scalar>))]
+ [(pow/3 (pow/3 <scalar>))]]
(let [can_use_with_expressions!
(nat.= ($_ nat.* scalar scalar scalar)
(pow/3 scalar))
@@ -114,13 +114,13 @@
))))
(_.cover [/.irregular_arguments]
(/.with [(arity/3 <0> <1> <2>)
- ""]
+ [""]]
(exception.match? /.irregular_arguments
(macro_error (arity/3 "a" "b")))))
(_.cover [/.cannot_shadow_definition]
(exception.match? /.cannot_shadow_definition
(macro_error (/.with [(macro_error <0> <1> <2>)
- ""]
+ [""]]
""))))
)))
))