aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/macro/code.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-11-17 20:23:53 -0400
committerEduardo Julian2020-11-17 20:23:53 -0400
commitd89d837de3475b75587a4293e094d755d2cd4626 (patch)
tree0975a487d987cfe855c4f6e87f05478346913a16 /stdlib/source/lux/macro/code.lux
parent2e5852abb1ac0ae5abdd8709238aca447f62520e (diff)
Made the syntax of ^template more consistent.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/macro/code.lux60
1 files changed, 30 insertions, 30 deletions
diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux
index e2d528dad..839084537 100644
--- a/stdlib/source/lux/macro/code.lux
+++ b/stdlib/source/lux/macro/code.lux
@@ -10,9 +10,9 @@
["." int]
["." rev]
["." frac]]
- ["." text ("#//." monoid equivalence)]
+ ["." text ("#\." monoid equivalence)]
[collection
- ["." list ("#//." functor fold)]]]
+ ["." list ("#\." functor fold)]]]
[meta
["." location]]])
@@ -65,8 +65,8 @@
(def: (= x y)
(case [x y]
(^template [<tag> <eq>]
- [[_ (<tag> x')] [_ (<tag> y')]]
- (:: <eq> = x' y'))
+ [[[_ (<tag> x')] [_ (<tag> y')]]
+ (:: <eq> = x' y')])
([#.Bit bit.equivalence]
[#.Nat nat.equivalence]
[#.Int int.equivalence]
@@ -77,8 +77,8 @@
[#.Tag name.equivalence])
(^template [<tag>]
- [[_ (<tag> xs')] [_ (<tag> ys')]]
- (:: (list.equivalence =) = xs' ys'))
+ [[[_ (<tag> xs')] [_ (<tag> ys')]]
+ (:: (list.equivalence =) = xs' ys')])
([#.Form]
[#.Tuple])
@@ -93,8 +93,8 @@
(-> Code Text)
(case ast
(^template [<tag> <struct>]
- [_ (<tag> value)]
- (:: <struct> encode value))
+ [[_ (<tag> value)]
+ (:: <struct> encode value)])
([#.Bit bit.codec]
[#.Nat nat.decimal]
[#.Int int.decimal]
@@ -106,33 +106,33 @@
(text.encode value)
[_ (#.Tag name)]
- (text//compose "#" (:: name.codec encode name))
+ (text\compose "#" (:: name.codec encode name))
(^template [<tag> <open> <close>]
- [_ (<tag> members)]
- ($_ text//compose
- <open>
- (list//fold (function (_ next prev)
+ [[_ (<tag> members)]
+ ($_ text\compose
+ <open>
+ (list\fold (function (_ next prev)
(let [next (format next)]
- (if (text//= "" prev)
+ (if (text\= "" prev)
next
- ($_ text//compose prev " " next))))
+ ($_ text\compose prev " " next))))
""
members)
- <close>))
+ <close>)])
([#.Form "(" ")"]
[#.Tuple "[" "]"])
[_ (#.Record pairs)]
- ($_ text//compose
+ ($_ text\compose
"{"
- (list//fold (function (_ [left right] prev)
- (let [next ($_ text//compose (format left) " " (format right))]
- (if (text//= "" prev)
- next
- ($_ text//compose prev " " next))))
- ""
- pairs)
+ (list\fold (function (_ [left right] prev)
+ (let [next ($_ text\compose (format left) " " (format right))]
+ (if (text\= "" prev)
+ next
+ ($_ text\compose prev " " next))))
+ ""
+ pairs)
"}")
))
@@ -143,16 +143,16 @@
substitute
(case ast
(^template [<tag>]
- [location (<tag> parts)]
- [location (<tag> (list//map (replace original substitute) parts))])
+ [[location (<tag> parts)]
+ [location (<tag> (list\map (replace original substitute) parts))]])
([#.Form]
[#.Tuple])
[location (#.Record parts)]
- [location (#.Record (list//map (function (_ [left right])
- [(replace original substitute left)
- (replace original substitute right)])
- parts))]
+ [location (#.Record (list\map (function (_ [left right])
+ [(replace original substitute left)
+ (replace original substitute right)])
+ parts))]
_
ast)))