aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation
diff options
context:
space:
mode:
authorEduardo Julian2022-07-26 18:08:04 -0400
committerEduardo Julian2022-07-26 18:08:04 -0400
commitfeacd79496ae9c76492d5a12d30b78724b642654 (patch)
treea85708d1bfe43a98ba62b7f8589dcc95a71f86f5 /stdlib/source/documentation
parentdec796a9838e39148c007f3f3d360964d7cb68de (diff)
Made inlined functions into first-class macros.
Diffstat (limited to 'stdlib/source/documentation')
-rw-r--r--stdlib/source/documentation/lux.lux2
-rw-r--r--stdlib/source/documentation/lux/ffi.js.lux10
-rw-r--r--stdlib/source/documentation/lux/ffi.py.lux8
-rw-r--r--stdlib/source/documentation/lux/meta/macro.lux101
4 files changed, 61 insertions, 60 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux
index 947fec8a1..1ffc31a13 100644
--- a/stdlib/source/documentation/lux.lux
+++ b/stdlib/source/documentation/lux.lux
@@ -893,6 +893,6 @@
/test.documentation
/world.documentation])))
-(def _
+(.def _
(program inputs
(io.io (debug.log! ($.markdown ..documentation)))))
diff --git a/stdlib/source/documentation/lux/ffi.js.lux b/stdlib/source/documentation/lux/ffi.js.lux
index cc4a6a8b2..a0e8edaef 100644
--- a/stdlib/source/documentation/lux/ffi.js.lux
+++ b/stdlib/source/documentation/lux/ffi.js.lux
@@ -54,14 +54,14 @@
[(= "function"
(type_of (function (_ value) value)))])
- ($.definition /.constant
+ ($.definition /.global
"Allows using definitions from the JavaScript host platform."
- [(constant .Frac [Math PI])])
+ [(global .Frac [Math PI])])
- ($.definition /.closure
+ ($.definition /.function
(format "Allows defining closures/anonymous-functions in the form that JavaScript expects."
\n "This is useful for adapting Lux functions for usage by JavaScript code.")
[(is /.Function
- (closure [left right]
- (do_something (as Foo left) (as Bar right))))])]
+ (function [left right]
+ (do_something (as Foo left) (as Bar right))))])]
[]))
diff --git a/stdlib/source/documentation/lux/ffi.py.lux b/stdlib/source/documentation/lux/ffi.py.lux
index 2701c47a1..d2da39eff 100644
--- a/stdlib/source/documentation/lux/ffi.py.lux
+++ b/stdlib/source/documentation/lux/ffi.py.lux
@@ -45,11 +45,11 @@
("static" getsize [String] "io" "try" Integer)
("static" getmtime [String] "io" "try" Float))])
- ($.definition /.lambda
+ ($.definition /.function
(format "Allows defining closures/anonymous-functions in the form that Python expects."
\n "This is useful for adapting Lux functions for usage by Python code.")
[(is ..Function
- (lambda [left right]
- (do_something (as Foo left)
- (as Bar right))))])]
+ (function [left right]
+ (do_something (as Foo left)
+ (as Bar right))))])]
[]))
diff --git a/stdlib/source/documentation/lux/meta/macro.lux b/stdlib/source/documentation/lux/meta/macro.lux
index 6e2557f3f..204efdd8c 100644
--- a/stdlib/source/documentation/lux/meta/macro.lux
+++ b/stdlib/source/documentation/lux/meta/macro.lux
@@ -18,19 +18,19 @@
(.List $.Module)
($.module /._
""
- [($.definition /.single_expansion
- (format "Given code that requires applying a macro, does it once and returns the result."
- \n "Otherwise, returns the code as-is.")
- [(single_expansion syntax)])
+ [... ($.definition /.single_expansion
+ ... (format "Given code that requires applying a macro, does it once and returns the result."
+ ... \n "Otherwise, returns the code as-is.")
+ ... [(single_expansion syntax)])
- ($.definition /.expansion
- (format "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left."
- \n "Otherwise, returns the code as-is.")
- [(expansion syntax)])
+ ... ($.definition /.expansion
+ ... (format "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left."
+ ... \n "Otherwise, returns the code as-is.")
+ ... [(expansion syntax)])
- ($.definition /.full_expansion
- "Expands all macro-calls everywhere recursively, until only primitive/base code remains."
- [(full_expansion syntax)])
+ ... ($.definition /.full_expansion
+ ... "Expands all macro-calls everywhere recursively, until only primitive/base code remains."
+ ... [(full_expansion syntax)])
($.definition /.symbol
(format "Generates a unique name as a Code node (ready to be used in code templates)."
@@ -52,48 +52,49 @@
(, g!_) ("jvm monitorexit" (, g!lock))]
(, g!body))))))))])
- ($.definition /.one_expansion
- "Works just like expand, except that it ensures that the output is a single Code token."
- [(one_expansion token)])
+ ... ($.definition /.one_expansion
+ ... "Works just like expand, except that it ensures that the output is a single Code token."
+ ... [(one_expansion token)])
- ($.definition /.log_single_expansion!
- (format "Performs a macro-expansion and logs the resulting code."
- \n "You can either use the resulting code, or omit them."
- \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
- [(log_single_expansion!
- (def (foo bar baz)
- (-> Int Int Int)
- (int.+ bar baz)))
- (log_single_expansion! "omit"
- (def (foo bar baz)
- (-> Int Int Int)
- (int.+ bar baz)))])
+ ... ($.definition /.log_single_expansion!
+ ... (format "Performs a macro-expansion and logs the resulting code."
+ ... \n "You can either use the resulting code, or omit them."
+ ... \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
+ ... [(log_single_expansion!
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz)))
+ ... (log_single_expansion! "omit"
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz)))])
- ($.definition /.log_expansion!
- (format "Performs a macro-expansion and logs the resulting code."
- \n "You can either use the resulting code, or omit them."
- \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
- [(log_expansion!
- (def (foo bar baz)
- (-> Int Int Int)
- (int.+ bar baz)))
- (log_expansion! "omit"
- (def (foo bar baz)
- (-> Int Int Int)
- (int.+ bar baz)))])
+ ... ($.definition /.log_expansion!
+ ... (format "Performs a macro-expansion and logs the resulting code."
+ ... \n "You can either use the resulting code, or omit them."
+ ... \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
+ ... [(log_expansion!
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz)))
+ ... (log_expansion! "omit"
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz)))])
- ($.definition /.log_full_expansion!
- (format "Performs a macro-expansion and logs the resulting code."
- \n "You can either use the resulting code, or omit them."
- \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
- [(log_full_expansion!
- (def (foo bar baz)
- (-> Int Int Int)
- (int.+ bar baz)))
- (log_full_expansion! "omit"
- (def (foo bar baz)
- (-> Int Int Int)
- (int.+ bar baz)))])]
+ ... ($.definition /.log_full_expansion!
+ ... (format "Performs a macro-expansion and logs the resulting code."
+ ... \n "You can either use the resulting code, or omit them."
+ ... \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
+ ... [(log_full_expansion!
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz)))
+ ... (log_full_expansion! "omit"
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz)))])
+ ]
[/local.documentation
/syntax.documentation
/template.documentation]))