aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/macro
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/macro.lux48
-rw-r--r--stdlib/source/library/lux/macro/code.lux22
-rw-r--r--stdlib/source/library/lux/macro/local.lux4
-rw-r--r--stdlib/source/library/lux/macro/syntax.lux6
-rw-r--r--stdlib/source/library/lux/macro/syntax/declaration.lux8
-rw-r--r--stdlib/source/library/lux/macro/syntax/export.lux2
-rw-r--r--stdlib/source/library/lux/macro/syntax/input.lux6
-rw-r--r--stdlib/source/library/lux/macro/template.lux40
8 files changed, 68 insertions, 68 deletions
diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux
index c1b8db599..a0b263646 100644
--- a/stdlib/source/library/lux/macro.lux
+++ b/stdlib/source/library/lux/macro.lux
@@ -4,10 +4,10 @@
[abstract
["[0]" monad {"+" [do]}]]
[data
- ["[0]" text ("[1]\[0]" monoid)]
- ["[0]" name ("[1]\[0]" codec)]
+ ["[0]" text ("[1]#[0]" monoid)]
+ ["[0]" name ("[1]#[0]" codec)]
[collection
- ["[0]" list ("[1]\[0]" monoid monad)]]]
+ ["[0]" list ("[1]#[0]" monoid monad)]]]
[macro
["[0]" code]]
[math
@@ -29,10 +29,10 @@
((:as Macro' macro) args)
{.#None}
- (\ //.monad in (list syntax))))
+ (# //.monad in (list syntax))))
_
- (\ //.monad in (list syntax))))
+ (# //.monad in (list syntax))))
(def: .public (expansion syntax)
(-> Code (Meta (List Code)))
@@ -46,13 +46,13 @@
[top_level_expansion ((:as Macro' macro) args)]
(|> top_level_expansion
(monad.each //.monad expansion)
- (\ ! each list\conjoint)))
+ (# ! each list#conjoint)))
{.#None}
- (\ //.monad in (list syntax))))
+ (# //.monad in (list syntax))))
_
- (\ //.monad in (list syntax))))
+ (# //.monad in (list syntax))))
(def: .public (full_expansion syntax)
(-> Code (Meta (List Code)))
@@ -65,62 +65,62 @@
(do //.monad
[expansion ((:as Macro' macro) args)
expansion' (monad.each //.monad full_expansion expansion)]
- (in (list\conjoint expansion')))
+ (in (list#conjoint expansion')))
{.#None}
(do //.monad
[parts' (monad.each //.monad full_expansion (list& (code.identifier name) args))]
- (in (list (code.form (list\conjoint parts')))))))
+ (in (list (code.form (list#conjoint parts')))))))
[_ {.#Form {.#Item [harg targs]}}]
(do //.monad
[harg+ (full_expansion harg)
targs+ (monad.each //.monad full_expansion targs)]
- (in (list (code.form (list\composite harg+ (list\conjoint (: (List (List Code)) targs+)))))))
+ (in (list (code.form (list#composite harg+ (list#conjoint (: (List (List Code)) targs+)))))))
[_ {.#Variant members}]
(do //.monad
[members' (monad.each //.monad full_expansion members)]
- (in (list (code.variant (list\conjoint members')))))
+ (in (list (code.variant (list#conjoint members')))))
[_ {.#Tuple members}]
(do //.monad
[members' (monad.each //.monad full_expansion members)]
- (in (list (code.tuple (list\conjoint members')))))
+ (in (list (code.tuple (list#conjoint members')))))
_
- (\ //.monad in (list syntax))))
+ (# //.monad in (list syntax))))
(def: .public (identifier prefix)
(-> Text (Meta Code))
(do //.monad
[id //.seed]
(in (|> id
- (\ nat.decimal encoded)
- ($_ text\composite "__gensym__" prefix)
+ (# nat.decimal encoded)
+ ($_ text#composite "__gensym__" prefix)
[""] code.identifier))))
(def: (local_identifier ast)
(-> Code (Meta Text))
(case ast
[_ {.#Identifier [_ name]}]
- (\ //.monad in name)
+ (# //.monad in name)
_
- (//.failure (text\composite "Code is not a local identifier: " (code.format ast)))))
+ (//.failure (text#composite "Code is not a local identifier: " (code.format ast)))))
(def: .public wrong_syntax_error
(-> Name Text)
- (|>> name\encoded
- (text.prefix (text\composite "Wrong syntax for " text.\''))
- (text.suffix (text\composite text.\'' "."))))
+ (|>> name#encoded
+ (text.prefix (text#composite "Wrong syntax for " text.\''))
+ (text.suffix (text#composite text.\'' "."))))
(macro: .public (with_identifiers tokens)
(case tokens
(^ (list [_ {.#Tuple identifiers}] body))
(do [! //.monad]
[identifier_names (monad.each ! ..local_identifier identifiers)
- .let [identifier_defs (list\conjoint (list\each (: (-> Text (List Code))
+ .let [identifier_defs (list#conjoint (list#each (: (-> Text (List Code))
(function (_ name) (list (code.identifier ["" name]) (` (..identifier (~ (code.text name)))))))
identifier_names))]]
(in (list (` ((~! do) (~! //.monad)
@@ -161,8 +161,8 @@
(do //.monad
[location //.location
output (<func> token)
- .let [_ ("lux io log" ($_ text\composite (name\encoded macro_name) " " (location.format location)))
- _ (list\each (|>> code.format "lux io log")
+ .let [_ ("lux io log" ($_ text#composite (name#encoded macro_name) " " (location.format location)))
+ _ (list#each (|>> code.format "lux io log")
output)
_ ("lux io log" "")]]
(in (if omit?
diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux
index b7c709482..2d5ffb59a 100644
--- a/stdlib/source/library/lux/macro/code.lux
+++ b/stdlib/source/library/lux/macro/code.lux
@@ -7,9 +7,9 @@
["[0]" product]
["[0]" bit]
["[0]" name]
- ["[0]" text ("[1]\[0]" monoid equivalence)]
+ ["[0]" text ("[1]#[0]" monoid equivalence)]
[collection
- ["[0]" list ("[1]\[0]" functor mix)]]]
+ ["[0]" list ("[1]#[0]" functor mix)]]]
[math
[number
["[0]" nat]
@@ -65,7 +65,7 @@
(case [x y]
(^template [<tag> <eq>]
[[[_ {<tag> x'}] [_ {<tag> y'}]]
- (\ <eq> = x' y')])
+ (# <eq> = x' y')])
([.#Bit bit.equivalence]
[.#Nat nat.equivalence]
[.#Int int.equivalence]
@@ -76,7 +76,7 @@
(^template [<tag>]
[[[_ {<tag> xs'}] [_ {<tag> ys'}]]
- (\ (list.equivalence =) = xs' ys')])
+ (# (list.equivalence =) = xs' ys')])
([.#Form]
[.#Variant]
[.#Tuple])
@@ -89,7 +89,7 @@
(case ast
(^template [<tag> <struct>]
[[_ {<tag> value}]
- (\ <struct> encoded value)])
+ (# <struct> encoded value)])
([.#Bit bit.codec]
[.#Nat nat.decimal]
[.#Int int.decimal]
@@ -102,13 +102,13 @@
(^template [<tag> <open> <close>]
[[_ {<tag> members}]
- ($_ text\composite
+ ($_ text#composite
<open>
- (list\mix (function (_ next prev)
+ (list#mix (function (_ next prev)
(let [next (format next)]
- (if (text\= "" prev)
+ (if (text#= "" prev)
next
- ($_ text\composite prev " " next))))
+ ($_ text#composite prev " " next))))
""
members)
<close>)])
@@ -119,12 +119,12 @@
(def: .public (replaced original substitute ast)
(-> Code Code Code Code)
- (if (\ ..equivalence = original ast)
+ (if (# ..equivalence = original ast)
substitute
(case ast
(^template [<tag>]
[[location {<tag> parts}]
- [location {<tag> (list\each (replaced original substitute) parts)}]])
+ [location {<tag> (list#each (replaced original substitute) parts)}]])
([.#Form]
[.#Variant]
[.#Tuple])
diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux
index 7fd34c7b3..03bd0c70c 100644
--- a/stdlib/source/library/lux/macro/local.lux
+++ b/stdlib/source/library/lux/macro/local.lux
@@ -11,7 +11,7 @@
["[0]" product]
["[0]" text]
[collection
- ["[0]" list ("[1]\[0]" functor)]
+ ["[0]" list ("[1]#[0]" functor)]
[dictionary
["[0]" plist {"+" [PList]}]]]]]]
["[0]" //
@@ -103,5 +103,5 @@
seed meta.seed
g!pop (//.identifier "pop")
_ (let [g!pop (: Name ["" (//code.format g!pop)])]
- (..push_one [g!pop (..pop_all (list\each product.left macros) g!pop)]))]
+ (..push_one [g!pop (..pop_all (list#each product.left macros) g!pop)]))]
(in (` ((~ g!pop))))))
diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux
index dcf042ead..7a00f0bc7 100644
--- a/stdlib/source/library/lux/macro/syntax.lux
+++ b/stdlib/source/library/lux/macro/syntax.lux
@@ -11,9 +11,9 @@
["<>" parser
["</>" code {"+" [Parser]}]]]
[data
- ["[0]" text ("[1]\[0]" monoid)]
+ ["[0]" text ("[1]#[0]" monoid)]
[collection
- ["[0]" list ("[1]\[0]" functor)]]]
+ ["[0]" list]]]
[math
[number
["[0]" nat]
@@ -33,7 +33,7 @@
{try.#Success [tokens output]}
{try.#Failure error}
- {try.#Failure ($_ text\composite
+ {try.#Failure ($_ text#composite
"Failed to parse: " (code.format binding) text.new_line
error)})))
diff --git a/stdlib/source/library/lux/macro/syntax/declaration.lux b/stdlib/source/library/lux/macro/syntax/declaration.lux
index bb7abe7b0..706fc6fdb 100644
--- a/stdlib/source/library/lux/macro/syntax/declaration.lux
+++ b/stdlib/source/library/lux/macro/syntax/declaration.lux
@@ -4,13 +4,13 @@
[abstract
[equivalence {"+" [Equivalence]}]]
[control
- ["<>" parser ("[1]\[0]" monad)
+ ["<>" parser ("[1]#[0]" monad)
["<[0]>" code {"+" [Parser]}]]]
[data
["[0]" product]
["[0]" text]
[collection
- ["[0]" list ("[1]\[0]" functor)]]]
+ ["[0]" list ("[1]#[0]" functor)]]]
[macro
["[0]" code]]]])
@@ -29,7 +29,7 @@
(def: .public parser
(Parser Declaration)
(<>.either (<>.and <code>.local_identifier
- (<>\in (list)))
+ (<>#in (list)))
(<code>.form (<>.and <code>.local_identifier
(<>.some <code>.local_identifier)))))
@@ -41,4 +41,4 @@
g!name
arguments
- (` ((~ g!name) (~+ (list\each code.local_identifier arguments)))))))
+ (` ((~ g!name) (~+ (list#each code.local_identifier arguments)))))))
diff --git a/stdlib/source/library/lux/macro/syntax/export.lux b/stdlib/source/library/lux/macro/syntax/export.lux
index 6fe7afd4b..e7f89cd42 100644
--- a/stdlib/source/library/lux/macro/syntax/export.lux
+++ b/stdlib/source/library/lux/macro/syntax/export.lux
@@ -4,7 +4,7 @@
[abstract
[monad {"+" [do]}]]
[control
- ["<>" parser ("[1]\[0]" monad)
+ ["<>" parser
["<[0]>" code {"+" [Parser]}]]]]])
(def: .public default_policy
diff --git a/stdlib/source/library/lux/macro/syntax/input.lux b/stdlib/source/library/lux/macro/syntax/input.lux
index 51aa4b5fe..006cb0418 100644
--- a/stdlib/source/library/lux/macro/syntax/input.lux
+++ b/stdlib/source/library/lux/macro/syntax/input.lux
@@ -9,7 +9,7 @@
[data
["[0]" product]
[collection
- ["[0]" list ("[1]\[0]" monad)]]]
+ ["[0]" list ("[1]#[0]" monad)]]]
[macro
["[0]" code]]]])
@@ -27,10 +27,10 @@
(def: .public format
(-> (List Input) Code)
- (|>> (list\each (function (_ value)
+ (|>> (list#each (function (_ value)
(list (value@ #binding value)
(value@ #type value))))
- list\conjoint
+ list#conjoint
code.tuple))
(def: .public parser
diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux
index 6a5136d15..1476d0f58 100644
--- a/stdlib/source/library/lux/macro/template.lux
+++ b/stdlib/source/library/lux/macro/template.lux
@@ -7,20 +7,20 @@
[control
["[0]" try {"+" [Try]}]
["[0]" exception {"+" [exception:]}]
- ["<>" parser ("[1]\[0]" functor)
+ ["<>" parser ("[1]#[0]" functor)
["<[0]>" code {"+" [Parser]}]]]
[data
- ["[0]" bit ("[1]\[0]" codec)]
+ ["[0]" bit ("[1]#[0]" codec)]
["[0]" text]
[collection
- ["[0]" list ("[1]\[0]" monad)]
+ ["[0]" list ("[1]#[0]" monad)]
["[0]" dictionary {"+" [Dictionary]}]]]
[math
[number
- ["[0]" nat ("[1]\[0]" decimal)]
- ["[0]" int ("[1]\[0]" decimal)]
- ["[0]" rev ("[1]\[0]" decimal)]
- ["[0]" frac ("[1]\[0]" decimal)]]]]]
+ ["[0]" nat ("[1]#[0]" decimal)]
+ ["[0]" int ("[1]#[0]" decimal)]
+ ["[0]" rev ("[1]#[0]" decimal)]
+ ["[0]" frac ("[1]#[0]" decimal)]]]]]
["[0]" //
[syntax {"+" [syntax:]}]
["[0]" code]
@@ -36,12 +36,12 @@
body <code>.any])
(do [! meta.monad]
[g!locals (|> locals
- (list\each //.identifier)
+ (list#each //.identifier)
(monad.all !))]
(in (list (` (.with_expansions [(~+ (|> (list.zipped/2 locals g!locals)
- (list\each (function (_ [name identifier])
+ (list#each (function (_ [name identifier])
(list (code.local_identifier name) (as_is identifier))))
- list\conjoint))]
+ list#conjoint))]
(~ body)))))))
(def: (name_side module_side? parser)
@@ -63,11 +63,11 @@
full_identifier
(<>.either <code>.local_identifier
full_identifier))
- (<>\each bit\encoded <code>.bit)
- (<>\each nat\encoded <code>.nat)
- (<>\each int\encoded <code>.int)
- (<>\each rev\encoded <code>.rev)
- (<>\each frac\encoded <code>.frac)
+ (<>#each bit#encoded <code>.bit)
+ (<>#each nat#encoded <code>.nat)
+ (<>#each int#encoded <code>.int)
+ (<>#each rev#encoded <code>.rev)
+ (<>#each frac#encoded <code>.frac)
)))
(def: (part module_side?)
@@ -107,7 +107,7 @@
(^template [<tag>]
[[meta {<tag> elems}]
- [meta {<tag> (list\each (applied env) elems)}]])
+ [meta {<tag> (list#each (applied env) elems)}]])
([.#Form]
[.#Variant]
[.#Tuple])
@@ -124,8 +124,8 @@
(exception: .public (irregular_arguments [expected Nat
actual Nat])
(exception.report
- ["Expected" (\ nat.decimal encoded expected)]
- ["Actual" (\ nat.decimal encoded actual)]))
+ ["Expected" (# nat.decimal encoded expected)]
+ ["Actual" (# nat.decimal encoded actual)]))
(def: (macro (^slots [#parameters #template]))
(-> Local Macro)
@@ -137,7 +137,7 @@
(.let [environment (: Environment
(|> (list.zipped/2 #parameters inputs)
(dictionary.of_list text.hash)))]
- {.#Right [compiler (list\each (..applied environment) #template)]})
+ {.#Right [compiler (list#each (..applied environment) #template)]})
(exception.except ..irregular_arguments [parameters_amount inputs_amount]))))))
(def: local
@@ -162,7 +162,7 @@
{.#Some _}
true)]}))
- g!pop (local.push (list\each (function (_ local)
+ g!pop (local.push (list#each (function (_ local)
[[here_name (value@ #name local)]
(..macro local)])
locals))]