diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/macro/code.lux | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux index 79eebb5df..5de323722 100644 --- a/stdlib/source/library/lux/macro/code.lux +++ b/stdlib/source/library/lux/macro/code.lux @@ -9,7 +9,7 @@ ["." name] ["." text ("#\." monoid equivalence)] [collection - ["." list ("#\." functor fold)]]] + ["." list ("#\." functor mix)]]] [math [number ["." nat] @@ -96,7 +96,7 @@ (case ast (^template [<tag> <struct>] [[_ (<tag> value)] - (\ <struct> encode value)]) + (\ <struct> encoded value)]) ([#.Bit bit.codec] [#.Nat nat.decimal] [#.Int int.decimal] @@ -108,19 +108,19 @@ (text.format value) [_ (#.Tag name)] - (text\compose "#" (\ name.codec encode name)) + (text\compose "#" (\ name.codec encoded name)) (^template [<tag> <open> <close>] [[_ (<tag> members)] ($_ text\compose <open> - (list\fold (function (_ next prev) - (let [next (format next)] - (if (text\= "" prev) - next - ($_ text\compose prev " " next)))) - "" - members) + (list\mix (function (_ next prev) + (let [next (format next)] + (if (text\= "" prev) + next + ($_ text\compose prev " " next)))) + "" + members) <close>)]) ([#.Form "(" ")"] [#.Tuple "[" "]"]) @@ -128,18 +128,17 @@ [_ (#.Record pairs)] ($_ 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\mix (function (_ [left right] prev) + (let [next ($_ text\compose (format left) " " (format right))] + (if (text\= "" prev) + next + ($_ text\compose prev " " next)))) + "" + pairs) "}") )) (def: .public (replaced original substitute ast) - {#.doc "Replaces all code that looks like the 'original' with the 'substitute'."} (-> Code Code Code Code) (if (\ ..equivalence = original ast) substitute |