diff options
34 files changed, 221 insertions, 356 deletions
diff --git a/documentation/bookmark/compilation.md b/documentation/bookmark/compilation.md index ddd165e6e..2e8b82c55 100644 --- a/documentation/bookmark/compilation.md +++ b/documentation/bookmark/compilation.md @@ -6,3 +6,7 @@ 1. [Queries: demand-driven compilation](https://github.com/rust-lang/rustc-guide/blob/master/src/query.md) +# Reference + +1. [William J Bowman: Compilation as Multi Language Semantics](https://www.youtube.com/watch?v=RfVhUPkAEKo) + diff --git a/lux-python/project.lux b/lux-python/project.lux index 57672fdea..118bc95b2 100644 --- a/lux-python/project.lux +++ b/lux-python/project.lux @@ -1,8 +1,8 @@ -{"" +["" [#identity ["com.github.luxlang" "lux-python" "0.6.0-SNAPSHOT"] - #deploy_repositories {"snapshots" "https://oss.sonatype.org/content/repositories/snapshots/" - "releases" "https://oss.sonatype.org/service/local/staging/deploy/maven2/"} + #deploy_repositories ["snapshots" "https://oss.sonatype.org/content/repositories/snapshots/" + "releases" "https://oss.sonatype.org/service/local/staging/deploy/maven2/"] #repositories ["https://oss.sonatype.org/content/repositories/snapshots/" "https://oss.sonatype.org/service/local/staging/deploy/maven2/"] @@ -11,4 +11,4 @@ #dependencies [["com.github.luxlang" "stdlib" "0.6.0-SNAPSHOT" "tar"] ["org.python" "jython-standalone" "2.7.2" "jar"]] - #program "program"]} + #program "program"]] diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux index 553b07499..34f527aed 100644 --- a/lux-python/source/program.lux +++ b/lux-python/source/program.lux @@ -280,7 +280,14 @@ (..read output)))) execute! (: (-> (_.Statement Any) (Try Any)) (function (execute! input) - (org/python/util/PythonInterpreter::exec (_.code input) interpreter)))] + (case (org/python/util/PythonInterpreter::exec (_.code input) interpreter) + (#try.Failure error) + (if (text.contains? "maximum recursion depth exceeded" error) + (execute! input) + (#try.Failure error)) + + output + output)))] (: (Host (_.Expression Any) (_.Statement Any)) (implementation (def: evaluate! evaluate!) @@ -370,7 +377,7 @@ {keywords [java/lang/String]}) org/python/core/PyObject (try.trusted - (case (array.list inputs) + (case (array.list #.None inputs) (^ (list)) (\ try.monad in (host_phase (list) phase)) diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux index b72716a3a..104f59381 100644 --- a/stdlib/source/documentation/lux/control/concatenative.lux +++ b/stdlib/source/documentation/lux/control/concatenative.lux @@ -56,11 +56,9 @@ (template [<arity>] [(with_expansions [<name> (template.identifier [/._] ["apply/" <arity>]) <doc> (template.text ["Lift a function of arity " <arity> - " into a concatenative function of arity " <arity> "."]) - <function_of_arity> (template.identifier ["function_of_arity_" <arity>])] + " into a concatenative function of arity " <arity> "."])] (documentation: <name> - <doc> - [(<name> <function_of_arity>)]))] + <doc>))] [1] [2] [3] [4] [5] [6] [7] [8] diff --git a/stdlib/source/documentation/lux/control/parser/json.lux b/stdlib/source/documentation/lux/control/parser/json.lux index 9c30df716..e072529b0 100644 --- a/stdlib/source/documentation/lux/control/parser/json.lux +++ b/stdlib/source/documentation/lux/control/parser/json.lux @@ -33,11 +33,9 @@ (template [<test> <check> <read>] [(`` (documentation: <test> - (format "Asks whether a JSON value is a " (~~ (template.text [<read>])) ".") - [(<test> test)])) + (format "Asks whether a JSON value is a " (~~ (template.text [<read>])) "."))) (`` (documentation: <check> - (format "Ensures a JSON value is a " (~~ (template.text [<read>])) ".") - [(<check> test)]))] + (format "Ensures a JSON value is a " (~~ (template.text [<read>])) ".")))] [/.boolean? /.boolean! ..boolean] [/.number? /.number! ..number] diff --git a/stdlib/source/documentation/lux/control/parser/synthesis.lux b/stdlib/source/documentation/lux/control/parser/synthesis.lux index a0c48b955..eebd25e91 100644 --- a/stdlib/source/documentation/lux/control/parser/synthesis.lux +++ b/stdlib/source/documentation/lux/control/parser/synthesis.lux @@ -31,8 +31,7 @@ [(`` (documentation: <query> (format "Queries for a " (~~ (template.text [<query>])) " synthesis node."))) (`` (documentation: <assertion> - (format "Checks for a specific " (~~ (template.text [<query>])) " synthesis node.") - [(<assertion> expected)]))] + (format "Checks for a specific " (~~ (template.text [<query>])) " synthesis node.")))] [/.bit /.bit!] [/.i64 /.i64!] diff --git a/stdlib/source/documentation/lux/control/parser/text.lux b/stdlib/source/documentation/lux/control/parser/text.lux index 44640e656..e3c3a96c6 100644 --- a/stdlib/source/documentation/lux/control/parser/text.lux +++ b/stdlib/source/documentation/lux/control/parser/text.lux @@ -35,8 +35,7 @@ (template [<name> <caveat>] [(`` (documentation: <name> - (format "Produce a character" (~~ (template.text [<caveat>])) " if the parser fails.") - [(<name> parser)]))] + (format "Produce a character" (~~ (template.text [<caveat>])) " if the parser fails.")))] [/.not ""] [/.not! " (as a slice)"] @@ -80,8 +79,7 @@ (template [<name> <description_modifier>] [(documentation: <name> - (format "Yields characters that are" <description_modifier> " part of a piece of text.") - [(<name> options)])] + (format "Yields characters that are" <description_modifier> " part of a piece of text."))] [/.one_of ""] [/.none_of " not"] @@ -89,8 +87,7 @@ (template [<name> <description_modifier>] [(documentation: <name> - (format "Yields characters (as a slice) that are" <description_modifier> " part of a piece of text.") - [(<name> options)])] + (format "Yields characters (as a slice) that are" <description_modifier> " part of a piece of text."))] [/.one_of! ""] [/.none_of! " not"] @@ -113,11 +110,9 @@ (template [<text> <slice>] [(`` (documentation: <text> - (format "Yields " (~~ (template.text [<name>])) " characters as a single continuous text.") - [(<text> parser)])) + (format "Yields " (~~ (template.text [<name>])) " characters as a single continuous text."))) (`` (documentation: <slice> - (format "Yields " (~~ (template.text [<name>])) " characters as a single continuous text (as a slice).") - [(<slice> parser)]))] + (format "Yields " (~~ (template.text [<name>])) " characters as a single continuous text (as a slice).")))] [/.some /.some!] [/.many /.many!] @@ -125,11 +120,9 @@ (template [<text> <slice> <doc_modifier>] [(`` (documentation: <text> - (format "Yields " <doc_modifier> " N characters.") - [(<text> amount parser)])) + (format "Yields " <doc_modifier> " N characters."))) (`` (documentation: <slice> - (format "Yields " <doc_modifier> " N characters (as a slice).") - [(<slice> amount parser)]))] + (format "Yields " <doc_modifier> " N characters (as a slice).")))] [/.exactly /.exactly! "exactly"] [/.at_most /.at_most! "at most"] diff --git a/stdlib/source/documentation/lux/control/parser/type.lux b/stdlib/source/documentation/lux/control/parser/type.lux index 5567ac18e..a755665c3 100644 --- a/stdlib/source/documentation/lux/control/parser/type.lux +++ b/stdlib/source/documentation/lux/control/parser/type.lux @@ -43,8 +43,7 @@ (template [<name>] [(`` (documentation: <name> - (format "Parses the contents of a " (~~ (template.text [<name>])) " type.") - [(<name> poly)]))] + (format "Parses the contents of a " (~~ (template.text [<name>])) " type.")))] [/.variant] [/.tuple] @@ -64,8 +63,7 @@ (template [<name> <doc>] [(documentation: <name> - <doc> - [(<name> expected)])] + <doc>)] [/.exactly "Parses a type exactly."] [/.sub "Parses a sub type."] diff --git a/stdlib/source/documentation/lux/control/remember.lux b/stdlib/source/documentation/lux/control/remember.lux index 955505c5c..5e42f67de 100644 --- a/stdlib/source/documentation/lux/control/remember.lux +++ b/stdlib/source/documentation/lux/control/remember.lux @@ -10,22 +10,32 @@ [\\library ["." /]]) -(template [<name> <type>] - [(`` (documentation: <name> - (format "A" <type> " message with an expiration date." - \n "Can have an optional piece of code to focus on.") - [((~~ (template.identifier [<name>])) - "2022-04-01" - "Do this, that and the other.")] - [((~~ (template.identifier [<name>])) - "2022-04-01" - "Improve the performace." - (some (complicated (computation 123))))]))] +(documentation: /.remember + (format "A message with an expiration date." + \n "Can have an optional piece of code to focus on.") + [(remember "2022-04-01" + "Do this, that and the other.")] + [(remember "2022-04-01" + "Improve the performace." + (some (complicated (computation 123))))]) - [/.remember ""] - [/.to_do " TODO"] - [/.fix_me " FIXME"] - ) +(documentation: /.to_do + (format "A TODO message with an expiration date." + \n "Can have an optional piece of code to focus on.") + [(to_do "2022-04-01" + "Do this, that and the other.")] + [(to_do "2022-04-01" + "Improve the performace." + (some (complicated (computation 123))))]) + +(documentation: /.fix_me + (format "A FIXME message with an expiration date." + \n "Can have an optional piece of code to focus on.") + [(fix_me "2022-04-01" + "Do this, that and the other.")] + [(fix_me "2022-04-01" + "Improve the performace." + (some (complicated (computation 123))))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/data/collection/bits.lux b/stdlib/source/documentation/lux/data/collection/bits.lux index c58e7358a..79d85d7fe 100644 --- a/stdlib/source/documentation/lux/data/collection/bits.lux +++ b/stdlib/source/documentation/lux/data/collection/bits.lux @@ -30,16 +30,6 @@ "" [(bit index bits)]) -(template [<name>] - [(documentation: <name> - "" - [(<name> index input)])] - - [/.one] - [/.zero] - [/.flipped] - ) - (documentation: /.intersects? "" [(intersects? reference sample)]) @@ -48,16 +38,6 @@ "" [(not input)]) -(template [<name>] - [(documentation: <name> - "" - [(<name> param subject)])] - - [/.and] - [/.or] - [/.xor] - ) - (.def: .public documentation (.List $.Module) ($.module /._ @@ -66,21 +46,19 @@ ..size ..capacity ..bit - - ..one - ..zero - ..flipped ..intersects? ..not - - ..and - ..or - ..xor ($.default /.Chunk) ($.default /.chunk_size) ($.default /.empty) ($.default /.empty?) - ($.default /.equivalence)] + ($.default /.equivalence) + ($.default /.one) + ($.default /.zero) + ($.default /.flipped) + ($.default /.and) + ($.default /.or) + ($.default /.xor)] [])) diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux index 072d14754..866e5a850 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux @@ -32,8 +32,7 @@ (template [<name>] [(`` (documentation: <name> - (format "Yields value under the " (~~ (template.text [<name>])) "imum key.") - [(<name> dict)]))] + (format "Yields value under the " (~~ (template.text [<name>])) "imum key.")))] [/.min] [/.max] diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux index 6f60d5085..fe7d11246 100644 --- a/stdlib/source/documentation/lux/data/collection/list.lux +++ b/stdlib/source/documentation/lux/data/collection/list.lux @@ -36,24 +36,6 @@ \n "Caveat emptor: If the list has an un-even number of elements, the last one will be skipped.") [(pairs xs)]) -(template [<name>] - [(documentation: <name> - "" - [(<name> n xs)])] - - [/.first] - [/.after] - ) - -(template [<name>] - [(documentation: <name> - "" - [(<name> predicate xs)])] - - [/.while] - [/.until] - ) - (documentation: /.split_at "" [(split_at n xs)]) @@ -94,15 +76,6 @@ "" [(size list)]) -(template [<name>] - [(documentation: <name> - "" - [(<name> predicate items)])] - - [/.every?] - [/.any?] - ) - (documentation: /.item "Fetches the element at the specified index." [(item i xs)]) @@ -121,8 +94,7 @@ (template [<name> <doc>] [(documentation: <name> - <doc> - [(<name> xs)])] + <doc>)] [/.head "Yields the first element of a list."] [/.tail "For a list of size N, yields the N-1 elements after the first one."] @@ -187,12 +159,6 @@ ..partition ..pairs - ..first - ..after - - ..while - ..until - ..split_at ..split_when ..sub @@ -203,9 +169,6 @@ ..example ..interposed ..size - - ..every? - ..any? ..item ..sorted @@ -235,5 +198,11 @@ ($.default /.zipped/2) ($.default /.zipped/3) ($.default /.zipped_with/2) - ($.default /.zipped_with/3)] + ($.default /.zipped_with/3) + ($.default /.first) + ($.default /.after) + ($.default /.while) + ($.default /.until) + ($.default /.every?) + ($.default /.any?)] [])) diff --git a/stdlib/source/documentation/lux/data/collection/sequence.lux b/stdlib/source/documentation/lux/data/collection/sequence.lux index 44b589ad7..fb97896d9 100644 --- a/stdlib/source/documentation/lux/data/collection/sequence.lux +++ b/stdlib/source/documentation/lux/data/collection/sequence.lux @@ -35,27 +35,6 @@ "" [(item idx sequence)]) -(template [<taker> <dropper>] - [(documentation: <taker> - "" - [(<taker> pred xs)]) - (documentation: <dropper> - "" - [(<dropper> pred xs)])] - - [/.while /.until] - [/.first /.after] - ) - -(template [<splitter>] - [(documentation: <splitter> - "" - [(<splitter> pred xs)])] - - [/.split_when] - [/.split_at] - ) - (documentation: /.only "A new sequence only with items that satisfy the predicate." [(only predicate sequence)]) @@ -81,12 +60,6 @@ ..repeated ..cycle ..item - - ..while ..until - ..first ..after - - ..split_when - ..split_at ..only ..partition @@ -94,5 +67,11 @@ ($.default /.head) ($.default /.tail) ($.default /.functor) - ($.default /.comonad)] + ($.default /.comonad) + ($.default /.while) + ($.default /.until) + ($.default /.first) + ($.default /.after) + ($.default /.split_when) + ($.default /.split_at)] [])) diff --git a/stdlib/source/documentation/lux/data/collection/set/multi.lux b/stdlib/source/documentation/lux/data/collection/set/multi.lux index fa1ee3d23..ea0a017ae 100644 --- a/stdlib/source/documentation/lux/data/collection/set/multi.lux +++ b/stdlib/source/documentation/lux/data/collection/set/multi.lux @@ -28,17 +28,6 @@ "" [(multiplicity set elem)]) -(template [<name>] - [(documentation: <name> - "" - [(<name> parameter subject)])] - - [/.union] - [/.sum] - [/.intersection] - [/.difference] - ) - (documentation: /.sub? "Is 'subject' a sub-set of 'reference'?" [(sub? reference subject)]) @@ -62,10 +51,7 @@ ..has ..lacks ..multiplicity - ..union - ..sum - ..intersection - ..difference + ..sub? ..support ..member? @@ -77,5 +63,9 @@ ($.default /.hash) ($.default /.empty?) ($.default /.of_list) - ($.default /.of_set)] + ($.default /.of_set) + ($.default /.union) + ($.default /.sum) + ($.default /.intersection) + ($.default /.difference)] [])) diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux index 7ad4ed77a..73c383ff1 100644 --- a/stdlib/source/documentation/lux/data/color.lux +++ b/stdlib/source/documentation/lux/data/color.lux @@ -40,17 +40,6 @@ "" [(interpolated ratio end start)]) -(template [<name>] - [(documentation: <name> - "" - [(<name> ratio color)])] - - [/.darker] - [/.brighter] - [/.saturated] - [/.un_saturated] - ) - (syntax: (palette_documentation [[_ name] <code>.identifier]) (in (list (code.text (format "A " (text.replaced "_" "-" name) " palette."))))) @@ -101,11 +90,6 @@ ..Color ..complement ..interpolated - - ..darker - ..brighter - ..saturated - ..un_saturated ..analogous ..monochromatic @@ -137,5 +121,9 @@ ($.default /.of_cmyk) ($.default /.gray_scale) ($.default /.Spread) - ($.default /.Palette)] + ($.default /.Palette) + ($.default /.darker) + ($.default /.brighter) + ($.default /.saturated) + ($.default /.un_saturated)] [/named.documentation])) diff --git a/stdlib/source/documentation/lux/data/format/json.lux b/stdlib/source/documentation/lux/data/format/json.lux index ae21ac641..cf3182daa 100644 --- a/stdlib/source/documentation/lux/data/format/json.lux +++ b/stdlib/source/documentation/lux/data/format/json.lux @@ -34,8 +34,7 @@ (template [<name> <desc>] [(documentation: <name> - (format "A JSON object field getter for " <desc> ".") - [(<name> key json)])] + (format "A JSON object field getter for " <desc> "."))] [/.boolean_field "booleans"] [/.number_field "numbers"] diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux index b9f05398e..b5b8cb245 100644 --- a/stdlib/source/documentation/lux/ffi.jvm.lux +++ b/stdlib/source/documentation/lux/ffi.jvm.lux @@ -40,9 +40,7 @@ (template [<name> <from> <to>] [(`` (documentation: <name> - "Type converter." - [(: <to> - (<name> (: <from> foo)))]))] + "Type converter."))] [/.byte_to_long Byte Long] diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux index 34bafe786..308c13a4a 100644 --- a/stdlib/source/documentation/lux/ffi.old.lux +++ b/stdlib/source/documentation/lux/ffi.old.lux @@ -12,10 +12,7 @@ (template [<name> <from> <to>] [(documentation: <name> - "Type converter." - [(: (primitive <to>) - (<name> (: (primitive <from>) - it)))])] + "Type converter.")] [/.byte_to_long "java.lang.Byte" "java.lang.Long"] diff --git a/stdlib/source/documentation/lux/macro.lux b/stdlib/source/documentation/lux/macro.lux index f82563c8a..d3ee4bbba 100644 --- a/stdlib/source/documentation/lux/macro.lux +++ b/stdlib/source/documentation/lux/macro.lux @@ -52,20 +52,44 @@ "Works just like expand, except that it ensures that the output is a single Code token." [(one_expansion token)]) -(template [<macro>] - [(documentation: <macro> - (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).") - [(<macro> "omit" - (def: (foo bar baz) - (-> Int Int Int) - (int.+ bar baz)))])] +(documentation: /.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)))]) - [/.log_single_expansion!] - [/.log_expansion!] - [/.log_full_expansion!] - ) +(documentation: /.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)))]) + +(documentation: /.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)))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/macro/template.lux b/stdlib/source/documentation/lux/macro/template.lux index 869c15518..00be1845a 100644 --- a/stdlib/source/documentation/lux/macro/template.lux +++ b/stdlib/source/documentation/lux/macro/template.lux @@ -39,20 +39,15 @@ "=>" "#0123+456+789.0abcdefghi"]) -(template [<a/an> <name> <short_example> <full_example>] - [(documentation: <name> - (format <a/an> " " (/.text [<name>]) " made by concatenating pieces of code." - \n "The (optional) module part and the short part are specified independently.") - [(<name> ["abc" .def ..ghi]) - "=>" - <short_example>] - [(<name> [.def] ["abc" .def ..ghi]) - "=>" - <full_example>])] - - ["An" /.identifier abcdefghi .abcdefghi] - ["A" /.tag #abcdefghi #.abcdefghi] - ) +(documentation: /.identifier + (format "An identifier made by concatenating pieces of code." + \n "The (optional) module part and the short part are specified independently.") + [(identifier ["abc" .def ..ghi]) + "=>" + abcdefghi] + [(identifier [.def] ["abc" .def ..ghi]) + "=>" + .abcdefghi]) (documentation: /.let "Lexically-bound templates." @@ -71,7 +66,6 @@ ..with_locals ..text ..identifier - ..tag ..let ($.default /.irregular_arguments)] [])) diff --git a/stdlib/source/documentation/lux/math/number/frac.lux b/stdlib/source/documentation/lux/math/number/frac.lux index d14b0e3b5..1d4a2f45e 100644 --- a/stdlib/source/documentation/lux/math/number/frac.lux +++ b/stdlib/source/documentation/lux/math/number/frac.lux @@ -32,8 +32,7 @@ (template [<name> <doc>] [(documentation: <name> - <doc> - [(<name> param subject)])] + <doc>)] [/.+ "Frac(tion) addition."] [/.- "Frac(tion) substraction."] @@ -48,8 +47,7 @@ (template [<name> <doc>] [(documentation: <name> - <doc> - [(<name> left right)])] + <doc>)] [/.min "Frac(tion) minimum."] [/.max "Frac(tion) minimum."] diff --git a/stdlib/source/documentation/lux/math/number/i64.lux b/stdlib/source/documentation/lux/math/number/i64.lux index 18365fe3a..49e371342 100644 --- a/stdlib/source/documentation/lux/math/number/i64.lux +++ b/stdlib/source/documentation/lux/math/number/i64.lux @@ -12,8 +12,7 @@ (template [<name> <doc>] [(documentation: <name> - <doc> - [(<name> parameter subject)])] + <doc>)] [/.or "Bitwise or."] [/.xor "Bitwise xor."] @@ -44,15 +43,11 @@ "Count the number of 1s in a bit-map." [(ones it)]) -(documentation: /.zero - "Clear bit at the given index." - [(zero index input)]) - (template [<name> <doc>] [(documentation: <name> - <doc> - [(<name> index input)])] + <doc>)] + [/.zero "Clear bit at the given index."] [/.one "Set bit at given index."] [/.flipped "Flip bit at given index."] ) @@ -65,15 +60,6 @@ "" [(zero? index input)]) -(template [<name>] - [(documentation: <name> - "" - [(<name> distance input)])] - - [/.left_rotated] - [/.right_rotated] - ) - (documentation: /.region "A mask for a block of bits of the given size, starting at the given offset." [(region offset size)]) @@ -105,8 +91,6 @@ ..flipped ..one? ..zero? - ..left_rotated - ..right_rotated ..region ..Sub ..sub @@ -119,5 +103,7 @@ ($.default /.hash) ($.default /.disjunction) ($.default /.conjunction) - ($.default /.reversed)] + ($.default /.reversed) + ($.default /.left_rotated) + ($.default /.right_rotated)] [])) diff --git a/stdlib/source/documentation/lux/math/number/int.lux b/stdlib/source/documentation/lux/math/number/int.lux index fc8b72cfd..60659050c 100644 --- a/stdlib/source/documentation/lux/math/number/int.lux +++ b/stdlib/source/documentation/lux/math/number/int.lux @@ -32,8 +32,7 @@ (template [<name> <doc>] [(documentation: <name> - <doc> - [(<name> left right)])] + <doc>)] [/.min "Int(eger) minimum."] [/.max "Int(eger) maximum."] @@ -41,8 +40,7 @@ (template [<name> <doc>] [(documentation: <name> - <doc> - [(<name> param subject)])] + <doc>)] [/.+ "Int(eger) addition."] [/.- "Int(eger) substraction."] diff --git a/stdlib/source/documentation/lux/math/number/nat.lux b/stdlib/source/documentation/lux/math/number/nat.lux index 957da93b0..dbae19c36 100644 --- a/stdlib/source/documentation/lux/math/number/nat.lux +++ b/stdlib/source/documentation/lux/math/number/nat.lux @@ -12,8 +12,7 @@ (template [<name> <documentation>] [(documentation: <name> - <documentation> - [(<name> parameter subject)])] + <documentation>)] [/.= "Nat(ural) equivalence."] [/.+ "Nat(ural) addition."] @@ -30,8 +29,7 @@ (template [<name> <doc>] [(documentation: <name> - <doc> - [(<name> left right)])] + <doc>)] [/.min "Nat(ural) minimum."] [/.max "Nat(ural) maximum."] diff --git a/stdlib/source/documentation/lux/math/number/rev.lux b/stdlib/source/documentation/lux/math/number/rev.lux index bd5c28ab1..2a2053128 100644 --- a/stdlib/source/documentation/lux/math/number/rev.lux +++ b/stdlib/source/documentation/lux/math/number/rev.lux @@ -32,8 +32,7 @@ (template [<name> <doc>] [(documentation: <name> - <doc> - [(<name> left right)])] + <doc>)] [/.min "Rev(olution) minimum."] [/.max "Rev(olution) maximum."] @@ -41,8 +40,7 @@ (template [<name> <doc>] [(documentation: <name> - <doc> - [(<name> param subject)])] + <doc>)] [/.+ "Rev(olution) addition."] [/.- "Rev(olution) substraction."] @@ -52,14 +50,13 @@ [/.ratio "Ratio between two rev(olution)s."] ) -(template [<name>] - [(documentation: <name> - "" - [(<name> scale subject)])] +(documentation: /.up + "" + [(up scale subject)]) - [/.up] - [/.down] - ) +(documentation: /.down + "" + [(down scale subject)]) (documentation: /.reciprocal "Rev(olution) reciprocal of a Nat(ural)." diff --git a/stdlib/source/documentation/lux/meta/annotation.lux b/stdlib/source/documentation/lux/meta/annotation.lux index 310072c36..10f4d0aad 100644 --- a/stdlib/source/documentation/lux/meta/annotation.lux +++ b/stdlib/source/documentation/lux/meta/annotation.lux @@ -10,41 +10,22 @@ [\\library ["." /]]) -(template [<name>] - [(documentation: <name> - "" - [(<name> tag ann)])] - - [/.value] - [/.bit] - [/.nat] - [/.int] - [/.rev] - [/.frac] - [/.text] - [/.identifier] - [/.tag] - [/.form] - [/.tuple] - [/.record] - ) - (.def: .public documentation (.List $.Module) ($.module /._ "Machinary for querying annotations on modules and definitions." - [..value - ..bit - ..nat - ..int - ..rev - ..frac - ..text - ..identifier - ..tag - ..form - ..tuple - ..record + [($.default /.value) + ($.default /.bit) + ($.default /.nat) + ($.default /.int) + ($.default /.rev) + ($.default /.frac) + ($.default /.text) + ($.default /.identifier) + ($.default /.tag) + ($.default /.form) + ($.default /.tuple) + ($.default /.record) ($.default /.Annotation) ($.default /.flagged?) ($.default /.implementation?)] diff --git a/stdlib/source/documentation/lux/static.lux b/stdlib/source/documentation/lux/static.lux index 64eb9c9b5..8f7789b25 100644 --- a/stdlib/source/documentation/lux/static.lux +++ b/stdlib/source/documentation/lux/static.lux @@ -12,10 +12,9 @@ (template [<name> <type>] [(documentation: <name> - "" - [(<name> - (: <type> - (value generating expression)))])] + (%.code (' (<name> + (: <type> + (value generating expression))))))] [/.nat .Nat] [/.int .Int] @@ -34,9 +33,8 @@ (template [<name> <type>] [(documentation: <name> - "" - [(: <type> - (<name>))])] + (%.code (' (: <type> + (<name>)))))] [/.random_nat .Nat] [/.random_int .Int] diff --git a/stdlib/source/documentation/lux/test.lux b/stdlib/source/documentation/lux/test.lux index 66a17fcf7..f63a8885d 100644 --- a/stdlib/source/documentation/lux/test.lux +++ b/stdlib/source/documentation/lux/test.lux @@ -68,17 +68,19 @@ \n "WARNING: This procedure is only meant to be used in (program: ...) forms.") [(run! test)]) -(template [<macro>] - [(documentation: <macro> - (format "Specifies a test as covering one or more definitions." - \n "Adds to the test tally information to track which definitions have been tested.") - [(<macro> [definition/0 definition/1 ,,, definition/N] - (: Bit - (some "computation")))])] - - [/.cover'] - [/.cover] - ) +(documentation: /.cover' + (format "Specifies a test as covering one or more definitions." + \n "Adds to the test tally information to track which definitions have been tested.") + [(cover' [definition/0 definition/1 ,,, definition/N] + (: Bit + (some "computation")))]) + +(documentation: /.cover + (format "Specifies a test as covering one or more definitions." + \n "Adds to the test tally information to track which definitions have been tested.") + [(cover [definition/0 definition/1 ,,, definition/N] + (: Bit + (some "computation")))]) (documentation: /.for (format "Specifies a context for tests as covering one or more definitions." diff --git a/stdlib/source/documentation/lux/type.lux b/stdlib/source/documentation/lux/type.lux index b14ddc183..57d8f9497 100644 --- a/stdlib/source/documentation/lux/type.lux +++ b/stdlib/source/documentation/lux/type.lux @@ -26,8 +26,7 @@ (template [<name>] [(documentation: <name> - "The number of parameters, and the body, of a quantified type." - [(<name> type)])] + "The number of parameters, and the body, of a quantified type.")] [/.flat_univ_q] [/.flat_ex_q] @@ -43,8 +42,7 @@ (template [<name>] [(documentation: <name> - "The members of a composite type." - [(<name> type)])] + "The members of a composite type.")] [/.flat_variant] [/.flat_tuple] @@ -73,8 +71,7 @@ (template [<name>] [(documentation: <name> - "A composite type, constituted by the given member types." - [(<name> types)])] + "A composite type, constituted by the given member types.")] [/.variant] [/.tuple] @@ -90,8 +87,7 @@ (template [<name>] [(documentation: <name> - "A quantified type, with the given number of parameters, and body." - [(<name> size body)])] + "A quantified type, with the given number of parameters, and body.")] [/.univ_q] [/.ex_q] diff --git a/stdlib/source/documentation/lux/type/abstract.lux b/stdlib/source/documentation/lux/type/abstract.lux index 3db8dc7be..41c91897f 100644 --- a/stdlib/source/documentation/lux/type/abstract.lux +++ b/stdlib/source/documentation/lux/type/abstract.lux @@ -26,8 +26,12 @@ (template [<name> <from> <to>] [(documentation: <name> "Type-casting macro for abstract/nominal types." - [(: <to> - (<name> (: <from> value)))])] + [(|> value + (: Representation) + :abstraction + (: Abstraction) + :representation + (: Representation))])] [/.:abstraction representation abstraction] [/.:representation abstraction representation] diff --git a/stdlib/source/documentation/lux/type/resource.lux b/stdlib/source/documentation/lux/type/resource.lux index b9fd2ae39..335cef3b0 100644 --- a/stdlib/source/documentation/lux/type/resource.lux +++ b/stdlib/source/documentation/lux/type/resource.lux @@ -53,8 +53,7 @@ (template [<name>] [(documentation: <name> - "Makes a value into a resource and adds the key/access-right to it to the ambient keyring for future use." - [(<name> monad value)])] + "Makes a value into a resource and adds the key/access-right to it to the ambient keyring for future use.")] [/.ordered] [/.commutative] diff --git a/stdlib/source/documentation/lux/type/unit.lux b/stdlib/source/documentation/lux/type/unit.lux index 98e13bcb3..14e7a8ce0 100644 --- a/stdlib/source/documentation/lux/type/unit.lux +++ b/stdlib/source/documentation/lux/type/unit.lux @@ -19,17 +19,6 @@ (documentation: (/.Qty unit) "A quantity with an associated unit of measurement.") -(template [<name>] - [(documentation: <name> - "" - [(<name> param subject)])] - - [/.+] - [/.-] - [/.*] - [/./] - ) - (documentation: (/.Unit unit) "A unit of measurement, to qualify numbers with.") @@ -83,10 +72,6 @@ ($.module /._ "" [..Qty - ..+ - ..- - ..* - ../ ..Unit ..Scale ..Pure @@ -117,5 +102,9 @@ ($.default /.Giga) ($.default /.Milli) ($.default /.Micro) - ($.default /.Nano)] + ($.default /.Nano) + ($.default /.+) + ($.default /.-) + ($.default /.*) + ($.default /./)] [])) diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux index c1ffafb17..d08b80b42 100644 --- a/stdlib/source/library/lux/control/concurrency/atom.lux +++ b/stdlib/source/library/lux/control/concurrency/atom.lux @@ -1,7 +1,6 @@ (.module: [library [lux "*" - ["." macro] ["." ffi] ["@" target] [abstract @@ -16,12 +15,11 @@ [type abstract]]]) -(with_expansions [<jvm> (as_is (macro.log_single_expansion! - (ffi.import: (java/util/concurrent/atomic/AtomicReference a) - ["#::." - (new [a]) - (get [] a) - (compareAndSet [a a] boolean)])))] +(with_expansions [<jvm> (as_is (ffi.import: (java/util/concurrent/atomic/AtomicReference a) + ["#::." + (new [a]) + (get [] a) + (compareAndSet [a a] boolean)]))] (for {@.old <jvm> @.jvm <jvm>} (as_is))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux index 3cd1226b0..3f5cdf8d6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux @@ -447,15 +447,14 @@ (def: .public generate (Operation [Registry Output]) - (/////generation.with_buffer - (do ///////phase.monad - [_ (/////generation.execute! ..runtime) - _ (/////generation.save! ..module_id #.None ..runtime)] - (in [(|> artifact.empty - artifact.resource - product.right) - (row.row [..module_id - #.None - (|> ..runtime - _.code - (\ utf8.codec encoded))])])))) + (do ///////phase.monad + [_ (/////generation.execute! ..runtime) + _ (/////generation.save! ..module_id #.None ..runtime)] + (in [(|> artifact.empty + artifact.resource + product.right) + (row.row [..module_id + #.None + (|> ..runtime + _.code + (\ utf8.codec encoded))])]))) |