From 5d4583aebd00adced10275b32ff1a93ab418be50 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 28 Jul 2021 04:48:42 -0400 Subject: Re-named List's tags: Nil => End && Cons => Item --- .../book/the_lux_programming_language/chapter_2.md | 4 +- .../book/the_lux_programming_language/chapter_3.md | 223 ++++ documentation/bookmark/license/post_open.md | 8 + documentation/bookmark/security.md | 1 + .../tool/integrated_development_environment.md | 4 +- stdlib/source/library/lux.lux | 1162 ++++++++++---------- stdlib/source/library/lux/abstract/enum.lux | 8 +- stdlib/source/library/lux/abstract/monad.lux | 46 +- .../source/library/lux/control/concatenative.lux | 116 +- .../library/lux/control/concurrency/actor.lux | 8 +- .../library/lux/control/concurrency/async.lux | 2 +- .../source/library/lux/control/concurrency/frp.lux | 42 +- .../source/library/lux/control/concurrency/stm.lux | 16 +- .../library/lux/control/concurrency/thread.lux | 4 +- stdlib/source/library/lux/control/exception.lux | 20 +- stdlib/source/library/lux/control/function.lux | 1 + .../source/library/lux/control/function/mutual.lux | 8 +- stdlib/source/library/lux/control/parser.lux | 29 +- .../source/library/lux/control/parser/analysis.lux | 10 +- stdlib/source/library/lux/control/parser/cli.lux | 12 +- stdlib/source/library/lux/control/parser/code.lux | 32 +- stdlib/source/library/lux/control/parser/json.lux | 14 +- .../library/lux/control/parser/synthesis.lux | 10 +- stdlib/source/library/lux/control/parser/type.lux | 18 +- stdlib/source/library/lux/control/parser/xml.lux | 22 +- stdlib/source/library/lux/control/pipe.lux | 15 + stdlib/source/library/lux/control/reader.lux | 3 +- stdlib/source/library/lux/control/region.lux | 15 +- stdlib/source/library/lux/control/remember.lux | 31 +- stdlib/source/library/lux/control/state.lux | 8 +- .../source/library/lux/data/collection/array.lux | 10 +- .../library/lux/data/collection/dictionary.lux | 14 +- .../lux/data/collection/dictionary/ordered.lux | 4 +- .../lux/data/collection/dictionary/plist.lux | 30 +- stdlib/source/library/lux/data/collection/list.lux | 198 ++-- .../source/library/lux/data/collection/queue.lux | 4 +- stdlib/source/library/lux/data/collection/row.lux | 2 +- .../library/lux/data/collection/sequence.lux | 6 +- .../library/lux/data/collection/set/multi.lux | 2 +- .../source/library/lux/data/collection/stack.lux | 10 +- stdlib/source/library/lux/data/collection/tree.lux | 7 +- .../library/lux/data/collection/tree/zipper.lux | 38 +- stdlib/source/library/lux/data/format/css/font.lux | 12 +- .../source/library/lux/data/format/css/value.lux | 4 +- stdlib/source/library/lux/data/format/html.lux | 14 +- stdlib/source/library/lux/data/maybe.lux | 4 +- stdlib/source/library/lux/data/sum.lux | 20 +- stdlib/source/library/lux/data/text.lux | 4 +- stdlib/source/library/lux/debug.lux | 18 +- stdlib/source/library/lux/extension.lux | 2 +- stdlib/source/library/lux/ffi.js.lux | 4 +- stdlib/source/library/lux/ffi.jvm.lux | 22 +- stdlib/source/library/lux/ffi.lua.lux | 6 +- stdlib/source/library/lux/ffi.old.lux | 18 +- stdlib/source/library/lux/ffi.py.lux | 4 +- stdlib/source/library/lux/ffi.rb.lux | 2 +- stdlib/source/library/lux/ffi.scm.lux | 2 +- stdlib/source/library/lux/macro.lux | 10 +- stdlib/source/library/lux/macro/syntax.lux | 4 +- .../library/lux/macro/syntax/declaration.lux | 2 +- .../source/library/lux/macro/syntax/definition.lux | 12 +- stdlib/source/library/lux/math/number.lux | 2 +- stdlib/source/library/lux/math/number/nat.lux | 26 +- stdlib/source/library/lux/math/random.lux | 2 +- stdlib/source/library/lux/meta.lux | 6 +- stdlib/source/library/lux/meta/annotation.lux | 4 +- stdlib/source/library/lux/meta/location.lux | 2 +- stdlib/source/library/lux/target/common_lisp.lux | 10 +- .../lux/target/jvm/bytecode/instruction.lux | 10 +- stdlib/source/library/lux/target/jvm/type/lux.lux | 8 +- .../library/lux/target/jvm/type/signature.lux | 4 +- stdlib/source/library/lux/target/php.lux | 2 +- stdlib/source/library/lux/target/scheme.lux | 14 +- stdlib/source/library/lux/test.lux | 4 +- .../library/lux/tool/compiler/default/platform.lux | 4 +- .../lux/tool/compiler/language/lux/analysis.lux | 12 +- .../tool/compiler/language/lux/phase/analysis.lux | 4 +- .../compiler/language/lux/phase/analysis/case.lux | 12 +- .../language/lux/phase/analysis/case/coverage.lux | 14 +- .../language/lux/phase/analysis/inference.lux | 4 +- .../language/lux/phase/analysis/module.lux | 6 +- .../compiler/language/lux/phase/analysis/scope.lux | 30 +- .../language/lux/phase/analysis/structure.lux | 12 +- .../language/lux/phase/extension/analysis/jvm.lux | 32 +- .../extension/generation/common_lisp/common.lux | 8 +- .../phase/extension/generation/scheme/common.lux | 6 +- .../lux/phase/extension/generation/scheme/host.lux | 6 +- .../lux/phase/generation/common_lisp/case.lux | 4 +- .../generation/common_lisp/extension/common.lux | 46 +- .../lux/phase/generation/common_lisp/function.lux | 2 +- .../lux/phase/generation/common_lisp/loop.lux | 2 +- .../lux/phase/generation/common_lisp/runtime.lux | 2 +- .../lux/phase/generation/common_lisp/structure.lux | 4 +- .../language/lux/phase/generation/js/case.lux | 8 +- .../language/lux/phase/generation/js/function.lux | 2 +- .../language/lux/phase/generation/js/loop.lux | 4 +- .../language/lux/phase/generation/js/structure.lux | 4 +- .../phase/generation/jvm/function/method/apply.lux | 2 +- .../lux/phase/generation/jvm/structure.lux | 4 +- .../language/lux/phase/generation/lua/case.lux | 4 +- .../language/lux/phase/generation/lua/function.lux | 2 +- .../language/lux/phase/generation/lua/loop.lux | 6 +- .../lux/phase/generation/lua/structure.lux | 4 +- .../compiler/language/lux/phase/generation/php.lux | 4 +- .../language/lux/phase/generation/php/case.lux | 4 +- .../lux/phase/generation/php/extension/common.lux | 38 +- .../language/lux/phase/generation/php/function.lux | 2 +- .../language/lux/phase/generation/php/loop.lux | 6 +- .../lux/phase/generation/php/structure.lux | 4 +- .../language/lux/phase/generation/python.lux | 4 +- .../language/lux/phase/generation/python/case.lux | 4 +- .../lux/phase/generation/python/function.lux | 2 +- .../language/lux/phase/generation/python/loop.lux | 6 +- .../lux/phase/generation/python/structure.lux | 4 +- .../language/lux/phase/generation/r/case.lux | 4 +- .../language/lux/phase/generation/r/function.lux | 2 +- .../language/lux/phase/generation/r/loop.lux | 2 +- .../lux/phase/generation/r/procedure/common.lux | 82 +- .../lux/phase/generation/r/procedure/host.lux | 14 +- .../language/lux/phase/generation/r/structure.lux | 4 +- .../language/lux/phase/generation/ruby.lux | 4 +- .../language/lux/phase/generation/ruby/case.lux | 8 +- .../lux/phase/generation/ruby/function.lux | 2 +- .../language/lux/phase/generation/ruby/loop.lux | 4 +- .../lux/phase/generation/ruby/structure.lux | 4 +- .../language/lux/phase/generation/scheme/case.lux | 4 +- .../phase/generation/scheme/extension/common.lux | 44 +- .../lux/phase/generation/scheme/function.lux | 2 +- .../language/lux/phase/generation/scheme/loop.lux | 2 +- .../lux/phase/generation/scheme/runtime.lux | 28 +- .../lux/phase/generation/scheme/structure.lux | 4 +- .../compiler/language/lux/phase/synthesis/case.lux | 22 +- .../language/lux/phase/synthesis/variable.lux | 6 +- .../lux/tool/compiler/language/lux/syntax.lux | 8 +- .../lux/tool/compiler/language/lux/synthesis.lux | 18 +- .../library/lux/tool/compiler/meta/io/archive.lux | 4 +- .../library/lux/tool/compiler/meta/io/context.lux | 4 +- stdlib/source/library/lux/type.lux | 20 +- stdlib/source/library/lux/type/abstract.lux | 16 +- stdlib/source/library/lux/type/check.lux | 20 +- stdlib/source/library/lux/type/implicit.lux | 26 +- stdlib/source/library/lux/type/refinement.lux | 18 +- stdlib/source/library/lux/type/resource.lux | 4 +- stdlib/source/library/lux/world/db/jdbc.lux | 60 +- stdlib/source/library/lux/world/db/jdbc/input.lux | 4 +- stdlib/source/library/lux/world/db/jdbc/output.lux | 32 +- stdlib/source/library/lux/world/db/sql.lux | 8 +- stdlib/source/library/lux/world/file.lux | 66 +- stdlib/source/library/lux/world/file/watch.lux | 6 +- .../source/library/lux/world/net/http/header.lux | 4 +- stdlib/source/library/lux/world/net/http/mime.lux | 54 +- .../source/library/lux/world/net/http/request.lux | 12 +- stdlib/source/library/lux/world/program.lux | 4 +- stdlib/source/program/aedifex/command/auto.lux | 4 +- stdlib/source/program/aedifex/command/build.lux | 12 +- stdlib/source/program/aedifex/command/deps.lux | 2 +- .../program/aedifex/dependency/resolution.lux | 12 +- stdlib/source/program/aedifex/format.lux | 2 +- stdlib/source/program/compositor.lux | 4 +- stdlib/source/program/scriptum.lux | 22 +- stdlib/source/specification/compositor.lux | 4 +- .../specification/compositor/analysis/type.lux | 16 +- stdlib/source/specification/compositor/common.lux | 32 +- .../specification/compositor/generation/case.lux | 122 +- .../specification/compositor/generation/common.lux | 114 +- .../compositor/generation/function.lux | 30 +- .../compositor/generation/primitive.lux | 10 +- .../compositor/generation/reference.lux | 8 +- .../compositor/generation/structure.lux | 58 +- stdlib/source/specification/lux/abstract/enum.lux | 4 +- .../source/specification/lux/abstract/interval.lux | 4 +- .../source/specification/lux/abstract/monoid.lux | 10 +- stdlib/source/specification/lux/abstract/order.lux | 8 +- stdlib/source/test/aedifex/command/build.lux | 8 +- stdlib/source/test/lux.lux | 18 + stdlib/source/test/lux/abstract/enum.lux | 4 +- stdlib/source/test/lux/abstract/equivalence.lux | 4 +- stdlib/source/test/lux/abstract/predicate.lux | 4 +- stdlib/source/test/lux/control/concatenative.lux | 4 +- stdlib/source/test/lux/control/concurrency/frp.lux | 6 +- stdlib/source/test/lux/control/continuation.lux | 8 +- stdlib/source/test/lux/control/parser.lux | 2 +- stdlib/source/test/lux/data/binary.lux | 6 +- stdlib/source/test/lux/data/collection/list.lux | 8 +- stdlib/source/test/lux/data/collection/queue.lux | 8 +- stdlib/source/test/lux/target/jvm.lux | 2 +- .../compiler/language/lux/phase/analysis/case.lux | 10 +- .../language/lux/phase/analysis/function.lux | 2 +- .../compiler/language/lux/phase/synthesis/case.lux | 130 +-- .../language/lux/phase/synthesis/function.lux | 326 +++--- .../language/lux/phase/synthesis/primitive.lux | 10 +- .../language/lux/phase/synthesis/structure.lux | 2 +- .../language/lux/phase/synthesis/variable.lux | 244 ++-- .../test/lux/tool/compiler/language/lux/syntax.lux | 46 +- 194 files changed, 2583 insertions(+), 2180 deletions(-) create mode 100644 documentation/book/the_lux_programming_language/chapter_3.md create mode 100644 documentation/bookmark/license/post_open.md diff --git a/documentation/book/the_lux_programming_language/chapter_2.md b/documentation/book/the_lux_programming_language/chapter_2.md index 6f12f9907..d396f0034 100644 --- a/documentation/book/the_lux_programming_language/chapter_2.md +++ b/documentation/book/the_lux_programming_language/chapter_2.md @@ -146,7 +146,9 @@ Suffice it to say that the `debug.log!` function will produce a value of type `A That `(IO Any)` value will then be run by the system at run-time, giving us the result we want. +--- + Now that we've discussed some of the basics of what goes on inside of Lux programs, it's time for us to explore the language in a little bit more depth. -See you in the next chapter! +See you in [the next chapter](chapter_3.md)! diff --git a/documentation/book/the_lux_programming_language/chapter_3.md b/documentation/book/the_lux_programming_language/chapter_3.md new file mode 100644 index 000000000..33400b355 --- /dev/null +++ b/documentation/book/the_lux_programming_language/chapter_3.md @@ -0,0 +1,223 @@ +# Chapter 3: Syntax and Data-Types + +_Where you will learn the what Lux code is made of._ + +--- + +# Syntax for data-types + +* `Bit`s look like this: + +``` +#0 ## false +#1 ## true +``` + +* `Nat`s look like this: + +``` +0 +123 +0456 +123,456,789 +``` + +* `Int`s look like this: + +``` ++0 +-123 ++0456 +-123,456,789 +``` + +* `Rev`s look like this: + +``` +.123 +.04,56 +.7890 +``` + +* `Frac`s look like this: + +``` ++123.456 +-456.7890 ++0.001 +123,456.789 +``` + +* `Text`s look like this: + +``` +"This is a single-line text" +``` + +* `Unit` looks like this: + +``` +[] +``` + +* Variants look like this: + +``` +#Foo +(#Bar 10 +20.0 "thirty") +``` + +* Tuples look like this: + +``` +[123 ["nested" #tuple] true] +``` + +* Records look like this: + +``` +{#name "Lux" #paradigm #Functional #platforms (list #JVM)} +``` + +**Note**: As you can see, commas (`,`) can be used as separators for the numeric literals. + +--- + +From looking at this, we can see a few interesting bits we haven't discussed. + +One is that the hash (`#`) character is overloaded. + +In the last chapter we saw it being used for comments, but now we're seeing it being used as a prefix for _some weird "label" thingies_ (more on that in a moment). + +To avoid reserving many characters for the language, Lux overloads the hash (`#`) character in situations where it can be used unambiguously. That way, most characters can be used by anyone without fear of stepping on the feet of the language. + +--- + +Regarding _those label thingies_ we saw earlier, they're called **tags**, and the reason they're not mentioned as part of Lux's data-types is that they're not really data-types; they're just part of the language syntax. + +They're used as part of the syntax for data-types, but they're not data-types in themselves. + +Also, you can't just use anything you want as a tag, as you first have to declare them. + +We'll talk more about tags a bit later, when we talk about defining types. + +--- + +Also, just from looking at the syntax for unit and tuples, you can see that they look quite similar. The reason is that unit is actually the empty tuple. I know it sounds odd, but for the most part you just have to think of unit as a kind of empty value, considering that it contains no information inside. + + It might sound specially odd that we have an "empty" value at all in the first place, but as it turns out, it's quite useful in a variety of situations. + + You're about to see one of those pretty soon. + +In the section for variants, you can see 2 different alternatives, and you might wonder how do they differ. + +Well, a variant is a pair of a tag and a _single_ value. That's right, I said **single** value; so you might be wondering how come we're associating 3 values with the `#Bar` tag. + +It's pretty simple, actually. Whenever you're trying to create a variant with more than one value, Lux just wraps all the values inside a tuple for you. + +So, `(#Bar 10 +20.0 "thirty")` is the same as `(#Bar [10 +20.0 "thirty"])`. + +Now, you might be thinking: _what's up with that `#Foo` variant?_ + +Well, sometimes you only care about a variant for its tag, and not for any value it may hold (for example, if you're trying to use a variant type as an enumeration). In that case, you'll want to pair the tag with an empty value (since it has to be paired with something). + +That's right! You've just witnessed **unit** value in action and you didn't even know it. If you just write the name of the tag without any parentheses, Lux will stick a **unit** in there for you. + +That means `#Foo` is the same as ``(#Foo [])``. + +--- + +You might have noticed that I mentioned **records** in this chapter, but not in the previous chapter, where I also talked about the basic data-types Lux offers. + +The reason is that records are a bit of a magic trick in Lux. That means records are not really a data-type that's distinct from the other ones. In fact, records just offer you an alternative syntax for writing tuples. + +That's right! `{#name "Lux" #paradigm #Functional #platforms (list #JVM)}` could mean the same as `["Lux" #Functional (list #JVM)]`, depending on the ordering imposed by the tags. + +--- + +Remember when I said that you needed to declare your tags? Well, depending on the order in which you declare them, that means that `#name` could point to the first element in the tuple, or to another position entirely. Also, in the same way that tags have a numeric value when it comes to their usage in tuples/records, that's also the case for variants. + +For example, the `List` type has two tags: `#.End` and `#.Item`. The `#.End` tag has value 0, while the `#.Item` tag has value 1. That's what allows Lux to the able to identify which option it is working with at runtime when you're dealing with variants. + +Tags belong to the module in which they were declared, and you must use the module name (or an alias) as a prefix when using tags. That is why I've written `#.End` and `#.Item`, instead of `#End` and `#Item`. However, you may forgo the prefixes if you're referring to tags which were defined in the same module in which they're being used. + +Finally, you may have noticed that, unlike all other data-types, variants re-use some syntax that you're already seen before: _the parentheses_. Clearly, we didn't build our program by creating a bunch of variants, so, what's going on? + +Well, the parenthesis delimit the syntax of what is called a **form** in Lux. This is actually an old concept that's very familiar to those with experience with other Lisp-like languages. Basically, a form is a composite expression or statement. + +When the form starts with a tag, Lux interprets that to be a variant. + +## Types for data-types + +_"But, wait!"_, you might say. _"We didn't talk about functions!"_ + +Patience, young grasshopper. We'll talk about those in the next chapter. + +For now, let's talk about **types**. + +The type-annotation macro is called `:` (I know, _real cute_). You use it like this `(: Some_Type some_value)`. + +There is also a separate macro for type-coerciones that's called `:as`, which is used the same way. However, you should probably steer clear off that one, unless you know what you're doing, since you can trick the compiler into thinking a value belongs to any type you want by using it. + +Now that we know about type annotations, I'll show you some types by giving you some valid Lux expressions: + +``` +(: Bit #1) +(: Bit .true) +(: Nat 123) +(: Int -123) +(: Rev .789) +(: Frac +456.789) +(: Text "YOLO") + +(type: Some_Enum + #primitive + #tuple + #variant) + +(: [Int [Text Some_Enum] Bit] + [10 ["nested" #tuple] .false]) + +(type: Quux + #Foo + (#Bar Int Frac Text)) + +(: Quux #Foo) + +(: Quux (#Bar 10 +20.0 "thirty")) + +(type: Lang + {#name Text + #paradigm Paradigm + #platforms (List Platform)}) + +(: Lang + {#name "Lux" + #paradigm #Functional + #platforms (list #JVM)}) + +(: Lang + ["Lux" #Functional (list #JVM)]) + +(: [Text Paradigm (List Platform)] + {#name "Lux" + #paradigm #Functional + #platforms (list #JVM)}) +``` + + By the way, the value of a type-annotation or a type-coearcion expression is just the value being annotated/coerced. So `(: Bit #1)` simply yields `#1`. + +_What is that `type:` thingie?_ + +It's just a macro for defining types. We'll learn more about it in a future chapter. + +The tags that get mentioned in the type definition get automatically declared, and the order in which they appear determines their value. `#Foo` came first, so it's value is 0. `#Bar`, as you may guess, gets the value 1. + +Also, you might be wondering what's the difference between `List` and `list`. Well, the first one is the type of lists (or a type-constructor for list types, however you want to look at it). The second one is a _macro_ for constructing actual list values. `List` can only take one argument (the type of the list elements), while `list` can take any number of arguments (the elements that make up the list value). + +--- + +Again, we haven't mentioned functions. But if you're impatient to learn about them, just click the link below. + +See you in the next chapter! + diff --git a/documentation/bookmark/license/post_open.md b/documentation/bookmark/license/post_open.md new file mode 100644 index 000000000..69b745893 --- /dev/null +++ b/documentation/bookmark/license/post_open.md @@ -0,0 +1,8 @@ +# Reference + +1. [Open Source Policy with Bruce Perens](https://www.owltail.com/people/rRld1-bruce-perens/appearances) +1. [Post-Open Source License – Early Draft](https://perens.com/2020/10/06/post-open-source-license-early-draft/) + https://perens.com/wp-content/uploads/sites/4/2020/10/PO_License_Draft.pdf +1. [What Comes After Open Source](https://www.youtube.com/watch?v=vTsc1m78BUk) +1. [Bruce Perens - Building a 'billion dollar' startup with Crystal and Lucky | Crystal 1.0 Conference](https://www.youtube.com/watch?v=XRl-it1-ruI&list=PLe1-A91ZPTpBBrrIV-N_fMmCWbFM4Uj4v) + diff --git a/documentation/bookmark/security.md b/documentation/bookmark/security.md index 32a5a7d90..620c37e1f 100644 --- a/documentation/bookmark/security.md +++ b/documentation/bookmark/security.md @@ -4,6 +4,7 @@ # User/human-level +1. [Securing your development environment](https://stsewd.dev/posts/securing-your-dev-environment/) 1. [Security Checklist: Tools and resources designed to improve your online privacy, safety, and security.](https://brianlovin.com/security) # Secrets | Confidentiality diff --git a/documentation/bookmark/tool/integrated_development_environment.md b/documentation/bookmark/tool/integrated_development_environment.md index 65aa01b32..27a302301 100644 --- a/documentation/bookmark/tool/integrated_development_environment.md +++ b/documentation/bookmark/tool/integrated_development_environment.md @@ -3,7 +3,7 @@ 1. [Utilso: All-in-one tools for developers](https://utilso.com/) 1. https://keycode.info/ -# Reference +# Exemplar -1. []() +1. [Pablo Tesone - Pharo: A live programming experience everywhere | Crystal 1.0 Conference](https://www.youtube.com/watch?v=r3ZwZQfspV0&list=PLe1-A91ZPTpAIO9YRZbAlPT3l1S5pMPrX&index=9) diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 881848963..9f2b0a697 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -52,14 +52,14 @@ #1) ## (type: (List a) -## #Nil -## (#Cons a (List a))) +## #End +## (#Item a (List a))) ("lux def type tagged" List (9 #1 ["library/lux" "List"] (7 #0 (0 #0) - (1 #0 ## "lux.Nil" + (1 #0 ## "lux.End" Any - ## "lux.Cons" + ## "lux.Item" (2 #0 (4 #0 1) (9 #0 (4 #0 1) (4 #0 0)))))) [dummy_location @@ -68,82 +68,82 @@ (0 #1 [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 "A potentially empty list of values.")]] (0 #0))))] - ["Nil" "Cons"] + ["End" "Item"] #1) ("lux def" Bit ("lux type check type" (9 #1 ["library/lux" "Bit"] - (0 #0 "#Bit" #Nil))) + (0 #0 "#Bit" #End))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "doc"])] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 "Your standard, run-of-the-mill boolean values (as bits).")]] - #Nil))] + #End))] #1) ("lux def" I64 ("lux type check type" (9 #1 ["library/lux" "I64"] (7 #0 (0 #0) - (0 #0 "#I64" (#Cons (4 #0 1) #Nil))))) + (0 #0 "#I64" (#Item (4 #0 1) #End))))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "doc"])] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 "64-bit integers without any semantics.")]] - #Nil))] + #End))] #1) ("lux def" Nat ("lux type check type" (9 #1 ["library/lux" "Nat"] - (0 #0 "#I64" (#Cons (0 #0 "#Nat" #Nil) #Nil)))) + (0 #0 "#I64" (#Item (0 #0 "#Nat" #End) #End)))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "doc"])] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 ("lux text concat" ("lux text concat" "Natural numbers (unsigned integers)." __paragraph) "They start at zero (0) and extend in the positive direction."))]] - #Nil))] + #End))] #1) ("lux def" Int ("lux type check type" (9 #1 ["library/lux" "Int"] - (0 #0 "#I64" (#Cons (0 #0 "#Int" #Nil) #Nil)))) + (0 #0 "#I64" (#Item (0 #0 "#Int" #End) #End)))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "doc"])] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 "Your standard, run-of-the-mill integer numbers.")]] - #Nil))] + #End))] #1) ("lux def" Rev ("lux type check type" (9 #1 ["library/lux" "Rev"] - (0 #0 "#I64" (#Cons (0 #0 "#Rev" #Nil) #Nil)))) + (0 #0 "#I64" (#Item (0 #0 "#Rev" #End) #End)))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "doc"])] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 ("lux text concat" ("lux text concat" "Fractional numbers that live in the interval [0,1)." __paragraph) "Useful for probability, and other domains that work within that interval."))]] - #Nil))] + #End))] #1) ("lux def" Frac ("lux type check type" (9 #1 ["library/lux" "Frac"] - (0 #0 "#Frac" #Nil))) + (0 #0 "#Frac" #End))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "doc"])] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]] - #Nil))] + #End))] #1) ("lux def" Text ("lux type check type" (9 #1 ["library/lux" "Text"] - (0 #0 "#Text" #Nil))) + (0 #0 "#Text" #End))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "doc"])] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 "Your standard, run-of-the-mill string values.")]] - #Nil))] + #End))] #1) ("lux def" Name @@ -151,9 +151,9 @@ (9 #1 ["library/lux" "Name"] (2 #0 Text Text))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "doc"])] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 "A name. It is used as part of Lux syntax to represent identifiers and tags.")]] - #Nil))] + #End))] #1) ## (type: (Maybe a) @@ -161,17 +161,17 @@ ## (#Some a)) ("lux def type tagged" Maybe (9 #1 ["library/lux" "Maybe"] - (7 #0 #Nil + (7 #0 #End (1 #0 ## "lux.None" Any ## "lux.Some" (4 #0 1)))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "type-args"])] - [dummy_location (9 #0 (#Cons [dummy_location (5 #0 "a")] #Nil))]] - (#Cons [[dummy_location (7 #0 ["library/lux" "doc"])] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "type-args"])] + [dummy_location (9 #0 (#Item [dummy_location (5 #0 "a")] #End))]] + (#Item [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 "A potentially missing value.")]] - #Nil)))] + #End)))] ["None" "Some"] #1) @@ -194,7 +194,7 @@ ({Type_List ({Type_Pair (9 #0 Nothing - (7 #0 #Nil + (7 #0 #End (1 #0 ## "lux.Primitive" (2 #0 Text Type_List) (1 #0 ## "lux.Sum" @@ -221,11 +221,11 @@ ("lux type check type" (9 #0 Type List)))} ("lux type check type" (9 #0 (4 #0 1) (4 #0 0))))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "doc"])] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 "This type represents the data-structures that are used to specify types themselves.")]] - (#Cons [[dummy_location (7 #0 ["library/lux" "type-rec?"])] + (#Item [[dummy_location (7 #0 ["library/lux" "type-rec?"])] [dummy_location (0 #0 #1)]] - #Nil)))] + #End)))] ["Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"] #1) @@ -237,9 +237,9 @@ (#Named ["library/lux" "Location"] (#Product Text (#Product Nat Nat))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "doc"])] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 "Locations are for specifying the location of Code nodes in Lux files during compilation.")]] - #Nil))] + #End))] ["module" "line" "column"] #1) @@ -248,16 +248,16 @@ ## #datum v}) ("lux def type tagged" Ann (#Named ["library/lux" "Ann"] - (#UnivQ #Nil - (#UnivQ #Nil + (#UnivQ #End + (#UnivQ #End (#Product (#Parameter 3) (#Parameter 1))))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "doc"])] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "doc"])] [dummy_location (5 #0 "The type of things that can be annotated with meta-data of arbitrary types.")]] - (#Cons [[dummy_location (7 #0 ["library/lux" "type-args"])] - [dummy_location (9 #0 (#Cons [dummy_location (5 #0 "m")] (#Cons [dummy_location (5 #0 "v")] #Nil)))]] - #Nil)))] + (#Item [[dummy_location (7 #0 ["library/lux" "type-args"])] + [dummy_location (9 #0 (#Item [dummy_location (5 #0 "m")] (#Item [dummy_location (5 #0 "v")] #End)))]] + #End)))] ["meta" "datum"] #1) @@ -277,7 +277,7 @@ (#Named ["library/lux" "Code'"] ({Code ({Code_List - (#UnivQ #Nil + (#UnivQ #End (#Sum ## "lux.Bit" Bit (#Sum ## "lux.Nat" @@ -307,9 +307,9 @@ (#Parameter 0)) (#Parameter 1))))) [dummy_location - (9 #1 (#Cons [[dummy_location (7 #0 ["library/lux" "type-args"])] - [dummy_location (9 #0 (#Cons [dummy_location (5 #0 "w")] #Nil))]] - #Nil))] + (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "type-args"])] + [dummy_location (9 #0 (#Item [dummy_location (5 #0 "w")] #End))]] + #End))] ["Bit" "Nat" "Int" "Rev" "Frac" "Text" "Identifier" "Tag" "Form" "Tuple" "Record"] #1) @@ -321,9 +321,9 @@ (#Apply (#Apply w Code') w)} ("lux type check type" (#Apply Location Ann)))) [dummy_location - (#Record (#Cons [[dummy_location (#Tag ["library/lux" "doc"])] + (#Record (#Item [[dummy_location (#Tag ["library/lux" "doc"])] [dummy_location (#Text "The type of Code nodes for Lux syntax.")]] - #Nil))] + #End))] #1) ("lux def" _ann @@ -333,85 +333,85 @@ Code) ([_ data] [dummy_location data])) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" bit$ ("lux type check" (#Function Bit Code) ([_ value] (_ann (#Bit value)))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" nat$ ("lux type check" (#Function Nat Code) ([_ value] (_ann (#Nat value)))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" int$ ("lux type check" (#Function Int Code) ([_ value] (_ann (#Int value)))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" rev$ ("lux type check" (#Function Rev Code) ([_ value] (_ann (#Rev value)))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" frac$ ("lux type check" (#Function Frac Code) ([_ value] (_ann (#Frac value)))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" text$ ("lux type check" (#Function Text Code) ([_ text] (_ann (#Text text)))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" identifier$ ("lux type check" (#Function Name Code) ([_ name] (_ann (#Identifier name)))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" local_identifier$ ("lux type check" (#Function Text Code) ([_ name] (_ann (#Identifier ["" name])))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" tag$ ("lux type check" (#Function Name Code) ([_ name] (_ann (#Tag name)))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" local_tag$ ("lux type check" (#Function Text Code) ([_ name] (_ann (#Tag ["" name])))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" form$ ("lux type check" (#Function (#Apply Code List) Code) ([_ tokens] (_ann (#Form tokens)))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" tuple$ ("lux type check" (#Function (#Apply Code List) Code) ([_ tokens] (_ann (#Tuple tokens)))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ("lux def" record$ ("lux type check" (#Function (#Apply (#Product Code Code) List) Code) ([_ tokens] (_ann (#Record tokens)))) - [dummy_location (#Record #Nil)] + [dummy_location (#Record #End)] #0) ## (type: Definition @@ -420,9 +420,9 @@ ("lux type check type" (#Named ["library/lux" "Definition"] (#Product Bit (#Product Type (#Product Code Any))))) - (record$ (#Cons [(tag$ ["library/lux" "doc"]) + (record$ (#Item [(tag$ ["library/lux" "doc"]) (text$ "Represents all the data associated with a definition: its type, its annotations, and its value.")] - #Nil)) + #End)) #1) ## (type: Alias @@ -431,7 +431,7 @@ ("lux type check type" (#Named ["library/lux" "Alias"] Name)) - (record$ #Nil) + (record$ #End) #1) ## (type: Global @@ -441,9 +441,9 @@ (#Named ["library/lux" "Global"] (#Sum Alias Definition)) - (record$ (#Cons [(tag$ ["library/lux" "doc"]) + (record$ (#Item [(tag$ ["library/lux" "doc"]) (text$ "Represents all the data associated with a global constant.")] - #Nil)) + #End)) ["Alias" "Definition"] #1) @@ -452,17 +452,17 @@ ## #mappings (List [k v])}) ("lux def type tagged" Bindings (#Named ["library/lux" "Bindings"] - (#UnivQ #Nil - (#UnivQ #Nil + (#UnivQ #End + (#UnivQ #End (#Product ## "lux.counter" Nat ## "lux.mappings" (#Apply (#Product (#Parameter 3) (#Parameter 1)) List))))) - (record$ (#Cons [(tag$ ["library/lux" "type-args"]) - (tuple$ (#Cons (text$ "k") (#Cons (text$ "v") #Nil)))] - #Nil)) + (record$ (#Item [(tag$ ["library/lux" "type-args"]) + (tuple$ (#Item (text$ "k") (#Item (text$ "v") #End)))] + #End)) ["counter" "mappings"] #1) @@ -475,7 +475,7 @@ Nat ## Captured Nat)) - (record$ #Nil) + (record$ #End) ["Local" "Captured"] #1) @@ -494,14 +494,14 @@ (#Apply (#Product Type Nat) (#Apply Text Bindings)) ## captured (#Apply (#Product Type Ref) (#Apply Text Bindings)))))) - (record$ #Nil) + (record$ #End) ["name" "inner" "locals" "captured"] #1) ("lux def" Code_List ("lux type check type" (#Apply Code List)) - (record$ #Nil) + (record$ #End) #0) ## (type: (Either l r) @@ -509,17 +509,17 @@ ## (#Right r)) ("lux def type tagged" Either (#Named ["library/lux" "Either"] - (#UnivQ #Nil - (#UnivQ #Nil + (#UnivQ #End + (#UnivQ #End (#Sum ## "lux.Left" (#Parameter 3) ## "lux.Right" (#Parameter 1))))) - (record$ (#Cons [(tag$ ["library/lux" "type-args"]) - (tuple$ (#Cons (text$ "l") (#Cons (text$ "r") #Nil)))] - (#Cons [(tag$ ["library/lux" "doc"]) + (record$ (#Item [(tag$ ["library/lux" "type-args"]) + (tuple$ (#Item (text$ "l") (#Item (text$ "r") #End)))] + (#Item [(tag$ ["library/lux" "doc"]) (text$ "A choice between two values of different types.")] - #Nil))) + #End))) ["Left" "Right"] #1) @@ -529,7 +529,7 @@ ("lux type check type" (#Named ["library/lux" "Source"] (#Product Location (#Product Nat Text)))) - (record$ #Nil) + (record$ #End) #1) ## (type: Module_State @@ -546,7 +546,7 @@ Any ## #Cached Any))) - (record$ #Nil) + (record$ #End) ["Active" "Compiled" "Cached"] #1) @@ -586,9 +586,9 @@ (#Apply Code Maybe) Module_State)) )))))) - (record$ (#Cons [(tag$ ["library/lux" "doc"]) + (record$ (#Item [(tag$ ["library/lux" "doc"]) (text$ "All the information contained within a Lux module.")] - #Nil)) + #End)) ["module_hash" "module_aliases" "definitions" "imports" "tags" "types" "module_annotations" "module_state"] #1) @@ -605,7 +605,7 @@ ## var_bindings (#Apply (#Product Nat (#Apply Type Maybe)) List)))) - (record$ #Nil) + (record$ #End) ["ex_counter" "var_counter" "var_bindings"] #1) @@ -621,9 +621,9 @@ Any ## Interpreter Any))) - (record$ (#Cons [(tag$ ["library/lux" "doc"]) + (record$ (#Item [(tag$ ["library/lux" "doc"]) (text$ "A sign that shows the conditions under which the compiler is running.")] - #Nil)) + #End)) ["Build" "Eval" "Interpreter"] #1) @@ -641,9 +641,9 @@ Text ## mode Mode))) - (record$ (#Cons [(tag$ ["library/lux" "doc"]) + (record$ (#Item [(tag$ ["library/lux" "doc"]) (text$ "Information about the current version and type of compiler that is running.")] - #Nil)) + #End)) ["target" "version" "mode"] #1) @@ -686,13 +686,13 @@ Any ## "lux.host" Any)))))))))))) - (record$ (#Cons [(tag$ ["library/lux" "doc"]) + (record$ (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "Represents the state of the Lux compiler during a run." __paragraph) ("lux text concat" ("lux text concat" "It is provided to macros during their invocation, so they can access compiler data." __paragraph) "Caveat emptor: Avoid fiddling with it, unless you know what you're doing.")))] - #Nil)) + #End)) ["info" "source" "location" "current_module" "modules" "scopes" "type_context" "expected" "seed" "scope_type_vars" "extensions" "host"] #1) @@ -701,17 +701,17 @@ ("lux def" Meta ("lux type check type" (#Named ["library/lux" "Meta"] - (#UnivQ #Nil + (#UnivQ #End (#Function Lux (#Apply (#Product Lux (#Parameter 1)) (#Apply Text Either)))))) - (record$ (#Cons [(tag$ ["library/lux" "doc"]) + (record$ (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "Computations that can have access to the state of the compiler." __paragraph) "These computations may fail, or modify the state of the compiler."))] - (#Cons [(tag$ ["library/lux" "type-args"]) - (tuple$ (#Cons (text$ "a") #Nil))] - #Nil))) + (#Item [(tag$ ["library/lux" "type-args"]) + (tuple$ (#Item (text$ "a") #End))] + #End))) #1) ## (type: Macro' @@ -720,7 +720,7 @@ ("lux type check type" (#Named ["library/lux" "Macro'"] (#Function Code_List (#Apply Code_List Meta)))) - (record$ #Nil) + (record$ #End) #1) ## (type: Macro @@ -728,16 +728,16 @@ ("lux def" Macro ("lux type check type" (#Named ["library/lux" "Macro"] - (#Primitive "#Macro" #Nil))) - (record$ (#Cons [(tag$ ["library/lux" "doc"]) + (#Primitive "#Macro" #End))) + (record$ (#Item [(tag$ ["library/lux" "doc"]) (text$ "Functions that run at compile-time and allow you to transform and extend the language in powerful ways.")] - #Nil)) + #End)) #1) ## Base functions & macros ("lux def" return ("lux type check" - (#UnivQ #Nil + (#UnivQ #End (#Function (#Parameter 1) (#Function Lux (#Apply (#Product Lux @@ -746,12 +746,12 @@ ([_ val] ([_ state] (#Right state val)))) - (record$ #Nil) + (record$ #End) #0) ("lux def" failure ("lux type check" - (#UnivQ #Nil + (#UnivQ #End (#Function Text (#Function Lux (#Apply (#Product Lux @@ -760,266 +760,266 @@ ([_ msg] ([_ state] (#Left msg)))) - (record$ #Nil) + (record$ #End) #0) ("lux def" let'' ("lux macro" ([_ tokens] - ({(#Cons lhs (#Cons rhs (#Cons body #Nil))) - (return (#Cons (form$ (#Cons (record$ (#Cons [lhs body] #Nil)) (#Cons rhs #Nil))) - #Nil)) + ({(#Item lhs (#Item rhs (#Item body #End))) + (return (#Item (form$ (#Item (record$ (#Item [lhs body] #End)) (#Item rhs #End))) + #End)) _ (failure "Wrong syntax for let''")} tokens))) - (record$ #.Nil) + (record$ #.End) #0) ("lux def" function'' ("lux macro" ([_ tokens] - ({(#Cons [_ (#Tuple (#Cons arg args'))] (#Cons body #Nil)) - (return (#Cons (_ann (#Form (#Cons (_ann (#Tuple (#Cons (_ann (#Identifier ["" ""])) - (#Cons arg #Nil)))) - (#Cons ({#Nil + ({(#Item [_ (#Tuple (#Item arg args'))] (#Item body #End)) + (return (#Item (_ann (#Form (#Item (_ann (#Tuple (#Item (_ann (#Identifier ["" ""])) + (#Item arg #End)))) + (#Item ({#End body _ - (_ann (#Form (#Cons (_ann (#Identifier ["library/lux" "function''"])) - (#Cons (_ann (#Tuple args')) - (#Cons body #Nil)))))} + (_ann (#Form (#Item (_ann (#Identifier ["library/lux" "function''"])) + (#Item (_ann (#Tuple args')) + (#Item body #End)))))} args') - #Nil)))) - #Nil)) + #End)))) + #End)) - (#Cons [_ (#Identifier ["" self])] (#Cons [_ (#Tuple (#Cons arg args'))] (#Cons body #Nil))) - (return (#Cons (_ann (#Form (#Cons (_ann (#Tuple (#Cons (_ann (#Identifier ["" self])) - (#Cons arg #Nil)))) - (#Cons ({#Nil + (#Item [_ (#Identifier ["" self])] (#Item [_ (#Tuple (#Item arg args'))] (#Item body #End))) + (return (#Item (_ann (#Form (#Item (_ann (#Tuple (#Item (_ann (#Identifier ["" self])) + (#Item arg #End)))) + (#Item ({#End body _ - (_ann (#Form (#Cons (_ann (#Identifier ["library/lux" "function''"])) - (#Cons (_ann (#Tuple args')) - (#Cons body #Nil)))))} + (_ann (#Form (#Item (_ann (#Identifier ["library/lux" "function''"])) + (#Item (_ann (#Tuple args')) + (#Item body #End)))))} args') - #Nil)))) - #Nil)) + #End)))) + #End)) _ (failure "Wrong syntax for function''")} tokens))) - (record$ #.Nil) + (record$ #.End) #0) ("lux def" location_code ("lux type check" Code - (tuple$ (#Cons (text$ "") (#Cons (nat$ 0) (#Cons (nat$ 0) #Nil))))) - (record$ #Nil) + (tuple$ (#Item (text$ "") (#Item (nat$ 0) (#Item (nat$ 0) #End))))) + (record$ #End) #0) ("lux def" meta_code ("lux type check" (#Function Name (#Function Code Code)) ([_ tag] ([_ value] - (tuple$ (#Cons location_code - (#Cons (form$ (#Cons (tag$ tag) (#Cons value #Nil))) - #Nil)))))) - (record$ #Nil) + (tuple$ (#Item location_code + (#Item (form$ (#Item (tag$ tag) (#Item value #End))) + #End)))))) + (record$ #End) #0) ("lux def" flag_meta ("lux type check" (#Function Text Code) ([_ tag] - (tuple$ (#Cons [(meta_code ["library/lux" "Tag"] (tuple$ (#Cons (text$ "library/lux") (#Cons (text$ tag) #Nil)))) - (#Cons [(meta_code ["library/lux" "Bit"] (bit$ #1)) - #Nil])])))) - (record$ #Nil) + (tuple$ (#Item [(meta_code ["library/lux" "Tag"] (tuple$ (#Item (text$ "library/lux") (#Item (text$ tag) #End)))) + (#Item [(meta_code ["library/lux" "Bit"] (bit$ #1)) + #End])])))) + (record$ #End) #0) ("lux def" doc_meta ("lux type check" (#Function Text (#Product Code Code)) (function'' [doc] [(tag$ ["library/lux" "doc"]) (text$ doc)])) - (record$ #Nil) + (record$ #End) #0) ("lux def" as_def ("lux type check" (#Function Code (#Function Code (#Function Code (#Function Bit Code)))) (function'' [name value annotations exported?] - (form$ (#Cons (text$ "lux def") (#Cons name (#Cons value (#Cons annotations (#Cons (bit$ exported?) #Nil)))))))) - (record$ #Nil) + (form$ (#Item (text$ "lux def") (#Item name (#Item value (#Item annotations (#Item (bit$ exported?) #End)))))))) + (record$ #End) #0) ("lux def" as_checked ("lux type check" (#Function Code (#Function Code Code)) (function'' [type value] - (form$ (#Cons (text$ "lux type check") (#Cons type (#Cons value #Nil)))))) - (record$ #Nil) + (form$ (#Item (text$ "lux type check") (#Item type (#Item value #End)))))) + (record$ #End) #0) ("lux def" as_function ("lux type check" (#Function Code (#Function (#Apply Code List) (#Function Code Code))) (function'' [self inputs output] - (form$ (#Cons (identifier$ ["library/lux" "function''"]) - (#Cons self - (#Cons (tuple$ inputs) - (#Cons output #Nil))))))) - (record$ #Nil) + (form$ (#Item (identifier$ ["library/lux" "function''"]) + (#Item self + (#Item (tuple$ inputs) + (#Item output #End))))))) + (record$ #End) #0) ("lux def" as_macro ("lux type check" (#Function Code Code) (function'' [expression] - (form$ (#Cons (text$ "lux macro") - (#Cons expression - #Nil))))) - (record$ #Nil) + (form$ (#Item (text$ "lux macro") + (#Item expression + #End))))) + (record$ #End) #0) ("lux def" def:'' ("lux macro" (function'' [tokens] - ({(#Cons [[_ (#Tag ["" "export"])] - (#Cons [[_ (#Form (#Cons [name args]))] - (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) - (return (#Cons [(as_def name (as_checked type (as_function name args body)) - (form$ (#Cons (identifier$ ["library/lux" "record$"]) - (#Cons meta - #Nil))) + ({(#Item [[_ (#Tag ["" "export"])] + (#Item [[_ (#Form (#Item [name args]))] + (#Item [meta (#Item [type (#Item [body #End])])])])]) + (return (#Item [(as_def name (as_checked type (as_function name args body)) + (form$ (#Item (identifier$ ["library/lux" "record$"]) + (#Item meta + #End))) #1) - #Nil])) + #End])) - (#Cons [[_ (#Tag ["" "export"])] (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) - (return (#Cons [(as_def name (as_checked type body) - (form$ (#Cons (identifier$ ["library/lux" "record$"]) - (#Cons meta - #Nil))) + (#Item [[_ (#Tag ["" "export"])] (#Item [name (#Item [meta (#Item [type (#Item [body #End])])])])]) + (return (#Item [(as_def name (as_checked type body) + (form$ (#Item (identifier$ ["library/lux" "record$"]) + (#Item meta + #End))) #1) - #Nil])) - - (#Cons [[_ (#Form (#Cons [name args]))] - (#Cons [meta (#Cons [type (#Cons [body #Nil])])])]) - (return (#Cons [(as_def name (as_checked type (as_function name args body)) - (form$ (#Cons (identifier$ ["library/lux" "record$"]) - (#Cons meta - #Nil))) + #End])) + + (#Item [[_ (#Form (#Item [name args]))] + (#Item [meta (#Item [type (#Item [body #End])])])]) + (return (#Item [(as_def name (as_checked type (as_function name args body)) + (form$ (#Item (identifier$ ["library/lux" "record$"]) + (#Item meta + #End))) #0) - #Nil])) + #End])) - (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])]) - (return (#Cons [(as_def name (as_checked type body) - (form$ (#Cons (identifier$ ["library/lux" "record$"]) - (#Cons meta - #Nil))) + (#Item [name (#Item [meta (#Item [type (#Item [body #End])])])]) + (return (#Item [(as_def name (as_checked type body) + (form$ (#Item (identifier$ ["library/lux" "record$"]) + (#Item meta + #End))) #0) - #Nil])) + #End])) _ (failure "Wrong syntax for def''")} tokens))) - (record$ #.Nil) + (record$ #.End) #0) ("lux def" macro:' ("lux macro" (function'' [tokens] - ({(#Cons [_ (#Form (#Cons name args))] (#Cons body #Nil)) - (return (#Cons (as_def name (as_macro (as_function name args body)) - (form$ (#Cons (identifier$ ["library/lux" "record$"]) - (#Cons (tag$ ["library/lux" "Nil"]) - #Nil))) + ({(#Item [_ (#Form (#Item name args))] (#Item body #End)) + (return (#Item (as_def name (as_macro (as_function name args body)) + (form$ (#Item (identifier$ ["library/lux" "record$"]) + (#Item (tag$ ["library/lux" "End"]) + #End))) #0) - #Nil)) + #End)) - (#Cons [_ (#Tag ["" "export"])] (#Cons [_ (#Form (#Cons name args))] (#Cons body #Nil))) - (return (#Cons (as_def name (as_macro (as_function name args body)) - (form$ (#Cons (identifier$ ["library/lux" "record$"]) - (#Cons (tag$ ["library/lux" "Nil"]) - #Nil))) + (#Item [_ (#Tag ["" "export"])] (#Item [_ (#Form (#Item name args))] (#Item body #End))) + (return (#Item (as_def name (as_macro (as_function name args body)) + (form$ (#Item (identifier$ ["library/lux" "record$"]) + (#Item (tag$ ["library/lux" "End"]) + #End))) #1) - #Nil)) + #End)) - (#Cons [_ (#Tag ["" "export"])] (#Cons [_ (#Form (#Cons name args))] (#Cons meta_data (#Cons body #Nil)))) - (return (#Cons (as_def name (as_macro (as_function name args body)) - (form$ (#Cons (identifier$ ["library/lux" "record$"]) - (#Cons meta_data - #Nil))) + (#Item [_ (#Tag ["" "export"])] (#Item [_ (#Form (#Item name args))] (#Item meta_data (#Item body #End)))) + (return (#Item (as_def name (as_macro (as_function name args body)) + (form$ (#Item (identifier$ ["library/lux" "record$"]) + (#Item meta_data + #End))) #1) - #Nil)) + #End)) _ (failure "Wrong syntax for macro:'")} tokens))) - (record$ #.Nil) + (record$ #.End) #0) (macro:' #export (comment tokens) - (#Cons [(tag$ ["library/lux" "doc"]) + (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Throws away any code given to it." __paragraph) ("lux text concat" ("lux text concat" "## Great for commenting-out code, while retaining syntax high-lighting and formatting in your text editor." __paragraph) "(comment +1 +2 +3 +4)")))] - #Nil) - (return #Nil)) + #End) + (return #End)) (macro:' ($' tokens) - ({(#Cons x #Nil) + ({(#Item x #End) (return tokens) - (#Cons x (#Cons y xs)) - (return (#Cons (form$ (#Cons (identifier$ ["library/lux" "$'"]) - (#Cons (form$ (#Cons (tag$ ["library/lux" "Apply"]) - (#Cons y (#Cons x #Nil)))) + (#Item x (#Item y xs)) + (return (#Item (form$ (#Item (identifier$ ["library/lux" "$'"]) + (#Item (form$ (#Item (tag$ ["library/lux" "Apply"]) + (#Item y (#Item x #End)))) xs))) - #Nil)) + #End)) _ (failure "Wrong syntax for $'")} tokens)) (def:'' (list\map f xs) - #Nil - (#UnivQ #Nil - (#UnivQ #Nil + #End + (#UnivQ #End + (#UnivQ #End (#Function (#Function (#Parameter 3) (#Parameter 1)) (#Function ($' List (#Parameter 3)) ($' List (#Parameter 1)))))) - ({#Nil - #Nil + ({#End + #End - (#Cons x xs') - (#Cons (f x) (list\map f xs'))} + (#Item x xs') + (#Item (f x) (list\map f xs'))} xs)) (def:'' RepEnv - #Nil + #End Type ($' List (#Product Text Code))) (def:'' (make_env xs ys) - #Nil + #End (#Function ($' List Text) (#Function ($' List Code) RepEnv)) - ({[(#Cons x xs') (#Cons y ys')] - (#Cons [x y] (make_env xs' ys')) + ({[(#Item x xs') (#Item y ys')] + (#Item [x y] (make_env xs' ys')) _ - #Nil} + #End} [xs ys])) (def:'' (text\= reference sample) - #Nil + #End (#Function Text (#Function Text Bit)) ("lux text =" reference sample)) (def:'' (get_rep key env) - #Nil + #End (#Function Text (#Function RepEnv ($' Maybe Code))) - ({#Nil + ({#End #None - (#Cons [k v] env') + (#Item [k v] env') ({#1 (#Some v) @@ -1029,7 +1029,7 @@ env)) (def:'' (replace_syntax reps syntax) - #Nil + #End (#Function RepEnv (#Function Code Code)) ({[_ (#Identifier "" name)] ({(#Some replacement) @@ -1058,7 +1058,7 @@ syntax)) (def:'' (n/* param subject) - (#.Cons (doc_meta "Nat(ural) multiplication.") #.Nil) + (#.Item (doc_meta "Nat(ural) multiplication.") #.End) (#Function Nat (#Function Nat Nat)) ("lux type as" Nat ("lux i64 *" @@ -1066,7 +1066,7 @@ ("lux type as" Int subject)))) (def:'' (update_parameters code) - #Nil + #End (#Function Code Code) ({[_ (#Tuple members)] (tuple$ (list\map update_parameters members)) @@ -1078,8 +1078,8 @@ [name (update_parameters val)]))) pairs)) - [_ (#Form (#Cons [_ (#Tag "library/lux" "Parameter")] (#Cons [_ (#Nat idx)] #Nil)))] - (form$ (#Cons (tag$ ["library/lux" "Parameter"]) (#Cons (nat$ ("lux i64 +" 2 idx)) #Nil))) + [_ (#Form (#Item [_ (#Tag "library/lux" "Parameter")] (#Item [_ (#Nat idx)] #End)))] + (form$ (#Item (tag$ ["library/lux" "Parameter"]) (#Item (nat$ ("lux i64 +" 2 idx)) #End))) [_ (#Form members)] (form$ (list\map update_parameters members)) @@ -1089,51 +1089,51 @@ code)) (def:'' (quantified_args_parser args next) - #Nil + #End ## (-> (List Code) (-> (List Text) (Meta (List Code))) (Meta (List Code))) (#Function ($' List Code) (#Function (#Function ($' List Text) (#Apply ($' List Code) Meta)) (#Apply ($' List Code) Meta) )) - ({#Nil - (next #Nil) + ({#End + (next #End) - (#Cons [_ (#Identifier "" arg_name)] args') - (quantified_args_parser args' (function'' [names] (next (#Cons arg_name names)))) + (#Item [_ (#Identifier "" arg_name)] args') + (quantified_args_parser args' (function'' [names] (next (#Item arg_name names)))) _ (failure "Expected identifier.")} args)) (def:'' (make_parameter idx) - #Nil + #End (#Function Nat Code) - (form$ (#Cons (tag$ ["library/lux" "Parameter"]) (#Cons (nat$ idx) #Nil)))) + (form$ (#Item (tag$ ["library/lux" "Parameter"]) (#Item (nat$ idx) #End)))) (def:'' (list\fold f init xs) - #Nil + #End ## (All [a b] (-> (-> b a a) a (List b) a)) - (#UnivQ #Nil (#UnivQ #Nil (#Function (#Function (#Parameter 1) + (#UnivQ #End (#UnivQ #End (#Function (#Function (#Parameter 1) (#Function (#Parameter 3) (#Parameter 3))) (#Function (#Parameter 3) (#Function ($' List (#Parameter 1)) (#Parameter 3)))))) - ({#Nil + ({#End init - (#Cons x xs') + (#Item x xs') (list\fold f (f x init) xs')} xs)) (def:'' (list\size list) - #Nil - (#UnivQ #Nil + #End + (#UnivQ #End (#Function ($' List (#Parameter 1)) Nat)) (list\fold (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list)) (macro:' #export (All tokens) - (#Cons [(tag$ ["library/lux" "doc"]) + (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Universal quantification." __paragraph) ("lux text concat" @@ -1141,43 +1141,43 @@ ("lux text concat" ("lux text concat" "## A name can be provided, to specify a recursive type." __paragraph) "(All List [a] (| Any [a (List a)]))"))))] - #Nil) - (let'' [self_name tokens] ({(#Cons [_ (#Identifier "" self_name)] tokens) + #End) + (let'' [self_name tokens] ({(#Item [_ (#Identifier "" self_name)] tokens) [self_name tokens] _ ["" tokens]} tokens) - ({(#Cons [_ (#Tuple args)] (#Cons body #Nil)) + ({(#Item [_ (#Tuple args)] (#Item body #End)) (quantified_args_parser args (function'' [names] (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code)) (function'' [name' body'] - (form$ (#Cons (tag$ ["library/lux" "UnivQ"]) - (#Cons (tag$ ["library/lux" "Nil"]) - (#Cons (replace_syntax (#Cons [name' (make_parameter 1)] #Nil) - (update_parameters body')) #Nil)))))) + (form$ (#Item (tag$ ["library/lux" "UnivQ"]) + (#Item (tag$ ["library/lux" "End"]) + (#Item (replace_syntax (#Item [name' (make_parameter 1)] #End) + (update_parameters body')) #End)))))) body names) - (return (#Cons ({[#1 _] + (return (#Item ({[#1 _] body' - [_ #Nil] + [_ #End] body' [#0 _] - (replace_syntax (#Cons [self_name (make_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] - #Nil) + (replace_syntax (#Item [self_name (make_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] + #End) body')} [(text\= "" self_name) names]) - #Nil))))) + #End))))) _ (failure "Wrong syntax for All")} tokens))) (macro:' #export (Ex tokens) - (#Cons [(tag$ ["library/lux" "doc"]) + (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Existential quantification." __paragraph) ("lux text concat" @@ -1185,93 +1185,93 @@ ("lux text concat" ("lux text concat" "## A name can be provided, to specify a recursive type." __paragraph) "(Ex Self [a] [(Codec Text a) a (List (Self a))])"))))] - #Nil) - (let'' [self_name tokens] ({(#Cons [_ (#Identifier "" self_name)] tokens) + #End) + (let'' [self_name tokens] ({(#Item [_ (#Identifier "" self_name)] tokens) [self_name tokens] _ ["" tokens]} tokens) - ({(#Cons [_ (#Tuple args)] (#Cons body #Nil)) + ({(#Item [_ (#Tuple args)] (#Item body #End)) (quantified_args_parser args (function'' [names] (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code)) (function'' [name' body'] - (form$ (#Cons (tag$ ["library/lux" "ExQ"]) - (#Cons (tag$ ["library/lux" "Nil"]) - (#Cons (replace_syntax (#Cons [name' (make_parameter 1)] #Nil) - (update_parameters body')) #Nil)))))) + (form$ (#Item (tag$ ["library/lux" "ExQ"]) + (#Item (tag$ ["library/lux" "End"]) + (#Item (replace_syntax (#Item [name' (make_parameter 1)] #End) + (update_parameters body')) #End)))))) body names) - (return (#Cons ({[#1 _] + (return (#Item ({[#1 _] body' - [_ #Nil] + [_ #End] body' [#0 _] - (replace_syntax (#Cons [self_name (make_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] - #Nil) + (replace_syntax (#Item [self_name (make_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] + #End) body')} [(text\= "" self_name) names]) - #Nil))))) + #End))))) _ (failure "Wrong syntax for Ex")} tokens))) (def:'' (list\reverse list) - #Nil + #End (All [a] (#Function ($' List a) ($' List a))) (list\fold ("lux type check" (All [a] (#Function a (#Function ($' List a) ($' List a)))) - (function'' [head tail] (#Cons head tail))) - #Nil + (function'' [head tail] (#Item head tail))) + #End list)) (macro:' #export (-> tokens) - (#Cons [(tag$ ["library/lux" "doc"]) + (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Function types:" __paragraph) ("lux text concat" ("lux text concat" "(-> Int Int Int)" __paragraph) "## This is the type of a function that takes 2 Ints and returns an Int.")))] - #Nil) - ({(#Cons output inputs) - (return (#Cons (list\fold ("lux type check" (#Function Code (#Function Code Code)) - (function'' [i o] (form$ (#Cons (tag$ ["library/lux" "Function"]) (#Cons i (#Cons o #Nil)))))) + #End) + ({(#Item output inputs) + (return (#Item (list\fold ("lux type check" (#Function Code (#Function Code Code)) + (function'' [i o] (form$ (#Item (tag$ ["library/lux" "Function"]) (#Item i (#Item o #End)))))) output inputs) - #Nil)) + #End)) _ (failure "Wrong syntax for ->")} (list\reverse tokens))) (macro:' #export (list xs) - (#Cons [(tag$ ["library/lux" "doc"]) + (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## List-construction macro." __paragraph) "(list +1 +2 +3)"))] - #Nil) - (return (#Cons (list\fold (function'' [head tail] - (form$ (#Cons (tag$ ["library/lux" "Cons"]) - (#Cons (tuple$ (#Cons [head (#Cons [tail #Nil])])) - #Nil)))) - (tag$ ["library/lux" "Nil"]) + #End) + (return (#Item (list\fold (function'' [head tail] + (form$ (#Item (tag$ ["library/lux" "Item"]) + (#Item (tuple$ (#Item [head (#Item [tail #End])])) + #End)))) + (tag$ ["library/lux" "End"]) (list\reverse xs)) - #Nil))) + #End))) (macro:' #export (list& xs) - (#Cons [(tag$ ["library/lux" "doc"]) + (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## List-construction macro, with the last element being a tail-list." __paragraph) ("lux text concat" ("lux text concat" "## In other words, this macro prepends elements to another list." __paragraph) "(list& +1 +2 +3 (list +4 +5 +6))")))] - #Nil) - ({(#Cons last init) + #End) + ({(#Item last init) (return (list (list\fold (function'' [head tail] - (form$ (list (tag$ ["library/lux" "Cons"]) + (form$ (list (tag$ ["library/lux" "Item"]) (tuple$ (list head tail))))) last init))) @@ -1281,7 +1281,7 @@ (list\reverse xs))) (macro:' #export (& tokens) - (#Cons [(tag$ ["library/lux" "doc"]) + (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Tuple types:" __paragraph) ("lux text concat" @@ -1289,18 +1289,18 @@ ("lux text concat" ("lux text concat" "## Any." __paragraph) "(&)"))))] - #Nil) - ({#Nil + #End) + ({#End (return (list (identifier$ ["library/lux" "Any"]))) - (#Cons last prevs) + (#Item last prevs) (return (list (list\fold (function'' [left right] (form$ (list (tag$ ["library/lux" "Product"]) left right))) last prevs)))} (list\reverse tokens))) (macro:' #export (| tokens) - (#Cons [(tag$ ["library/lux" "doc"]) + (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Variant types:" __paragraph) ("lux text concat" @@ -1308,28 +1308,28 @@ ("lux text concat" ("lux text concat" "## Nothing." __paragraph) "(|)"))))] - #Nil) - ({#Nil + #End) + ({#End (return (list (identifier$ ["library/lux" "Nothing"]))) - (#Cons last prevs) + (#Item last prevs) (return (list (list\fold (function'' [left right] (form$ (list (tag$ ["library/lux" "Sum"]) left right))) last prevs)))} (list\reverse tokens))) (macro:' (function' tokens) - (let'' [name tokens'] ({(#Cons [[_ (#Identifier ["" name])] tokens']) + (let'' [name tokens'] ({(#Item [[_ (#Identifier ["" name])] tokens']) [name tokens'] _ ["" tokens]} tokens) - ({(#Cons [[_ (#Tuple args)] (#Cons [body #Nil])]) - ({#Nil + ({(#Item [[_ (#Tuple args)] (#Item [body #End])]) + ({#End (failure "function' requires a non-empty arguments tuple.") - (#Cons [harg targs]) + (#Item [harg targs]) (return (list (form$ (list (tuple$ (list (local_identifier$ name) harg)) (list\fold (function'' [arg body'] @@ -1345,9 +1345,9 @@ tokens'))) (macro:' (def:''' tokens) - ({(#Cons [[_ (#Tag ["" "export"])] - (#Cons [[_ (#Form (#Cons [name args]))] - (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) + ({(#Item [[_ (#Tag ["" "export"])] + (#Item [[_ (#Form (#Item [name args]))] + (#Item [meta (#Item [type (#Item [body #End])])])])]) (return (list (form$ (list (text$ "lux def") name (form$ (list (text$ "lux type check") @@ -1356,24 +1356,24 @@ name (tuple$ args) body)))) - (form$ (#Cons (identifier$ ["library/lux" "record$"]) - (#Cons meta - #Nil))) + (form$ (#Item (identifier$ ["library/lux" "record$"]) + (#Item meta + #End))) (bit$ #1))))) - (#Cons [[_ (#Tag ["" "export"])] (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) + (#Item [[_ (#Tag ["" "export"])] (#Item [name (#Item [meta (#Item [type (#Item [body #End])])])])]) (return (list (form$ (list (text$ "lux def") name (form$ (list (text$ "lux type check") type body)) - (form$ (#Cons (identifier$ ["library/lux" "record$"]) - (#Cons meta - #Nil))) + (form$ (#Item (identifier$ ["library/lux" "record$"]) + (#Item meta + #End))) (bit$ #1))))) - (#Cons [[_ (#Form (#Cons [name args]))] - (#Cons [meta (#Cons [type (#Cons [body #Nil])])])]) + (#Item [[_ (#Form (#Item [name args]))] + (#Item [meta (#Item [type (#Item [body #End])])])]) (return (list (form$ (list (text$ "lux def") name (form$ (list (text$ "lux type check") @@ -1382,18 +1382,18 @@ name (tuple$ args) body)))) - (form$ (#Cons (identifier$ ["library/lux" "record$"]) - (#Cons meta - #Nil))) + (form$ (#Item (identifier$ ["library/lux" "record$"]) + (#Item meta + #End))) (bit$ #0))))) - (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])]) + (#Item [name (#Item [meta (#Item [type (#Item [body #End])])])]) (return (list (form$ (list (text$ "lux def") name (form$ (list (text$ "lux type check") type body)) - (form$ (#Cons (identifier$ ["library/lux" "record$"]) - (#Cons meta - #Nil))) + (form$ (#Item (identifier$ ["library/lux" "record$"]) + (#Item meta + #End))) (bit$ #0))))) _ @@ -1401,17 +1401,17 @@ tokens)) (def:''' (as_pairs xs) - #Nil + #End (All [a] (-> ($' List a) ($' List (& a a)))) - ({(#Cons x (#Cons y xs')) - (#Cons [x y] (as_pairs xs')) + ({(#Item x (#Item y xs')) + (#Item [x y] (as_pairs xs')) _ - #Nil} + #End} xs)) (macro:' (let' tokens) - ({(#Cons [[_ (#Tuple bindings)] (#Cons [body #Nil])]) + ({(#Item [[_ (#Tuple bindings)] (#Item [body #End])]) (return (list (list\fold ("lux type check" (-> (& Code Code) Code Code) (function' [binding body] @@ -1426,46 +1426,46 @@ tokens)) (def:''' (any? p xs) - #Nil + #End (All [a] (-> (-> a Bit) ($' List a) Bit)) - ({#Nil + ({#End #0 - (#Cons x xs') + (#Item x xs') ({#1 #1 #0 (any? p xs')} (p x))} xs)) (def:''' (wrap_meta content) - #Nil + #End (-> Code Code) (tuple$ (list (tuple$ (list (text$ "") (nat$ 0) (nat$ 0))) content))) (def:''' (untemplated_list tokens) - #Nil + #End (-> ($' List Code) Code) - ({#Nil - (_ann (#Tag ["library/lux" "Nil"])) + ({#End + (_ann (#Tag ["library/lux" "End"])) - (#Cons [token tokens']) - (_ann (#Form (list (_ann (#Tag ["library/lux" "Cons"])) token (untemplated_list tokens'))))} + (#Item [token tokens']) + (_ann (#Form (list (_ann (#Tag ["library/lux" "Item"])) token (untemplated_list tokens'))))} tokens)) (def:''' (list\compose xs ys) - #Nil + #End (All [a] (-> ($' List a) ($' List a) ($' List a))) - ({(#Cons x xs') - (#Cons x (list\compose xs' ys)) + ({(#Item x xs') + (#Item x (list\compose xs' ys)) - #Nil + #End ys} xs)) (def:''' (_$_joiner op a1 a2) - #Nil + #End (-> Code Code Code Code) ({[_ (#Form parts)] (form$ (list\compose parts (list a1 a2))) @@ -1475,14 +1475,14 @@ op)) (def:''' (function/flip func) - #Nil + #End (All [a b c] (-> (-> a b c) (-> b a c))) (function' [right left] (func left right))) (macro:' #export (_$ tokens) - (#Cons [(tag$ ["library/lux" "doc"]) + (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Left-association for the application of binary functions over variadic arguments." ..\n) ("lux text concat" @@ -1490,9 +1490,9 @@ ("lux text concat" ("lux text concat" "## =>" ..\n) "(text\compose (text\compose ''Hello, '' name) ''. How are you?'')"))))] - #Nil) - ({(#Cons op tokens') - ({(#Cons first nexts) + #End) + ({(#Item op tokens') + ({(#Item first nexts) (return (list (list\fold (function/flip (_$_joiner op)) first nexts))) _ @@ -1504,7 +1504,7 @@ tokens)) (macro:' #export ($_ tokens) - (#Cons [(tag$ ["library/lux" "doc"]) + (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Right-association for the application of binary functions over variadic arguments." ..\n) ("lux text concat" @@ -1512,9 +1512,9 @@ ("lux text concat" ("lux text concat" "## =>" ..\n) "(text\compose ''Hello, '' (text\compose name ''. How are you?''))"))))] - #Nil) - ({(#Cons op tokens') - ({(#Cons last prevs) + #End) + ({(#Item op tokens') + ({(#Item last prevs) (return (list (list\fold (_$_joiner op) last prevs))) _ @@ -1542,7 +1542,7 @@ #0) (def:''' maybe_monad - #Nil + #End ($' Monad Maybe) {#in (function' [x] (#Some x)) @@ -1554,7 +1554,7 @@ ma))}) (def:''' meta_monad - #Nil + #End ($' Monad Meta) {#in (function' [x] @@ -1572,7 +1572,7 @@ (ma state))))}) (macro:' (do tokens) - ({(#Cons monad (#Cons [_ (#Tuple bindings)] (#Cons body #Nil))) + ({(#Item monad (#Item [_ (#Tuple bindings)] (#Item body #End))) (let' [g!in (local_identifier$ "in") g!bind (local_identifier$ " bind ") body' (list\fold ("lux type check" (-> (& Code Code) Code Code) @@ -1597,7 +1597,7 @@ tokens)) (def:''' (monad\map m f xs) - #Nil + #End ## (All [m a b] ## (-> (Monad m) (-> a (m b)) (List a) (m (List b)))) (All [m a b] @@ -1606,18 +1606,18 @@ ($' List a) ($' m ($' List b)))) (let' [{#in in #bind _} m] - ({#Nil - (in #Nil) + ({#End + (in #End) - (#Cons x xs') + (#Item x xs') (do m [y (f x) ys (monad\map m f xs')] - (in (#Cons y ys)))} + (in (#Item y ys)))} xs))) (def:''' (monad\fold m f y xs) - #Nil + #End ## (All [m a b] ## (-> (Monad m) (-> a b (m b)) b (List a) (m b))) (All [m a b] @@ -1627,10 +1627,10 @@ ($' List a) ($' m b))) (let' [{#in in #bind _} m] - ({#Nil + ({#End (in y) - (#Cons x xs') + (#Item x xs') (do m [y' (f x y)] (monad\fold m f y' xs'))} @@ -1642,7 +1642,7 @@ "Picks which expression to evaluate based on a bit test value." __paragraph "(if #1 ''Oh, yeah!'' ''Aw hell naw!'')" __paragraph "=> ''Oh, yeah!''"))]) - ({(#Cons test (#Cons then (#Cons else #Nil))) + ({(#Item test (#Item then (#Item else #End))) (return (list (form$ (list (record$ (list [(bit$ #1) then] [(bit$ #0) else])) test)))) @@ -1652,38 +1652,38 @@ tokens)) (def:''' (get k plist) - #Nil + #End (All [a] (-> Text ($' List (& Text a)) ($' Maybe a))) - ({(#Cons [[k' v] plist']) + ({(#Item [[k' v] plist']) (if (text\= k k') (#Some v) (get k plist')) - #Nil + #End #None} plist)) (def:''' (put k v dict) - #Nil + #End (All [a] (-> Text a ($' List (& Text a)) ($' List (& Text a)))) - ({#Nil + ({#End (list [k v]) - (#Cons [[k' v'] dict']) + (#Item [[k' v'] dict']) (if (text\= k k') - (#Cons [[k' v] dict']) - (#Cons [[k' v'] (put k v dict')]))} + (#Item [[k' v] dict']) + (#Item [[k' v'] (put k v dict')]))} dict)) (def:''' (text\compose x y) - #Nil + #End (-> Text Text Text) ("lux text concat" x y)) (def:''' (name\encode full_name) - #Nil + #End (-> Name Text) (let' [[module name] full_name] ({"" name @@ -1691,11 +1691,11 @@ module))) (def:''' (get_meta tag def_meta) - #Nil + #End (-> Name Code ($' Maybe Code)) (let' [[prefix name] tag] ({[_ (#Record def_meta)] - ({(#Cons [key value] def_meta') + ({(#Item [key value] def_meta') ({[_ (#Tag [prefix' name'])] ({[#1 #1] (#Some value) @@ -1709,7 +1709,7 @@ (get_meta tag (record$ def_meta'))} key) - #Nil + #End #None} def_meta) @@ -1718,7 +1718,7 @@ def_meta))) (def:''' (resolve_global_identifier full_name state) - #Nil + #End (-> Name ($' Meta Name)) (let' [[module name] full_name {#info info #source source #current_module _ #modules modules @@ -1743,7 +1743,7 @@ (get module modules)))) (def:''' (as_code_list expression) - #Nil + #End (-> Code Code) (let' [type (form$ (list (tag$ ["library/lux" "Apply"]) (identifier$ ["library/lux" "Code"]) @@ -1751,26 +1751,26 @@ (form$ (list (text$ "lux type check") type expression)))) (def:''' (spliced replace? untemplate elems) - #Nil + #End (-> Bit (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) ({#1 - ({#Nil - (return (tag$ ["library/lux" "Nil"])) + ({#End + (return (tag$ ["library/lux" "End"])) - (#Cons lastI inits) + (#Item lastI inits) (do meta_monad - [lastO ({[_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))] + [lastO ({[_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))] (in (as_code_list spliced)) _ (do meta_monad [lastO (untemplate lastI)] - (in (as_code_list (form$ (list (tag$ ["library/lux" "Cons"]) - (tuple$ (list lastO (tag$ ["library/lux" "Nil"]))))))))} + (in (as_code_list (form$ (list (tag$ ["library/lux" "Item"]) + (tuple$ (list lastO (tag$ ["library/lux" "End"]))))))))} lastI)] (monad\fold meta_monad (function' [leftI rightO] - ({[_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))] + ({[_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))] (let' [g!in-module (form$ (list (text$ "lux in-module") (text$ "library/lux") (identifier$ ["library/lux" "list\compose"])))] @@ -1779,7 +1779,7 @@ _ (do meta_monad [leftO (untemplate leftI)] - (in (form$ (list (tag$ ["library/lux" "Cons"]) (tuple$ (list leftO rightO))))))} + (in (form$ (list (tag$ ["library/lux" "Item"]) (tuple$ (list leftO rightO))))))} leftI)) lastO inits))} @@ -1791,12 +1791,12 @@ replace?)) (def:''' (untemplated_text value) - #Nil + #End (-> Text Code) (wrap_meta (form$ (list (tag$ ["library/lux" "Text"]) (text$ value))))) (def:''' (untemplate replace? subst token) - #Nil + #End (-> Bit Text Code ($' Meta Code)) ({[_ [_ (#Bit value)]] (return (wrap_meta (form$ (list (tag$ ["library/lux" "Bit"]) (bit$ value))))) @@ -1844,12 +1844,12 @@ [#0 [_ (#Identifier [module name])]] (return (wrap_meta (form$ (list (tag$ ["library/lux" "Identifier"]) (tuple$ (list (text$ module) (text$ name))))))) - [#1 [_ (#Form (#Cons [[_ (#Identifier ["" "~"])] (#Cons [unquoted #Nil])]))]] + [#1 [_ (#Form (#Item [[_ (#Identifier ["" "~"])] (#Item [unquoted #End])]))]] (return (form$ (list (text$ "lux type check") (identifier$ ["library/lux" "Code"]) unquoted))) - [#1 [_ (#Form (#Cons [[_ (#Identifier ["" "~!"])] (#Cons [dependent #Nil])]))]] + [#1 [_ (#Form (#Item [[_ (#Identifier ["" "~!"])] (#Item [dependent #End])]))]] (do meta_monad [independent (untemplate replace? subst dependent)] (in (wrap_meta (form$ (list (tag$ ["library/lux" "Form"]) @@ -1857,7 +1857,7 @@ (untemplated_text subst) independent))))))) - [#1 [_ (#Form (#Cons [[_ (#Identifier ["" "~'"])] (#Cons [keep_quoted #Nil])]))]] + [#1 [_ (#Form (#Item [[_ (#Identifier ["" "~'"])] (#Item [keep_quoted #End])]))]] (untemplate #0 subst keep_quoted) [_ [meta (#Form elems)]] @@ -1892,10 +1892,10 @@ "## Macro to treat define new primitive types." __paragraph "(primitive ''java.lang.Object'')" __paragraph "(primitive ''java.util.List'' [(primitive ''java.lang.Long'')])"))]) - ({(#Cons [_ (#Text class_name)] #Nil) - (return (list (form$ (list (tag$ ["library/lux" "Primitive"]) (text$ class_name) (tag$ ["library/lux" "Nil"]))))) + ({(#Item [_ (#Text class_name)] #End) + (return (list (form$ (list (tag$ ["library/lux" "Primitive"]) (text$ class_name) (tag$ ["library/lux" "End"]))))) - (#Cons [_ (#Text class_name)] (#Cons [_ (#Tuple params)] #Nil)) + (#Item [_ (#Text class_name)] (#Item [_ (#Tuple params)] #End)) (return (list (form$ (list (tag$ ["library/lux" "Primitive"]) (text$ class_name) (untemplated_list params))))) _ @@ -1903,7 +1903,7 @@ tokens)) (def:'' (current_module_name state) - #Nil + #End ($' Meta Text) ({{#info info #source source #current_module current_module #modules modules #scopes scopes #type_context types #host host @@ -1923,7 +1923,7 @@ "## Hygienic quasi-quotation as a macro. Unquote (~) and unquote-splice (~+) must also be used as forms." __paragraph "## All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used." __paragraph "(` (def: (~ name) (function ((~' _) (~+ args)) (~ body))))"))]) - ({(#Cons template #Nil) + ({(#Item template #End) (do meta_monad [current_module current_module_name =template (untemplate #1 current_module template)] @@ -1940,7 +1940,7 @@ (text$ ($_ "lux text concat" "## Unhygienic quasi-quotation as a macro. Unquote (~) and unquote-splice (~+) must also be used as forms." __paragraph "(`' (def: (~ name) (function (_ (~+ args)) (~ body))))"))]) - ({(#Cons template #Nil) + ({(#Item template #End) (do meta_monad [=template (untemplate #1 "" template)] (in (list (form$ (list (text$ "lux type check") (identifier$ ["library/lux" "Code"]) =template))))) @@ -1954,7 +1954,7 @@ (text$ ($_ "lux text concat" "## Quotation as a macro." __paragraph "(' YOLO)"))]) - ({(#Cons template #Nil) + ({(#Item template #End) (do meta_monad [=template (untemplate #0 "" template)] (in (list (form$ (list (text$ "lux type check") (identifier$ ["library/lux" "Code"]) =template))))) @@ -1970,7 +1970,7 @@ "(|> elems (list\map int\encode) (interpose '' '') (fold text\compose ''''))" __paragraph "## =>" __paragraph "(fold text\compose '''' (interpose '' '' (list\map int\encode elems)))"))]) - ({(#Cons [init apps]) + ({(#Item [init apps]) (return (list (list\fold ("lux type check" (-> Code Code Code) (function' [app acc] ({[_ (#Tuple parts)] @@ -1996,7 +1996,7 @@ "(<| (fold text\compose '''') (interpose '' '') (list\map int\encode) elems)" __paragraph "## =>" __paragraph "(fold text\compose '''' (interpose '' '' (list\map int\encode elems)))"))]) - ({(#Cons [init apps]) + ({(#Item [init apps]) (return (list (list\fold ("lux type check" (-> Code Code Code) (function' [app acc] ({[_ (#Tuple parts)] @@ -2023,7 +2023,7 @@ (function' [x] (f (g x)))) (def:''' (get_name x) - #Nil + #End (-> Code ($' Maybe Name)) ({[_ (#Identifier sname)] (#Some sname) @@ -2033,7 +2033,7 @@ x)) (def:''' (get_tag x) - #Nil + #End (-> Code ($' Maybe Name)) ({[_ (#Tag sname)] (#Some sname) @@ -2043,7 +2043,7 @@ x)) (def:''' (get_short x) - #Nil + #End (-> Code ($' Maybe Text)) ({[_ (#Identifier "" sname)] (#Some sname) @@ -2053,7 +2053,7 @@ x)) (def:''' (tuple_to_list tuple) - #Nil + #End (-> Code ($' Maybe ($' List Code))) ({[_ (#Tuple members)] (#Some members) @@ -2063,7 +2063,7 @@ tuple)) (def:''' (apply_template env template) - #Nil + #End (-> RepEnv Code Code) ({[_ (#Identifier "" sname)] ({(#Some subst) @@ -2091,7 +2091,7 @@ template)) (def:''' (every? p xs) - #Nil + #End (All [a] (-> (-> a Bit) ($' List a) Bit)) (list\fold (function' [_2 _1] (if _1 (p _2) #0)) #1 xs)) @@ -2132,10 +2132,10 @@ ("lux i64 =" reference sample))) (def:''' (list\join xs) - #Nil + #End (All [a] (-> ($' List ($' List a)) ($' List a))) - (list\fold list\compose #Nil (list\reverse xs))) + (list\fold list\compose #End (list\reverse xs))) (macro:' #export (template tokens) (list [(tag$ ["library/lux" "doc"]) @@ -2145,7 +2145,7 @@ " " "[(def: #export (-> Int Int) (+ ))]" __paragraph " " "[inc +1]" ..\n " " "[dec -1]"))]) - ({(#Cons [[_ (#Tuple bindings)] (#Cons [[_ (#Tuple templates)] data])]) + ({(#Item [[_ (#Tuple bindings)] (#Item [[_ (#Tuple templates)] data])]) ({[(#Some bindings') (#Some data')] (let' [apply ("lux type check" (-> RepEnv ($' List Code)) (function' [env] (list\map (apply_template env) templates))) @@ -2202,12 +2202,12 @@ right)) (def:''' (bit\encode x) - #Nil + #End (-> Bit Text) (if x "#1" "#0")) (def:''' (digit::format digit) - #Nil + #End (-> Nat Text) ({0 "0" 1 "1" 2 "2" 3 "3" @@ -2217,7 +2217,7 @@ digit)) (def:''' (nat\encode value) - #Nil + #End (-> Nat Text) ({0 "0" @@ -2234,14 +2234,14 @@ value)) (def:''' (int\abs value) - #Nil + #End (-> Int Int) (if ("lux i64 <" +0 value) ("lux i64 *" -1 value) value)) (def:''' (int\encode value) - #Nil + #End (-> Int Text) (if ("lux i64 =" +0 value) "+0" @@ -2259,12 +2259,12 @@ (|> value ("lux i64 %" +10) int\abs ("lux type as" Nat) digit::format))))) (def:''' (frac\encode x) - #Nil + #End (-> Frac Text) ("lux f64 encode" x)) (def:''' (multiple? div n) - #Nil + #End (-> Nat Nat Bit) (|> n (n/% div) ("lux i64 =" 0))) @@ -2280,7 +2280,7 @@ (def:''' (macro_type? type) (list) (-> Type Bit) - ({(#Named ["library/lux" "Macro"] (#Primitive "#Macro" #Nil)) + ({(#Named ["library/lux" "Macro"] (#Primitive "#Macro" #End)) #1 _ @@ -2288,7 +2288,7 @@ type)) (def:''' (macro' modules current_module module name) - #Nil + #End (-> ($' List (& Text Module)) Text Text Text ($' Maybe Macro)) @@ -2310,7 +2310,7 @@ ("lux type check" Global gdef)))) (def:''' (normalize name) - #Nil + #End (-> Name ($' Meta Name)) ({["" name] (do meta_monad @@ -2322,7 +2322,7 @@ name)) (def:''' (macro full_name) - #Nil + #End (-> Name ($' Meta ($' Maybe Macro))) (do meta_monad [current_module current_module_name] @@ -2337,7 +2337,7 @@ state))))) (def:''' (macro? name) - #Nil + #End (-> Name ($' Meta Bit)) (do meta_monad [name (normalize name) @@ -2347,23 +2347,23 @@ output)))) (def:''' (interpose sep xs) - #Nil + #End (All [a] (-> a ($' List a) ($' List a))) - ({#Nil + ({#End xs - (#Cons [x #Nil]) + (#Item [x #End]) xs - (#Cons [x xs']) + (#Item [x xs']) (list& x sep (interpose sep xs'))} xs)) (def:''' (macro_expand_once token) - #Nil + #End (-> Code ($' Meta ($' List Code))) - ({[_ (#Form (#Cons [_ (#Identifier macro_name)] args))] + ({[_ (#Form (#Item [_ (#Identifier macro_name)] args))] (do meta_monad [macro_name' (normalize macro_name) ?macro (macro macro_name')] @@ -2379,9 +2379,9 @@ token)) (def:''' (macro_expand token) - #Nil + #End (-> Code ($' Meta ($' List Code))) - ({[_ (#Form (#Cons [_ (#Identifier macro_name)] args))] + ({[_ (#Form (#Item [_ (#Identifier macro_name)] args))] (do meta_monad [macro_name' (normalize macro_name) ?macro (macro macro_name')] @@ -2400,9 +2400,9 @@ token)) (def:''' (macro_expand_all syntax) - #Nil + #End (-> Code ($' Meta ($' List Code))) - ({[_ (#Form (#Cons [_ (#Identifier macro_name)] args))] + ({[_ (#Form (#Item [_ (#Identifier macro_name)] args))] (do meta_monad [macro_name' (normalize macro_name) ?macro (macro macro_name')] @@ -2415,7 +2415,7 @@ #None (do meta_monad [args' (monad\map meta_monad macro_expand_all args)] - (in (list (form$ (#Cons (identifier$ macro_name) (list\join args'))))))} + (in (list (form$ (#Item (identifier$ macro_name) (list\join args'))))))} ?macro)) [_ (#Form members)] @@ -2435,7 +2435,7 @@ (let' [[key val] kv] (do meta_monad [val' (macro_expand_all val)] - ({(#Cons val'' #Nil) + ({(#Item val'' #End) (return [key val'']) _ @@ -2449,24 +2449,24 @@ syntax)) (def:''' (walk_type type) - #Nil + #End (-> Code Code) - ({[_ (#Form (#Cons [_ (#Tag tag)] parts))] - (form$ (#Cons [(tag$ tag) (list\map walk_type parts)])) + ({[_ (#Form (#Item [_ (#Tag tag)] parts))] + (form$ (#Item [(tag$ tag) (list\map walk_type parts)])) [_ (#Tuple members)] (` (& (~+ (list\map walk_type members)))) - [_ (#Form (#Cons [_ (#Text "lux in-module")] - (#Cons [_ (#Text module)] - (#Cons type' - #Nil))))] + [_ (#Form (#Item [_ (#Text "lux in-module")] + (#Item [_ (#Text module)] + (#Item type' + #End))))] (` ("lux in-module" (~ (text$ module)) (~ (walk_type type')))) - [_ (#Form (#Cons [_ (#Identifier ["" ":~"])] (#Cons expression #Nil)))] + [_ (#Form (#Item [_ (#Identifier ["" ":~"])] (#Item expression #End)))] expression - [_ (#Form (#Cons type_fn args))] + [_ (#Form (#Item type_fn args))] (list\fold ("lux type check" (-> Code Code Code) (function' [arg type_fn] (` (#.Apply (~ arg) (~ type_fn))))) (walk_type type_fn) @@ -2481,10 +2481,10 @@ (text$ ($_ "lux text concat" "## Takes a type expression and returns it's representation as data-structure." __paragraph "(type (All [a] (Maybe (List a))))"))]) - ({(#Cons type #Nil) + ({(#Item type #End) (do meta_monad [type+ (macro_expand_all type)] - ({(#Cons type' #Nil) + ({(#Item type' #End) (in (list (walk_type type'))) _ @@ -2500,7 +2500,7 @@ (text$ ($_ "lux text concat" "## The type-annotation macro." __paragraph "(: (List Int) (list +1 +2 +3))"))]) - ({(#Cons type (#Cons value #Nil)) + ({(#Item type (#Item value #End)) (return (list (` ("lux type check" (type (~ type)) (~ value))))) _ @@ -2512,7 +2512,7 @@ (text$ ($_ "lux text concat" "## The type-coercion macro." __paragraph "(:as Dinosaur (list +1 +2 +3))"))]) - ({(#Cons type (#Cons value #Nil)) + ({(#Item type (#Item value #End)) (return (list (` ("lux type as" (type (~ type)) (~ value))))) _ @@ -2520,15 +2520,15 @@ tokens)) (def:''' (empty? xs) - #Nil + #End (All [a] (-> ($' List a) Bit)) - ({#Nil #1 + ({#End #1 _ #0} xs)) (template [ ] [(def:''' ( xy) - #Nil + #End (All [a b] (-> (& a b) )) (let' [[x y] xy] ))] @@ -2536,9 +2536,9 @@ [second b y]) (def:''' (unfold_type_def type_codes) - #Nil + #End (-> ($' List Code) ($' Meta (& Code ($' Maybe ($' List Text))))) - ({(#Cons [_ (#Record pairs)] #Nil) + ({(#Item [_ (#Record pairs)] #End) (do meta_monad [members (monad\map meta_monad (: (-> [Code Code] (Meta [Text Code])) @@ -2553,18 +2553,18 @@ (return [(` (& (~+ (list\map second members)))) (#Some (list\map first members))])) - (#Cons type #Nil) + (#Item type #End) ({[_ (#Tag "" member_name)] (return [(` .Any) (#Some (list member_name))]) - [_ (#Form (#Cons [_ (#Tag "" member_name)] member_types))] + [_ (#Form (#Item [_ (#Tag "" member_name)] member_types))] (return [(` (& (~+ member_types))) (#Some (list member_name))]) _ (return [type #None])} type) - (#Cons case cases) + (#Item case cases) (do meta_monad [members (monad\map meta_monad (: (-> Code (Meta [Text Code])) @@ -2572,10 +2572,10 @@ ({[_ (#Tag "" member_name)] (return [member_name (` .Any)]) - [_ (#Form (#Cons [_ (#Tag "" member_name)] (#Cons member_type #Nil)))] + [_ (#Form (#Item [_ (#Tag "" member_name)] (#Item member_type #End)))] (return [member_name member_type]) - [_ (#Form (#Cons [_ (#Tag "" member_name)] member_types))] + [_ (#Form (#Item [_ (#Tag "" member_name)] member_types))] (return [member_name (` (& (~+ member_types)))]) _ @@ -2590,7 +2590,7 @@ type_codes)) (def:''' (gensym prefix state) - #Nil + #End (-> Text ($' Meta Code)) ({{#info info #source source #current_module _ #modules modules #scopes scopes #type_context types #host host @@ -2611,10 +2611,10 @@ "## Parameter-less recursive types." __paragraph "## A name has to be given to the whole type, to use it within its body." __paragraph "(Rec Self [Int (List Self)])"))]) - ({(#Cons [_ (#Identifier "" name)] (#Cons body #Nil)) + ({(#Item [_ (#Identifier "" name)] (#Item body #End)) (let' [body' (replace_syntax (list [name (` (#.Apply (~ (make_parameter 1)) (~ (make_parameter 0))))]) (update_parameters body))] - (return (list (` (#.Apply .Nothing (#.UnivQ #.Nil (~ body'))))))) + (return (list (` (#.Apply .Nothing (#.UnivQ #.End (~ body'))))))) _ (failure "Wrong syntax for Rec")} @@ -2629,7 +2629,7 @@ " " "(log! ''#2'')" ..\n " " "(log! ''#3'')" ..\n "''YOLO'')"))]) - ({(#Cons value actions) + ({(#Item value actions) (let' [dummy (local_identifier$ "")] (return (list (list\fold ("lux type check" (-> Code Code Code) (function' [pre post] (` ({(~ dummy) (~ post)} @@ -2642,30 +2642,30 @@ (list\reverse tokens))) (macro:' (def:' tokens) - (let' [[export? tokens'] ({(#Cons [_ (#Tag ["" "export"])] tokens') + (let' [[export? tokens'] ({(#Item [_ (#Tag ["" "export"])] tokens') [#1 tokens'] _ [#0 tokens]} tokens) parts (: (Maybe [Code (List Code) (Maybe Code) Code]) - ({(#Cons [_ (#Form (#Cons name args))] (#Cons type (#Cons body #Nil))) + ({(#Item [_ (#Form (#Item name args))] (#Item type (#Item body #End))) (#Some name args (#Some type) body) - (#Cons name (#Cons type (#Cons body #Nil))) - (#Some name #Nil (#Some type) body) + (#Item name (#Item type (#Item body #End))) + (#Some name #End (#Some type) body) - (#Cons [_ (#Form (#Cons name args))] (#Cons body #Nil)) + (#Item [_ (#Form (#Item name args))] (#Item body #End)) (#Some name args #None body) - (#Cons name (#Cons body #Nil)) - (#Some name #Nil #None body) + (#Item name (#Item body #End)) + (#Some name #End #None body) _ #None} tokens'))] ({(#Some name args ?type body) - (let' [body' ({#Nil + (let' [body' ({#End body _ @@ -2680,7 +2680,7 @@ (return (list (` ("lux def" (~ name) (~ body'') [(~ location_code) - (#.Record #.Nil)] + (#.Record #.End)] (~ (bit$ export?))))))) #None @@ -2751,8 +2751,8 @@ (def:' (expander branches) (-> (List Code) (Meta (List Code))) - ({(#Cons [_ (#Form (#Cons [_ (#Identifier macro_name)] macro_args))] - (#Cons body + ({(#Item [_ (#Form (#Item [_ (#Identifier macro_name)] macro_args))] + (#Item body branches')) (do meta_monad [??? (macro? macro_name)] @@ -2766,12 +2766,12 @@ body sub_expansion))))) - (#Cons pattern (#Cons body branches')) + (#Item pattern (#Item body branches')) (do meta_monad [sub_expansion (expander branches')] (in (list& pattern body sub_expansion))) - #Nil + #End (do meta_monad [] (in (list))) _ @@ -2788,11 +2788,11 @@ "## The pattern-matching macro." ..\n "## Allows the usage of macros within the patterns to provide custom syntax." ..\n "(case (: (List Int) (list +1 +2 +3))" ..\n - " " "(#Cons x (#Cons y (#Cons z #Nil)))" ..\n + " " "(#Item x (#Item y (#Item z #End)))" ..\n " " "(#Some ($_ * x y z))" __paragraph " " "_" ..\n " " "#None)"))]) - ({(#Cons value branches) + ({(#Item value branches) (do meta_monad [expansion (expander branches)] (in (list (` ((~ (record$ (as_pairs expansion))) (~ value)))))) @@ -2813,11 +2813,11 @@ " _" ..\n " #None)"))]) (case tokens - (#Cons [_ (#Form (#Cons pattern #Nil))] (#Cons body branches)) + (#Item [_ (#Form (#Item pattern #End))] (#Item body branches)) (do meta_monad [pattern+ (macro_expand_all pattern)] (case pattern+ - (#Cons pattern' #Nil) + (#Item pattern' #End) (in (list& pattern' body branches)) _ @@ -2844,7 +2844,7 @@ (case tokens (^ (list& [_ (#Form patterns)] body branches)) (case patterns - #Nil + #End (failure "^or cannot have 0 patterns") _ @@ -2899,7 +2899,7 @@ " (function (_ x y) x))" __paragraph "(: (All [a b] (-> a b a))" ..\n - " (function (const x y) x))"))]) + " (function (constant x y) x))"))]) (case (: (Maybe [Text Code (List Code) Code]) (case tokens (^ (list [_ (#Form (list& [_ (#Identifier ["" name])] head tail))] body)) @@ -2976,11 +2976,11 @@ (def:' (with_func_args args meta) (-> (List Code) Code Code) (case args - #Nil + #End meta _ - (` (#.Cons [[(~ location_code) (#.Tag ["library/lux" "func-args"])] + (` (#.Item [[(~ location_code) (#.Tag ["library/lux" "func-args"])] [(~ location_code) (#.Tuple (.list (~+ (list\map (function (_ arg) (` [(~ location_code) (#.Text (~ (text$ (code\encode arg))))])) args))))]] @@ -2994,7 +2994,7 @@ (def:' (export^ tokens) (-> (List Code) [Bit (List Code)]) (case tokens - (#Cons [_ (#Tag [_ "export"])] tokens') + (#Item [_ (#Tag [_ "export"])] tokens') [#1 tokens'] _ @@ -3021,36 +3021,36 @@ (let [[exported? tokens'] (export^ tokens) parts (: (Maybe [Code (List Code) (Maybe Code) Code (List [Code Code])]) (case tokens' - (^ (list [_ (#Form (#Cons name args))] [_ (#Record meta_kvs)] type body)) + (^ (list [_ (#Form (#Item name args))] [_ (#Record meta_kvs)] type body)) (#Some [name args (#Some type) body meta_kvs]) (^ (list name [_ (#Record meta_kvs)] type body)) - (#Some [name #Nil (#Some type) body meta_kvs]) + (#Some [name #End (#Some type) body meta_kvs]) - (^ (list [_ (#Form (#Cons name args))] [_ (#Record meta_kvs)] body)) + (^ (list [_ (#Form (#Item name args))] [_ (#Record meta_kvs)] body)) (#Some [name args #None body meta_kvs]) (^ (list name [_ (#Record meta_kvs)] body)) - (#Some [name #Nil #None body meta_kvs]) + (#Some [name #End #None body meta_kvs]) - (^ (list [_ (#Form (#Cons name args))] type body)) - (#Some [name args (#Some type) body #Nil]) + (^ (list [_ (#Form (#Item name args))] type body)) + (#Some [name args (#Some type) body #End]) (^ (list name type body)) - (#Some [name #Nil (#Some type) body #Nil]) + (#Some [name #End (#Some type) body #End]) - (^ (list [_ (#Form (#Cons name args))] body)) - (#Some [name args #None body #Nil]) + (^ (list [_ (#Form (#Item name args))] body)) + (#Some [name args #None body #End]) (^ (list name body)) - (#Some [name #Nil #None body #Nil]) + (#Some [name #End #None body #End]) _ #None))] (case parts (#Some name args ?type body meta) (let [body (case args - #Nil + #End body _ @@ -3075,7 +3075,7 @@ (-> [Code Code] Code Code) (case [addition meta] [[name value] [location (#Record pairs)]] - [location (#Record (#Cons [name value] pairs))] + [location (#Record (#Item [name value] pairs))] _ meta)) @@ -3109,13 +3109,13 @@ (#Some [name args (list) body]) (^ (list [_ (#Identifier name)] body)) - (#Some [name #Nil (list) body]) + (#Some [name #End (list) body]) (^ (list [_ (#Form (list& [_ (#Identifier name)] args))] [_ (#Record meta_rec_parts)] body)) (#Some [name args meta_rec_parts body]) (^ (list [_ (#Identifier name)] [_ (#Record meta_rec_parts)] body)) - (#Some [name #Nil meta_rec_parts body]) + (#Some [name #End meta_rec_parts body]) _ #None))] @@ -3123,7 +3123,7 @@ (#Some [name args meta body]) (let [name (identifier$ name) body (case args - #Nil + #End body _ @@ -3160,13 +3160,13 @@ (#Some name args [meta_rec_location (#Record meta_rec_parts)] sigs) (^ (list& [_ (#Identifier name)] [meta_rec_location (#Record meta_rec_parts)] sigs)) - (#Some name #Nil [meta_rec_location (#Record meta_rec_parts)] sigs) + (#Some name #End [meta_rec_location (#Record meta_rec_parts)] sigs) (^ (list& [_ (#Form (list& [_ (#Identifier name)] args))] sigs)) (#Some name args (` {}) sigs) (^ (list& [_ (#Identifier name)] sigs)) - (#Some name #Nil (` {}) sigs) + (#Some name #End (` {}) sigs) _ #None))] @@ -3195,7 +3195,7 @@ sig_meta (meta_code_merge (` {#.sig? #1}) meta) usage (case args - #Nil + #End def_name _ @@ -3209,10 +3209,10 @@ (All [a b] (-> (-> a (Maybe b)) (List a) (Maybe b))) (case xs - #Nil + #End #None - (#Cons x xs') + (#Item x xs') (case (f x) #None (find f xs') @@ -3288,10 +3288,10 @@ (All [a] (-> Nat (List a) (Maybe a))) (case xs - #Nil + #End #None - (#Cons x xs') + (#Item x xs') (if ("lux i64 =" 0 idx) (#Some x) (nth ("lux i64 -" 1 idx) xs')))) @@ -3311,7 +3311,7 @@ (#UnivQ ?local_env ?local_def) (case ?local_env - #Nil + #End (#UnivQ env ?local_def) _ @@ -3319,7 +3319,7 @@ (#ExQ ?local_env ?local_def) (case ?local_env - #Nil + #End (#ExQ env ?local_def) _ @@ -3383,7 +3383,7 @@ (case type (#Apply head func') (let [[func tail] (flat_app func')] - [func (#Cons head tail)]) + [func (#Item head tail)]) _ [type (list)])) @@ -3527,10 +3527,10 @@ (def: (text\join_with separator parts) (-> Text (List Text) Text) (case parts - #Nil + #End "" - (#Cons head tail) + (#Item head tail) (list\fold (function (_ right left) ($_ text\compose left separator right)) head @@ -3558,20 +3558,20 @@ (#Some name args type [meta_rec_location (#Record meta_rec_parts)] definitions) (^ (list& name [meta_rec_location (#Record meta_rec_parts)] type definitions)) - (#Some name #Nil type [meta_rec_location (#Record meta_rec_parts)] definitions) + (#Some name #End type [meta_rec_location (#Record meta_rec_parts)] definitions) (^ (list& [_ (#Form (list& name args))] type definitions)) (#Some name args type (` {}) definitions) (^ (list& name type definitions)) - (#Some name #Nil type (` {}) definitions) + (#Some name #End type (` {}) definitions) _ #None))] (case ?parts (#Some [name args type meta definitions]) (let [usage (case args - #Nil + #End name _ @@ -3590,10 +3590,10 @@ (macro: #export (type: tokens) {#.doc (text$ ($_ "lux text concat" "## The type-definition macro." ..\n - "(type: (List a) #Nil (#Cons a (List a)))"))} + "(type: (List a) #End (#Item a (List a)))"))} (let [[exported? tokens'] (export^ tokens) [rec? tokens'] (case tokens' - (#Cons [_ (#Tag [_ "rec"])] tokens') + (#Item [_ (#Tag [_ "rec"])] tokens') [#1 tokens'] _ @@ -3601,21 +3601,21 @@ parts (: (Maybe [Text (List Code) (List [Code Code]) (List Code)]) (case tokens' (^ (list [_ (#Identifier "" name)] [meta_location (#Record meta_parts)] [type_location (#Record type_parts)])) - (#Some [name #Nil meta_parts (list [type_location (#Record type_parts)])]) + (#Some [name #End meta_parts (list [type_location (#Record type_parts)])]) (^ (list& [_ (#Identifier "" name)] [meta_location (#Record meta_parts)] type_code1 type_codes)) - (#Some [name #Nil meta_parts (#Cons type_code1 type_codes)]) + (#Some [name #End meta_parts (#Item type_code1 type_codes)]) (^ (list& [_ (#Identifier "" name)] type_codes)) - (#Some [name #Nil (list) type_codes]) + (#Some [name #End (list) type_codes]) - (^ (list [_ (#Form (#Cons [_ (#Identifier "" name)] args))] [meta_location (#Record meta_parts)] [type_location (#Record type_parts)])) + (^ (list [_ (#Form (#Item [_ (#Identifier "" name)] args))] [meta_location (#Record meta_parts)] [type_location (#Record type_parts)])) (#Some [name args meta_parts (list [type_location (#Record type_parts)])]) - (^ (list& [_ (#Form (#Cons [_ (#Identifier "" name)] args))] [meta_location (#Record meta_parts)] type_code1 type_codes)) - (#Some [name args meta_parts (#Cons type_code1 type_codes)]) + (^ (list& [_ (#Form (#Item [_ (#Identifier "" name)] args))] [meta_location (#Record meta_parts)] type_code1 type_codes)) + (#Some [name args meta_parts (#Item type_code1 type_codes)]) - (^ (list& [_ (#Form (#Cons [_ (#Identifier "" name)] args))] type_codes)) + (^ (list& [_ (#Form (#Item [_ (#Identifier "" name)] args))] type_codes)) (#Some [name args (list) type_codes]) _ @@ -3637,14 +3637,14 @@ .Nothing)))) #None) (case args - #Nil + #End (#Some type) _ (#Some (` (.All (~ type_name) [(~+ args)] (~ type))))))) total_meta (let [meta (process_def_meta meta) meta (if rec? - (` (#.Cons (~ (flag_meta "type-rec?")) (~ meta))) + (` (#.Item (~ (flag_meta "type-rec?")) (~ meta))) meta)] (` [(~ location_code) (#.Record (~ meta))]))] @@ -3747,8 +3747,8 @@ (def: (openings_parser parts) (-> (List Code) (Meta [(List Openings) (List Code)])) (case parts - #.Nil - (return [#.Nil #.Nil]) + #.End + (return [#.End #.End]) (^ (list& [_ (#Form (list& [_ (#Text prefix)] structs))] parts')) (do meta_monad @@ -3763,11 +3763,11 @@ structs) next+remainder (openings_parser parts')] (let [[next remainder] next+remainder] - (return [(#.Cons [prefix structs'] next) + (return [(#.Item [prefix structs'] next) remainder]))) _ - (return [#.Nil parts]))) + (return [#.End parts]))) (def: (text\split! at x) (-> Nat Text [Text Text]) @@ -3845,19 +3845,19 @@ (def: (list\take amount list) (All [a] (-> Nat (List a) (List a))) (case [amount list] - (^or [0 _] [_ #Nil]) - #Nil + (^or [0 _] [_ #End]) + #End - [_ (#Cons head tail)] - (#Cons head (list\take ("lux i64 -" 1 amount) tail)))) + [_ (#Item head tail)] + (#Item head (list\take ("lux i64 -" 1 amount) tail)))) (def: (list\drop amount list) (All [a] (-> Nat (List a) (List a))) (case [amount list] - (^or [0 _] [_ #Nil]) + (^or [0 _] [_ #End]) list - [_ (#Cons _ tail)] + [_ (#Item _ tail)] (list\drop ("lux i64 -" 1 amount) tail))) (def: (clean_module nested? relative_root module) @@ -3934,7 +3934,7 @@ #let [[openings extra] openings+extra] sub_imports (imports_parser #1 import_name context_alias extra)] (in (case [referral openings] - [#Nothing #Nil] + [#Nothing #End] sub_imports _ @@ -3959,7 +3959,7 @@ de_aliased (de_alias context_alias m_name alias)] sub_imports (imports_parser #1 import_name de_aliased extra)] (in (case [referral openings] - [#Ignore #Nil] + [#Ignore #End] sub_imports _ @@ -4023,12 +4023,12 @@ (def: (only p xs) (All [a] (-> (-> a Bit) (List a) (List a))) (case xs - #Nil + #End (list) - (#Cons x xs') + (#Item x xs') (if (p x) - (#Cons x (only p xs')) + (#Item x (only p xs')) (only p xs')))) (def: (is_member? cases name) @@ -4121,10 +4121,10 @@ (def: (type_variable idx bindings) (-> Nat (List [Nat (Maybe Type)]) (Maybe Type)) (case bindings - #Nil - #Nil + #End + #End - (#Cons [var bound] bindings') + (#Item [var bound] bindings') (if ("lux i64 =" idx var) bound (type_variable idx bindings')))) @@ -4174,9 +4174,9 @@ (def: (zipped/2 xs ys) (All [a b] (-> (List a) (List b) (List [a b]))) (case xs - (#Cons x xs') + (#Item x xs') (case ys - (#Cons y ys') + (#Item y ys') (list& [x y] (zipped/2 xs' ys')) _ @@ -4190,7 +4190,7 @@ (case type (#Primitive name params) (case params - #Nil + #End name _ @@ -4307,11 +4307,11 @@ (def: (enumeration' idx xs) (All [a] (-> Nat (List a) (List [Nat a]))) (case xs - (#Cons x xs') - (#Cons [idx x] (enumeration' ("lux i64 +" 1 idx) xs')) + (#Item x xs') + (#Item [idx x] (enumeration' ("lux i64 +" 1 idx) xs')) - #Nil - #Nil)) + #End + #End)) (def: (enumeration xs) (All [a] (-> (List a) (List [Nat a]))) @@ -4393,7 +4393,7 @@ _ (return (list (` ("lux def" (~ (local_identifier$ (de_alias "" short alias))) (~ source+) - [(~ location_code) (#.Record #Nil)] + [(~ location_code) (#.Record #End)] #0))))))) (macro: #export (open: tokens) @@ -4432,7 +4432,7 @@ (do meta_monad [g!struct (gensym "struct")] (return (list (` ("lux def" (~ g!struct) (~ struct) - [(~ location_code) (#.Record #Nil)] + [(~ location_code) (#.Record #End)] #0)) (` (..open: (~ (text$ alias)) (~ g!struct))))))) @@ -4477,7 +4477,7 @@ #let [[openings options] openings+options] current_module current_module_name] (case options - #Nil + #End (in {#refer_defs referral #refer_open openings}) @@ -4613,7 +4613,7 @@ =module (` ("lux def module" [(~ location_code) (#.Record (~ (process_def_meta _meta)))] (~ =imports)))]] - (in (#Cons =module =refers)))) + (in (#Item =module =refers)))) (macro: #export (\ tokens) {#.doc (text$ ($_ "lux text concat" @@ -4678,7 +4678,7 @@ (^ (list [_ (#Tuple slots)] value record)) (case slots - #Nil + #End (failure "Wrong syntax for set@") _ @@ -4696,8 +4696,8 @@ [_ accesses'] (list\fold (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))]) (function (_ [new_slot new_binding] [old_record accesses']) [(` (get@ (~ new_slot) (~ new_binding))) - (#Cons (list new_binding old_record) accesses')])) - [record (: (List (List Code)) #Nil)] + (#Item (list new_binding old_record) accesses')])) + [record (: (List (List Code)) #End)] pairs) accesses (list\join (list\reverse accesses'))]] (in (list (` (let [(~+ accesses)] @@ -4767,7 +4767,7 @@ (^ (list [_ (#Tuple slots)] fun record)) (case slots - #Nil + #End (failure "Wrong syntax for update@") _ @@ -4818,7 +4818,7 @@ " (^template []" ..\n " [( old_env def)" ..\n " (case old_env" ..\n - " #.Nil" ..\n + " #.End" ..\n " ( env def)" __paragraph " _" ..\n @@ -4916,8 +4916,8 @@ (def: (repeat n x) (All [a] (-> Int a (List a))) (if ("lux i64 <" n +0) - (#Cons x (repeat ("lux i64 +" -1 n) x)) - #Nil)) + (#Item x (repeat ("lux i64 +" -1 n) x)) + #End)) (def: (location_padding baseline [_ old_line old_column] [_ new_line new_column]) (-> Nat Location Location Text) @@ -5020,15 +5020,15 @@ (def: (interleave xs ys) (All [a] (-> (List a) (List a) (List a))) (case xs - #Nil - #Nil + #End + #End - (#Cons x xs') + (#Item x xs') (case ys - #Nil - #Nil + #End + #End - (#Cons y ys') + (#Item y ys') (list& x y (interleave xs' ys'))))) (def: (type_to_code type) @@ -5233,7 +5233,7 @@ _ (failure "[with_expansions] Improper macro expansion."))) - #Nil + #End (return bodies) _ @@ -5341,10 +5341,10 @@ (def: (multi_level_case^ levels) (-> (List Code) (Meta Multi_Level_Case)) (case levels - #Nil + #End (failure "Multi-level patterns cannot be empty.") - (#Cons init extras) + (#Item init extras) (do meta_monad [extras' (monad\map meta_monad case_level^ extras)] (in [init extras'])))) @@ -5545,7 +5545,7 @@ (-> Int Int) (undefined)))} (case tokens - #Nil + #End (do meta_monad [location ..location #let [[module line column] location @@ -5710,8 +5710,8 @@ type+value (..definition_value identifier) #let [[type value] type+value]] (case (..flat_alias type) - (^or (#Primitive "#Text" #Nil) - (#Named ["library/lux" "Text"] (#Primitive "#Text" #Nil))) + (^or (#Primitive "#Text" #End) + (#Named ["library/lux" "Text"] (#Primitive "#Text" #End))) (in (:as ..Text value)) _ @@ -5727,7 +5727,7 @@ (def: (target_pick target options default) (-> Text (List [Code Code]) (Maybe Code) (Meta (List Code))) (case options - #Nil + #End (case default #.None (failure ($_ text\compose "No code for target platform: " target)) @@ -5735,7 +5735,7 @@ (#.Some default) (return (list default))) - (#Cons [key pick] options') + (#Item [key pick] options') (do meta_monad [platform (..resolve_target key)] (if (text\= target platform) @@ -5819,11 +5819,11 @@ (def: (untemplated_list& last inits) (-> Code (List Code) Code) (case inits - #Nil + #End last - (#Cons [init inits']) - (` (#.Cons (~ init) (~ (untemplated_list& last inits')))))) + (#Item [init inits']) + (` (#.Item (~ init) (~ (untemplated_list& last inits')))))) (def: (untemplated_record g!meta untemplated_pattern fields) (-> Code (-> Code (Meta Code)) @@ -5843,7 +5843,7 @@ (-> Code (-> Code (Meta Code)) (-> (List Code) (Meta Code))) (case (list\reverse elems) - (#Cons [_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))] + (#Item [_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))] inits) (do meta_monad [=inits (monad\map meta_monad untemplated_pattern (list\reverse inits))] @@ -5875,10 +5875,10 @@ [#.Tag name$] [#.Identifier name$]) - [_ (#Form (#Cons [[_ (#Identifier ["" "~"])] (#Cons [unquoted #Nil])]))] + [_ (#Form (#Item [[_ (#Identifier ["" "~"])] (#Item [unquoted #End])]))] (return unquoted) - [_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))] + [_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))] (failure "Cannot use (~+) inside of ^code unless it is the last element in a form or a tuple.") (^template [ ] diff --git a/stdlib/source/library/lux/abstract/enum.lux b/stdlib/source/library/lux/abstract/enum.lux index e80975172..4cb27558a 100644 --- a/stdlib/source/library/lux/abstract/enum.lux +++ b/stdlib/source/library/lux/abstract/enum.lux @@ -15,12 +15,12 @@ (All [a] (-> (Enum a) a a (List a))) (let [(^open "/\.") enum] (loop [end to - output #.Nil] + output #.End] (cond (/\< end from) - (recur (/\pred end) (#.Cons end output)) + (recur (/\pred end) (#.Item end output)) (/\< from end) - (recur (/\succ end) (#.Cons end output)) + (recur (/\succ end) (#.Item end output)) ## (/\= end from) - (#.Cons end output))))) + (#.Item end output))))) diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index 4dc1e1477..e4d739638 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -10,10 +10,10 @@ (All [a b] (-> (-> b a a) a (List b) a)) (case xs - #.Nil + #.End init - (#.Cons x xs') + (#.Item x xs') (list\fold f (f x init) xs'))) (def: (list\size xs) @@ -21,27 +21,27 @@ (loop [counter 0 xs xs] (case xs - #.Nil + #.End counter - (#.Cons _ xs') + (#.Item _ xs') (recur (inc counter) xs')))) (def: (reverse xs) (All [a] (-> (List a) (List a))) - (list\fold (function (_ head tail) (#.Cons head tail)) - #.Nil + (list\fold (function (_ head tail) (#.Item head tail)) + #.End xs)) (def: (as_pairs xs) (All [a] (-> (List a) (List [a a]))) (case xs - (#.Cons x1 (#.Cons x2 xs')) - (#.Cons [x1 x2] (as_pairs xs')) + (#.Item x1 (#.Item x2 xs')) + (#.Item [x1 x2] (as_pairs xs')) _ - #.Nil)) + #.End)) (interface: #export (Monad m) {#.doc (doc "A monad is a monoid in the category of endofunctors." @@ -126,13 +126,13 @@ (let [(^open "!\.") monad] (function (recur xs) (case xs - #.Nil - (!\in #.Nil) + #.End + (!\in #.End) - (#.Cons x xs') + (#.Item x xs') (|> x (!\map (function (_ _x) - (!\map (|>> (#.Cons _x)) (recur xs')))) + (!\map (|>> (#.Item _x)) (recur xs')))) !\join))))) (def: #export (map monad f) @@ -143,13 +143,13 @@ (let [(^open "!\.") monad] (function (recur xs) (case xs - #.Nil - (!\in #.Nil) + #.End + (!\in #.End) - (#.Cons x xs') + (#.Item x xs') (|> (f x) (!\map (function (_ _x) - (!\map (|>> (#.Cons _x)) (recur xs')))) + (!\map (|>> (#.Item _x)) (recur xs')))) !\join))))) (def: #export (only monad f) @@ -160,15 +160,15 @@ (let [(^open "!\.") monad] (function (recur xs) (case xs - #.Nil - (!\in #.Nil) + #.End + (!\in #.End) - (#.Cons head xs') + (#.Item head xs') (|> (f head) (!\map (function (_ verdict) (!\map (function (_ tail) (if verdict - (#.Cons head tail) + (#.Item head tail) tail)) (recur xs')))) !\join))))) @@ -179,10 +179,10 @@ (-> (Monad M) (-> b a (M a)) a (List b) (M a))) (case xs - #.Nil + #.End (\ monad in init) - (#.Cons x xs') + (#.Item x xs') (do monad [init' (f x init)] (fold monad f init' xs')))) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index f8426ebb7..88ac4f0b9 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -12,6 +12,7 @@ ["." list ("#\." fold functor)]]] ["." macro (#+ with_gensyms) ["." code] + ["." template] [syntax (#+ syntax:) ["|.|" export] ["|.|" annotations]]] @@ -61,7 +62,7 @@ (monad.do meta.monad [expansion expander] (case expansion - (#.Cons singleton #.Nil) + (#.Item singleton #.End) (in singleton) _ @@ -71,6 +72,15 @@ (syntax: #export (=> {aliases aliases^} {inputs stack^} {outputs stack^}) + {#.doc (doc "Concatenative function types." + (=> [Nat] [Nat]) + (All [a] (-> a (=> [] [a]))) + (All [t] (=> [t] [])) + (All [a b c] (=> [a b c] [b c a])) + (All [___a ___z] + (=> {then (=> ___a ___z) + else (=> ___a ___z)} + ___a [Bit then else] ___z)))} (let [de_alias (function (_ aliased) (list\fold (function (_ [from to] pre) (code.replace (code.local_identifier from) to pre)) @@ -102,6 +112,13 @@ top)) (syntax: #export (||> {commands (<>.some .any)}) + {#.doc (doc "A self-contained sequence of concatenative instructions." + (is? value + (||> (..push sample))) + + (||> (push 123) + dup + n/=))} (in (list (` (|> (~! ..begin!) (~+ commands) ((~! ..end!))))))) (syntax: #export (word: @@ -110,12 +127,21 @@ {annotations (<>.default |annotations|.empty |annotations|.parser)} type {commands (<>.some .any)}) + {#.doc (doc "A named concatenative function." + (word: square + (=> [Nat] [Nat]) + + dup + (apply/2 n.*)))} (in (list (` (def: (~+ (|export|.format export)) (~ (code.local_identifier name)) (~ (|annotations|.format annotations)) (~ type) (|>> (~+ commands))))))) (syntax: #export (apply {arity (|> .nat (<>.only (n.> 0)))}) + {#.doc (doc "A generator for functions that turn arity N functions into arity N concatenative functions." + (: (=> [Nat] [Nat]) + ((apply 1) inc)))} (with_gensyms [g! g!func g!stack g!output] (monad.do {! meta.monad} [g!inputs (|> (macro.gensym "input") (list.repeat arity) (monad.seq !))] @@ -126,70 +152,84 @@ (function ((~ g!) (~ (stack_fold g!inputs g!stack))) [(~ g!stack) ((~ g!func) (~+ g!inputs))]))))))))) -(def: #export apply/1 (apply 1)) -(def: #export apply/2 (apply 2)) -(def: #export apply/3 (apply 3)) -(def: #export apply/4 (apply 4)) -(def: #export apply/5 (apply 5)) -(def: #export apply/6 (apply 6)) -(def: #export apply/7 (apply 7)) -(def: #export apply/8 (apply 8)) +(template [] + [(with_expansions [ (template.identifier ["apply/" ]) + (template.text ["Lift a function of arity " + " into a concatenative function of arity " "."])] + (def: #export + {#.doc (doc )} + (apply )))] + + [1] [2] [3] [4] + [5] [6] [7] [8] + ) (def: #export (push x) + {#.doc (doc "Push a value onto the stack.")} (All [a] (-> a (=> [] [a]))) (function (_ stack) [stack x])) (def: #export drop + {#.doc (doc "Drop/pop a value from the top of the stack.")} (All [t] (=> [t] [])) (function (_ [stack top]) stack)) (def: #export nip + {#.doc (doc "Drop the second-to-last value from the top of the stack.")} (All [_ a] (=> [_ a] [a])) (function (_ [[stack _] top]) [stack top])) (def: #export dup + {#.doc (doc "Duplicate the top of the stack.")} (All [a] (=> [a] [a a])) (function (_ [stack top]) [[stack top] top])) (def: #export swap + {#.doc (doc "Swaps the 2 topmost stack values.")} (All [a b] (=> [a b] [b a])) (function (_ [[stack l] r]) [[stack r] l])) (def: #export rotL + {#.doc (doc "Rotes the 3 topmost stack values to the left.")} (All [a b c] (=> [a b c] [b c a])) (function (_ [[[stack a] b] c]) [[[stack b] c] a])) (def: #export rotR + {#.doc (doc "Rotes the 3 topmost stack values to the right.")} (All [a b c] (=> [a b c] [c a b])) (function (_ [[[stack a] b] c]) [[[stack c] a] b])) (def: #export && + {#.doc (doc "Groups the 2 topmost stack values as a 2-tuple.")} (All [a b] (=> [a b] [(& a b)])) (function (_ [[stack l] r]) [stack [l r]])) (def: #export ||L + {#.doc (doc "Left-injects the top into sum.")} (All [a b] (=> [a] [(| a b)])) (function (_ [stack l]) [stack (0 #0 l)])) (def: #export ||R + {#.doc (doc "Right-injects the top into sum.")} (All [a b] (=> [b] [(| a b)])) (function (_ [stack r]) [stack (0 #1 r)])) (template [ ] - [(def: #export - (=> [ ] []) - (function (_ [[stack subject] param]) - [stack ( param subject)]))] + [(`` (def: #export + {#.doc (doc (~~ (template.text [ " for " " arithmetic."])))} + (=> [ ] []) + (function (_ [[stack subject] param]) + [stack ( param subject)])))] [Nat Nat n/+ n.+] [Nat Nat n/- n.-] @@ -237,6 +277,12 @@ ) (def: #export if + {#.doc (doc "If expression." + (is? "then" + (||> (push true) + (push "then") + (push "else") + if)))} (All [___a ___z] (=> {then (=> ___a ___z) else (=> ___a ___z)} @@ -247,6 +293,7 @@ (else stack)))) (def: #export call + {#.doc (doc "Executes an anonymous block on the stack.")} (All [___a ___z] (=> {quote (=> ___a ___z)} ___a [quote] ___z)) @@ -254,6 +301,7 @@ (quote stack))) (def: #export loop + {#.doc (doc "Executes a block as a loop until it yields #0 to stop.")} (All [___] (=> {test (=> ___ ___ [Bit])} ___ [test] ___)) @@ -264,6 +312,7 @@ stack')))) (def: #export dip + {#.doc (doc "Executes a block on the stack, save for the topmost value.")} (All [___ a] (=> ___ [a (=> ___ ___)] ___ [a])) @@ -271,6 +320,7 @@ [(quote stack) a])) (def: #export dip/2 + {#.doc (doc "Executes a block on the stack, save for the 2 topmost values.")} (All [___ a b] (=> ___ [a b (=> ___ ___)] ___ [a b])) @@ -278,6 +328,12 @@ [[(quote stack) a] b])) (def: #export do + {#.doc (doc "Do-while loop expression." + (n.= (inc sample) + (||> (push sample) + (push (push false)) + (push (|>> (push 1) n/+)) + do while)))} (All [___a ___z] (=> {body (=> ___a ___z) pred (=> ___z ___a [Bit])} @@ -287,6 +343,14 @@ [[(body stack) pred] body])) (def: #export while + {#.doc (doc "While loop expression." + (n.= (n.+ distance start) + (||> (push start) + (push (|>> dup + (push start) n/- + (push distance) n/<)) + (push (|>> (push 1) n/+)) + while)))} (All [___a ___z] (=> {body (=> ___z ___a) pred (=> ___a ___z [Bit])} @@ -299,13 +363,27 @@ stack')))) (def: #export compose + {#.doc (doc "Function composition." + (n.= (n.+ 2 sample) + (||> (push sample) + (push (|>> (push 1) n/+)) + (push (|>> (push 1) n/+)) + compose + call)))} (All [___a ___ ___z] (=> [(=> ___a ___) (=> ___ ___z)] [(=> ___a ___z)])) (function (_ [[stack f] g]) [stack (|>> f g)])) -(def: #export curry +(def: #export partial + {#.doc (doc "Partial application." + (n.= (n.+ sample sample) + (||> (push sample) + (push sample) + (push n/+) + partial + call)))} (All [___a ___z a] (=> ___a [a (=> ___a [a] ___z)] ___a [(=> ___a ___z)])) @@ -313,19 +391,21 @@ [stack (|>> (push arg) quote)])) (word: #export when + {#.doc (doc "Only execute the block when #1.")} (All [___] (=> {body (=> ___ ___)} ___ [Bit body] ___)) swap - (push (|>> call)) - (push (|>> drop)) + (push ..call) + (push ..drop) if) (word: #export ? + {#.doc (doc "Choose the top value when #0 and the second-to-top when #1.")} (All [a] (=> [Bit a a] [a])) rotL - (push (|>> drop)) - (push (|>> nip)) + (push ..drop) + (push ..nip) if) diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index 5b954efcd..72d28a0b7 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -58,11 +58,11 @@ [current (async.poll read)] (case current (#.Some [head tail]) - (\ ! map (|>> (#.Cons head)) + (\ ! map (|>> (#.Item head)) (pending tail)) #.None - (in #.Nil)))) + (in #.End)))) (abstract: #export (Actor s) {#obituary [(Async ) @@ -106,7 +106,7 @@ (exec (io.run (do io.monad [pending (..pending tail)] - (resolve [error state (#.Cons head pending)]))) + (resolve [error state (#.Item head pending)]))) (in []))) (#try.Success state') @@ -270,7 +270,7 @@ (message: #export (push {value a} state self) (List a) - (let [state' (#.Cons value state)] + (let [state' (#.Item value state)] (async.resolved (#try.Success [state' state']))))) (actor: #export Counter diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index 68a586914..4f96b2122 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -78,7 +78,7 @@ (f value) #.None - (let [new [_value (#.Cons f _observers)]] + (let [new [_value (#.Item f _observers)]] (do ! [swapped? (atom.compare_and_swap old new async)] (if swapped? diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux index 9bda3c334..beecb2511 100644 --- a/stdlib/source/library/lux/control/concurrency/frp.lux +++ b/stdlib/source/library/lux/control/concurrency/frp.lux @@ -102,9 +102,9 @@ (def: (apply ff fa) (do async.monad - [cons_f ff - cons_a fa] - (case [cons_f cons_a] + [item_f ff + item_a fa] + (case [item_f item_a] [(#.Some [head_f tail_f]) (#.Some [head_a tail_a])] (in (#.Some [(head_f head_a) (apply tail_f tail_a)])) @@ -157,8 +157,8 @@ (io (exec (: (Async Any) (loop [channel channel] (do async.monad - [cons channel] - (case cons + [item channel] + (case item (#.Some [head tail]) (case (io.run (subscriber head)) (#.Some _) @@ -176,8 +176,8 @@ "that pass the test.")} (All [a] (-> (-> a Bit) (Channel a) (Channel a))) (do async.monad - [cons channel] - (case cons + [item channel] + (case item (#.Some [head tail]) (let [tail' (only pass? tail)] (if (pass? head) @@ -200,8 +200,8 @@ (-> (-> b a (Async a)) a (Channel b) (Async a))) (do {! async.monad} - [cons channel] - (case cons + [item channel] + (case item #.None (in init) @@ -215,8 +215,8 @@ (-> (-> b a (Async a)) a (Channel b) (Channel a))) (do {! async.monad} - [cons channel] - (case cons + [item channel] + (case item #.None (in (#.Some [init (in #.None)])) @@ -254,8 +254,8 @@ (def: (distinct' equivalence previous channel) (All [a] (-> (Equivalence a) a (Channel a) (Channel a))) (do async.monad - [cons channel] - (case cons + [item channel] + (case item (#.Some [head tail]) (if (\ equivalence = previous head) (distinct' equivalence previous tail) @@ -267,8 +267,8 @@ (def: #export (distinct equivalence channel) (All [a] (-> (Equivalence a) (Channel a) (Channel a))) (do async.monad - [cons channel] - (case cons + [item channel] + (case item (#.Some [head tail]) (in (#.Some [head (distinct' equivalence head tail)])) @@ -278,23 +278,23 @@ (def: #export (consume channel) (All [a] (-> (Channel a) (Async (List a)))) (do {! async.monad} - [cons channel] - (case cons + [item channel] + (case item (#.Some [head tail]) - (\ ! map (|>> (#.Cons head)) + (\ ! map (|>> (#.Item head)) (consume tail)) #.None - (in #.Nil)))) + (in #.End)))) (def: #export (sequential milli_seconds values) {#.doc (doc "Transforms the given list into a channel with the same elements.")} (All [a] (-> Nat (List a) (Channel a))) (case values - #.Nil + #.End ..empty - (#.Cons head tail) + (#.Item head tail) (async.resolved (#.Some [head (do async.monad [_ (async.wait milli_seconds)] (sequential milli_seconds tail))])))) diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index da01d2db8..183558265 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -72,7 +72,7 @@ (do io.monad [#let [[channel sink] (frp.channel [])] _ (atom.update (function (_ [value observers]) - [value (#.Cons sink observers)]) + [value (#.Item sink observers)]) (:representation target))] (in [channel sink]))) ) @@ -109,23 +109,23 @@ #.None (let [value (..read! var)] - [(#.Cons [var value value] tx) + [(#.Item [var value value] tx) value])))) (def: (update_tx_value var value tx) (All [a] (-> (Var a) a Tx Tx)) (case tx - #.Nil - #.Nil + #.End + #.End - (#.Cons [_var _original _current] tx') + (#.Item [_var _original _current] tx') (if (is? (:as (Var Any) var) (:as (Var Any) _var)) - (#.Cons {#var (:as (Var Any) _var) + (#.Item {#var (:as (Var Any) _var) #original (:as Any _original) #current (:as Any value)} tx') - (#.Cons {#var _var + (#.Item {#var _var #original _original #current _current} (update_tx_value var value tx'))))) @@ -139,7 +139,7 @@ []] #.None - [(#.Cons [var (..read! var) value] tx) + [(#.Item [var (..read! var) value] tx) []]))) (implementation: #export functor diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux index 36f65d0ea..9a6f3a7b1 100644 --- a/stdlib/source/library/lux/control/concurrency/thread.lux +++ b/stdlib/source/library/lux/control/concurrency/thread.lux @@ -130,7 +130,7 @@ ## Default (do {! io.monad} [now (\ ! map (|>> instant.to_millis .nat) instant.now) - _ (atom.update (|>> (#.Cons {#creation now + _ (atom.update (|>> (#.Item {#creation now #delay milli_seconds #action action})) ..runner)] @@ -153,7 +153,7 @@ [threads (atom.read ..runner)] (case threads ## And... we're done! - #.Nil + #.End (in []) _ diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index 22b882f85..c57c9877b 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -34,6 +34,7 @@ #constructor (-> a Text)}) (def: #export (match? exception error) + {#.doc (doc "Is this exception the cause of the error message?")} (All [e] (-> (Exception e) Text Bit)) (text.starts_with? (get@ #label exception) error)) @@ -100,7 +101,7 @@ (exception: #export some_exception) "" "Complex case:" - (exception: #export [optional type variables] (some_exception {optional Text} {arguments Int}) + (exception: #export [arbitrary type variables] (some_exception {optional Text} {arguments Int}) optional_body))} (macro.with_gensyms [g!descriptor] (do meta.monad @@ -140,29 +141,37 @@ (text.replace_all text.new_line on_new_line) ($_ text\compose padding header header_separator)))))] (case entries - #.Nil + #.End "" - (#.Cons head tail) + (#.Item head tail) (list\fold (function (_ post pre) ($_ text\compose pre text.new_line (on_entry post))) (on_entry head) tail)))) (syntax: #export (report {entries (p.many (s.tuple (p.and s.any s.any)))}) + {#.doc (doc "An error report." + (: Text + (report ["Row 0" value/0] + ["Row 1" value/1] + ,,, + ["Row N" value/N])))} (in (list (` ((~! report') (list (~+ (|> entries (list\map (function (_ [header message]) (` [(~ header) (~ message)]))))))))))) (def: #export (enumerate format entries) + {#.doc (doc "A numbered report of the entries on a list." + "NOTE: 0-based numbering.")} (All [a] (-> (-> a Text) (List a) Text)) (|> entries (list\fold (function (_ entry [index next]) [(inc index) - (#.Cons [(n\encode index) (format entry)] + (#.Item [(n\encode index) (format entry)] next)]) - [0 #.Nil]) + [0 #.End]) product.right list.reverse ..report')) @@ -183,6 +192,7 @@ error)) (def: #export (with exception message computation) + {#.doc (doc "If a computation fails, prepends the exception to the error.")} (All [e a] (-> (Exception e) e (Try a) (Try a))) (case computation (#//.Failure error) diff --git a/stdlib/source/library/lux/control/function.lux b/stdlib/source/library/lux/control/function.lux index 2f880a872..32d3633ef 100644 --- a/stdlib/source/library/lux/control/function.lux +++ b/stdlib/source/library/lux/control/function.lux @@ -36,6 +36,7 @@ (function (_ x y) (f y x))) (def: #export (apply input function) + {#.doc (doc "Simple 1-argument function application.")} (All [i o] (-> i (-> i o) o)) (function input)) diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux index 73407a7f1..d53249897 100644 --- a/stdlib/source/library/lux/control/function/mutual.lux +++ b/stdlib/source/library/lux/control/function/mutual.lux @@ -70,10 +70,10 @@ (and (even? 4) (odd? 5))))} (case functions - #.Nil + #.End (in (list body)) - (#.Cons mutual #.Nil) + (#.Item mutual #.End) (.let [g!name (|> mutual (get@ [#declaration #declaration.name]) code.local_identifier)] (in (list (` (.let [(~ g!name) (: (~ (get@ #type mutual)) (function (~ (declaration.format (get@ #declaration mutual))) @@ -134,10 +134,10 @@ 0 false _ (even? (dec number)))]))} (case functions - #.Nil + #.End (in (list)) - (#.Cons definition #.Nil) + (#.Item definition #.End) (.let [(^slots [#exported? #mutual]) definition (^slots [#declaration #type #body]) mutual] (in (list (` (.def: diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux index f473208a9..d38044ec1 100644 --- a/stdlib/source/library/lux/control/parser.lux +++ b/stdlib/source/library/lux/control/parser.lux @@ -90,6 +90,9 @@ (#try.Success [input' (#.Some x)])))) (def: #export (run parser input) + {#.doc (doc "Executes the parser on the input." + "Does not verify that all of the input has been consumed by the parser." + "Returns both the parser's output, and a value that represents the remaining input.")} (All [s a] (-> (Parser s a) s (Try [s a]))) (parser input)) @@ -151,7 +154,7 @@ (-> (Parser s a) (Parser s (List a)))) (|> (..some parser) (..and parser) - (\ ..monad map (|>> #.Cons)))) + (\ ..monad map (|>> #.Item)))) (def: #export (exactly amount parser) {#.doc "Parse exactly N times."} @@ -162,7 +165,7 @@ [x parser] (|> parser (exactly (dec amount)) - (\ ! map (|>> (#.Cons x))))))) + (\ ! map (|>> (#.Item x))))))) (def: #export (at_least amount parser) {#.doc "Parse at least N times."} @@ -182,7 +185,7 @@ (#try.Success [input (list)]) (#try.Success [input' x]) - (..run (\ ..monad map (|>> (#.Cons x)) + (..run (\ ..monad map (|>> (#.Item x)) (at_most (dec amount) parser)) input'))))) @@ -197,21 +200,22 @@ (in minimum)))) (def: #export (separated_by separator parser) - {#.doc "Parsers instances of 'parser' that are separated by instances of 'separator'."} + {#.doc "Parses instances of 'parser' that are separated by instances of 'separator'."} (All [s a b] (-> (Parser s b) (Parser s a) (Parser s (List a)))) (do {! ..monad} [?x (..maybe parser)] (case ?x #.None - (in #.Nil) + (in #.End) (#.Some x) (|> parser (..and separator) ..some - (\ ! map (|>> (list\map product.right) (#.Cons x))))))) + (\ ! map (|>> (list\map product.right) (#.Item x))))))) (def: #export (not parser) + {#.doc (doc "Only succeeds when the underlying parser fails.")} (All [s a] (-> (Parser s a) (Parser s Any))) (function (_ input) (case (parser input) @@ -222,11 +226,13 @@ (#try.Failure "Expected to fail; yet succeeded.")))) (def: #export (failure message) + {#.doc (doc "Always fail with this 'message'.")} (All [s a] (-> Text (Parser s a))) (function (_ input) (#try.Failure message))) (def: #export (lift operation) + {#.doc (doc "Lift a potentially failed computation into a parser.")} (All [s a] (-> (Try a) (Parser s a))) (function (_ input) (case operation @@ -248,23 +254,26 @@ (#try.Success [input' output])))) (def: #export remaining + {#.doc (doc "Yield the remaining input (without consuming it).")} (All [s] (Parser s s)) (function (_ inputs) (#try.Success [inputs inputs]))) (def: #export (rec parser) - {#.doc "Combinator for recursive parser."} + {#.doc "Combinator for recursive parsers."} (All [s a] (-> (-> (Parser s a) (Parser s a)) (Parser s a))) (function (_ inputs) (..run (parser (rec parser)) inputs))) (def: #export (after param subject) + {#.doc (doc "Run the parser after another one (whose output is ignored).")} (All [s _ a] (-> (Parser s _) (Parser s a) (Parser s a))) (do ..monad [_ param] subject)) (def: #export (before param subject) + {#.doc (doc "Run the parser before another one (whose output is ignored).")} (All [s _ a] (-> (Parser s _) (Parser s a) (Parser s a))) (do ..monad [output subject @@ -272,6 +281,7 @@ (in output))) (def: #export (only test parser) + {#.doc (doc "Only succeed when the parser's output passes a test.")} (All [s a] (-> (-> a Bit) (Parser s a) (Parser s a))) (do ..monad [output parser @@ -279,6 +289,7 @@ (in output))) (def: #export (parses? parser) + {#.doc (doc "Ignore a parser's output and just verify that it succeeds.")} (All [s a] (-> (Parser s a) (Parser s Bit))) (function (_ input) (case (parser input) @@ -289,6 +300,7 @@ (#try.Success [input' true])))) (def: #export (parses parser) + {#.doc (doc "Ignore a parser's output and just execute it.")} (All [s a] (-> (Parser s a) (Parser s Any))) (function (_ input) (case (parser input) @@ -299,6 +311,8 @@ (#try.Success [input' []])))) (def: #export (speculative parser) + {#.doc (doc "Executes a parser, without actually consuming the input." + "That way, the same input can be consumed again by another parser.")} (All [s a] (-> (Parser s a) (Parser s a))) (function (_ input) (case (parser input) @@ -309,6 +323,7 @@ output))) (def: #export (codec codec parser) + {#.doc (doc "Decode the output of a parser using a codec.")} (All [s a z] (-> (Codec a z) (Parser s a) (Parser s z))) (function (_ input) (case (parser input) diff --git a/stdlib/source/library/lux/control/parser/analysis.lux b/stdlib/source/library/lux/control/parser/analysis.lux index 2b585c31e..b94490a95 100644 --- a/stdlib/source/library/lux/control/parser/analysis.lux +++ b/stdlib/source/library/lux/control/parser/analysis.lux @@ -59,7 +59,7 @@ (#try.Failure error) (#try.Failure error) - (#try.Success [#.Nil value]) + (#try.Success [#.End value]) (#try.Success value) (#try.Success [unconsumed _]) @@ -70,10 +70,10 @@ (Parser Analysis) (function (_ input) (case input - #.Nil + #.End (exception.except ..cannot_parse input) - (#.Cons [head tail]) + (#.Item [head tail]) (#try.Success [tail head])))) (def: #export end! @@ -81,7 +81,7 @@ (Parser Any) (function (_ tokens) (case tokens - #.Nil (#try.Success [tokens []]) + #.End (#try.Success [tokens []]) _ (#try.Failure (format "Expected list of tokens to be empty!" (remaining_inputs tokens)))))) @@ -90,7 +90,7 @@ (Parser Bit) (function (_ tokens) (#try.Success [tokens (case tokens - #.Nil true + #.End true _ false)]))) (template [ ] diff --git a/stdlib/source/library/lux/control/parser/cli.lux b/stdlib/source/library/lux/control/parser/cli.lux index e8796ff1b..df59dbd44 100644 --- a/stdlib/source/library/lux/control/parser/cli.lux +++ b/stdlib/source/library/lux/control/parser/cli.lux @@ -20,7 +20,7 @@ (case (//.run parser inputs) (#try.Success [remaining output]) (case remaining - #.Nil + #.End (#try.Success output) _ @@ -34,7 +34,7 @@ (Parser Text) (function (_ inputs) (case inputs - (#.Cons arg inputs') + (#.Item arg inputs') (#try.Success [inputs' arg]) _ @@ -70,13 +70,13 @@ (#try.Failure try) (case immediate - #.Nil + #.End (#try.Failure try) - (#.Cons to_omit immediate') + (#.Item to_omit immediate') (do try.monad [[remaining output] (recur immediate')] - (in [(#.Cons to_omit remaining) + (in [(#.Item to_omit remaining) output]))))))) (def: #export end @@ -84,7 +84,7 @@ (Parser Any) (function (_ inputs) (case inputs - #.Nil (#try.Success [inputs []]) + #.End (#try.Success [inputs []]) _ (#try.Failure (format "Unknown parameters: " (text.join_with " " inputs)))))) (def: #export (named name value) diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux index 6f52b23d9..7dd43ffa4 100644 --- a/stdlib/source/library/lux/control/parser/code.lux +++ b/stdlib/source/library/lux/control/parser/code.lux @@ -24,8 +24,8 @@ (def: (join_pairs pairs) (All [a] (-> (List [a a]) (List a))) (case pairs - #.Nil #.Nil - (#.Cons [[x y] pairs']) (list& x y (join_pairs pairs')))) + #.End #.End + (#.Item [[x y] pairs']) (list& x y (join_pairs pairs')))) (type: #export Parser {#.doc "A Lux code parser."} @@ -41,10 +41,10 @@ (Parser Code) (function (_ tokens) (case tokens - #.Nil + #.End (#try.Failure "There are no tokens to parse!") - (#.Cons [t tokens']) + (#.Item [t tokens']) (#try.Success [tokens' t])))) (template [ ] @@ -54,7 +54,7 @@ (Parser ) (function (_ tokens) (case tokens - (#.Cons [[_ ( x)] tokens']) + (#.Item [[_ ( x)] tokens']) (#try.Success [tokens' x]) _ @@ -65,7 +65,7 @@ (-> (Parser Any)) (function (_ tokens) (case tokens - (#.Cons [[_ ( actual)] tokens']) + (#.Item [[_ ( actual)] tokens']) (if (\ = expected actual) (#try.Success [tokens' []]) ) @@ -88,7 +88,7 @@ (-> Code (Parser Any)) (function (_ tokens) (case tokens - (#.Cons [token tokens']) + (#.Item [token tokens']) (if (code\= code token) (#try.Success [tokens' []]) (#try.Failure ($_ text\compose "Expected a " (code.format code) " but instead got " (code.format token) @@ -104,7 +104,7 @@ (Parser Text) (function (_ tokens) (case tokens - (#.Cons [[_ ( ["" x])] tokens']) + (#.Item [[_ ( ["" x])] tokens']) (#try.Success [tokens' x]) _ @@ -115,7 +115,7 @@ (-> Text (Parser Any)) (function (_ tokens) (case tokens - (#.Cons [[_ ( ["" actual])] tokens']) + (#.Item [[_ ( ["" actual])] tokens']) (if (\ = expected actual) (#try.Success [tokens' []]) ) @@ -134,9 +134,9 @@ (-> (Parser a) (Parser a))) (function (_ tokens) (case tokens - (#.Cons [[_ ( members)] tokens']) + (#.Item [[_ ( members)] tokens']) (case (p members) - (#try.Success [#.Nil x]) (#try.Success [tokens' x]) + (#try.Success [#.End x]) (#try.Success [tokens' x]) _ (#try.Failure ($_ text\compose "Parser was expected to fully consume " (remaining_inputs tokens)))) _ @@ -152,9 +152,9 @@ (-> (Parser a) (Parser a))) (function (_ tokens) (case tokens - (#.Cons [[_ (#.Record pairs)] tokens']) + (#.Item [[_ (#.Record pairs)] tokens']) (case (p (join_pairs pairs)) - (#try.Success [#.Nil x]) (#try.Success [tokens' x]) + (#try.Success [#.End x]) (#try.Success [tokens' x]) _ (#try.Failure ($_ text\compose "Parser was expected to fully consume record" (remaining_inputs tokens)))) _ @@ -165,7 +165,7 @@ (Parser Any) (function (_ tokens) (case tokens - #.Nil (#try.Success [tokens []]) + #.End (#try.Success [tokens []]) _ (#try.Failure ($_ text\compose "Expected list of tokens to be empty!" (remaining_inputs tokens)))))) (def: #export end? @@ -173,7 +173,7 @@ (Parser Bit) (function (_ tokens) (#try.Success [tokens (case tokens - #.Nil true + #.End true _ false)]))) (def: #export (run parser inputs) @@ -185,7 +185,7 @@ (#try.Success [unconsumed value]) (case unconsumed - #.Nil + #.End (#try.Success value) _ diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux index cc20f6512..f186a315a 100644 --- a/stdlib/source/library/lux/control/parser/json.lux +++ b/stdlib/source/library/lux/control/parser/json.lux @@ -39,7 +39,7 @@ (case (//.run parser (list json)) (#try.Success [remainder output]) (case remainder - #.Nil + #.End (#try.Success output) _ @@ -53,10 +53,10 @@ (Parser JSON) (<| (function (_ inputs)) (case inputs - #.Nil + #.End (exception.except ..empty_input []) - (#.Cons head tail) + (#.Item head tail) (#try.Success [tail head])))) (exception: #export (unexpected_value {value JSON}) @@ -138,7 +138,7 @@ (#try.Success [remainder output]) (case remainder - #.Nil + #.End (in output) _ @@ -166,7 +166,7 @@ (#try.Success [remainder output]) (case remainder - #.Nil + #.End (in output) _ @@ -184,7 +184,7 @@ (^ (list& (#/.String key) value inputs')) (if (text\= key field_name) (case (//.run parser (list value)) - (#try.Success [#.Nil output]) + (#try.Success [#.End output]) (#try.Success [inputs' output]) (#try.Success [inputs'' _]) @@ -197,7 +197,7 @@ (in [(list& (#/.String key) value inputs'') output]))) - #.Nil + #.End (exception.except ..empty_input []) _ diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux index 3496fde42..b902d4b81 100644 --- a/stdlib/source/library/lux/control/parser/synthesis.lux +++ b/stdlib/source/library/lux/control/parser/synthesis.lux @@ -60,7 +60,7 @@ (#try.Failure error) (#try.Failure error) - (#try.Success [#.Nil value]) + (#try.Success [#.End value]) (#try.Success value) (#try.Success [unconsumed _]) @@ -71,10 +71,10 @@ (Parser Synthesis) (.function (_ input) (case input - #.Nil + #.End (exception.except ..empty_input []) - (#.Cons [head tail]) + (#.Item [head tail]) (#try.Success [tail head])))) (def: #export end! @@ -82,7 +82,7 @@ (Parser Any) (.function (_ tokens) (case tokens - #.Nil (#try.Success [tokens []]) + #.End (#try.Success [tokens []]) _ (exception.except ..expected_empty_input [tokens])))) (def: #export end? @@ -90,7 +90,7 @@ (Parser Bit) (.function (_ tokens) (#try.Success [tokens (case tokens - #.Nil true + #.End true _ false)]))) (template [ ] diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux index d8177a553..c4438fbf8 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -81,7 +81,7 @@ (#try.Success [[env' remaining] output]) (case remaining - #.Nil + #.End (#try.Success output) _ @@ -114,10 +114,10 @@ (Parser Type) (.function (_ [env inputs]) (case inputs - #.Nil + #.End (exception.except ..empty_input []) - (#.Cons headT tail) + (#.Item headT tail) (#try.Success [[env inputs] headT])))) (def: #export any @@ -125,10 +125,10 @@ (Parser Type) (.function (_ [env inputs]) (case inputs - #.Nil + #.End (exception.except ..empty_input []) - (#.Cons headT tail) + (#.Item headT tail) (#try.Success [[env tail] headT])))) (def: #export (local types poly) @@ -202,7 +202,7 @@ (|> env' (dictionary.put funcI [headT funcL]) (dictionary.put (inc funcI) [(#.Parameter (inc funcI)) varL])) - (#.Cons varL all_varsL))) + (#.Item varL all_varsL))) (let [partialI (|> current_arg (n.* 2) (n.+ funcI)) partial_varI (inc partialI) partial_varL (label partial_varI) @@ -213,7 +213,7 @@ (|> env' (dictionary.put partialI [.Nothing partialC]) (dictionary.put partial_varI [(#.Parameter partial_varI) partial_varL])) - (#.Cons partial_varL all_varsL)))) + (#.Item partial_varL all_varsL)))) [all_varsL env']))]] (<| (with_env env') (local (list non_poly)) @@ -240,7 +240,7 @@ #let [[funcT paramsT] (type.flat_application (type.anonymous headT))]] (if (n.= 0 (list.size paramsT)) (//.failure (exception.construct ..not_application headT)) - (..local (#.Cons funcT paramsT) poly)))) + (..local (#.Item funcT paramsT) poly)))) (template [ ] [(def: #export ( expected) @@ -324,7 +324,7 @@ (`` (template: (|nothing|) (#.Named [(~~ (static .prelude_module)) "Nothing"] - (#.UnivQ #.Nil + (#.UnivQ #.End (#.Parameter 1))))) (def: #export (recursive poly) diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux index eb11fb3fd..4af88b9b3 100644 --- a/stdlib/source/library/lux/control/parser/xml.lux +++ b/stdlib/source/library/lux/control/parser/xml.lux @@ -60,10 +60,10 @@ (Parser Text) (function (_ [attrs documents]) (case documents - #.Nil + #.End (exception.except ..empty_input []) - (#.Cons head tail) + (#.Item head tail) (case head (#/.Text value) (#try.Success [[attrs tail] value]) @@ -76,10 +76,10 @@ (Parser Tag) (function (_ [attrs documents]) (case documents - #.Nil + #.End (exception.except ..empty_input []) - (#.Cons head _) + (#.Item head _) (case head (#/.Text _) (exception.except ..unexpected_input []) @@ -103,10 +103,10 @@ (All [a] (-> Tag (Parser a) (Parser a))) (function (_ [attrs documents]) (case documents - #.Nil + #.End (exception.except ..empty_input []) - (#.Cons head tail) + (#.Item head tail) (case head (#/.Text _) (exception.except ..unexpected_input []) @@ -123,10 +123,10 @@ (Parser Any) (function (_ [attrs documents]) (case documents - #.Nil + #.End (exception.except ..empty_input []) - (#.Cons head tail) + (#.Item head tail) (#try.Success [[attrs tail] []])))) (exception: #export nowhere) @@ -141,11 +141,11 @@ (#try.Failure error) (case input - #.Nil + #.End (exception.except ..nowhere []) - (#.Cons head tail) + (#.Item head tail) (do try.monad [[[attrs tail'] output] (recur [attrs tail])] - (in [[attrs (#.Cons head tail')] + (in [[attrs (#.Item head tail')] output])))))) diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux index 1945eec59..128c8f036 100644 --- a/stdlib/source/library/lux/control/pipe.lux +++ b/stdlib/source/library/lux/control/pipe.lux @@ -68,11 +68,26 @@ (|> (~ g!temp) (~+ else))))))))) (syntax: #export (if> {test body^} {then body^} {else body^} prev) + {#.doc (doc "If-branching." + (is? (if (n.even? sample) + "even" + "odd") + (|> sample + (if> [n.even?] + [(new> "even" [])] + [(new> "odd" [])]))))} (in (list (` (cond> [(~+ test)] [(~+ then)] [(~+ else)] (~ prev)))))) (syntax: #export (when> {test body^} {then body^} prev) + {#.doc (doc "Only execute the body when the test passes." + (is? (if (n.even? sample) + (n.* 2 sample) + sample) + (|> sample + (when> [n.even?] + [(n.* 2)]))))} (in (list (` (cond> [(~+ test)] [(~+ then)] [] (~ prev)))))) diff --git a/stdlib/source/library/lux/control/reader.lux b/stdlib/source/library/lux/control/reader.lux index cf565cd22..8c46ef9a8 100644 --- a/stdlib/source/library/lux/control/reader.lux +++ b/stdlib/source/library/lux/control/reader.lux @@ -2,8 +2,8 @@ [library [lux #* [abstract - ["." functor (#+ Functor)] [apply (#+ Apply)] + ["." functor (#+ Functor)] ["." monad (#+ Monad do)]]]]) (type: #export (Reader r a) @@ -21,6 +21,7 @@ (|>> change proc)) (def: #export (run env proc) + {#.doc (doc "Executes the reader against the given environment.")} (All [r a] (-> r (Reader r a) a)) (proc env)) diff --git a/stdlib/source/library/lux/control/region.lux b/stdlib/source/library/lux/control/region.lux index 98250983a..281c8d19e 100644 --- a/stdlib/source/library/lux/control/region.lux +++ b/stdlib/source/library/lux/control/region.lux @@ -19,6 +19,8 @@ (-> r (! (Try Any)))) (type: #export (Region r ! a) + {#.doc (doc "A region where resources may be be claimed and where a side-effecting computation may be performed." + "Every resource is paired with a function that knows how to clean/reclaim it, to make sure there are no leaks.")} (-> [r (List (Cleaner r !))] (! [(List (Cleaner r !)) (Try a)]))) @@ -52,6 +54,7 @@ (exception.except ..clean_up_error [error output]))) (def: #export (run monad computation) + {#.doc (doc "Executes a region-based computation, with a side-effect determined by the monad.")} (All [! a] (-> (Monad !) (All [r] (Region r ! a)) (! (Try a)))) @@ -62,10 +65,11 @@ (in (list\fold combine_outcomes output results)))) (def: #export (acquire monad cleaner value) + {#.doc (doc "Acquire a resource while pairing it a function that knows how to reclaim it.")} (All [! a] (-> (Monad !) (-> a (! (Try Any))) a (All [r] (Region r ! a)))) (function (_ [region cleaners]) - (\ monad in [(#.Cons (function (_ region) (cleaner value)) + (\ monad in [(#.Item (function (_ region) (cleaner value)) cleaners) (#try.Success value)]))) @@ -136,6 +140,7 @@ (in [cleaners (#try.Failure error)])))))) (def: #export (failure monad error) + {#.doc (doc "Immediately fail with this 'message'.")} (All [! a] (-> (Monad !) Text (All [r] (Region r ! a)))) @@ -143,16 +148,18 @@ (\ monad in [cleaners (#try.Failure error)]))) (def: #export (except monad exception message) + {#.doc (doc "Fail by throwing/raising an exception.")} (All [! e a] (-> (Monad !) (Exception e) e (All [r] (Region r ! a)))) (failure monad (exception.construct exception message))) (def: #export (lift monad operation) + {#.doc (doc "Lift an effectful computation into a region-based computation.")} (All [! a] (-> (Monad !) (! a) (All [r] (Region r ! a)))) (function (_ [region cleaners]) - (do monad - [output operation] - (in [cleaners (#try.Success output)])))) + (\ monad map + (|>> #try.Success [cleaners]) + operation))) diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux index d8a6dc8a7..659c1cc39 100644 --- a/stdlib/source/library/lux/control/remember.lux +++ b/stdlib/source/library/lux/control/remember.lux @@ -18,6 +18,7 @@ ["." meta] [macro ["." code] + ["." template] [syntax (#+ syntax:)]]]]) (exception: #export (must_remember {deadline Date} {today Date} {message Text} {focus (Maybe Code)}) @@ -47,6 +48,13 @@ (<>.failure message))))) (syntax: #export (remember {deadline ..deadline} {message .text} {focus (<>.maybe .any)}) + {#.doc (doc "A message with an expiration date." + "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)))))} (let [now (io.run instant.now) today (instant.date now)] (if (date\< deadline today) @@ -59,15 +67,22 @@ (meta.failure (exception.construct ..must_remember [deadline today message focus]))))) (template [ ] - [(syntax: #export ( {deadline ..deadline} {message .text} {focus (<>.maybe .any)}) - (in (list (` (..remember (~ (code.text (%.date deadline))) - (~ (code.text (format " " message))) - (~+ (case focus - (#.Some focus) - (list focus) + [(`` (syntax: #export ( {deadline ..deadline} {message .text} {focus (<>.maybe .any)}) + {#.doc (doc (~~ (template.text ["A " " message with an expiration date."])) + "Can have an optional piece of code to focus on." + ( "2022-04-01" + "Do this, that and the other.") + ( "2022-04-01" + "Improve the performace." + (some (complicated (computation 123)))))} + (in (list (` (..remember (~ (code.text (%.date deadline))) + (~ (code.text (format " " message))) + (~+ (case focus + (#.Some focus) + (list focus) - #.None - (list))))))))] + #.None + (list)))))))))] [to_do "TODO"] [fix_me "FIXME"] diff --git a/stdlib/source/library/lux/control/state.lux b/stdlib/source/library/lux/control/state.lux index 661c081d8..447b6428e 100644 --- a/stdlib/source/library/lux/control/state.lux +++ b/stdlib/source/library/lux/control/state.lux @@ -29,13 +29,13 @@ [(change state) []])) (def: #export (use user) - {#.doc "Run function on current state."} + {#.doc "Run a function on the current state."} (All [s a] (-> (-> s a) (State s a))) (function (_ state) [state (user state)])) (def: #export (local change action) - {#.doc "Run computation with a locally-modified state."} + {#.doc "Run the computation with a locally-modified state."} (All [s a] (-> (-> s s) (State s a) (State s a))) (function (_ state) (let [[state' output] (action (change state))] @@ -80,6 +80,7 @@ (ma state'))))) (def: #export (while condition body) + {#.doc (doc "A stateful while loop.")} (All [s] (-> (State s Bit) (State s Any) (State s Any))) (do {! ..monad} [execute? condition] @@ -90,6 +91,7 @@ (in [])))) (def: #export (do_while condition body) + {#.doc (doc "A stateful do-while loop.")} (All [s] (-> (State s Bit) (State s Any) (State s Any))) (do ..monad [_ body] @@ -120,7 +122,7 @@ (-> s (M [s a]))) (def: #export (run' state action) - {#.doc "Run a stateful computation decorated by a monad."} + {#.doc "Execute a stateful computation decorated by a monad."} (All [M s a] (-> s (State' M s a) (M [s a]))) (action state)) diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index ac34275aa..c1b5cd7bc 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -22,7 +22,7 @@ (type: #export (Array a) {#.doc "Mutable arrays."} - (#.Primitive ..type_name (#.Cons a #.Nil))) + (#.Primitive ..type_name (#.Item a #.End))) (with_expansions [ (primitive "java.lang.Long") (primitive "java.lang.Object") @@ -279,13 +279,13 @@ (def: #export (to_list array) (All [a] (-> (Array a) (List a))) (loop [idx (dec (size array)) - output #.Nil] + output #.End] (if (n.= ..underflow idx) output (recur (dec idx) (case (read idx array) (#.Some head) - (#.Cons head output) + (#.Item head output) #.None output))))) @@ -293,11 +293,11 @@ (def: #export (to_list' default array) (All [a] (-> a (Array a) (List a))) (loop [idx (dec (size array)) - output #.Nil] + output #.End] (if (n.= ..underflow idx) output (recur (dec idx) - (#.Cons (maybe.default default (read idx array)) + (#.Item (maybe.default default (read idx array)) output))))) (implementation: #export (equivalence (^open ",\.")) diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index 490f3f3e0..81ad72fbd 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -533,7 +533,7 @@ (case node (#Hierarchy _size hierarchy) (array\fold (function (_ sub_node tail) (list\compose (entries' sub_node) tail)) - #.Nil + #.End hierarchy) (#Base bitmap base) @@ -543,13 +543,13 @@ (list\compose (entries' sub_node) tail) (#.Right [key' val']) - (#.Cons [key' val'] tail))) - #.Nil + (#.Item [key' val'] tail))) + #.End base) (#Collisions hash colls) - (array\fold (function (_ [key' val'] tail) (#.Cons [key' val'] tail)) - #.Nil + (array\fold (function (_ [key' val'] tail) (#.Item [key' val'] tail)) + #.End colls))) (type: #export (Dictionary k v) @@ -639,8 +639,8 @@ (All [k v] (-> (Dictionary k v) (List ))) (|>> ..entries (list\fold (function (_ [k v] bundle) - (#.Cons bundle)) - #.Nil)))] + (#.Item bundle)) + #.End)))] [keys k] [values v] diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux index cb187b477..fcac55d8a 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -572,10 +572,10 @@ (loop [entriesR (entries reference) entriesS (entries sample)] (case [entriesR entriesS] - [#.Nil #.Nil] + [#.End #.End] #1 - [(#.Cons [keyR valueR] entriesR') (#.Cons [keyS valueS] entriesS')] + [(#.Item [keyR valueR] entriesR') (#.Item [keyS valueS] entriesS')] (and (/\= keyR keyS) (,\= valueR valueS) (recur entriesR' entriesS')) diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux index f3f51c779..ac7cbcf6f 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux @@ -17,7 +17,7 @@ (def: #export empty PList - #.Nil) + #.End) (def: #export size (All [a] (-> (PList a) Nat)) @@ -30,10 +30,10 @@ (def: #export (get key properties) (All [a] (-> Text (PList a) (Maybe a))) (case properties - #.Nil + #.End #.None - (#.Cons [k' v'] properties') + (#.Item [k' v'] properties') (if (text\= key k') (#.Some v') (get key properties')))) @@ -59,37 +59,37 @@ (def: #export (put key val properties) (All [a] (-> Text a (PList a) (PList a))) (case properties - #.Nil + #.End (list [key val]) - (#.Cons [k' v'] properties') + (#.Item [k' v'] properties') (if (text\= key k') - (#.Cons [key val] + (#.Item [key val] properties') - (#.Cons [k' v'] + (#.Item [k' v'] (put key val properties'))))) (def: #export (update key f properties) (All [a] (-> Text (-> a a) (PList a) (PList a))) (case properties - #.Nil - #.Nil + #.End + #.End - (#.Cons [k' v'] properties') + (#.Item [k' v'] properties') (if (text\= key k') - (#.Cons [k' (f v')] properties') - (#.Cons [k' v'] (update key f properties'))))) + (#.Item [k' (f v')] properties') + (#.Item [k' v'] (update key f properties'))))) (def: #export (remove key properties) (All [a] (-> Text (PList a) (PList a))) (case properties - #.Nil + #.End properties - (#.Cons [k' v'] properties') + (#.Item [k' v'] properties') (if (text\= key k') properties' - (#.Cons [k' v'] + (#.Item [k' v'] (remove key properties'))))) (def: #export equivalence diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index e1661f1a4..feaebb373 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -20,60 +20,60 @@ ["n" nat]]]]]) ## (type: (List a) -## #Nil -## (#Cons a (List a))) +## #End +## (#Item a (List a))) (implementation: #export fold (Fold List) (def: (fold f init xs) (case xs - #.Nil + #.End init - (#.Cons x xs') + (#.Item x xs') (fold f (f x init) xs')))) (def: #export (folds f init inputs) (All [a b] (-> (-> a b b) b (List a) (List b))) (case inputs - #.Nil + #.End (list init) - (#.Cons [head tail]) - (#.Cons [init (folds f (f head init) tail)]))) + (#.Item [head tail]) + (#.Item [init (folds f (f head init) tail)]))) (def: #export (reverse xs) (All [a] (-> (List a) (List a))) - (fold (function (_ head tail) (#.Cons head tail)) - #.Nil + (fold (function (_ head tail) (#.Item head tail)) + #.End xs)) (def: #export (only keep? xs) (All [a] (-> (Predicate a) (List a) (List a))) (case xs - #.Nil - #.Nil + #.End + #.End - (#.Cons x xs') + (#.Item x xs') (if (keep? x) - (#.Cons x (only keep? xs')) + (#.Item x (only keep? xs')) (only keep? xs')))) (def: #export (partition satisfies? list) {#.doc "Divide the list into all elements that satisfy a predicate, and all elements that do not."} (All [a] (-> (Predicate a) (List a) [(List a) (List a)])) (case list - #.Nil - [#.Nil #.Nil] + #.End + [#.End #.End] - (#.Cons head tail) + (#.Item head tail) (let [[in out] (partition satisfies? tail)] (if (satisfies? head) - [(#.Cons head in) out] - [in (#.Cons head out)])))) + [(#.Item head in) out] + [in (#.Item head out)])))) (def: #export (as_pairs xs) {#.doc (doc "Cut the list into pairs of 2." @@ -81,10 +81,10 @@ (All [a] (-> (List a) (List [a a]))) (case xs (^ (list& x1 x2 xs')) - (#.Cons [x1 x2] (as_pairs xs')) + (#.Item [x1 x2] (as_pairs xs')) _ - #.Nil)) + #.End)) (template [ ] [(def: #export ( n xs) @@ -92,14 +92,14 @@ (-> Nat (List a) (List a))) (if (n.> 0 n) (case xs - #.Nil - #.Nil + #.End + #.End - (#.Cons x xs') + (#.Item x xs') ) ))] - [take (#.Cons x (take (dec n) xs')) #.Nil] + [take (#.Item x (take (dec n) xs')) #.End] [drop (drop (dec n) xs') xs] ) @@ -108,15 +108,15 @@ (All [a] (-> (Predicate a) (List a) (List a))) (case xs - #.Nil - #.Nil + #.End + #.End - (#.Cons x xs') + (#.Item x xs') (if (predicate x) )))] - [take_while (#.Cons x (take_while predicate xs')) #.Nil] + [take_while (#.Item x (take_while predicate xs')) #.End] [drop_while (drop_while predicate xs') xs] ) @@ -125,58 +125,58 @@ (-> Nat (List a) [(List a) (List a)])) (if (n.> 0 n) (case xs - #.Nil - [#.Nil #.Nil] + #.End + [#.End #.End] - (#.Cons x xs') + (#.Item x xs') (let [[tail rest] (split (dec n) xs')] - [(#.Cons x tail) rest])) - [#.Nil xs])) + [(#.Item x tail) rest])) + [#.End xs])) (def: (split_with' predicate ys xs) (All [a] (-> (Predicate a) (List a) (List a) [(List a) (List a)])) (case xs - #.Nil + #.End [ys xs] - (#.Cons x xs') + (#.Item x xs') (if (predicate x) - (split_with' predicate (#.Cons x ys) xs') + (split_with' predicate (#.Item x ys) xs') [ys xs]))) (def: #export (split_with predicate xs) {#.doc "Segment the list by using a predicate to tell when to cut."} (All [a] (-> (Predicate a) (List a) [(List a) (List a)])) - (let [[ys' xs'] (split_with' predicate #.Nil xs)] + (let [[ys' xs'] (split_with' predicate #.End xs)] [(reverse ys') xs'])) (def: #export (chunk n xs) {#.doc "Segment the list in chunks of size N."} (All [a] (-> Nat (List a) (List (List a)))) (case xs - #.Nil + #.End (list) _ (let [[pre post] (split n xs)] - (#.Cons pre (chunk n post))))) + (#.Item pre (chunk n post))))) (def: #export (repeat n x) {#.doc "A list of the value x, repeated n times."} (All [a] (-> Nat a (List a))) (if (n.> 0 n) - (#.Cons x (repeat (dec n) x)) - #.Nil)) + (#.Item x (repeat (dec n) x)) + #.End)) (def: (iterate' f x) (All [a] (-> (-> a (Maybe a)) a (List a))) (case (f x) (#.Some x') - (#.Cons x (iterate' f x')) + (#.Item x (iterate' f x')) #.None (list))) @@ -187,7 +187,7 @@ (-> (-> a (Maybe a)) a (List a))) (case (f x) (#.Some x') - (#.Cons x (iterate' f x')) + (#.Item x (iterate' f x')) #.None (list x))) @@ -196,10 +196,10 @@ (All [a b] (-> (-> a (Maybe b)) (List a) (Maybe b))) (case xs - #.Nil + #.End #.None - (#.Cons x xs') + (#.Item x xs') (case (check x) (#.Some output) (#.Some output) @@ -215,20 +215,20 @@ (fold (function (_ head tail) (case (check head) (#.Some head) - (#.Cons head tail) + (#.Item head tail) #.None tail)) - #.Nil + #.End (reverse xs))} (case xs - #.Nil - #.Nil + #.End + #.End - (#.Cons x xs') + (#.Item x xs') (case (check x) (#.Some output) - (#.Cons output (all check xs')) + (#.Item output (all check xs')) #.None (all check xs'))))) @@ -248,13 +248,13 @@ (All [a] (-> a (List a) (List a))) (case xs - #.Nil + #.End xs - (#.Cons x #.Nil) + (#.Item x #.End) xs - (#.Cons x xs') + (#.Item x xs') (list& x sep (interpose sep xs')))) (def: #export (size list) @@ -267,10 +267,10 @@ (-> (Predicate a) (List a) Bit)) (loop [xs xs] (case xs - #.Nil + #.End - (#.Cons x xs') + (#.Item x xs') (case (predicate x) (recur xs') @@ -287,10 +287,10 @@ (All [a] (-> Nat (List a) (Maybe a))) (case xs - #.Nil + #.End #.None - (#.Cons x xs') + (#.Item x xs') (if (n.= 0 i) (#.Some x) (nth (dec i) xs')))) @@ -300,10 +300,10 @@ (def: (= xs ys) (case [xs ys] - [#.Nil #.Nil] + [#.End #.End] #1 - [(#.Cons x xs') (#.Cons y ys')] + [(#.Item x xs') (#.Item y ys')] (and (\ Equivalence = x y) (= xs' ys')) @@ -326,14 +326,14 @@ (implementation: #export monoid (All [a] (Monoid (List a))) - (def: identity #.Nil) + (def: identity #.End) (def: (compose xs ys) (case xs - #.Nil + #.End ys - (#.Cons x xs') - (#.Cons x (compose xs' ys))))) + (#.Item x xs') + (#.Item x (compose xs' ys))))) (open: "." ..monoid) @@ -342,11 +342,11 @@ (def: (map f ma) (case ma - #.Nil - #.Nil + #.End + #.End - (#.Cons a ma') - (#.Cons (f a) (map f ma'))))) + (#.Item a ma') + (#.Item (f a) (map f ma'))))) (open: "." ..functor) @@ -357,10 +357,10 @@ (def: (apply ff fa) (case ff - #.Nil - #.Nil + #.End + #.End - (#.Cons f ff') + (#.Item f ff') (compose (map f fa) (apply ff' fa))))) (implementation: #export monad @@ -369,21 +369,21 @@ (def: &functor ..functor) (def: (in a) - (#.Cons a #.Nil)) + (#.Item a #.End)) (def: join (|>> reverse (fold compose identity)))) (def: #export (sort < xs) (All [a] (-> (-> a a Bit) (List a) (List a))) (case xs - #.Nil + #.End (list) - (#.Cons x xs') + (#.Item x xs') (let [[pre post] (fold (function (_ x' [pre post]) (if (< x x') - [(#.Cons x' pre) post] - [pre (#.Cons x' post)])) + [(#.Item x' pre) post] + [pre (#.Item x' post)])) [(list) (list)] xs')] ($_ compose (sort < pre) (list x) (sort < post))))) @@ -391,7 +391,7 @@ (def: #export (empty? xs) (All [a] (Predicate (List a))) (case xs - #.Nil + #.End true _ @@ -400,10 +400,10 @@ (def: #export (member? eq xs x) (All [a] (-> (Equivalence a) (List a) a Bit)) (case xs - #.Nil + #.End #0 - (#.Cons x' xs') + (#.Item x' xs') (or (\ eq = x x') (member? eq xs' x)))) @@ -412,10 +412,10 @@ {#.doc } (All [a] (-> (List a) (Maybe ))) (case xs - #.Nil + #.End #.None - (#.Cons x xs') + (#.Item x xs') (#.Some )))] [head a x "Returns the first element of a list."] @@ -476,7 +476,7 @@ (let [base (nat@encode idx)] [(identifier$ base) (identifier$ ("lux text concat" base "'"))])))) - pattern (` [(~+ (map (function (_ [v vs]) (` (#.Cons (~ v) (~ vs)))) + pattern (` [(~+ (map (function (_ [v vs]) (` (#.Item (~ v) (~ vs)))) vars+lists))]) g!step (identifier$ "0step0") g!blank (identifier$ "0,0") @@ -485,11 +485,11 @@ (function ((~ g!step) (~+ list_vars)) (case [(~+ list_vars)] (~ pattern) - (#.Cons [(~+ (map product.left vars+lists))] + (#.Item [(~+ (map product.left vars+lists))] ((~ g!step) (~+ list_vars))) (~ g!blank) - #.Nil))))] + #.End))))] (#.Right [state (list code)])) (#.Left "Cannot zipped 0 lists.")) @@ -523,7 +523,7 @@ (let [base (nat@encode idx)] [(identifier$ base) (identifier$ ("lux text concat" base "'"))])))) - pattern (` [(~+ (map (function (_ [v vs]) (` (#.Cons (~ v) (~ vs)))) + pattern (` [(~+ (map (function (_ [v vs]) (` (#.Item (~ v) (~ vs)))) vars+lists))]) g!step (identifier$ "0step0") g!blank (identifier$ "0,0") @@ -532,11 +532,11 @@ (function ((~ g!step) (~ g!func) (~+ list_vars)) (case [(~+ list_vars)] (~ pattern) - (#.Cons ((~ g!func) (~+ (map product.left vars+lists))) + (#.Item ((~ g!func) (~+ (map product.left vars+lists))) ((~ g!step) (~ g!func) (~+ list_vars))) (~ g!blank) - #.Nil))))] + #.End))))] (#.Right [state (list code)])) (#.Left "Cannot zipped_with 0 lists.")) @@ -549,13 +549,13 @@ (def: #export (last xs) (All [a] (-> (List a) (Maybe a))) (case xs - #.Nil + #.End #.None - (#.Cons x #.Nil) + (#.Item x #.End) (#.Some x) - (#.Cons x xs') + (#.Item x xs') (last xs'))) (def: #export (inits xs) @@ -563,19 +563,19 @@ "Empty lists will result in a #.None value being returned instead.")} (All [a] (-> (List a) (Maybe (List a)))) (case xs - #.Nil + #.End #.None - (#.Cons x #.Nil) - (#.Some #.Nil) + (#.Item x #.End) + (#.Some #.End) - (#.Cons x xs') + (#.Item x xs') (case (inits xs') #.None (undefined) (#.Some tail) - (#.Some (#.Cons x tail))) + (#.Some (#.Item x tail))) )) (def: #export (concat xss) @@ -609,8 +609,8 @@ (loop [idx 0 xs xs] (case xs - #.Nil - #.Nil + #.End + #.End - (#.Cons x xs') - (#.Cons [idx x] (recur (inc idx) xs'))))) + (#.Item x xs') + (#.Item [idx x] (recur (inc idx) xs'))))) diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux index e107fd98d..5fc4b333d 100644 --- a/stdlib/source/library/lux/data/collection/queue.lux +++ b/stdlib/source/library/lux/data/collection/queue.lux @@ -71,11 +71,11 @@ (def: #export (push val queue) (All [a] (-> a (Queue a) (Queue a))) (case (get@ #front queue) - #.Nil + #.End (set@ #front (list val) queue) _ - (update@ #rear (|>> (#.Cons val)) queue))) + (update@ #rear (|>> (#.Item val)) queue))) (implementation: #export (equivalence super) (All [a] (-> (Equivalence a) (Equivalence (Queue a)))) diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux index 6447d96fe..a53c7fb0e 100644 --- a/stdlib/source/library/lux/data/collection/row.lux +++ b/stdlib/source/library/lux/data/collection/row.lux @@ -180,7 +180,7 @@ array.to_list list.reverse (list\fold (function (_ sub acc) (list\compose (to_list' sub) acc)) - #.Nil)))) + #.End)))) (type: #export (Row a) {#level Level diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index 3fe88a087..d36ca16c4 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -43,10 +43,10 @@ (loop [head start tail next] (//.pending [head (case tail - #.Nil + #.End (recur start next) - (#.Cons head' tail') + (#.Item head' tail') (recur head' tail'))]))) (template [ ] @@ -89,7 +89,7 @@ (let [[x xs'] (//.run xs)] (if (let [[tail next] ( xs')] - [(#.Cons [x tail]) next]) + [(#.Item [x tail]) next]) [(list) xs])))] [take_while drop_while split_while (-> a Bit) (pred x) pred] diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux index c078c4df1..14ee02181 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -63,7 +63,7 @@ dictionary.entries (list\fold (function (_ [elem multiplicity] output) (list\compose (list.repeat multiplicity elem) output)) - #.Nil))) + #.End))) (template [ ] [(def: #export ( parameter subject) diff --git a/stdlib/source/library/lux/data/collection/stack.lux b/stdlib/source/library/lux/data/collection/stack.lux index c81240c29..53b608c2c 100644 --- a/stdlib/source/library/lux/data/collection/stack.lux +++ b/stdlib/source/library/lux/data/collection/stack.lux @@ -28,24 +28,24 @@ (def: #export (peek stack) (All [a] (-> (Stack a) (Maybe a))) (case (:representation stack) - #.Nil + #.End #.None - (#.Cons value _) + (#.Item value _) (#.Some value))) (def: #export (pop stack) (All [a] (-> (Stack a) (Maybe [a (Stack a)]))) (case (:representation stack) - #.Nil + #.End #.None - (#.Cons top stack') + (#.Item top stack') (#.Some [top (:abstraction stack')]))) (def: #export (push value stack) (All [a] (-> a (Stack a) (Stack a))) - (:abstraction (#.Cons value (:representation stack)))) + (:abstraction (#.Item value (:representation stack)))) (implementation: #export (equivalence super) (All [a] diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux index 444ab32e2..7a14946c5 100644 --- a/stdlib/source/library/lux/data/collection/tree.lux +++ b/stdlib/source/library/lux/data/collection/tree.lux @@ -22,8 +22,11 @@ (def: #export (flatten tree) (All [a] (-> (Tree a) (List a))) - (#.Cons (get@ #value tree) - (list\join (list\map flatten (get@ #children tree))))) + (|> tree + (get@ #children) + (list\map flatten) + list\join + (#.Item (get@ #value tree)))) (def: #export (leaf value) (All [a] (-> a (Tree a))) diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux index 9803124a4..998b75c3e 100644 --- a/stdlib/source/library/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux @@ -86,12 +86,12 @@ (def: #export (down zipper) (All [a] (-> (Zipper a) (Maybe (Zipper a)))) (case (..children zipper) - #.Nil + #.End #.None - (#.Cons head tail) + (#.Item head tail) (#.Some {#family (#.Some {#parent (set@ [#node #//.children] (list) zipper) - #lefts #.Nil + #lefts #.End #rights tail}) #node head}))) @@ -103,12 +103,12 @@ (for {@.old (update@ #node (: (-> (Tree ($ 0)) (Tree ($ 0))) (set@ #//.children (list\compose (list.reverse lefts) - (#.Cons (get@ #node zipper) + (#.Item (get@ #node zipper) rights)))) parent)} (set@ [#node #//.children] (list\compose (list.reverse lefts) - (#.Cons (get@ #node zipper) + (#.Item (get@ #node zipper) rights)) parent)))))) @@ -118,20 +118,20 @@ (case (get@ #family zipper) (#.Some family) (case (get@ family) - (#.Cons next side') + (#.Item next side') (#.Some (for {@.old {#family (#.Some (|> family (set@ side') - (update@ (|>> (#.Cons (get@ #node zipper)))))) + (update@ (|>> (#.Item (get@ #node zipper)))))) #node next}} (let [move (: (All [a] (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) (function (_ side' zipper) (|>> (set@ side') - (update@ (|>> (#.Cons (get@ #node zipper)))))))] + (update@ (|>> (#.Item (get@ #node zipper)))))))] {#family (#.Some (move side' zipper family)) #node next}))) - #.Nil + #.End #.None) #.None @@ -145,19 +145,19 @@ (#.Some family) (case (list.reverse (get@ family)) - #.Nil + #.End #.None - (#.Cons last prevs) + (#.Item last prevs) (#.Some (for {@.old {#family (#.Some (|> family - (set@ #.Nil) - (update@ (|>> (#.Cons (get@ #node zipper)) + (set@ #.End) + (update@ (|>> (#.Item (get@ #node zipper)) (list\compose prevs))))) #node last}} (let [move (: (All [a] (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) (function (_ prevs zipper) - (|>> (set@ #.Nil) - (update@ (|>> (#.Cons (get@ #node zipper)) + (|>> (set@ #.End) + (update@ (|>> (#.Item (get@ #node zipper)) (list\compose prevs))))))] {#family (#.Some (move prevs zipper family)) #node last}))))))] @@ -249,7 +249,7 @@ (def: #export (adopt value zipper) (All [a] (-> a (Zipper a) (Zipper a))) (update@ [#node #//.children] - (|>> (#.Cons (//.leaf value))) + (|>> (#.Item (//.leaf value))) zipper)) (def: #export (remove zipper) @@ -257,12 +257,12 @@ (do maybe.monad [family (get@ #family zipper)] (case (get@ #lefts family) - #.Nil + #.End (in (set@ [#node #//.children] (get@ #rights family) (get@ #parent family))) - (#.Cons next side) + (#.Item next side) (in (|> zipper (set@ #family (|> family (set@ #lefts side) @@ -278,7 +278,7 @@ (#.Some family) (#.Some (set@ #family - (#.Some (update@ (|>> (#.Cons (//.leaf value))) family)) + (#.Some (update@ (|>> (#.Item (//.leaf value))) family)) zipper))))] [insert_left #lefts] diff --git a/stdlib/source/library/lux/data/format/css/font.lux b/stdlib/source/library/lux/data/format/css/font.lux index c153ec0b8..9856d19e4 100644 --- a/stdlib/source/library/lux/data/format/css/font.lux +++ b/stdlib/source/library/lux/data/format/css/font.lux @@ -11,16 +11,16 @@ [world [net (#+ URL)]]]] ["." // #_ - ["#." value (#+ Value Font-Stretch Font-Style Font-Weight)]]) + ["#." value (#+ Value Font_Stretch Font_Style Font_Weight)]]) -(type: #export Unicode-Range +(type: #export Unicode_Range {#start Nat #end Nat}) (type: #export Font {#family Text #source URL - #stretch (Maybe (Value Font-Stretch)) - #style (Maybe (Value Font-Style)) - #weight (Maybe (Value Font-Weight)) - #unicode-range (Maybe Unicode-Range)}) + #stretch (Maybe (Value Font_Stretch)) + #style (Maybe (Value Font_Style)) + #weight (Maybe (Value Font_Weight)) + #unicode_range (Maybe Unicode_Range)}) diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux index 85a775440..1b69f1496 100644 --- a/stdlib/source/library/lux/data/format/css/value.lux +++ b/stdlib/source/library/lux/data/format/css/value.lux @@ -1155,13 +1155,13 @@ (def: #export (font_family options) (-> (List Font) (Value Font)) (case options - (#.Cons _) + (#.Item _) (|> options (list\map ..font_name) (text.join_with ",") (:abstraction Value)) - #.Nil + #.End ..initial))]) (def: #export font_size diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux index 6cd460f9d..a96a6df84 100644 --- a/stdlib/source/library/lux/data/format/html.lux +++ b/stdlib/source/library/lux/data/format/html.lux @@ -210,7 +210,7 @@ (def: #export (image source attributes) (-> URL Attributes Image) (|> attributes - (#.Cons ["src" source]) + (#.Item ["src" source]) (..simple "img"))) (def: #export (svg attributes content) @@ -292,10 +292,10 @@ ($_ ..and for (case (list\map (product.uncurry ..area) areas) - #.Nil + #.End (..empty "map" attributes) - (#.Cons head tail) + (#.Item head tail) (..tag "map" attributes (list\fold (function.flip ..and) head tail))))) @@ -457,10 +457,10 @@ (..term term) (..description description))) descriptions) - #.Nil + #.End (..empty "dl" attributes) - (#.Cons head tail) + (#.Item head tail) (..tag "dl" attributes (list\fold (function.flip ..and) head tail)))) @@ -515,10 +515,10 @@ (-> Attributes (Maybe Content) (Maybe Column) Header (List Cell) (Maybe Cell) Element) (let [head (..table_head (..table_row headers)) content (case (list\map table_row rows) - #.Nil + #.End head - (#.Cons first rest) + (#.Item first rest) (..and head (..table_body (list\fold (function.flip ..and) first rest)))) diff --git a/stdlib/source/library/lux/data/maybe.lux b/stdlib/source/library/lux/data/maybe.lux index d51bfed90..155254f2e 100644 --- a/stdlib/source/library/lux/data/maybe.lux +++ b/stdlib/source/library/lux/data/maybe.lux @@ -145,7 +145,7 @@ (All [a] (-> (Maybe a) (List a))) (case value #.None - #.Nil + #.End (#.Some value) - (#.Cons value #.Nil))) + (#.Item value #.End))) diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux index 7a439fc54..2f0fddee9 100644 --- a/stdlib/source/library/lux/data/sum.lux +++ b/stdlib/source/library/lux/data/sum.lux @@ -36,13 +36,13 @@ [(def: #export ( es) (All [a b] (-> (List (| a b)) (List ))) (case es - #.Nil - #.Nil + #.End + #.End - (#.Cons (0 x) es') - (#.Cons [x ( es')]) + (#.Item (0 x) es') + (#.Item [x ( es')]) - (#.Cons _ es') + (#.Item _ es') ( es')))] [lefts a #0] @@ -52,14 +52,14 @@ (def: #export (partition xs) (All [a b] (-> (List (| a b)) [(List a) (List b)])) (case xs - #.Nil - [#.Nil #.Nil] + #.End + [#.End #.End] - (#.Cons x xs') + (#.Item x xs') (let [[lefts rights] (partition xs')] (case x - (0 #0 x') [(#.Cons x' lefts) rights] - (0 #1 x') [lefts (#.Cons x' rights)])))) + (0 #0 x') [(#.Item x' lefts) rights] + (0 #1 x') [lefts (#.Item x' rights)])))) (def: #export (equivalence left right) (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence (| l r)))) diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index 15dd8ec04..1ab453032 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -181,12 +181,12 @@ (case (..split_with token input) (#.Some [pre post]) (|> output - (#.Cons pre) + (#.Item pre) (recur post)) #.None (|> output - (#.Cons input) + (#.Item input) list.reverse)))) (def: #export (replace_once pattern replacement template) diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index c57394dd3..2778746ea 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -125,8 +125,8 @@ (loop [idx 0] (let [member ("lua array read" idx tuple)] (if ("lua object nil?" member) - #.Nil - (#.Cons member (recur (inc idx))))))))} + #.End + (#.Item member (recur (inc idx))))))))} (as_is)) (def: (tuple_inspection inspection) @@ -449,18 +449,18 @@ representations membersR+ variantV variantV] (case representations - (#.Cons leftR (#.Cons rightR extraR+)) + (#.Item leftR (#.Item rightR extraR+)) (case (:as (| Any Any) variantV) (#.Left left) [lefts #0 (leftR left)] (#.Right right) (case extraR+ - #.Nil + #.End [lefts #1 (rightR right)] _ - (recur (inc lefts) (#.Cons rightR extraR+) right))) + (recur (inc lefts) (#.Item rightR extraR+) right))) _ (undefined)))] @@ -474,13 +474,13 @@ (let [tuple_body (loop [representations membersR+ tupleV tupleV] (case representations - #.Nil + #.End "" - (#.Cons lastR #.Nil) + (#.Item lastR #.End) (lastR tupleV) - (#.Cons headR tailR) + (#.Item headR tailR) (let [[leftV rightV] (:as [Any Any] tupleV)] (%.format (headR leftV) " " (recur tailR rightV)))))] (%.format "[" tuple_body "]")))))) @@ -571,7 +571,7 @@ (dictionary.of_list text.hash))] targets (: (Meta (List Target)) (case targets - #.Nil + #.End (|> environment dictionary.keys (list\map (function (_ local) [local #.None])) diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux index add1ec871..4347cec39 100644 --- a/stdlib/source/library/lux/extension.lux +++ b/stdlib/source/library/lux/extension.lux @@ -61,7 +61,7 @@ {[name extension phase archive inputs] (..declaration (` ))} body) (let [g!parser (case (list\map product.right inputs) - #.Nil + #.End (` ) parsers diff --git a/stdlib/source/library/lux/ffi.js.lux b/stdlib/source/library/lux/ffi.js.lux index 629d2f4f5..81ecf4d82 100644 --- a/stdlib/source/library/lux/ffi.js.lux +++ b/stdlib/source/library/lux/ffi.js.lux @@ -327,7 +327,7 @@ (with_gensyms [g!_] (let [constant (` ("js constant" (~ (code.text head))))] (case tail - #.Nil + #.End (in (list (` (: (.Maybe (~ type)) (case (..type_of (~ constant)) "undefined" @@ -336,7 +336,7 @@ (~ g!_) (#.Some (:as (~ type) (~ constant)))))))) - (#.Cons [next tail]) + (#.Item [next tail]) (let [separator "."] (in (list (` (: (.Maybe (~ type)) (case (..type_of (~ constant)) diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index ff3215f6a..ba8499262 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -57,7 +57,7 @@ (template [ ] [(def: #export .Type - (#.Primitive #.Nil))] + (#.Primitive #.End))] [Boolean box.boolean] [Byte box.byte] @@ -72,7 +72,7 @@ (template [ ] [(def: #export .Type - (#.Primitive (reflection.reflection ) #.Nil))] + (#.Primitive (reflection.reflection ) #.End))] ## Primitives [boolean reflection.boolean] @@ -378,11 +378,11 @@ [parser.primitive? type (primitive_type mode type)] [parser.array? elementT (case (parser.primitive? elementT) (#.Some elementT) - (` (#.Primitive (~ (code.text (..reflection (type.array elementT)))) #.Nil)) + (` (#.Primitive (~ (code.text (..reflection (type.array elementT)))) #.End)) #.None (` (#.Primitive (~ (code.text array.type_name)) - (#.Cons (~ (value_type mode elementT)) #.Nil))))])) + (#.Item (~ (value_type mode elementT)) #.End))))])) (undefined) ))) @@ -437,7 +437,7 @@ (def: (parser->replacer p ast) (-> (Parser Code) (-> Code Code)) (case (<>.run p (list ast)) - (#.Right [#.Nil ast']) + (#.Right [#.End ast']) ast' _ @@ -1512,7 +1512,7 @@ #.None refined)] (case post - #.Nil + #.End unboxed/boxed _ @@ -1574,7 +1574,7 @@ (do meta.monad [#let [enum_type (: Code (case class_tvars - #.Nil + #.End (` (primitive (~ (code.text full_name)))) _ @@ -1843,7 +1843,7 @@ (`` (cond (~~ (template [] [(text\= (..reflection ) name) (case params - #.Nil + #.End (\ meta.monad in ) _ @@ -1861,7 +1861,7 @@ (~~ (template [] [(text\= (..reflection (type.array )) name) (case params - #.Nil + #.End (\ meta.monad in (type.array )) _ @@ -1878,7 +1878,7 @@ (text\= array.type_name name) (case params - (#.Cons elementLT #.Nil) + (#.Item elementLT #.End) (\ meta.monad map type.array (lux_type->jvm_type elementLT)) @@ -1887,7 +1887,7 @@ (text.starts_with? descriptor.array_prefix name) (case params - #.Nil + #.End (let [[_ unprefixed] (maybe.assume (text.split_with descriptor.array_prefix name))] (\ meta.monad map type.array (lux_type->jvm_type (#.Primitive unprefixed (list))))) diff --git a/stdlib/source/library/lux/ffi.lua.lux b/stdlib/source/library/lux/ffi.lua.lux index a1481fa45..7a4825ea7 100644 --- a/stdlib/source/library/lux/ffi.lua.lux +++ b/stdlib/source/library/lux/ffi.lua.lux @@ -140,7 +140,7 @@ (#.Some (~ g!temp)) (~ g!temp) - #.Nil + #.None ("lua object nil"))) input)) @@ -226,14 +226,14 @@ g!type (code.local_identifier class) real_class (text.replace_all "/" "." class) imported (case (text.split_all_with "/" class) - (#.Cons head tail) + (#.Item head tail) (list\fold (function (_ sub super) (` ("lua object get" (~ (code.text sub)) (:as (..Object .Any) (~ super))))) (` ("lua import" (~ (code.text head)))) tail) - #.Nil + #.End (` ("lua import" (~ (code.text class)))))] (in (list& (` (type: (~ g!type) (..Object (primitive (~ (code.text real_class)))))) diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index ff9ef9f31..5187df976 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -274,11 +274,11 @@ (-> Primitive_Mode (List Type_Parameter) Bit GenericType Code) Code) (case [name+params mode in_array?] - (^multi [[prim #.Nil] #ManualPrM #0] + (^multi [[prim #.End] #ManualPrM #0] {(manual_primitive_to_type prim) (#.Some output)}) output - (^multi [[prim #.Nil] #AutoPrM #0] + (^multi [[prim #.End] #AutoPrM #0] {(auto_primitive_to_type prim) (#.Some output)}) output @@ -329,10 +329,10 @@ (let [=params (list\map (: (-> Type_Parameter Code) (function (_ [pname pbounds]) (case pbounds - #.Nil + #.End (code.identifier ["" pname]) - (#.Cons bound1 _) + (#.Item bound1 _) (class_to_type #ManualPrM class_params bound1)))) class_params)] (` (primitive (~ (code.text (safe class_name))) @@ -369,7 +369,7 @@ (format "[" (simple_class$ env param)) (^template [ ] - [(#GenericClass #.Nil) + [(#GenericClass #.End) ]) (["boolean" "[Z"] ["byte" "[B"] @@ -427,7 +427,7 @@ (def: (parser_to_replacer p ast) (-> (Parser Code) (-> Code Code)) (case (<>.run p (list ast)) - (#.Right [#.Nil ast']) + (#.Right [#.End ast']) ast' _ @@ -551,7 +551,7 @@ [component recur^] (case component (^template [ ] - [(#GenericClass #.Nil) + [(#GenericClass #.End) (in (#GenericClass (list)))]) (["[Z" "boolean"] ["[B" "byte"] @@ -1446,7 +1446,7 @@ (def: (free_type_param? [name bounds]) (-> Type_Parameter Bit) (case bounds - #.Nil #1 + #.End #1 _ #0)) (def: (type_param_to_type_arg [name _]) @@ -1504,7 +1504,7 @@ (do {! meta.monad} [#let [enum_type (: Code (case class_tvars - #.Nil + #.End (` (primitive (~ (code.text full_name)))) _ diff --git a/stdlib/source/library/lux/ffi.py.lux b/stdlib/source/library/lux/ffi.py.lux index 150cbf578..436f1c729 100644 --- a/stdlib/source/library/lux/ffi.py.lux +++ b/stdlib/source/library/lux/ffi.py.lux @@ -226,14 +226,14 @@ g!type (code.local_identifier class) real_class (text.replace_all "/" "." class) imported (case (text.split_all_with "/" class) - (#.Cons head tail) + (#.Item head tail) (list\fold (function (_ sub super) (` ("python object get" (~ (code.text sub)) (:as (..Object .Any) (~ super))))) (` ("python import" (~ (code.text head)))) tail) - #.Nil + #.End (` ("python import" (~ (code.text class)))))] (in (list& (` (type: (~ g!type) (..Object (primitive (~ (code.text real_class)))))) diff --git a/stdlib/source/library/lux/ffi.rb.lux b/stdlib/source/library/lux/ffi.rb.lux index ba63ac1b1..d22138957 100644 --- a/stdlib/source/library/lux/ffi.rb.lux +++ b/stdlib/source/library/lux/ffi.rb.lux @@ -148,7 +148,7 @@ (#.Some (~ g!temp)) (~ g!temp) - #.Nil + #.None ("ruby object nil"))) input)) diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux index 69559353f..dddce2ebc 100644 --- a/stdlib/source/library/lux/ffi.scm.lux +++ b/stdlib/source/library/lux/ffi.scm.lux @@ -122,7 +122,7 @@ (#.Some (~ g!temp)) (~ g!temp) - #.Nil + #.None ("scheme object nil"))) input)) diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux index 242ed8a85..e80b1d665 100644 --- a/stdlib/source/library/lux/macro.lux +++ b/stdlib/source/library/lux/macro.lux @@ -23,7 +23,7 @@ "Otherwise, returns the code as-is.")} (-> Code (Meta (List Code))) (case syntax - [_ (#.Form (#.Cons [[_ (#.Identifier name)] args]))] + [_ (#.Form (#.Item [[_ (#.Identifier name)] args]))] (do //.monad [?macro (//.macro name)] (case ?macro @@ -41,7 +41,7 @@ "Otherwise, returns the code as-is.")} (-> Code (Meta (List Code))) (case syntax - [_ (#.Form (#.Cons [[_ (#.Identifier name)] args]))] + [_ (#.Form (#.Item [[_ (#.Identifier name)] args]))] (do //.monad [?macro (//.macro name)] (case ?macro @@ -61,7 +61,7 @@ {#.doc "Expands all macro-calls everywhere recursively, until only primitive/base code remains."} (-> Code (Meta (List Code))) (case syntax - [_ (#.Form (#.Cons [[_ (#.Identifier name)] args]))] + [_ (#.Form (#.Item [[_ (#.Identifier name)] args]))] (do //.monad [?macro (//.macro name)] (case ?macro @@ -76,7 +76,7 @@ [parts' (monad.map //.monad expand_all (list& (code.identifier name) args))] (in (list (code.form (list\join parts'))))))) - [_ (#.Form (#.Cons [harg targs]))] + [_ (#.Form (#.Item [harg targs]))] (do //.monad [harg+ (expand_all harg) targs+ (monad.map //.monad expand_all targs)] @@ -95,7 +95,7 @@ [left (expand_all left) right (expand_all right)] (case [left right] - [(#.Cons left #.Nil) (#.Cons right #.Nil)] + [(#.Item left #.End) (#.Item right #.End)] (in [left right]) _ diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux index 1ba0c4f9f..4108f7ced 100644 --- a/stdlib/source/library/lux/macro/syntax.lux +++ b/stdlib/source/library/lux/macro/syntax.lux @@ -38,8 +38,8 @@ (def: (join_pairs pairs) (All [a] (-> (List [a a]) (List a))) (case pairs - #.Nil #.Nil - (#.Cons [[x y] pairs']) (list& x y (join_pairs pairs')))) + #.End #.End + (#.Item [[x y] pairs']) (list& x y (join_pairs pairs')))) (macro: #export (syntax: tokens) {#.doc (doc "A more advanced way to define macros than 'macro:'." diff --git a/stdlib/source/library/lux/macro/syntax/declaration.lux b/stdlib/source/library/lux/macro/syntax/declaration.lux index 75098a7b9..550c3a4b0 100644 --- a/stdlib/source/library/lux/macro/syntax/declaration.lux +++ b/stdlib/source/library/lux/macro/syntax/declaration.lux @@ -40,7 +40,7 @@ (-> Declaration Code) (let [g!name (code.local_identifier (get@ #name value))] (case (get@ #arguments value) - #.Nil + #.End g!name arguments diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux index a97abb278..3b8bab1d5 100644 --- a/stdlib/source/library/lux/macro/syntax/definition.lux +++ b/stdlib/source/library/lux/macro/syntax/definition.lux @@ -55,11 +55,11 @@ (def: (annotations_format value) (-> Annotations Code) (case value - #.Nil - (` #.Nil) + #.End + (` #.End) - (#.Cons [name value] tail) - (` (#.Cons [(~ (..tag_format name)) + (#.Item [name value] tail) + (` (#.Item [(~ (..tag_format name)) (~ value)] (~ (annotations_format tail)))))) @@ -91,9 +91,9 @@ (<>.rec (function (_ recur) ($_ <>.or - (.tag! (name_of #.Nil)) + (.tag! (name_of #.End)) (.form (do <>.monad - [_ (.tag! (name_of #.Cons)) + [_ (.tag! (name_of #.Item)) [head tail] (<>.and (.tuple (<>.and tag_parser .any)) recur)] (in [head tail]))) diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux index dd03f37b3..288afd703 100644 --- a/stdlib/source/library/lux/math/number.lux +++ b/stdlib/source/library/lux/math/number.lux @@ -49,7 +49,7 @@ [(macro: #export ( tokens state) {#.doc } (case tokens - (#.Cons [meta (#.Text repr')] #.Nil) + (#.Item [meta (#.Text repr')] #.End) (if (..separator_prefixed? repr') (#try.Failure ) (let [repr (..without_separators repr')] diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux index ebec1b4e9..7599e221f 100644 --- a/stdlib/source/library/lux/math/number/nat.lux +++ b/stdlib/source/library/lux/math/number/nat.lux @@ -299,7 +299,7 @@ ["d" "D" 13] ["e" "E" 14] ["f" "F" 15]) _ #.None)) -(template [ ] +(template [ ] [(implementation: #export (Codec Text Nat) @@ -309,7 +309,7 @@ (loop [input value output ""] (let [output' ("lux text concat" - ( ("lux i64 and" mask input)) + ( ("lux i64 and" mask input)) output)] (case (: Nat ("lux i64 right-shift" input)) 0 @@ -319,17 +319,17 @@ (recur input' output'))))))) (def: (decode repr) - (let [input-size ("lux text size" repr)] - (if (..> 0 input-size) + (let [input_size ("lux text size" repr)] + (if (..> 0 input_size) (loop [idx 0 output 0] - (if (..< input-size idx) - (case ( ("lux text char" idx repr)) - (#.Some digit-value) + (if (..< input_size idx) + (case ( ("lux text char" idx repr)) + (#.Some digit_value) (recur (inc idx) (|> output ("lux i64 left-shift" ) - ("lux i64 or" digit-value))) + ("lux i64 or" digit_value))) _ (#try.Failure ("lux text concat" repr))) @@ -357,19 +357,19 @@ (recur input' output'))))) (def: (decode repr) - (let [input-size ("lux text size" repr)] + (let [input_size ("lux text size" repr)] (with_expansions [ (#try.Failure ("lux text concat" "Invalid decimal syntax for Nat: " repr))] - (if (..> 0 input-size) + (if (..> 0 input_size) (loop [idx 0 output 0] - (if (..< input-size idx) + (if (..< input_size idx) (case (decimal_value ("lux text char" idx repr)) #.None - (#.Some digit-value) + (#.Some digit_value) (recur (inc idx) - (|> output (..* 10) (..+ digit-value)))) + (|> output (..* 10) (..+ digit_value)))) (#try.Success output))) ))))) diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux index 9df9cbc53..f0a912431 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -253,7 +253,7 @@ (in ( x xs))) (\ ..monad in )))] - [list List (.list) #.Cons] + [list List (.list) #.Item] [row Row row.empty row.add] ) diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index ec154caaf..3a6174cda 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -147,7 +147,7 @@ (def: (macro_type? type) (-> Type Bit) (`` (case type - (#.Named [(~~ (static .prelude_module)) "Macro"] (#.Primitive "#Macro" #.Nil)) + (#.Named [(~~ (static .prelude_module)) "Macro"] (#.Primitive "#Macro" #.End)) true _ @@ -224,10 +224,10 @@ (def: (type_variable idx bindings) (-> Nat (List [Nat (Maybe Type)]) (Maybe Type)) (case bindings - #.Nil + #.End #.None - (#.Cons [var bound] bindings') + (#.Item [var bound] bindings') (if (n.= idx var) bound (type_variable idx bindings')))) diff --git a/stdlib/source/library/lux/meta/annotation.lux b/stdlib/source/library/lux/meta/annotation.lux index 14f55f106..27512d5f6 100644 --- a/stdlib/source/library/lux/meta/annotation.lux +++ b/stdlib/source/library/lux/meta/annotation.lux @@ -16,7 +16,7 @@ [_ (#.Record ann)] (loop [ann ann] (case ann - (#.Cons [key value] ann') + (#.Item [key value] ann') (case key [_ (#.Tag tag')] (if (name\= tag tag') @@ -26,7 +26,7 @@ _ (recur ann')) - #.Nil + #.End #.None)) _ diff --git a/stdlib/source/library/lux/meta/location.lux b/stdlib/source/library/lux/meta/location.lux index ddc40b147..8738d873a 100644 --- a/stdlib/source/library/lux/meta/location.lux +++ b/stdlib/source/library/lux/meta/location.lux @@ -20,7 +20,7 @@ (macro: #export (here tokens compiler) (case tokens - #.Nil + #.End (let [location (get@ #.location compiler)] (#.Right [compiler (list (` [(~ [..dummy (#.Text (get@ #.module location))]) diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux index 9fb5dfaa3..ecc778d98 100644 --- a/stdlib/source/library/lux/target/common_lisp.lux +++ b/stdlib/source/library/lux/target/common_lisp.lux @@ -152,10 +152,10 @@ (def: #export (args& singles rest) (-> (List Var/1) Var/1 Var/*) (|> (case singles - #.Nil + #.End "" - (#.Cons _) + (#.Item _) (|> singles (list\map ..code) (text.join_with " ") @@ -173,7 +173,7 @@ (def: #export (call/* func) (-> (Expression Any) (-> (List (Expression Any)) (Computation Any))) - (|>> (#.Cons func) ..form)) + (|>> (#.Item func) ..form)) (template [ ] [(def: #export @@ -401,10 +401,10 @@ [(def: #export ( conditions expression) (-> (List Text) (Expression Any) (Expression Any)) (case conditions - #.Nil + #.End expression - (#.Cons single #.Nil) + (#.Item single #.End) (:abstraction (format single " " (:representation expression))) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index a77eb88a4..c2532933a 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -632,12 +632,12 @@ _ (binary.write/32 offset (///signed.value maximum) binary)] (loop [offset (n.+ (///unsigned.value ..integer_size) offset) afterwards (: (List Big_Jump) - (#.Cons at_minimum afterwards))] + (#.Item at_minimum afterwards))] (case afterwards - #.Nil + #.End (in binary) - (#.Cons head tail) + (#.Item head tail) (do ! [_ (binary.write/32 offset (///signed.value head) binary)] (recur (n.+ (///unsigned.value ..big_jump_size) offset) @@ -693,10 +693,10 @@ (loop [offset (n.+ (///unsigned.value ..integer_size) offset) cases cases] (case cases - #.Nil + #.End (in binary) - (#.Cons [value jump] tail) + (#.Item [value jump] tail) (do ! [_ (binary.write/32 offset (///signed.value value) binary) _ (binary.write/32 (n.+ (///unsigned.value ..integer_size) offset) (///signed.value jump) binary)] diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux index 3224c9a24..6b6fc2b5f 100644 --- a/stdlib/source/library/lux/target/jvm/type/lux.lux +++ b/stdlib/source/library/lux/target/jvm/type/lux.lux @@ -55,7 +55,7 @@ [(def: (Parser (Check Type)) (<>.after - (<>\in (check\in (#.Primitive (//reflection.reflection ) #.Nil)))))] + (<>\in (check\in (#.Primitive (//reflection.reflection ) #.End)))))] [boolean //parser.boolean //reflection.boolean] [byte //parser.byte //reflection.byte] @@ -71,7 +71,7 @@ [(def: (Parser (Check Type)) (<>.after - (<>\in (check\in (#.Primitive #.Nil)))))] + (<>\in (check\in (#.Primitive #.End)))))] [boxed_boolean //parser.boolean //box.boolean] [boxed_byte //parser.byte //box.byte] @@ -173,7 +173,7 @@ (-> (Parser (Check Type)) (Parser (Check Type))) (|>> (<>\map (check\map (function (_ elementT) (case elementT - (#.Primitive name #.Nil) + (#.Primitive name #.End) (if (`` (or (~~ (template [] [(text\= (//reflection.reflection ) name)] @@ -185,7 +185,7 @@ [//reflection.float] [//reflection.double] [//reflection.char])))) - (#.Primitive (|> name //reflection.class //reflection.array //reflection.reflection) #.Nil) + (#.Primitive (|> name //reflection.class //reflection.array //reflection.reflection) #.End) (|> elementT array.Array .type)) _ diff --git a/stdlib/source/library/lux/target/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux index 570ec8e73..7e1164671 100644 --- a/stdlib/source/library/lux/target/jvm/type/signature.lux +++ b/stdlib/source/library/lux/target/jvm/type/signature.lux @@ -85,7 +85,7 @@ (format //descriptor.class_prefix (|> name ///name.internal ///name.read) (case parameters - #.Nil + #.End "" _ @@ -122,7 +122,7 @@ (Signature Method)) (:abstraction (format (case type_variables - #.Nil + #.End "" _ (|> type_variables diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux index 10ef0dbd3..7cc266b98 100644 --- a/stdlib/source/library/lux/target/php.lux +++ b/stdlib/source/library/lux/target/php.lux @@ -214,7 +214,7 @@ (def: #export (closure uses arguments body!) (-> (List Argument) (List Argument) Statement Literal) (let [uses (case uses - #.Nil + #.End "" _ diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux index cb6878cb4..f03f876b8 100644 --- a/stdlib/source/library/lux/target/scheme.lux +++ b/stdlib/source/library/lux/target/scheme.lux @@ -77,7 +77,7 @@ (case rest (#.Some rest) (case mandatory - #.Nil + #.End rest _ @@ -155,20 +155,20 @@ (def: form (-> (List (Code Any)) Code) (.let [nested_new_line (format text.new_line text.tab)] - (|>> (case> #.Nil + (|>> (case> #.End (:abstraction "()") - (#.Cons head tail) + (#.Item head tail) (|> tail (list\map (|>> :representation nest)) - (#.Cons (:representation head)) + (#.Item (:representation head)) (text.join_with nested_new_line) (text.enclose ["(" ")"]) :abstraction))))) (def: #export (apply/* args func) (-> (List Expression) Expression Computation) - (..form (#.Cons func args))) + (..form (#.Item func args))) (template [ ] [(def: #export ( members) @@ -339,7 +339,7 @@ (-> Var Arguments Expression Computation) (..form (list (..var "define") (|> arguments - (update@ #mandatory (|>> (#.Cons name))) + (update@ #mandatory (|>> (#.Item name))) ..arguments) body))) @@ -349,7 +349,7 @@ (def: #export begin (-> (List Expression) Computation) - (|>> (#.Cons (..var "begin")) ..form)) + (|>> (#.Item (..var "begin")) ..form)) (def: #export (set! name value) (-> Var Expression Computation) diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux index 2faf51dd2..8af624e4c 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -358,9 +358,9 @@ #let [coverage (|> definitions (list\fold (function (_ [short [exported? _]] aggregate) (if exported? - (#.Cons short aggregate) + (#.Item short aggregate) aggregate)) - #.Nil) + #.End) ..encode_coverage)]] (in (list (` ((~! ..covering') (~ (code.text module)) diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index 8a3d4a1cd..cde736979 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -555,10 +555,10 @@ recur))] (do ! [[archive state] (case new_dependencies - #.Nil + #.End (in [archive state]) - (#.Cons _) + (#.Item _) (do ! [archive,document+ (|> new_dependencies (list\map (import! module)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux index b2b7b6c18..f5e65f9bb 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux @@ -205,7 +205,7 @@ [(#Case [reference_analysis reference_match]) (#Case [sample_analysis sample_match])] (and (= reference_analysis sample_analysis) - (\ (list.equivalence (branch_equivalence =)) = (#.Cons reference_match) (#.Cons sample_match))) + (\ (list.equivalence (branch_equivalence =)) = (#.Item reference_match) (#.Item sample_match))) [(#Function [reference_environment reference_analysis]) (#Function [sample_environment sample_analysis])] @@ -273,7 +273,7 @@ inputs (list)] (case abstraction (#Apply input next) - (recur next (#.Cons input inputs)) + (recur next (#.Item input inputs)) _ [abstraction inputs]))) @@ -376,7 +376,7 @@ (#Apply _) (|> analysis ..application - #.Cons + #.Item (list\map %analysis) (text.join_with " ") (text.enclose ["(" ")"])) @@ -426,14 +426,14 @@ (def: #export (with_scope action) (All [a] (-> (Operation a) (Operation [Scope a]))) (function (_ [bundle state]) - (case (action [bundle (update@ #.scopes (|>> (#.Cons fresh_scope)) state)]) + (case (action [bundle (update@ #.scopes (|>> (#.Item fresh_scope)) state)]) (#try.Success [[bundle' state'] output]) (case (get@ #.scopes state') - (#.Cons head tail) + (#.Item head tail) (#try.Success [[bundle' (set@ #.scopes tail state')] [head output]]) - #.Nil + #.End (#try.Failure "Impossible error: Drained scopes!")) (#try.Failure error) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux index b2a5e9fc6..faa4089a1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux @@ -59,7 +59,7 @@ (^ (#.Form (list& [_ (#.Tag tag)] values))) (case values - (#.Cons value #.Nil) + (#.Item value #.End) (/structure.tagged_sum compile tag archive value) _ @@ -68,7 +68,7 @@ (^ (#.Form (list& [_ (#.Nat lefts)] [_ (#.Bit right?)] values))) (case values - (#.Cons value #.Nil) + (#.Item value #.End) (/structure.sum compile lefts right? archive value) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux index fb8d67bf5..e48d2b1f8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -62,10 +62,10 @@ (def: (re_quantify envs baseT) (-> (List (List Type)) Type Type) (.case envs - #.Nil + #.End baseT - (#.Cons head tail) + (#.Item head tail) (re_quantify tail (#.UnivQ head baseT)))) ## Type-checking on the input value is done during the analysis of a @@ -96,7 +96,7 @@ (recur envs unnamedT) (#.UnivQ env unquantifiedT) - (recur (#.Cons env envs) unquantifiedT) + (recur (#.Item env envs) unquantifiedT) (#.ExQ _) (do ///.monad @@ -182,7 +182,7 @@ [Rev (#.Rev pattern_value) (#/.Rev pattern_value)] [Frac (#.Frac pattern_value) (#/.Frac pattern_value)] [Text (#.Text pattern_value) (#/.Text pattern_value)] - [Any (#.Tuple #.Nil) #/.Unit]) + [Any (#.Tuple #.End) #/.Unit]) (^ [location (#.Tuple (list singleton))]) (analyse_pattern #.None inputT singleton next) @@ -301,7 +301,7 @@ (def: #export (case analyse branches archive inputC) (-> Phase (List [Code Code]) Phase) (.case branches - (#.Cons [patternH bodyH] branchesT) + (#.Item [patternH bodyH] branchesT) (do {! ///.monad} [[inputT inputA] (//type.with_inference (analyse archive inputC)) @@ -321,5 +321,5 @@ (/.failure error))] (in (#/.Case inputA [outputH outputT]))) - #.Nil + #.End (/.except ..cannot_have_empty_branches ""))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux index 37177e7ba..9a34b72aa 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux @@ -122,10 +122,10 @@ ## their sub-patterns. (#/.Complex (#/.Tuple membersP+)) (case (list.reverse membersP+) - (^or #.Nil (#.Cons _ #.Nil)) + (^or #.End (#.Item _ #.End)) (/.except ..invalid_tuple_pattern []) - (#.Cons lastP prevsP+) + (#.Item lastP prevsP+) (do ////.monad [lastC (determine lastP)] (monad.fold ////.monad @@ -328,17 +328,17 @@ (function (_ coverageA possibilitiesSF) (loop [altsSF possibilitiesSF] (case altsSF - #.Nil + #.End (in [#.None (list coverageA)]) - (#.Cons altSF altsSF') + (#.Item altSF altsSF') (case (merge coverageA altSF) (#try.Success altMSF) (case altMSF (#Alt _) (do ! [[success altsSF+] (recur altsSF')] - (in [success (#.Cons altSF altsSF+)])) + (in [success (#.Item altSF altsSF+)])) _ (in [(#.Some altMSF) altsSF'])) @@ -357,12 +357,12 @@ #.None (case (list.reverse possibilitiesSF) - (#.Cons last prevs) + (#.Item last prevs) (in (list\fold (function (_ left right) (#Alt left right)) last prevs)) - #.Nil + #.End (undefined))))) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux index abdf5b806..05a147c3d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux @@ -110,12 +110,12 @@ (def: #export (general archive analyse inferT args) (-> Archive Phase Type (List Code) (Operation [Type (List Analysis)])) (case args - #.Nil + #.End (do ///.monad [_ (//type.infer inferT)] (in [inferT (list)])) - (#.Cons argC args') + (#.Item argC args') (case inferT (#.Named name unnamedT) (general archive analyse unnamedT args) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux index 1ae1152bd..eccae999a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux @@ -106,7 +106,7 @@ (if (list.any? (text\= module) current) current - (#.Cons module current))))) + (#.Item module current))))) state) []]))))) @@ -118,7 +118,7 @@ (function (_ state) (#try.Success [(update@ #.modules (plist.update self_name (update@ #.module_aliases (: (-> (List [Text Text]) (List [Text Text])) - (|>> (#.Cons [alias module]))))) + (|>> (#.Item [alias module]))))) state) []]))))) @@ -145,7 +145,7 @@ (plist.put self_name (update@ #.definitions (: (-> (List [Text Global]) (List [Text Global])) - (|>> (#.Cons [name definition]))) + (|>> (#.Item [name definition]))) self)) state) []]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux index ab202ed61..863975408 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux @@ -51,12 +51,12 @@ (loop [idx 0 mappings (get@ [#.captured #.mappings] scope)] (case mappings - (#.Cons [_name [_source_type _source_ref]] mappings') + (#.Item [_name [_source_type _source_ref]] mappings') (if (text\= name _name) (#.Some [_source_type (#variable.Foreign idx)]) (recur (inc idx) mappings')) - #.Nil + #.End #.None))) (def: (reference? name scope) @@ -81,22 +81,22 @@ (get@ #.scopes) (list.split_with (|>> (reference? name) not)))] (case outer - #.Nil + #.End (#.Right [state #.None]) - (#.Cons top_outer _) + (#.Item top_outer _) (let [[ref_type init_ref] (maybe.default (undefined) (..reference name top_outer)) [ref inner'] (list\fold (: (-> Scope [Variable (List Scope)] [Variable (List Scope)]) (function (_ scope ref+inner) [(#variable.Foreign (get@ [#.captured #.counter] scope)) - (#.Cons (update@ #.captured + (#.Item (update@ #.captured (: (-> Foreign Foreign) (|>> (update@ #.counter inc) (update@ #.mappings (plist.put name [ref_type (product.left ref+inner)])))) scope) (product.right ref+inner))])) - [init_ref #.Nil] + [init_ref #.End] (list.reverse inner)) scopes (list\compose inner' outer)] (#.Right [(set@ #.scopes scopes state) @@ -110,7 +110,7 @@ (All [a] (-> [Text Type] (Operation a) (Operation a))) (function (_ [bundle state]) (case (get@ #.scopes state) - (#.Cons head tail) + (#.Item head tail) (let [old_mappings (get@ [#.locals #.mappings] head) new_var_id (get@ [#.locals #.counter] head) new_head (update@ #.locals @@ -118,12 +118,12 @@ (|>> (update@ #.counter inc) (update@ #.mappings (plist.put name [type new_var_id])))) head)] - (case (///.run' [bundle (set@ #.scopes (#.Cons new_head tail) state)] + (case (///.run' [bundle (set@ #.scopes (#.Item new_head tail) state)] action) (#try.Success [[bundle' state'] output]) (case (get@ #.scopes state') - (#.Cons head' tail') - (let [scopes' (#.Cons (set@ #.locals (get@ #.locals head) head') + (#.Item head' tail') + (let [scopes' (#.Item (set@ #.locals (get@ #.locals head) head') tail')] (#try.Success [[bundle' (set@ #.scopes scopes' state')] output])) @@ -159,13 +159,13 @@ (All [a] (-> Text (Operation a) (Operation a))) (function (_ [bundle state]) (let [parent_name (case (get@ #.scopes state) - #.Nil + #.End (list) - (#.Cons top _) + (#.Item top _) (get@ #.name top))] (case (action [bundle (update@ #.scopes - (|>> (#.Cons (scope parent_name name))) + (|>> (#.Item (scope parent_name name))) state)]) (#try.Success [[bundle' state'] output]) (#try.Success [[bundle' (update@ #.scopes @@ -184,10 +184,10 @@ (///extension.lift (function (_ state) (case (get@ #.scopes state) - (#.Cons top _) + (#.Item top _) (#try.Success [state (get@ [#.locals #.counter] top)]) - #.Nil + #.End (exception.except ..cannot_get_next_reference_when_there_is_no_scope []))))) (def: (ref_to_variable ref) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux index 449ac9606..f3e9d30a1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -173,20 +173,20 @@ (loop [membersT+ (type.flat_tuple expectedT) membersC+ members] (case [membersT+ membersC+] - [(#.Cons memberT #.Nil) _] + [(#.Item memberT #.End) _] (//type.with_type memberT (\ ! map (|>> list) (analyse archive (code.tuple membersC+)))) - [_ (#.Cons memberC #.Nil)] + [_ (#.Item memberC #.End)] (//type.with_type (type.tuple membersT+) (\ ! map (|>> list) (analyse archive memberC))) - [(#.Cons memberT membersT+') (#.Cons memberC membersC+')] + [(#.Item memberT membersT+') (#.Item memberC membersC+')] (do ! [memberA (//type.with_type memberT (analyse archive memberC)) memberA+ (recur membersT+' membersC+')] - (in (#.Cons memberA memberA+))) + (in (#.Item memberA memberA+))) _ (/.except ..cannot_analyse_tuple [expectedT members]))))] @@ -302,10 +302,10 @@ (-> (List [Name Code]) (Operation [(List Code) Type])) (case record ## empty_record = empty_tuple = unit = [] - #.Nil + #.End (\ ///.monad in [(list) Any]) - (#.Cons [head_k head_v] _) + (#.Item [head_k head_v] _) (do {! ///.monad} [head_k (///extension.lift (meta.normal head_k)) [_ tag_set recordT] (///extension.lift (meta.resolve_tag head_k)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index 6ff584f36..b34743db7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -164,7 +164,7 @@ ## TODO: Get rid of this template block and use the definition in ## lux/ffi.jvm.lux ASAP (template [ ] - [(def: #export .Type (#.Primitive #.Nil))] + [(def: #export .Type (#.Primitive #.End))] ## Boxes [Boolean box.boolean] @@ -366,7 +366,7 @@ (case (dictionary.get class ..boxes) (#.Some [_ primitive_type]) (case parametersT - #.Nil + #.End (phase\in primitive_type) _ @@ -528,7 +528,7 @@ (def: (check_jvm objectT) (-> .Type (Operation (Type Value))) (case objectT - (#.Primitive name #.Nil) + (#.Primitive name #.End) (`` (cond (~~ (template [] [(text\= (..reflection ) name) (phase\in )] @@ -878,7 +878,7 @@ #.None (if (java/lang/reflect/Modifier::isInterface (java/lang/Class::getModifiers from_class)) - (#.Cons (:as java/lang/reflect/Type (ffi.class_for java/lang/Object)) + (#.Item (:as java/lang/reflect/Type (ffi.class_for java/lang/Object)) (array.to_list (java/lang/Class::getGenericInterfaces from_class))) (array.to_list (java/lang/Class::getGenericInterfaces from_class))))))) @@ -952,10 +952,10 @@ (case (|> candidate_parents (list.only product.right) (list\map product.left)) - (#.Cons [next_name nextT] _) + (#.Item [next_name nextT] _) (recur [next_name nextT]) - #.Nil + #.End (in false)))))))))] (if can_cast? (in (#/////analysis.Extension extension_name (list (/////analysis.text from_name) @@ -1303,10 +1303,10 @@ (|>> #Hint)) (method_signature method_style method)))))))] (case (list.all pass! candidates) - (#.Cons method #.Nil) + (#.Item method #.End) (in method) - #.Nil + #.End (/////analysis.except ..no_candidates [class_name method_name inputsJT (list.all hint! candidates)]) candidates @@ -1333,10 +1333,10 @@ (if passes? (|>> #Pass) (|>> #Hint)) (constructor_signature constructor))))))] (case (list.all pass! candidates) - (#.Cons constructor #.Nil) + (#.Item constructor #.End) (in constructor) - #.Nil + #.End (/////analysis.except ..no_candidates [class_name ..constructor_method inputsJT (list.all hint! candidates)]) candidates @@ -1398,7 +1398,7 @@ (not deprecated?)) [outputT allA] (inferenceA.general archive analyse methodT (list& objectC (list\map product.right argsTC))) #let [[objectA argsA] (case allA - (#.Cons objectA argsA) + (#.Item objectA argsA) [objectA argsA] _ @@ -1444,7 +1444,7 @@ (not deprecated?)) [outputT allA] (inferenceA.general archive analyse methodT (list& objectC (list\map product.right argsTC))) #let [[objectA argsA] (case allA - (#.Cons objectA argsA) + (#.Item objectA argsA) [objectA argsA] _ @@ -1685,7 +1685,7 @@ (in [name luxT]))) arguments) [scope bodyA] (|> arguments' - (#.Cons [self_name selfT]) + (#.Item [self_name selfT]) list.reverse (list\fold scope.with_local (analyse archive body)) (typeA.with_type .Any) @@ -1761,7 +1761,7 @@ (in [name luxT]))) arguments) [scope bodyA] (|> arguments' - (#.Cons [self_name selfT]) + (#.Item [self_name selfT]) list.reverse (list\fold scope.with_local (analyse archive body)) (typeA.with_type returnT) @@ -2001,7 +2001,7 @@ arguments) returnT (boxed_reflection_return mapping return) [scope bodyA] (|> arguments' - (#.Cons [self_name selfT]) + (#.Item [self_name selfT]) list.reverse (list\fold scope.with_local (analyse archive body)) (typeA.with_type returnT) @@ -2153,7 +2153,7 @@ (analyse archive term))] (in [type termA]))) constructor_args) - #let [supers (#.Cons super_class super_interfaces)] + #let [supers (#.Item super_class super_interfaces)] _ (..require_complete_method_concretion class_loader supers methods) methodsA (monad.map ! (analyse_overriden_method analyse archive selfT mapping supers) methods)] (in (#/////analysis.Extension extension_name diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux index ec91d1e10..4fd8d5842 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux @@ -110,7 +110,7 @@ (/.install "/" (binary _.floor/2)) (/.install "%" (binary _.rem/2)) ## (/.install "f64" (unary (_.//2 (_.float +1.0)))) - (/.install "char" (unary (|>> _.code-char/1 _.string/1))) + (/.install "char" (unary (|>> _.code_char/1 _.string/1))) ))) (def: f64_procs @@ -125,7 +125,7 @@ ## (/.install "/" (binary (product.uncurry _.//2))) ## (/.install "%" (binary (product.uncurry _.rem/2))) ## (/.install "i64" (unary _.truncate/1)) - (/.install "encode" (unary _.write-to-string/1)) + (/.install "encode" (unary _.write_to_string/1)) ## (/.install "decode" (unary //runtime.f64//decode)) ))) @@ -139,7 +139,7 @@ (def: (text//char [index text]) (Binary (Expression Any)) - (_.char-code/1 (_.char/2 [text index]))) + (_.char_code/1 (_.char/2 [text index]))) (def: text_procs Bundle @@ -157,7 +157,7 @@ (def: (io//log! message) (Unary (Expression Any)) - (_.progn (list (_.write-line/1 message) + (_.progn (list (_.write_line/1 message) //runtime.unit))) (def: io_procs diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux index 2025fe4e2..3663f845a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux @@ -110,7 +110,7 @@ (/.install "/" (binary (product.uncurry //runtime.i64//division))) (/.install "%" (binary (product.uncurry _.remainder/2))) (/.install "f64" (unary (_.//2 (_.float +1.0)))) - (/.install "char" (unary (|>> _.integer->char/1 (_.make-string/2 (_.int +1))))) + (/.install "char" (unary (|>> _.integer->char/1 (_.make_string/2 (_.int +1))))) ))) (def: f64_procs @@ -142,9 +142,9 @@ (|> /.empty (/.install "=" (binary (product.uncurry _.string=?/2))) (/.install "<" (binary (product.uncurry _.string <=>] - [( cons) + [( item) (do {! ///////phase.monad} [clauses (monad.map ! (function (_ [match then]) (do ! @@ -179,7 +179,7 @@ (in [(<=> [(|> match ) ..peek]) then!]))) - (#.Cons cons))] + (#.Item item))] (in (list\fold (function (_ [when then] else) (_.if when then else)) (_.go @fail) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux index baac3e891..1853971a6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux @@ -12,7 +12,7 @@ [collection ["." dictionary]]] [target - ["_" common-lisp (#+ Expression)]]]] + ["_" common_lisp (#+ Expression)]]]] ["." /// #_ ["#." runtime (#+ Operation Phase Handler Bundle)] ["#." primitive] @@ -23,35 +23,35 @@ [extension ["." bundle]]]]]) -(def: lux-procs +(def: lux_procs Bundle (|> bundle.empty (bundle.install "is" (binary (product.uncurry _.eq))) (bundle.install "try" (unary ///runtime.lux//try)))) -(def: (i64//left-shift [paramG subjectG]) +(def: (i64//left_shift [paramG subjectG]) (Binary (Expression Any)) (_.ash (_.rem (_.int +64) paramG) subjectG)) -(def: (i64//arithmetic-right-shift [paramG subjectG]) +(def: (i64//arithmetic_right_shift [paramG subjectG]) (Binary (Expression Any)) (_.ash (|> paramG (_.rem (_.int +64)) (_.* (_.int -1))) subjectG)) -(def: (i64//logic-right-shift [paramG subjectG]) +(def: (i64//logic_right_shift [paramG subjectG]) (Binary (Expression Any)) - (///runtime.i64//logic-right-shift (_.rem (_.int +64) paramG) subjectG)) + (///runtime.i64//logic_right_shift (_.rem (_.int +64) paramG) subjectG)) -(def: i64-procs +(def: i64_procs Bundle (<| (bundle.prefix "i64") (|> bundle.empty (bundle.install "and" (binary (product.uncurry _.logand))) (bundle.install "or" (binary (product.uncurry _.logior))) (bundle.install "xor" (binary (product.uncurry _.logxor))) - (bundle.install "left-shift" (binary i64//left-shift)) - (bundle.install "logical-right-shift" (binary i64//logic-right-shift)) - (bundle.install "arithmetic-right-shift" (binary i64//arithmetic-right-shift)) + (bundle.install "left-shift" (binary i64//left_shift)) + (bundle.install "logical-right-shift" (binary i64//logic_right_shift)) + (bundle.install "arithmetic-right-shift" (binary i64//arithmetic_right_shift)) (bundle.install "=" (binary (product.uncurry _.=))) (bundle.install "<" (binary (product.uncurry _.<))) (bundle.install "+" (binary (product.uncurry _.+))) @@ -61,10 +61,10 @@ (bundle.install "%" (binary (product.uncurry _.rem))) (bundle.install "f64" (unary (function (_ value) (_.coerce/2 [value (_.symbol "double-float")])))) - (bundle.install "char" (unary (|>> _.code-char/1 _.string/1))) + (bundle.install "char" (unary (|>> _.code_char/1 _.string/1))) ))) -(def: f64-procs +(def: f64_procs Bundle (<| (bundle.prefix "f64") (|> bundle.empty @@ -76,12 +76,12 @@ (bundle.install "=" (binary (product.uncurry _.=))) (bundle.install "<" (binary (product.uncurry _.<))) (bundle.install "i64" (unary _.floor/1)) - (bundle.install "encode" (unary _.write-to-string/1)) + (bundle.install "encode" (unary _.write_to_string/1)) (bundle.install "decode" (unary (let [@temp (_.var "temp")] (function (_ input) - (_.let (list [@temp (_.read-from-string/1 input)]) + (_.let (list [@temp (_.read_from_string/1 input)]) (_.if (_.equal (_.symbol "DOUBLE-FLOAT") - (_.type-of/1 @temp)) + (_.type_of/1 @temp)) (///runtime.some @temp) ///runtime.none))))))))) @@ -99,7 +99,7 @@ (Trinary (Expression Any)) (///runtime.text//index textO partO startO)) -(def: text-procs +(def: text_procs Bundle (<| (bundle.prefix "text") (|> bundle.empty @@ -108,7 +108,7 @@ (bundle.install "concat" (binary _.concatenate/2|string)) (bundle.install "index" (trinary text//index)) (bundle.install "size" (unary _.length/1)) - (bundle.install "char" (binary (|>> _.char/2 _.char-int/1))) + (bundle.install "char" (binary (|>> _.char/2 _.char_int/1))) (bundle.install "clip" (trinary text//clip)) ))) @@ -118,7 +118,7 @@ code ///runtime.unit)) -(def: io-procs +(def: io_procs Bundle (<| (bundle.prefix "io") (|> bundle.empty @@ -129,9 +129,9 @@ (def: #export bundle Bundle (<| (bundle.prefix "lux") - (|> lux-procs - (dictionary.merge i64-procs) - (dictionary.merge f64-procs) - (dictionary.merge text-procs) - (dictionary.merge io-procs) + (|> lux_procs + (dictionary.merge i64_procs) + (dictionary.merge f64_procs) + (dictionary.merge text_procs) + (dictionary.merge io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux index a43c24bc8..fab6fe24c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux @@ -43,7 +43,7 @@ (def: (with_closure inits function_definition) (-> (List (Expression Any)) (Expression Any) (Operation (Expression Any))) (case inits - #.Nil + #.End (\ ///////phase.monad in function_definition) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux index 5d7faa8f8..bbb46cba2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux @@ -36,7 +36,7 @@ (Generator (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (expression archive bodyS) ## true loop diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux index b9b97fdbe..fd0e7a780 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux @@ -139,7 +139,7 @@ (runtime: (lux//try op) (with_vars [error] - (_.handler-case + (_.handler_case (list [(_.bool true) error (..left (_.format/3 [_.nil (_.string "~A") error]))]) (..right (_.funcall/+ [op (list ..unit)]))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux index 6cfd16cc4..a0b6b78e9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux @@ -17,10 +17,10 @@ (def: #export (tuple expression archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.Nil + #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Cons singletonS #.Nil) + (#.Item singletonS #.End) (expression archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux index 8c0ef681a..7beef96cb 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux @@ -251,7 +251,7 @@ else! then!)))) - (#/////synthesis.I64_Fork cons) + (#/////synthesis.I64_Fork item) (do {! ///////phase.monad} [clauses (monad.map ! (function (_ [match then]) (do ! @@ -259,15 +259,15 @@ (in [(//runtime.i64//= (//primitive.i64 (.int match)) ..peek_cursor) then!]))) - (#.Cons cons))] + (#.Item item))] (in (_.cond clauses ..fail_pm!))) (^template [ ] - [( cons) + [( item) (do {! ///////phase.monad} [cases (monad.map ! (function (_ [match then]) (\ ! map (|>> [(list ( match))]) (recur then))) - (#.Cons cons))] + (#.Item item))] (in (_.switch ..peek_cursor cases (#.Some ..fail_pm!))))]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux index b06f9e347..d4b81f29b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux @@ -41,7 +41,7 @@ (def: (with_closure @self inits body!) (-> Var (List Expression) Statement [Statement Expression]) (case inits - #.Nil + #.End [(_.function! @self (list) body!) @self] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux index 8e9f4265c..de6b0a500 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux @@ -45,7 +45,7 @@ (Generator! (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (statement expression archive bodyS) ## true loop @@ -64,7 +64,7 @@ (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (expression archive bodyS) ## true loop diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux index 1b3f8e526..5cbacf111 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux @@ -17,10 +17,10 @@ (def: #export (tuple generate archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.Nil + #.End (///////phase\in //runtime.unit) - (#.Cons singletonS #.Nil) + (#.Item singletonS #.End) (generate archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux index cfe49a36b..d3e13091a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux @@ -97,7 +97,7 @@ @labelsT (|> _.new_label (list.repeat (dec num_partials)) (monad.seq _.monad)) - #let [cases (|> (list\compose (#.Cons [@labelsH @labelsT]) + #let [cases (|> (list\compose (#.Item [@labelsH @labelsT]) (list @default)) list.enumeration (list\map (function (_ [stage @case]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux index b997af01d..06b60b6c1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux @@ -29,10 +29,10 @@ (def: #export (tuple generate archive membersS) (Generator (Tuple Synthesis)) (case membersS - #.Nil + #.End (\ phase.monad in //runtime.unit) - (#.Cons singletonS #.Nil) + (#.Item singletonS #.End) (generate archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux index 94b086149..2114acc89 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux @@ -190,7 +190,7 @@ then!)))) (^template [ ] - [( cons) + [( item) (do {! ///////phase.monad} [clauses (monad.map ! (function (_ [match then]) (do ! @@ -198,7 +198,7 @@ (in [(_.= (|> match ) ..peek) then!]))) - (#.Cons cons))] + (#.Item item))] (in (_.cond clauses ..fail!)))]) ([#/////synthesis.I64_Fork (<| _.int .int)] [#/////synthesis.F64_Fork _.float] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux index 66f2aa0c4..9affe12f6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux @@ -43,7 +43,7 @@ (def: (with_closure inits @self @args body!) (-> (List Expression) Var (List Var) Statement [Statement Expression]) (case inits - #.Nil + #.End [(_.function @self @args body!) @self] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux index 7d063fa09..5d44bcc3c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux @@ -53,7 +53,7 @@ (Operation [(List Expression) Statement])) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (|> bodyS (statement expression archive) (\ ///////phase.monad map (|>> [(list)]))) @@ -75,7 +75,7 @@ (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (expression archive bodyS) ## true loop @@ -93,7 +93,7 @@ (set.of_list _.hash) (set.difference (set.of_list _.hash locals)) set.to_list) - #.Nil + #.End [(_.function @loop locals scope!) @loop] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux index 56954873e..8b070c7a3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux @@ -17,10 +17,10 @@ (def: #export (tuple generate archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.Nil + #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Cons singletonS #.Nil) + (#.Item singletonS #.End) (generate archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux index 12714b2cd..aad40560a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux @@ -59,7 +59,7 @@ (//////phase\map _.return (/function.function statement expression archive abstraction)) )) -(exception: #export cannot-recur-as-an-expression) +(exception: #export cannot_recur_as_an_expression) (def: #export (expression archive synthesis) Phase @@ -93,7 +93,7 @@ [////synthesis.function/abstraction /function.function]) (^ (////synthesis.loop/recur _)) - (//////phase.except ..cannot-recur-as-an-expression []) + (//////phase.except ..cannot_recur_as_an_expression []) (#////synthesis.Extension extension) (///extension.apply archive expression extension))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux index 48a05b104..af27eb9fc 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux @@ -190,7 +190,7 @@ then!)))) (^template [ ] - [( cons) + [( item) (do {! ///////phase.monad} [clauses (monad.map ! (function (_ [match then]) (do ! @@ -198,7 +198,7 @@ (in [(_.=== (|> match ) ..peek) then!]))) - (#.Cons cons))] + (#.Item item))] (in (_.cond clauses ..fail!)))]) ([#/////synthesis.I64_Fork //primitive.i64] [#/////synthesis.F64_Fork //primitive.f64] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension/common.lux index 5eaccf0aa..8da358393 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension/common.lux @@ -24,28 +24,28 @@ [extension ["." bundle]]]]]) -(def: lux-procs +(def: lux_procs Bundle (|> bundle.empty (bundle.install "is" (binary (product.uncurry _.=))) (bundle.install "try" (unary ///runtime.lux//try)))) -(def: i64-procs +(def: i64_procs Bundle (<| (bundle.prefix "i64") (|> bundle.empty - (bundle.install "and" (binary (product.uncurry _.bit-and))) - (bundle.install "or" (binary (product.uncurry _.bit-or))) - (bundle.install "xor" (binary (product.uncurry _.bit-xor))) - (bundle.install "left-shift" (binary (product.uncurry _.bit-shl))) - (bundle.install "logical-right-shift" (binary (product.uncurry ///runtime.i64//logic-right-shift))) - (bundle.install "arithmetic-right-shift" (binary (product.uncurry _.bit-shr))) + (bundle.install "and" (binary (product.uncurry _.bit_and))) + (bundle.install "or" (binary (product.uncurry _.bit_or))) + (bundle.install "xor" (binary (product.uncurry _.bit_xor))) + (bundle.install "left-shift" (binary (product.uncurry _.bit_shl))) + (bundle.install "logical-right-shift" (binary (product.uncurry ///runtime.i64//logic_right_shift))) + (bundle.install "arithmetic-right-shift" (binary (product.uncurry _.bit_shr))) (bundle.install "=" (binary (product.uncurry _.=))) (bundle.install "+" (binary (product.uncurry _.+))) (bundle.install "-" (binary (product.uncurry _.-))) ))) -(def: int-procs +(def: int_procs Bundle (<| (bundle.prefix "int") (|> bundle.empty @@ -56,7 +56,7 @@ (bundle.install "frac" (unary _.floatval/1)) (bundle.install "char" (unary _.chr/1))))) -(def: frac-procs +(def: frac_procs Bundle (<| (bundle.prefix "frac") (|> bundle.empty @@ -76,7 +76,7 @@ (Trinary (Expression Any)) (///runtime.text//index textO partO startO)) -(def: text-procs +(def: text_procs Bundle (<| (bundle.prefix "text") (|> bundle.empty @@ -91,11 +91,11 @@ (_.substr/3 [text from (_.- from to)])))) ))) -(def: io-procs +(def: io_procs Bundle (<| (bundle.prefix "io") (|> bundle.empty - (bundle.install "log" (unary (|>> (_.concat (_.string text.new-line)) _.print/1))) + (bundle.install "log" (unary (|>> (_.concat (_.string text.new_line)) _.print/1))) (bundle.install "error" (unary ///runtime.io//throw!)) (bundle.install "exit" (unary _.exit/1)) (bundle.install "current-time" (nullary (|>> _.time/0 (_.* (_.int +1,000)))))))) @@ -103,10 +103,10 @@ (def: #export bundle Bundle (<| (bundle.prefix "lux") - (|> lux-procs - (dictionary.merge i64-procs) - (dictionary.merge int-procs) - (dictionary.merge frac-procs) - (dictionary.merge text-procs) - (dictionary.merge io-procs) + (|> lux_procs + (dictionary.merge i64_procs) + (dictionary.merge int_procs) + (dictionary.merge frac_procs) + (dictionary.merge text_procs) + (dictionary.merge io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux index d1cfcea2e..9f02325d3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux @@ -50,7 +50,7 @@ (def: (with_closure inits @selfG @selfL body!) (-> (List Expression) Global Var Statement [Statement Expression]) (case inits - #.Nil + #.End [($_ _.then (_.set! @selfL (_.closure (list (_.reference @selfL)) (list) body!)) (_.set! @selfG @selfL)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux index 4952b71ab..82fe69b94 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux @@ -51,7 +51,7 @@ (Generator! (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (statement expression archive bodyS) ## true loop @@ -70,7 +70,7 @@ (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (expression archive bodyS) ## true loop @@ -92,7 +92,7 @@ (list\fold set.union (referenced_variables bodyS)) (set.difference loop_variables) set.to_list) - #.Nil + #.End [(_.define_function @loop (list) scope!) @loop] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux index 5d01a16c6..601361f31 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux @@ -20,10 +20,10 @@ (def: #export (tuple expression archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.Nil + #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Cons singletonS #.Nil) + (#.Item singletonS #.End) (expression archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux index d88f2eb0c..1d01ba8b0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux @@ -59,7 +59,7 @@ (//////phase\map _.return (/function.function statement expression archive abstraction)) )) -(exception: #export cannot-recur-as-an-expression) +(exception: #export cannot_recur_as_an_expression) (def: #export (expression archive synthesis) Phase @@ -97,7 +97,7 @@ (/loop.scope ..statement expression archive scope) (^ (////synthesis.loop/recur updates)) - (//////phase.except ..cannot-recur-as-an-expression []) + (//////phase.except ..cannot_recur_as_an_expression []) (^ (////synthesis.function/abstraction abstraction)) (/function.function ..statement expression archive abstraction) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux index 71e856034..a3f993150 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux @@ -197,14 +197,14 @@ then!))))) (^template [ ] - [( cons) + [( item) (do {! ///////phase.monad} [clauses (monad.map ! (function (_ [match then]) (\ ! map (|>> [(_.= (|> match ) ..peek)]) (recur then))) - (#.Cons cons))] + (#.Item item))] (in (#.Some (_.cond clauses ..fail_pm!))))]) ([#/////synthesis.I64_Fork (<| //primitive.i64 .int)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux index 3c114a935..58d814dcc 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux @@ -45,7 +45,7 @@ (def: (with_closure function_id @function inits function_definition) (-> artifact.ID SVar (List (Expression Any)) (Statement Any) (Operation (Expression Any))) (case inits - #.Nil + #.End (do ///////phase.monad [_ (/////generation.execute! function_definition) _ (/////generation.save! function_id #.None function_definition)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux index 45dbaf999..066925e96 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux @@ -51,7 +51,7 @@ (Generator! (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (statement expression archive bodyS) ## true loop @@ -68,7 +68,7 @@ (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (expression archive bodyS) ## true loop @@ -91,7 +91,7 @@ (set.of_list _.hash) (set.difference (set.of_list _.hash locals)) set.to_list) - #.Nil + #.End [actual_loop @loop] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux index 394804f3e..4e7bc841d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux @@ -17,10 +17,10 @@ (def: #export (tuple generate archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.Nil + #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Cons singletonS #.Nil) + (#.Item singletonS #.End) (generate archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux index 1026bd0fe..133ce1fa8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux @@ -162,7 +162,7 @@ then!)))) (^template [ <=>] - [( cons) + [( item) (do {! ///////phase.monad} [clauses (monad.map ! (function (_ [match then]) (do ! @@ -170,7 +170,7 @@ (in [(<=> (|> match ) ..peek) then!]))) - (#.Cons cons))] + (#.Item item))] (in (list\fold (function (_ [when then] else) (_.if when then else)) ..fail! diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux index ed2ef6a5d..a6497d206 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux @@ -42,7 +42,7 @@ (def: (with_closure function_id $function inits function_definition) (-> artifact.ID SVar (List Expression) Expression (Operation Expression)) (case inits - #.Nil + #.End (do ///////phase.monad [_ (/////generation.execute! function_definition) _ (/////generation.save! (%.nat function_id) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux index 84d61fb44..47bb19e87 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux @@ -37,7 +37,7 @@ (Generator (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (expression archive bodyS) ## true loop diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux index 557d5b572..225d32a81 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux @@ -10,7 +10,7 @@ [number] (coll [list "list/" Functor] (dictionary ["dict" unordered #+ Dict]))) - [macro #+ with-gensyms] + [macro #+ with_gensyms] (macro [code] ["s" syntax #+ syntax:]) [host]) @@ -54,19 +54,19 @@ (|> bundle dict.entries (list/map (function (_ [key val]) [(format prefix " " key) val])) - (dict.from-list text.Hash))) + (dict.from_list text.Hash))) -(def: (wrong-arity proc expected actual) +(def: (wrong_arity proc expected actual) (-> Text Nat Nat Text) (format "Wrong number of arguments for " (%t proc) "\n" "Expected: " (|> expected .int %i) "\n" " Actual: " (|> actual .int %i))) -(syntax: (arity: {name s.local-identifier} {arity s.nat}) - (with-gensyms [g!_ g!proc g!name g!translate g!inputs] +(syntax: (arity: {name s.local_identifier} {arity s.nat}) + (with_gensyms [g!_ g!proc g!name g!translate g!inputs] (do {@ macro.monad} [g!input+ (monad.seq @ (list.repeat arity (macro.gensym "input")))] - (in (list (` (def: #export ((~ (code.local-identifier name)) (~ g!proc)) + (in (list (` (def: #export ((~ (code.local_identifier name)) (~ g!proc)) (-> (-> (..Vector (~ (code.nat arity)) Expression) Expression) (-> Text ..Proc)) (function ((~ g!_) (~ g!name)) @@ -81,7 +81,7 @@ ((~' in) ((~ g!proc) [(~+ g!input+)]))) (~' _) - (macro.failure (wrong-arity (~ g!name) +1 (list.size (~ g!inputs)))))))))))))) + (macro.failure (wrong_arity (~ g!name) +1 (list.size (~ g!inputs)))))))))))))) (arity: nullary +0) (arity: unary +1) @@ -90,7 +90,7 @@ (def: #export (variadic proc) (-> Variadic (-> Text Proc)) - (function (_ proc-name) + (function (_ proc_name) (function (_ translate inputsS) (do {@ macro.Monad} [inputsI (monad.map @ translate inputsS)] @@ -105,39 +105,39 @@ (def: (lux//if [testO thenO elseO]) Trinary - (caseT.translate-if testO thenO elseO)) + (caseT.translate_if testO thenO elseO)) (def: (lux//try riskyO) Unary (runtimeT.lux//try riskyO)) -(exception: #export (Wrong-Syntax {message Text}) +(exception: #export (Wrong_Syntax {message Text}) message) -(def: #export (wrong-syntax procedure args) +(def: #export (wrong_syntax procedure args) (-> Text (List ls.Synthesis) Text) (format "Procedure: " procedure "\n" "Arguments: " (%code (code.tuple args)))) (def: lux//loop (-> Text Proc) - (function (_ proc-name) + (function (_ proc_name) (function (_ translate inputsS) (case (s.run inputsS ($_ p.seq s.nat (s.tuple (p.many s.any)) s.any)) (#e.Success [offset initsS+ bodyS]) - (loopT.translate-loop translate offset initsS+ bodyS) + (loopT.translate_loop translate offset initsS+ bodyS) (#e.Error error) - (&.throw Wrong-Syntax (wrong-syntax proc-name inputsS))) + (&.throw Wrong_Syntax (wrong_syntax proc_name inputsS))) ))) (def: lux//recur (-> Text Proc) - (function (_ proc-name) + (function (_ proc_name) (function (_ translate inputsS) - (loopT.translate-recur translate inputsS)))) + (loopT.translate_recur translate inputsS)))) -(def: lux-procs +(def: lux_procs Bundle (|> (dict.new text.Hash) (install "is" (binary lux//is)) @@ -161,23 +161,23 @@ (template [ ] [(def: ( [subjectO paramO]) Binary - ( (runtimeT.int64-low paramO) subjectO))] + ( (runtimeT.int64_low paramO) subjectO))] - [bit//left-shift runtimeT.bit//left-shift] - [bit//arithmetic-right-shift runtimeT.bit//arithmetic-right-shift] - [bit//logical-right-shift runtimeT.bit//logical-right-shift] + [bit//left_shift runtimeT.bit//left_shift] + [bit//arithmetic_right_shift runtimeT.bit//arithmetic_right_shift] + [bit//logical_right_shift runtimeT.bit//logical_right_shift] ) -(def: bit-procs +(def: bit_procs Bundle (<| (prefix "bit") (|> (dict.new text.Hash) (install "and" (binary bit//and)) (install "or" (binary bit//or)) (install "xor" (binary bit//xor)) - (install "left-shift" (binary bit//left-shift)) - (install "logical-right-shift" (binary bit//logical-right-shift)) - (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift)) + (install "left-shift" (binary bit//left_shift)) + (install "logical-right-shift" (binary bit//logical_right_shift)) + (install "arithmetic-right-shift" (binary bit//arithmetic_right_shift)) ))) ## [[Numbers]] @@ -238,9 +238,9 @@ (function (_ value) (r.apply (list value) func))) -(def: int//char (|>> runtimeT.int64-low (apply1 (r.global "intToUtf8")))) +(def: int//char (|>> runtimeT.int64_low (apply1 (r.global "intToUtf8")))) -(def: int-procs +(def: int_procs Bundle (<| (prefix "int") (|> (dict.new text.Hash) @@ -251,14 +251,14 @@ (install "%" (binary int//rem)) (install "=" (binary int//=)) (install "<" (binary int//<)) - (install "to-frac" (unary runtimeT.int//to-float)) + (install "to-frac" (unary runtimeT.int//to_float)) (install "char" (unary int//char))))) (def: (frac//encode value) (-> Expression Expression) (r.apply (list (r.string "%f") value) (r.global "sprintf"))) -(def: frac-procs +(def: frac_procs Bundle (<| (prefix "frac") (|> (dict.new text.Hash) @@ -293,7 +293,7 @@ Trinary (runtimeT.text//index textO partO startO)) -(def: text-procs +(def: text_procs Bundle (<| (prefix "text") (|> (dict.new text.Hash) @@ -301,7 +301,7 @@ (install "<" (binary text//<)) (install "concat" (binary text//concat)) (install "index" (trinary text//index)) - (install "size" (unary (|>> (apply1 (r.global "nchar")) runtimeT.int//from-float))) + (install "size" (unary (|>> (apply1 (r.global "nchar")) runtimeT.int//from_float))) (install "char" (binary text//char)) (install "clip" (trinary text//clip)) ))) @@ -309,15 +309,15 @@ ## [[IO]] (def: (io//exit input) Unary - (r.apply-kw (list) - (list ["status" (runtimeT.int//to-float input)]) + (r.apply_kw (list) + (list ["status" (runtimeT.int//to_float input)]) (r.global "quit"))) (def: (void code) (-> Expression Expression) (r.block (r.then code runtimeT.unit))) -(def: io-procs +(def: io_procs Bundle (<| (prefix "io") (|> (dict.new text.Hash) @@ -325,16 +325,16 @@ (install "error" (unary r.stop)) (install "exit" (unary io//exit)) (install "current-time" (nullary (function (_ _) - (runtimeT.io//current-time! runtimeT.unit))))))) + (runtimeT.io//current_time! runtimeT.unit))))))) ## [Bundles] (def: #export procedures Bundle (<| (prefix "lux") - (|> lux-procs - (dict.merge bit-procs) - (dict.merge int-procs) - (dict.merge frac-procs) - (dict.merge text-procs) - (dict.merge io-procs) + (|> lux_procs + (dict.merge bit_procs) + (dict.merge int_procs) + (dict.merge frac_procs) + (dict.merge text_procs) + (dict.merge io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux index 74dc0231e..cb0f5e48d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux @@ -31,7 +31,7 @@ ## (in name)) ## _ -## (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) +## (&.throw @.Wrong_Syntax (@.wrong_syntax proc inputs)))) ## (def: (lua//call proc translate inputs) ## (-> Text @.Proc) @@ -43,9 +43,9 @@ ## (in (lua.apply functionO argsO+))) ## _ -## (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) +## (&.throw @.Wrong_Syntax (@.wrong_syntax proc inputs)))) -## (def: lua-procs +## (def: lua_procs ## @.Bundle ## (|> (dict.new text.Hash) ## (@.install "nil" (@.nullary lua//nil)) @@ -63,7 +63,7 @@ ## (in (lua.method field tableO argsO+))) ## _ -## (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) +## (&.throw @.Wrong_Syntax (@.wrong_syntax proc inputs)))) ## (def: (table//get [fieldO tableO]) ## @.Binary @@ -73,7 +73,7 @@ ## @.Trinary ## (runtimeT.lua//set tableO fieldO valueO)) -## (def: table-procs +## (def: table_procs ## @.Bundle ## (<| (@.prefix "table") ## (|> (dict.new text.Hash) @@ -85,6 +85,6 @@ @.Bundle (<| (@.prefix "lua") (dict.new text.Hash) - ## (|> lua-procs - ## (dict.merge table-procs)) + ## (|> lua_procs + ## (dict.merge table_procs)) )) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux index 1853aa963..4ea0f31a2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux @@ -20,10 +20,10 @@ (def: #export (tuple expression archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.Nil + #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Cons singletonS #.Nil) + (#.Item singletonS #.End) (expression archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux index f4c393a19..3a80031eb 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux @@ -59,7 +59,7 @@ (//////phase\map _.return (/function.function statement expression archive abstraction)) )) -(exception: #export cannot-recur-as-an-expression) +(exception: #export cannot_recur_as_an_expression) (def: (expression archive synthesis) Phase @@ -92,7 +92,7 @@ [////synthesis.function/abstraction /function.function]) (^ (////synthesis.loop/recur _)) - (//////phase.except ..cannot-recur-as-an-expression []) + (//////phase.except ..cannot_recur_as_an_expression []) (#////synthesis.Reference value) (//reference.reference /reference.system archive value) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux index edb00ae21..69df6f104 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux @@ -206,14 +206,14 @@ then!))))) (^template [ ] - [( cons) + [( item) (do {! ///////phase.monad} [clauses (monad.map ! (function (_ [match then]) (\ ! map (|>> [(_.= (|> match ) ..peek)]) (recur then))) - (#.Cons cons))] + (#.Item item))] (in (#.Some (_.cond clauses ..fail!))))]) ([#/////synthesis.I64_Fork (<| //primitive.i64 .int)] @@ -261,14 +261,14 @@ then!)))) (^template [ ] - [( cons) + [( item) (do {! ///////phase.monad} [clauses (monad.map ! (function (_ [match then]) (\ ! map (|>> [(_.= (|> match ) ..peek)]) (recur then))) - (#.Cons cons))] + (#.Item item))] (in (_.cond clauses ..fail!)))]) ([#/////synthesis.I64_Fork (<| //primitive.i64 .int)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux index eae79b459..8c849da68 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux @@ -45,7 +45,7 @@ (def: (with_closure inits self function_definition) (-> (List Expression) Text Expression [Statement Expression]) (case inits - #.Nil + #.End (let [@self (_.global self)] [(_.set (list @self) function_definition) @self]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux index 14f55ae91..ed5370a68 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux @@ -52,7 +52,7 @@ (Generator! (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (statement expression archive bodyS) ## true loop @@ -69,7 +69,7 @@ (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (expression archive bodyS) ## true loop diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux index e5d1da1ea..eaf6add62 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux @@ -17,10 +17,10 @@ (def: #export (tuple generate archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.Nil + #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Cons singletonS #.Nil) + (#.Item singletonS #.End) (generate archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux index 43409b31d..9d9c62b18 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux @@ -156,7 +156,7 @@ then!)))) (^template [ <=>] - [( cons) + [( item) (do {! ///////phase.monad} [clauses (monad.map ! (function (_ [match then]) (do ! @@ -164,7 +164,7 @@ (in [(<=> (|> match ) ..peek) then!]))) - (#.Cons cons))] + (#.Item item))] (in (list\fold (function (_ [when then] else) (_.if when then else)) ..fail! diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux index 74362d6ad..6b976b9b6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux @@ -15,7 +15,7 @@ [collection ["." list ("#\." functor)] ["dict" dictionary (#+ Dictionary)]]] - ["." macro (#+ with-gensyms) + ["." macro (#+ with_gensyms) ["." code] [syntax (#+ syntax:)]] [target @@ -37,11 +37,11 @@ (type: #export Trinary (-> (Vector 3 Expression) Computation)) (type: #export Variadic (-> (List Expression) Computation)) -(syntax: (arity: {name s.local-identifier} {arity s.nat}) - (with-gensyms [g!_ g!extension g!name g!phase g!inputs] +(syntax: (arity: {name s.local_identifier} {arity s.nat}) + (with_gensyms [g!_ g!extension g!name g!phase g!inputs] (do {! macro.monad} [g!input+ (monad.seq ! (list.repeat arity (macro.gensym "input")))] - (in (list (` (def: #export ((~ (code.local-identifier name)) (~ g!extension)) + (in (list (` (def: #export ((~ (code.local_identifier name)) (~ g!extension)) (-> (-> (..Vector (~ (code.nat arity)) Expression) Computation) Handler) (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!inputs)) @@ -55,7 +55,7 @@ ((~' in) ((~ g!extension) [(~+ g!input+)]))) (~' _) - (/////.except /////extension.incorrect-arity [(~ g!name) 1 (list.size (~ g!inputs))])))))))))) + (/////.except /////extension.incorrect_arity [(~ g!name) 1 (list.size (~ g!inputs))])))))))))) (arity: nullary 0) (arity: unary 1) @@ -64,7 +64,7 @@ (def: #export (variadic extension) (-> Variadic Handler) - (function (_ extension-name) + (function (_ extension_name) (function (_ phase inputsS) (do {! /////.monad} [inputsI (monad.map ! phase inputsS)] @@ -81,24 +81,24 @@ Binary ( paramO subjectO))] - [i64::and _.bit-and/2] - [i64::or _.bit-or/2] - [i64::xor _.bit-xor/2] + [i64::and _.bit_and/2] + [i64::or _.bit_or/2] + [i64::xor _.bit_xor/2] ) -(def: (i64::left-shift [subjectO paramO]) +(def: (i64::left_shift [subjectO paramO]) Binary - (_.arithmetic-shift/2 (_.remainder/2 (_.int +64) paramO) + (_.arithmetic_shift/2 (_.remainder/2 (_.int +64) paramO) subjectO)) -(def: (i64::arithmetic-right-shift [subjectO paramO]) +(def: (i64::arithmetic_right_shift [subjectO paramO]) Binary - (_.arithmetic-shift/2 (|> paramO (_.remainder/2 (_.int +64)) (_.*/2 (_.int -1))) + (_.arithmetic_shift/2 (|> paramO (_.remainder/2 (_.int +64)) (_.*/2 (_.int -1))) subjectO)) -(def: (i64::logical-right-shift [subjectO paramO]) +(def: (i64::logical_right_shift [subjectO paramO]) Binary - (///runtime.i64//logical-right-shift (_.remainder/2 (_.int +64) paramO) subjectO)) + (///runtime.i64//logical_right_shift (_.remainder/2 (_.int +64) paramO) subjectO)) (template [ ] [(def: ( [subjectO paramO]) @@ -147,9 +147,9 @@ (bundle.install "and" (binary i64::and)) (bundle.install "or" (binary i64::or)) (bundle.install "xor" (binary i64::xor)) - (bundle.install "left-shift" (binary i64::left-shift)) - (bundle.install "logical-right-shift" (binary i64::logical-right-shift)) - (bundle.install "arithmetic-right-shift" (binary i64::arithmetic-right-shift)) + (bundle.install "left-shift" (binary i64::left_shift)) + (bundle.install "logical-right-shift" (binary i64::logical_right_shift)) + (bundle.install "arithmetic-right-shift" (binary i64::arithmetic_right_shift)) (bundle.install "+" (binary i64::+)) (bundle.install "-" (binary i64::-)) (bundle.install "*" (binary i64::*)) @@ -177,7 +177,7 @@ (def: (text::char [subjectO paramO]) Binary - (_.string/1 (_.string-ref/2 subjectO paramO))) + (_.string/1 (_.string_ref/2 subjectO paramO))) (def: (text::clip [subjectO startO endO]) Trinary @@ -189,8 +189,8 @@ (|> bundle.empty (bundle.install "=" (binary text::=)) (bundle.install "<" (binary text::<)) - (bundle.install "concat" (binary (product.uncurry _.string-append/2))) - (bundle.install "size" (unary _.string-length/1)) + (bundle.install "concat" (binary (product.uncurry _.string_append/2))) + (bundle.install "size" (unary _.string_length/1)) (bundle.install "char" (binary text::char)) (bundle.install "clip" (trinary text::clip))))) @@ -210,7 +210,7 @@ (bundle.install "log" (unary (|>> io::log ..void))) (bundle.install "error" (unary _.raise/1)) (bundle.install "exit" (unary _.exit/1)) - (bundle.install "current-time" (nullary (function (_ _) (///runtime.io//current-time (_.string //////synthesis.unit)))))))) + (bundle.install "current-time" (nullary (function (_ _) (///runtime.io//current_time (_.string //////synthesis.unit)))))))) (def: #export bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux index dbf2c47b9..dd19db665 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux @@ -44,7 +44,7 @@ (-> (List Expression) Computation (Operation Computation)) (///////phase\in (case inits - #.Nil + #.End function_definition _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux index 3010bf016..25b0feb46 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux @@ -40,7 +40,7 @@ (Generator (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop - #.Nil + #.End (expression archive bodyS) ## true loop diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux index de05f8c6e..140b72106 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux @@ -115,10 +115,10 @@ (list (_.define_constant last_index_right (..last_index tuple)) (_.if (_.>/2 lefts last_index_right) ## No need for recursion - (_.vector-ref/2 tuple lefts) + (_.vector_ref/2 tuple lefts) ## Needs recursion (tuple//left (_.-/2 last_index_right lefts) - (_.vector-ref/2 tuple last_index_right))))))) + (_.vector_ref/2 tuple last_index_right))))))) (runtime: (tuple//right lefts tuple) (with_vars [last_index_right right_index @slice] @@ -126,14 +126,14 @@ (list (_.define_constant last_index_right (..last_index tuple)) (_.define_constant right_index (_.+/2 (_.int +1) lefts)) (<| (_.if (_.=/2 last_index_right right_index) - (_.vector-ref/2 tuple right_index)) + (_.vector_ref/2 tuple right_index)) (_.if (_.>/2 last_index_right right_index) ## Needs recursion. (tuple//right (_.-/2 last_index_right lefts) - (_.vector-ref/2 tuple last_index_right))) + (_.vector_ref/2 tuple last_index_right))) (_.begin - (list (_.define_constant @slice (_.make-vector/1 (_.-/2 right_index (_.length/1 tuple)))) - (_.vector-copy!/5 @slice (_.int +0) tuple right_index (_.length/1 tuple)) + (list (_.define_constant @slice (_.make_vector/1 (_.-/2 right_index (_.length/1 tuple)))) + (_.vector_copy!/5 @slice (_.int +0) tuple right_index (_.length/1 tuple)) @slice)))) ))) @@ -267,7 +267,7 @@ (runtime: (i64//left_shift param subject) (|> subject - (_.arithmetic-shift/2 (_.remainder/2 (_.int +64) param)) + (_.arithmetic_shift/2 (_.remainder/2 (_.int +64) param)) ..i64//64)) (def: as_nat @@ -279,15 +279,15 @@ subject (|> subject ..as_nat - (_.arithmetic-shift/2 (_.-/2 shift (_.int +0))))))) + (_.arithmetic_shift/2 (_.-/2 shift (_.int +0))))))) (template [ ] [(runtime: ( left right) (..i64//64 ( (..as_nat left) (..as_nat right))))] - [i64//or _.bitwise-ior/2] - [i64//xor _.bitwise-xor/2] - [i64//and _.bitwise-and/2] + [i64//or _.bitwise_ior/2] + [i64//xor _.bitwise_xor/2] + [i64//and _.bitwise_and/2] ) (runtime: (i64//division param subject) @@ -319,7 +319,7 @@ (runtime: (text//index offset sub text) (with_vars [index] - (_.let (list [index (_.string-contains/3 text sub offset)]) + (_.let (list [index (_.string_contains/3 text sub offset)]) (_.if index (..some index) ..none)))) @@ -328,7 +328,7 @@ (_.substring/3 text offset (_.+/2 offset length))) (runtime: (text//char index text) - (_.char->integer/1 (_.string-ref/2 text index))) + (_.char->integer/1 (_.string_ref/2 text index))) (def: runtime//text (_.begin (list @text//index @@ -336,7 +336,7 @@ @text//char))) (runtime: (array//write idx value array) - (_.begin (list (_.vector-set!/3 array idx value) + (_.begin (list (_.vector_set!/3 array idx value) array))) (def: runtime//array diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux index 46237d2a2..3cf04831b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux @@ -20,10 +20,10 @@ (def: #export (tuple expression archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ - #.Nil + #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Cons singletonS #.Nil) + (#.Item singletonS #.End) (expression archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux index d004e97ef..dc22dc355 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -101,16 +101,16 @@ [[old_test (weave new_then old_then)] old_tail] [[old_test old_then] (case old_tail - #.Nil + #.End (list [new_test new_then]) - (#.Cons old_cons) - (#.Cons (weave_branch weave equivalence [new_test new_then] old_cons)))])) + (#.Item old_item) + (#.Item (weave_branch weave equivalence [new_test new_then] old_item)))])) (def: (weave_fork weave equivalence new_fork old_fork) (All [a] (-> (-> Path Path Path) (Equivalence a) (/.Fork a Path) (/.Fork a Path) (/.Fork a Path))) - (list\fold (..weave_branch weave equivalence) old_fork (#.Cons new_fork))) + (list\fold (..weave_branch weave equivalence) old_fork (#.Item new_fork))) (def: (weave new old) (-> Path Path Path) @@ -199,10 +199,10 @@ (#.Right (dec lefts)) (#.Left lefts)))] (case patterns - #.Nil + #.End - (#.Cons head tail) + (#.Item head tail) (case head (#///analysis.Simple #///analysis.Unit) @@ -214,7 +214,7 @@ (#///analysis.Complex (#///analysis.Tuple sub_patterns)) (case (get sub_patterns @selection) - #.Nil + #.End sub_members @@ -263,7 +263,7 @@ (def: #export (synthesize_get synthesize archive input patterns @member) (-> Phase Archive Synthesis (///analysis.Tuple ///analysis.Pattern) Register (Operation Synthesis)) (case (..get patterns @member) - #.Nil + #.End (..synthesize_case synthesize archive input (!get patterns @member)) path @@ -283,7 +283,7 @@ (..synthesize_masking synthesize^ archive inputS @variable @output) [[(#///analysis.Bind @variable) body] - #.Nil] + #.End] (..synthesize_let synthesize^ archive inputS @variable body) (^or (^ [[(///analysis.pattern/bit #1) then] @@ -356,7 +356,7 @@ (^or (#/.I64_Fork forks) (#/.F64_Fork forks) (#/.Text_Fork forks)) - (|> (#.Cons forks) + (|> (#.Item forks) (list\map product.right) (list\fold for_path path_storage)) @@ -384,7 +384,7 @@ (update@ #dependencies (set.add var) synthesis_storage) (^ (/.function/apply [functionS argsS])) - (list\fold for_synthesis synthesis_storage (#.Cons functionS argsS)) + (list\fold for_synthesis synthesis_storage (#.Item functionS argsS)) (^ (/.function/abstraction [environment arity bodyS])) (list\fold for_synthesis synthesis_storage environment) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index 074790e37..956c59cd6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -197,16 +197,16 @@ (All [a] (-> (Optimization a) (Optimization (List a)))) (function (recur [redundancy values]) (case values - #.Nil + #.End (#try.Success [redundancy values]) - (#.Cons head tail) + (#.Item head tail) (do try.monad [[redundancy head] (optimization [redundancy head]) [redundancy tail] (recur [redundancy tail])] (in [redundancy - (#.Cons head tail)]))))) + (#.Item head tail)]))))) (template [] [(exception: #export ( {register Register}) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux index e5329f36a..87be39c2a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -222,10 +222,10 @@ (-> (Parser Code) Location Offset Text (Either [Source Text] [Source Code])) (loop [source (: Source [(!forward 1 where) offset source_code]) - stack (: (List Code) #.Nil)] + stack (: (List Code) #.End)] (case (parse source) (#.Right [source' top]) - (recur source' (#.Cons top stack)) + (recur source' (#.Item top stack)) (#.Left [source' error]) (if (is? error) @@ -244,11 +244,11 @@ (-> (Parser Code) Location Offset Text (Either [Source Text] [Source Code])) (loop [source (: Source [(!forward 1 where) offset source_code]) - stack (: (List [Code Code]) #.Nil)] + stack (: (List [Code Code]) #.End)] (case (parse source) (#.Right [sourceF field]) (!letE [sourceFV value] (parse sourceF) - (recur sourceFV (#.Cons [field value] stack))) + (recur sourceFV (#.Item [field value] stack))) (#.Left [source' error]) (if (is? ..close_record error) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux index cec608916..fdfebb72c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux @@ -275,8 +275,8 @@ ")") (^template [ ] - [( cons) - (|> (#.Cons cons) + [( item) + (|> (#.Item item) (list\map (function (_ [test then]) (format ( test) " " (%path' %then then)))) (text.join_with " ") @@ -500,11 +500,11 @@ (\ (maybe.equivalence =) = reference_else sample_else)) (^template [ ] - [[( reference_cons) - ( sample_cons)] + [[( reference_item) + ( sample_item)] (\ (list.equivalence (product.equivalence =)) = - (#.Cons reference_cons) - (#.Cons sample_cons))]) + (#.Item reference_item) + (#.Item sample_item))]) ([#I64_Fork i64.equivalence] [#F64_Fork f.equivalence] [#Text_Fork text.equivalence]) @@ -552,11 +552,11 @@ (\ (maybe.hash (path'_hash super)) hash else)) (^template [ ] - [( cons) + [( item) (let [case_hash (product.hash (path'_hash super)) - cons_hash (product.hash case_hash (list.hash case_hash))] - (n.* (\ cons_hash hash cons)))]) + item_hash (product.hash case_hash (list.hash case_hash))] + (n.* (\ item_hash hash item)))]) ([11 #I64_Fork i64.hash] [13 #F64_Fork f.hash] [17 #Text_Fork text.hash]) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux index ee2e507e8..7290b74a5 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -223,7 +223,7 @@ output (: Output row.empty)] (let [[analysers synthesizers generators directives] bundles] (case input - (#.Cons [[artifact_id artifact_category] input']) + (#.Item [[artifact_id artifact_category] input']) (case (do ! [data (try.of_maybe (dictionary.get (format (%.nat artifact_id) extension) actual)) #let [context [module_id artifact_id] @@ -318,7 +318,7 @@ failure failure) - #.Nil + #.End (#try.Success [definitions bundles output]))))) content (document.read $.key document) definitions (monad.map ! (function (_ [def_name def_global]) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux index b7838a270..aae528bda 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux @@ -55,10 +55,10 @@ (-> (file.System Async) Module (List Context) Module Extension (Async (Try file.Path))) (case contexts - #.Nil + #.End (async\in (exception.except ..cannot_find_module [importer module])) - (#.Cons context contexts') + (#.Item context contexts') (let [path (format (..path fs context module) extension)] (do async.monad [? (\ fs file? path)] diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux index 596272af0..6b16939e4 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -151,7 +151,7 @@ (^template [] [( old_env def) (case old_env - #.Nil + #.End ( env def) _ @@ -224,10 +224,10 @@ (def: #export (applied params func) (-> (List Type) Type (Maybe Type)) (case params - #.Nil + #.End (#.Some func) - (#.Cons param params') + (#.Item param params') (case func (^template [] [( env body) @@ -295,13 +295,13 @@ [(def: #export ( types) (-> (List Type) Type) (case types - #.Nil + #.End - (#.Cons type #.Nil) + (#.Item type #.End) type - (#.Cons type types') + (#.Item type types') ( type ( types'))))] [variant Nothing #.Sum] @@ -311,19 +311,19 @@ (def: #export (function inputs output) (-> (List Type) Type Type) (case inputs - #.Nil + #.End output - (#.Cons input inputs') + (#.Item input inputs') (#.Function input (function inputs' output)))) (def: #export (application params quant) (-> (List Type) Type Type) (case params - #.Nil + #.End quant - (#.Cons param params') + (#.Item param params') (application params' (#.Apply param quant)))) (template [ ] diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux index a918db8e5..f6b6b35ac 100644 --- a/stdlib/source/library/lux/type/abstract.lux +++ b/stdlib/source/library/lux/type/abstract.lux @@ -28,7 +28,7 @@ (def: (push value stack) (All [a] (-> a (Stack a) (Stack a))) - (#.Cons value stack)) + (#.Item value stack)) (def: pop (All [a] (-> (Stack a) (Maybe (Stack a)))) @@ -42,17 +42,17 @@ (def: frames (Stack Frame) - #.Nil) + #.End) (template: (!peek ) (loop [entries ] (case entries - (#.Cons [head_name head] tail) + (#.Item [head_name head] tail) (if (text\= head_name) (recur tail)) - #.Nil + #.End (undefined)))) (def: (peek_frames_definition reference source) @@ -102,14 +102,14 @@ (template: (!push ) (loop [entries ] (case entries - (#.Cons [head_name head] tail) + (#.Item [head_name head] tail) (if (text\= head_name) - (#.Cons [head_name ] + (#.Item [head_name ] tail) - (#.Cons [head_name head] + (#.Item [head_name head] (recur tail))) - #.Nil + #.End (undefined)))) (def: (push_frame_definition reference frame source) diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index fc3b31347..4e6bcdc3d 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/type/check.lux @@ -129,32 +129,32 @@ (def: (var::new id plist) (-> Var Type_Vars Type_Vars) - (#.Cons [id #.None] plist)) + (#.Item [id #.None] plist)) (def: (var::get id plist) (-> Var Type_Vars (Maybe (Maybe Type))) (case plist - (#.Cons [var_id var_type] + (#.Item [var_id var_type] plist') (if (!n\= id var_id) (#.Some var_type) (var::get id plist')) - #.Nil + #.End #.None)) (def: (var::put id value plist) (-> Var (Maybe Type) Type_Vars Type_Vars) (case plist - #.Nil + #.End (list [id value]) - (#.Cons [var_id var_type] + (#.Item [var_id var_type] plist') (if (!n\= id var_id) - (#.Cons [var_id value] + (#.Item [var_id value] plist') - (#.Cons [var_id var_type] + (#.Item [var_id var_type] (var::put id value plist'))))) (def: #export (run context proc) @@ -358,7 +358,7 @@ (def: (assume! assumption assumptions) (-> Assumption (List Assumption) (List Assumption)) - (#.Cons assumption assumptions)) + (#.Item assumption assumptions)) ## TODO: "if_bind" can be optimized... (def: (if_bind id type then else) @@ -625,10 +625,10 @@ e_params e_params a_params a_params] (case [e_params a_params] - [#.Nil #.Nil] + [#.End #.End] (check\in assumptions) - [(#.Cons e_head e_tail) (#.Cons a_head a_tail)] + [(#.Item e_head e_tail) (#.Item a_head a_tail)] (do ..monad [assumptions' (check' assumptions e_head a_head)] (recur assumptions' e_tail a_tail)) diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux index 59b8288ed..f44509aaa 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/type/implicit.lux @@ -98,10 +98,10 @@ candidates (list.only (|>> product.right (text\= simple_name)) tag_lists)]] (case candidates - #.Nil + #.End (meta.failure (format "Unknown tag: " (%.name member))) - (#.Cons winner #.Nil) + (#.Item winner #.End) (in winner) _ @@ -123,7 +123,7 @@ (if (and (annotation.implementation? def_anns) (or (text\= target_module source_module) exported?)) - (#.Cons [[source_module name] def_type] aggregate) + (#.Item [[source_module name] def_type] aggregate) aggregate)) aggregate constants)) @@ -146,7 +146,7 @@ (do {! meta.monad} [this_module_name meta.current_module_name definitions (meta.definitions this_module_name)] - (in (prepare_definitions this_module_name this_module_name definitions #.Nil)))) + (in (prepare_definitions this_module_name this_module_name definitions #.End)))) (def: imported_structs (Meta (List [Name Type])) @@ -156,7 +156,7 @@ accessible_definitions (monad.map ! meta.definitions imported_modules)] (in (list\fold (function (_ [imported_module definitions] tail) (prepare_definitions imported_module this_module_name definitions tail)) - #.Nil + #.End (list.zipped/2 imported_modules accessible_definitions))))) (def: (apply_function_type func arg) @@ -186,7 +186,7 @@ (do check.monad [[id var] check.var [ids final_output] (concrete_type (maybe.assume (type.applied (list var) type)))] - (in [(#.Cons id ids) + (in [(#.Item id ids) final_output])) _ @@ -228,7 +228,7 @@ (#.Right =deps) (list [alt_name =deps])))) list\join) - #.Nil + #.End (meta.failure (format "No candidates for provisioning: " (%.type dep))) found @@ -246,10 +246,10 @@ (#.Right candidates) (case candidates - #.Nil + #.End (check.failure (format "No candidates for provisioning: " (%.type dep))) - (#.Cons winner #.Nil) + (#.Item winner #.End) (\ check.monad in winner) _ @@ -279,7 +279,7 @@ (#.Right =deps) (list [alt_name =deps])))) list\join) - #.Nil + #.End (meta.failure (format "No alternatives for " (%.type (type.function input_types output_type)))) found @@ -309,7 +309,7 @@ (def: (instance$ [constructor dependencies]) (-> Instance Code) (case dependencies - #.Nil + #.End (code.identifier constructor) _ @@ -350,10 +350,10 @@ output_type meta.expected_type chosen_ones (alternatives sig_type member_idx input_types output_type)] (case chosen_ones - #.Nil + #.End (meta.failure (format "No implementation could be found for member: " (%.name member))) - (#.Cons chosen #.Nil) + (#.Item chosen #.End) (in (list (` (\ (~ (instance$ chosen)) (~ (code.local_identifier (product.right member))) (~+ (list\map code.identifier args)))))) diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux index 1b9d94381..f2709d5e2 100644 --- a/stdlib/source/library/lux/type/refinement.lux +++ b/stdlib/source/library/lux/type/refinement.lux @@ -52,13 +52,13 @@ (def: #export (only refiner values) (All [t %] (-> (Refiner t %) (List t) (List (Refined t %)))) (case values - #.Nil - #.Nil + #.End + #.End - (#.Cons head tail) + (#.Item head tail) (case (refiner head) (#.Some refined) - (#.Cons refined (only refiner tail)) + (#.Item refined (only refiner tail)) #.None (only refiner tail)))) @@ -66,19 +66,19 @@ (def: #export (partition refiner values) (All [t %] (-> (Refiner t %) (List t) [(List (Refined t %)) (List t)])) (case values - #.Nil - [#.Nil #.Nil] + #.End + [#.End #.End] - (#.Cons head tail) + (#.Item head tail) (let [[yes no] (partition refiner tail)] (case (refiner head) (#.Some refined) - [(#.Cons refined yes) + [(#.Item refined yes) no] #.None [yes - (#.Cons head no)])))) + (#.Item head no)])))) (syntax: #export (type refiner) (macro.with_gensyms [g!t g!%] diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux index dc321578e..d0cee7d42 100644 --- a/stdlib/source/library/lux/type/resource.lux +++ b/stdlib/source/library/lux/type/resource.lux @@ -157,10 +157,10 @@ [(syntax: #export ( {swaps ..indices}) (macro.with_gensyms [g!_ g!context] (case swaps - #.Nil + #.End (in (list (` ((~! no_op) )))) - (#.Cons head tail) + (#.Item head tail) (do {! meta.monad} [#let [max_idx (list\fold n.max head tail)] g!inputs (<| (monad.seq !) (list.repeat (inc max_idx)) (macro.gensym "input")) diff --git a/stdlib/source/library/lux/world/db/jdbc.lux b/stdlib/source/library/lux/world/db/jdbc.lux index ccc9d91af..0d1112282 100644 --- a/stdlib/source/library/lux/world/db/jdbc.lux +++ b/stdlib/source/library/lux/world/db/jdbc.lux @@ -66,27 +66,27 @@ [(capability: #export ( ! i) ( (Statement i) (! (Try ))))] - [Can-Execute can-execute Nat] - [Can-Insert can-insert (List ID)] + [Can_Execute can_execute Nat] + [Can_Insert can_insert (List ID)] ) -(capability: #export (Can-Query ! i o) - (can-query [(Statement i) (Output o)] (! (Try (List o))))) +(capability: #export (Can_Query ! i o) + (can_query [(Statement i) (Output o)] (! (Try (List o))))) -(capability: #export (Can-Close !) - (can-close Any (! (Try Any)))) +(capability: #export (Can_Close !) + (can_close Any (! (Try Any)))) (interface: #export (DB !) - (: (Can-Execute !) + (: (Can_Execute !) execute) - (: (Can-Insert !) + (: (Can_Insert !) insert) - (: (Can-Query !) + (: (Can_Query !) query) - (: (Can-Close !) + (: (Can_Close !) close)) -(def: (with-statement statement conn action) +(def: (with_statement statement conn action) (All [i a] (-> (Statement i) java/sql/Connection (-> java/sql/PreparedStatement (IO (Try a))) @@ -106,10 +106,10 @@ (~~ (template [ ] [(def: ( (|>> (!.use (\ db )) async.future)))] - [execute can-execute] - [insert can-insert] - [close can-close] - [query can-query]))))) + [execute can_execute] + [insert can_insert] + [close can_close] + [query can_query]))))) (def: #export (connect creds) (-> Credentials (IO (Try (DB IO)))) @@ -120,40 +120,40 @@ (in (: (DB IO) (implementation (def: execute - (..can-execute + (..can_execute (function (execute statement) - (with-statement statement connection + (with_statement statement connection (function (_ prepared) (do (try.with io.monad) - [row-count (java/sql/PreparedStatement::executeUpdate prepared)] - (in (.nat row-count)))))))) + [row_count (java/sql/PreparedStatement::executeUpdate prepared)] + (in (.nat row_count)))))))) (def: insert - (..can-insert + (..can_insert (function (insert statement) - (with-statement statement connection + (with_statement statement connection (function (_ prepared) (do (try.with io.monad) [_ (java/sql/PreparedStatement::executeUpdate prepared) - result-set (io.io (java/sql/Statement::getGeneratedKeys prepared))] - (/output.rows /output.long result-set))))))) + result_set (io.io (java/sql/Statement::getGeneratedKeys prepared))] + (/output.rows /output.long result_set))))))) (def: close - (..can-close + (..can_close (function (close _) (java/sql/Connection::close connection)))) (def: query - (..can-query + (..can_query (function (query [statement output]) - (with-statement statement connection + (with_statement statement connection (function (_ prepared) (do (try.with io.monad) - [result-set (java/sql/PreparedStatement::executeQuery prepared)] - (/output.rows output result-set))))))) + [result_set (java/sql/PreparedStatement::executeQuery prepared)] + (/output.rows output result_set))))))) ))))) -(def: #export (with-db creds action) +(def: #export (with_db creds action) (All [a] (-> Credentials (-> (DB IO) (IO (Try a))) @@ -164,7 +164,7 @@ _ (!.use (\ db close) [])] (in result))) -(def: #export (with-async-db creds action) +(def: #export (with_async_db creds action) (All [a] (-> Credentials (-> (DB Async) (Async (Try a))) diff --git a/stdlib/source/library/lux/world/db/jdbc/input.lux b/stdlib/source/library/lux/world/db/jdbc/input.lux index 7388e1334..10cf48c86 100644 --- a/stdlib/source/library/lux/world/db/jdbc/input.lux +++ b/stdlib/source/library/lux/world/db/jdbc/input.lux @@ -97,11 +97,11 @@ (function (_ value [idx statement]) (do try.monad [_ ( (.int idx) - ( (instant.to-millis value)) + ( (instant.to_millis value)) statement)] (in [(.inc idx) statement]))))] [date java/sql/PreparedStatement::setDate java/sql/Date::new] [time java/sql/PreparedStatement::setTime java/sql/Time::new] - [time-stamp java/sql/PreparedStatement::setTimestamp java/sql/Timestamp::new] + [time_stamp java/sql/PreparedStatement::setTimestamp java/sql/Timestamp::new] ) diff --git a/stdlib/source/library/lux/world/db/jdbc/output.lux b/stdlib/source/library/lux/world/db/jdbc/output.lux index 4ddc8ea2d..29f1d86a5 100644 --- a/stdlib/source/library/lux/world/db/jdbc/output.lux +++ b/stdlib/source/library/lux/world/db/jdbc/output.lux @@ -24,8 +24,8 @@ (import: java/sql/Timestamp) (`` (import: java/sql/ResultSet - (~~ (template [ ] - [( [int] #try )] + (~~ (template [ ] + [( [int] #try )] [getBoolean boolean] @@ -101,7 +101,7 @@ (def: #export (fail error) (All [a] (-> Text (Output a))) - (function (_ [idx result-set]) + (function (_ [idx result_set]) (#try.Failure error))) (def: #export (and left right) @@ -112,11 +112,11 @@ =right right] (in [=left =right]))) -(template [ ] - [(def: #export +(template [ ] + [(def: #export (Output ) - (function (_ [idx result-set]) - (case ( [(.int idx)] result-set) + (function (_ [idx result_set]) + (case ( [(.int idx)] result_set) (#try.Failure error) (#try.Failure error) @@ -137,35 +137,35 @@ [bytes java/sql/ResultSet::getBytes Binary] ) -(template [ ] - [(def: #export +(template [ ] + [(def: #export (Output Instant) - (function (_ [idx result-set]) - (case ( [(.int idx)] result-set) + (function (_ [idx result_set]) + (case ( [(.int idx)] result_set) (#try.Failure error) (#try.Failure error) (#try.Success value) (#try.Success [(inc idx) - (instant.from-millis (java/util/Date::getTime value))]))))] + (instant.from_millis (java/util/Date::getTime value))]))))] [date java/sql/ResultSet::getDate] [time java/sql/ResultSet::getTime] - [time-stamp java/sql/ResultSet::getTimestamp] + [time_stamp java/sql/ResultSet::getTimestamp] ) (def: #export (rows output results) (All [a] (-> (Output a) java/sql/ResultSet (IO (Try (List a))))) (case (java/sql/ResultSet::next results) - (#try.Success has-next?) - (if has-next? + (#try.Success has_next?) + (if has_next? (case (output [1 results]) (#.Some [_ head]) (do io.monad [?tail (rows output results)] (case ?tail (#try.Success tail) - (in (ex.return (#.Cons head tail))) + (in (ex.return (#.Item head tail))) (#try.Failure error) (do io.monad diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux index 99f3f027d..93cd86b48 100644 --- a/stdlib/source/library/lux/world/db/sql.lux +++ b/stdlib/source/library/lux/world/db/sql.lux @@ -210,7 +210,7 @@ (format " " (case columns - #.Nil + #.End "*" _ @@ -288,7 +288,7 @@ (Query where having No-Order group limit offset) (Query where having With-Order group limit offset))) (case pairs - #.Nil + #.End (|> query :representation :abstraction) _ @@ -306,7 +306,7 @@ (Query where having order No-Group limit offset) (Query where having order With-Group limit offset))) (case pairs - #.Nil + #.End (|> query :representation :abstraction) _ @@ -331,7 +331,7 @@ (-> Table (List [Column Value]) (Command No-Where No-Having)) (:abstraction (format "UPDATE " (:representation table) (case pairs - #.Nil + #.End "" _ diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index f66458f87..962636aa9 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -726,14 +726,14 @@ output (: (List ..Path) (list))] (case input - #.Nil + #.End (in output) - (#.Cons head tail) + (#.Item head tail) (do ! [verdict ( head)] (recur tail (if verdict - (#.Cons head output) + (#.Item head output) output))))) _ (RubyDir::close [] self)] (in output)))] @@ -921,14 +921,14 @@ ## output (: (List ( IO)) ## (list))] ## (case input - ## #.Nil + ## #.End ## (in output) - ## (#.Cons head tail) + ## (#.Item head tail) ## (do ! ## [verdict ( head)] ## (if verdict - ## (recur tail (#.Cons ( head) output)) + ## (recur tail (#.Item ( head) output)) ## (recur tail output)))))))] ## [files ..is_file ..file File] @@ -1007,23 +1007,23 @@ (loop [directory mock trail (text.split_all_with separator path)] (case trail - (#.Cons head tail) + (#.Item head tail) (case (dictionary.get head directory) #.None (exception.except ..cannot_find_file [path]) (#.Some node) (case [node tail] - [(#.Left file) #.Nil] + [(#.Left file) #.End] (#try.Success [head file]) - [(#.Right sub_directory) (#.Cons _)] + [(#.Right sub_directory) (#.Item _)] (recur sub_directory tail) _ (exception.except ..cannot_find_file [path]))) - #.Nil + #.End (exception.except ..cannot_find_file [path])))) (def: (update_mock_file! / path now content mock) @@ -1031,30 +1031,30 @@ (loop [directory mock trail (text.split_all_with / path)] (case trail - (#.Cons head tail) + (#.Item head tail) (case (dictionary.get head directory) #.None (case tail - #.Nil + #.End (#try.Success (dictionary.put head (#.Left {#mock_last_modified now #mock_can_execute false #mock_content content}) directory)) - (#.Cons _) + (#.Item _) (exception.except ..cannot_find_file [path])) (#.Some node) (case [node tail] - [(#.Left file) #.Nil] + [(#.Left file) #.End] (#try.Success (dictionary.put head (#.Left (|> file (set@ #mock_last_modified now) (set@ #mock_content content))) directory)) - [(#.Right sub_directory) (#.Cons _)] + [(#.Right sub_directory) (#.Item _)] (do try.monad [sub_directory (recur sub_directory tail)] (in (dictionary.put head (#.Right sub_directory) directory))) @@ -1062,7 +1062,7 @@ _ (exception.except ..cannot_find_file [path]))) - #.Nil + #.End (exception.except ..cannot_find_file [path])))) (def: (mock_delete! / path mock) @@ -1070,14 +1070,14 @@ (loop [directory mock trail (text.split_all_with / path)] (case trail - (#.Cons head tail) + (#.Item head tail) (case (dictionary.get head directory) #.None (exception.except ..cannot_delete [path]) (#.Some node) (case tail - #.Nil + #.End (case node (#.Left file) (#try.Success (dictionary.remove head directory)) @@ -1087,7 +1087,7 @@ (#try.Success (dictionary.remove head directory)) (exception.except ..cannot_delete [path]))) - (#.Cons _) + (#.Item _) (case node (#.Left file) (exception.except ..cannot_delete [path]) @@ -1097,7 +1097,7 @@ [sub_directory' (recur sub_directory tail)] (in (dictionary.put head (#.Right sub_directory') directory)))))) - #.Nil + #.End (exception.except ..cannot_delete [path])))) (def: (try_update! transform var) @@ -1118,19 +1118,19 @@ (loop [directory mock trail (text.split_all_with / path)] (case trail - (#.Cons head tail) + (#.Item head tail) (case (dictionary.get head directory) #.None (case tail - #.Nil + #.End (#try.Success (dictionary.put head (#.Right ..empty_mock) directory)) - (#.Cons _) + (#.Item _) (exception.except ..cannot_make_directory [path])) (#.Some node) (case [node tail] - [(#.Right sub_directory) (#.Cons _)] + [(#.Right sub_directory) (#.Item _)] (do try.monad [sub_directory (recur sub_directory tail)] (in (dictionary.put head (#.Right sub_directory) directory))) @@ -1138,7 +1138,7 @@ _ (exception.except ..cannot_make_directory [path]))) - #.Nil + #.End (exception.except ..cannot_make_directory [path])))) (def: (retrieve_mock_directory! / path mock) @@ -1146,10 +1146,10 @@ (loop [directory mock trail (text.split_all_with / path)] (case trail - #.Nil + #.End (#try.Success directory) - (#.Cons head tail) + (#.Item head tail) (case (dictionary.get head directory) #.None (exception.except ..cannot_find_directory [path]) @@ -1161,10 +1161,10 @@ (#.Right sub_directory) (case tail - #.Nil + #.End (#try.Success sub_directory) - (#.Cons _) + (#.Item _) (recur sub_directory tail))))))) (def: #export (mock separator) @@ -1322,10 +1322,10 @@ (case (if rooted? (list.drop 1 segments) segments) - #.Nil + #.End (\ monad in (exception.except ..cannot_make_directory [path])) - (#.Cons head tail) + (#.Item head tail) (case head "" (\ monad in (exception.except ..cannot_make_directory [path])) _ (loop [current (if rooted? @@ -1337,10 +1337,10 @@ (case ? (#try.Success _) (case next - #.Nil + #.End (in (#try.Success [])) - (#.Cons head tail) + (#.Item head tail) (recur (format current (\ fs separator) head) tail)) diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index daa1380a4..eea669a47 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -273,10 +273,10 @@ (All [a] (-> (java/util/List a) (List a))) (let [size (.nat (java/util/List::size list))] (loop [idx 0 - output #.Nil] + output #.End] (if (n.< size idx) (recur (inc idx) - (#.Cons (java/util/List::get (.int idx) list) + (#.Item (java/util/List::get (.int idx) list) output)) output)))) @@ -384,7 +384,7 @@ java/nio/file/Path::toString (:as //.Path))] concern (..default_key_concern key)] - (recur (#.Cons [concern path] + (recur (#.Item [concern path] output))) (recur output))) diff --git a/stdlib/source/library/lux/world/net/http/header.lux b/stdlib/source/library/lux/world/net/http/header.lux index e5b1882ad..1d84b3318 100644 --- a/stdlib/source/library/lux/world/net/http/header.lux +++ b/stdlib/source/library/lux/world/net/http/header.lux @@ -22,11 +22,11 @@ previous (format previous "," value))))) -(def: #export content-length +(def: #export content_length (-> Nat Header) (|>> %.nat (..add "Content-Length"))) -(def: #export content-type +(def: #export content_type (-> MIME Header) (|>> mime.name (..add "Content-Type"))) diff --git a/stdlib/source/library/lux/world/net/http/mime.lux b/stdlib/source/library/lux/world/net/http/mime.lux index 859b0840e..445796038 100644 --- a/stdlib/source/library/lux/world/net/http/mime.lux +++ b/stdlib/source/library/lux/world/net/http/mime.lux @@ -26,20 +26,20 @@ (template [ ] [(def: #export MIME (..mime ))] - [aac-audio "audio/aac"] + [aac_audio "audio/aac"] [abiword "application/x-abiword"] [avi "video/x-msvideo"] - [amazon-kindle-ebook "application/vnd.amazon.ebook"] + [amazon_kindle_ebook "application/vnd.amazon.ebook"] [binary "application/octet-stream"] [bitmap "image/bmp"] [bzip "application/x-bzip"] [bzip2 "application/x-bzip2"] - [c-shell "application/x-csh"] + [c_shell "application/x-csh"] [css "text/css"] [csv "text/csv"] - [microsoft-word "application/msword"] - [microsoft-word-openxml "application/vnd.openxmlformats-officedocument.wordprocessingml.document"] - [ms-embedded-opentype-fonts "application/vnd.ms-fontobject"] + [microsoft_word "application/msword"] + [microsoft_word_openxml "application/vnd.openxmlformats-officedocument.wordprocessingml.document"] + [ms_embedded_opentype_fonts "application/vnd.ms-fontobject"] [epub "application/epub+zip"] [ecmascript "application/ecmascript"] [gif "image/gif"] @@ -52,49 +52,51 @@ [json "application/json"] [midi "audio/midi"] [mpeg "video/mpeg"] - [apple-installer-package "application/vnd.apple.installer+xml"] - [opendocument-presentation "application/vnd.oasis.opendocument.presentation"] - [opendocument-spreadsheet "application/vnd.oasis.opendocument.spreadsheet"] - [opendocument-text "application/vnd.oasis.opendocument.text"] - [ogg-audio "audio/ogg"] - [ogg-video "video/ogg"] + [apple_installer_package "application/vnd.apple.installer+xml"] + [opendocument_presentation "application/vnd.oasis.opendocument.presentation"] + [opendocument_spreadsheet "application/vnd.oasis.opendocument.spreadsheet"] + [opendocument_text "application/vnd.oasis.opendocument.text"] + [ogg_audio "audio/ogg"] + [ogg_video "video/ogg"] [ogg "application/ogg"] - [opentype-font "font/otf"] + [opentype_font "font/otf"] [png "image/png"] [pdf "application/pdf"] - [microsoft-powerpoint "application/vnd.ms-powerpoint"] - [microsoft-powerpoint-openxml "application/vnd.openxmlformats-officedocument.presentationml.presentation"] + [microsoft_powerpoint "application/vnd.ms-powerpoint"] + [microsoft_powerpoint_openxml "application/vnd.openxmlformats-officedocument.presentationml.presentation"] [rar "application/x-rar-compressed"] [rtf "application/rtf"] - [bourne-shell "application/x-sh"] + [bourne_shell "application/x-sh"] [svg "image/svg+xml"] [flash "application/x-shockwave-flash"] [tar "application/x-tar"] [tiff "image/tiff"] [typescript "application/typescript"] - [truetype-font "font/ttf"] - [microsoft-visio "application/vnd.visio"] + [truetype_font "font/ttf"] + [microsoft_visio "application/vnd.visio"] [wav "audio/wav"] - [webm-audio "audio/webm"] - [webm-video "video/webm"] + [webm_audio "audio/webm"] + [webm_video "video/webm"] [webp "image/webp"] [woff "font/woff"] [woff2 "font/woff2"] [xhtml "application/xhtml+xml"] - [microsoft-excel "application/vnd.ms-excel"] - [microsoft-excel-openxml "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"] + [microsoft_excel "application/vnd.ms-excel"] + [microsoft_excel_openxml "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"] [xml "application/xml"] [xul "application/vnd.mozilla.xul+xml"] [zip "application/zip"] - [!3gpp-audio "audio/3gpp"] + [!3gpp_audio "audio/3gpp"] [!3gpp "video/3gpp"] - [!3gpp2-audio "audio/3gpp2"] + [!3gpp2_audio "audio/3gpp2"] [!3gpp2 "video/3gpp2"] [!7z "application/x-7z-compressed"] ) (def: #export (text encoding) (-> Encoding MIME) - (..mime (format "text/plain; charset=" text.double-quote (encoding.name encoding) text.double-quote))) + (..mime (format "text/plain; charset=" text.double_quote (encoding.name encoding) text.double_quote))) -(def: #export utf-8 MIME (..text encoding.utf-8)) +(def: #export utf_8 + MIME + (..text encoding.utf_8)) diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux index 2c08a7cca..a65f5b2c0 100644 --- a/stdlib/source/library/lux/world/net/http/request.lux +++ b/stdlib/source/library/lux/world/net/http/request.lux @@ -44,19 +44,19 @@ inputs))] output)) -(def: (read-text-body body) +(def: (read_text_body body) (-> Body (Async (Try Text))) (do async.monad [blobs (frp.consume body)] (in (\ encoding.utf8 decode (merge blobs))))) -(def: failure (//response.bad-request "")) +(def: failure (//response.bad_request "")) (def: #export (json reader server) (All [a] (-> (.Reader a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (do async.monad - [?raw (read-text-body (get@ #//.body message))] + [?raw (read_text_body (get@ #//.body message))] (case (do try.monad [raw ?raw content (\ json.codec decode raw)] @@ -71,7 +71,7 @@ (-> (-> Text Server) Server) (function (_ (^@ request [identification protocol resource message])) (do async.monad - [?raw (read-text-body (get@ #//.body message))] + [?raw (read_text_body (get@ #//.body message))] (case ?raw (#try.Success content) (server content request) @@ -84,7 +84,7 @@ (function (_ [identification protocol resource message]) (let [full (get@ #//.uri resource) [uri query] (|> full - (text.split-with "?") + (text.split_with "?") (maybe.default [full ""]))] (case (do try.monad [query (//query.parameters query) @@ -101,7 +101,7 @@ (All [a] (-> (Property a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (do async.monad - [?body (read-text-body (get@ #//.body message))] + [?body (read_text_body (get@ #//.body message))] (case (do try.monad [body ?body form (//query.parameters body)] diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux index e90307894..730a2001a 100644 --- a/stdlib/source/library/lux/world/program.lux +++ b/stdlib/source/library/lux/world/program.lux @@ -136,9 +136,9 @@ (def: (jvm\\consume iterator) (All [a] (-> (java/util/Iterator a) (List a))) (if (java/util/Iterator::hasNext iterator) - (#.Cons (java/util/Iterator::next iterator) + (#.Item (java/util/Iterator::next iterator) (jvm\\consume iterator)) - #.Nil)) + #.End)) )] (for {@.old (as_is ) @.jvm (as_is ) diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux index a80193663..994f192fe 100644 --- a/stdlib/source/program/aedifex/command/auto.lux +++ b/stdlib/source/program/aedifex/command/auto.lux @@ -65,10 +65,10 @@ [_ (..pause delay) events (\ watcher poll [])] (case events - (#.Cons _) + (#.Item _) (do ! [_ ] (recur [])) - #.Nil + #.End (recur [])))))))))) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 6a0b6bcd0..b675bb5cd 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -139,19 +139,19 @@ (loop [left (text.split_all_with ..version_separator left) right (text.split_all_with ..version_separator right)] (case [left right] - [(#.Cons leftH leftT) (#.Cons rightH rightT)] + [(#.Item leftH leftT) (#.Item rightH rightT)] (if (text\= leftH rightH) (recur leftT rightT) (or (n.< (text.size leftH) (text.size rightH)) (text\< leftH rightH))) - [(#.Cons leftH leftT) #.Nil] + [(#.Item leftH leftT) #.End] false - [#.Nil (#.Cons rightH rightT)] + [#.End (#.Item rightH rightT)] true - [#.Nil #.Nil] + [#.End #.End] false)))) (def: #export (host_dependencies fs home) @@ -245,14 +245,14 @@ (def: (jvm_class_path host_dependencies) (-> (List Path) Text) (|> host_dependencies - (#.Cons ".") + (#.Item ".") (text.join_with ..jvm_class_path_separator) %.text)) (def: #export (with_jvm_class_path host_dependencies runtime) (-> (List Path) ///runtime.Runtime ///runtime.Runtime) (case host_dependencies - #.Nil + #.End runtime _ diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux index 434bedbdd..0238f64cd 100644 --- a/stdlib/source/program/aedifex/command/deps.lux +++ b/stdlib/source/program/aedifex/command/deps.lux @@ -42,7 +42,7 @@ (do async.monad [#let [dependencies (|> (get@ #///.dependencies profile) set.to_list - (#.Cons (get@ #///.compiler profile)))] + (#.Item (get@ #///.compiler profile)))] [local_successes local_failures cache] (///dependency/resolution.all console (list local) new_repository diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index 8c7b6ab6a..3bd510675 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -177,12 +177,12 @@ (def: #export (any console repositories dependency) (-> (Console Async) (List (Repository Async)) Dependency (Async (Try Package))) (case repositories - #.Nil + #.End (|> dependency (exception.except ..cannot_resolve) (\ async.monad in)) - (#.Cons repository alternatives) + (#.Item repository alternatives) (do {! async.monad} [_ (..announce_fetching console repository (get@ #//.artifact dependency)) outcome (..one repository dependency)] @@ -208,11 +208,11 @@ dependencies dependencies resolution resolution] (case dependencies - #.Nil + #.End (\ async.monad in [successes failures resolution]) - (#.Cons head tail) + (#.Item head tail) (case (get@ [#//.artifact #///artifact.version] head) ## Skip if there is no version "" (recur repositories @@ -243,7 +243,7 @@ ## sub_repositories (list\compose repositories package_repositories) sub_repositories repositories] [successes failures resolution] (recur sub_repositories - (#.Cons head successes) + (#.Item head successes) failures sub_dependencies (dictionary.put head package resolution))] @@ -256,6 +256,6 @@ (#try.Failure error) (recur repositories successes - (#.Cons head failures) + (#.Item head failures) tail resolution))))))) diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index 1896415ea..f87fcfaae 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -81,7 +81,7 @@ (All [a] (-> Text (List a) (Format a) Aggregate Aggregate)) (case value - #.Nil + #.End aggregate value diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index c804d86b0..5976c681a 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -101,10 +101,10 @@ output (: (Dictionary file.Path Binary) (dictionary.new text.hash))] (case pending - #.Nil + #.End (in output) - (#.Cons head tail) + (#.Item head tail) (do ! [content (\ fs read head)] (recur tail diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux index 889ba4a0f..e429ff86f 100644 --- a/stdlib/source/program/scriptum.lux +++ b/stdlib/source/program/scriptum.lux @@ -109,7 +109,7 @@ (case [recursive_type? type] [_ (#.Primitive name params)] (case params - #.Nil + #.End (format "(primitive " (%.text name) ")") _ @@ -118,7 +118,7 @@ [_ (#.Sum _)] (let [members (type.flat_variant type)] (case tags - #.Nil + #.End (format "(| " (|> members (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) @@ -145,7 +145,7 @@ [_ (#.Product _)] (let [members (type.flat_tuple type)] (case tags - #.Nil + #.End (format "[" (|> members (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) (text.join_with " ")) "]") _ @@ -183,7 +183,7 @@ body_doc (pprint_type_definition (n.+ level level') type_func_info tags module signature? recursive_type? body)] (format "(" " " "[" (text.join_with " " args) "]" (case tags - #.Nil + #.End (format " " body_doc) _ @@ -210,7 +210,7 @@ (case type (#.Primitive name params) (case params - #.Nil + #.End (format "(primitive " (%.text name) ")") _ @@ -285,25 +285,25 @@ (cond (type\= .Type def_type) (update@ #types (: (Mutation (List Value)) - (|>> (#.Cons [name def_annotations (:as Type def_value)]))) + (|>> (#.Item [name def_annotations (:as Type def_value)]))) organization) (type\= .Macro def_type) (update@ #macros (: (Mutation (List [Text Code])) - (|>> (#.Cons [name def_annotations]))) + (|>> (#.Item [name def_annotations]))) organization) (annotation.implementation? def_annotations) (update@ #implementations (: (Mutation (List Value)) - (|>> (#.Cons [name def_annotations def_type]))) + (|>> (#.Item [name def_annotations def_type]))) organization) ## else (update@ #values (: (Mutation (List Value)) - (|>> (#.Cons [name def_annotations def_type]))) + (|>> (#.Item [name def_annotations def_type]))) organization))) (def: name_sort @@ -359,7 +359,7 @@ type_arguments (annotation.type_arguments def_annotations) signature? (annotation.signature? def_annotations) usage (case type_arguments - #.Nil + #.End _name _ @@ -429,7 +429,7 @@ (list\map (function (_ [name def_annotations value_type]) (let [?doc (annotation.documentation def_annotations) usage (case (annotation.function_arguments def_annotations) - #.Nil + #.End name args diff --git a/stdlib/source/specification/compositor.lux b/stdlib/source/specification/compositor.lux index 162dcbec8..5645b0164 100644 --- a/stdlib/source/specification/compositor.lux +++ b/stdlib/source/specification/compositor.lux @@ -58,9 +58,9 @@ expander program))]] (case ?state,runner,definer - (#try.Success [[directive-bundle directive-state] runner definer]) + (#try.Success [[directive_bundle directive_state] runner definer]) (..test runner definer - (get@ [#directive.analysis #directive.state] directive-state) + (get@ [#directive.analysis #directive.state] directive_state) expander) (#try.Failure error) diff --git a/stdlib/source/specification/compositor/analysis/type.lux b/stdlib/source/specification/compositor/analysis/type.lux index 4db867513..5a34eae36 100644 --- a/stdlib/source/specification/compositor/analysis/type.lux +++ b/stdlib/source/specification/compositor/analysis/type.lux @@ -20,10 +20,10 @@ ["#/." scope] ["#/." type]]]]]]) -(def: (check-success+ expander state extension params output-type) +(def: (check_success+ expander state extension params output_type) (-> Expander State+ Text (List Code) Type Bit) - (|> (analysis/scope.with-scope "" - (analysis/type.with-type output-type + (|> (analysis/scope.with_scope "" + (analysis/type.with_type output_type (analysis.phase expander (` ((~ (code.text extension)) (~+ params)))))) (phase.run state) (case> (#try.Success _) @@ -46,18 +46,18 @@ [r.nat (0 #0 "#I64" (0 #1 (0 #0 "#Nat" (0 #0)) (0 #0))) code.nat] [r.int (0 #0 "#I64" (0 #1 (0 #0 "#Int" (0 #0)) (0 #0))) code.int] [r.rev (0 #0 "#I64" (0 #1 (0 #0 "#Rev" (0 #0)) (0 #0))) code.rev] - [r.safe-frac (0 #0 "#Frac" (0 #0)) code.frac] - [(r.ascii/upper-alpha 5) (0 #0 "#Text" (0 #0)) code.text] + [r.safe_frac (0 #0 "#Frac" (0 #0)) code.frac] + [(r.ascii/upper_alpha 5) (0 #0 "#Text" (0 #0)) code.text] ))))) (def: #export (spec expander state) (-> Expander State+ Test) (do r.monad [[typeC exprT exprC] ..check - [other-typeC other-exprT other-exprC] ..check] + [other_typeC other_exprT other_exprC] ..check] ($_ _.and (_.test "lux check" - (check-success+ expander state "lux check" (list typeC exprC) exprT)) + (check_success+ expander state "lux check" (list typeC exprC) exprT)) (_.test "lux coerce" - (check-success+ expander state "lux coerce" (list typeC other-exprC) exprT)) + (check_success+ expander state "lux coerce" (list typeC other_exprC) exprT)) ))) diff --git a/stdlib/source/specification/compositor/common.lux b/stdlib/source/specification/compositor/common.lux index 33268ecde..0b7c7979a 100644 --- a/stdlib/source/specification/compositor/common.lux +++ b/stdlib/source/specification/compositor/common.lux @@ -33,32 +33,32 @@ (def: (runner (^slots [#platform.runtime #platform.phase #platform.host]) state) (Instancer Runner) - (function (_ evaluation-name expressionS) + (function (_ evaluation_name expressionS) (do try.monad [expressionG (<| (phase.run state) - generation.with-buffer + generation.with_buffer (do phase.monad [_ runtime] (phase expressionS)))] - (\ host evaluate! evaluation-name expressionG)))) + (\ host evaluate! evaluation_name expressionG)))) (def: (definer (^slots [#platform.runtime #platform.phase #platform.host]) state) (Instancer Definer) - (function (_ lux-name expressionS) + (function (_ lux_name expressionS) (do try.monad [definitionG (<| (phase.run state) - generation.with-buffer + generation.with_buffer (do phase.monad [_ runtime expressionG (phase expressionS) - [host-name host-value host-directive] (generation.define! lux-name expressionG) - _ (generation.learn lux-name host-name)] - (phase (synthesis.constant lux-name))))] + [host_name host_value host_directive] (generation.define! lux_name expressionG) + _ (generation.learn lux_name host_name)] + (phase (synthesis.constant lux_name))))] (\ host evaluate! "definer" definitionG)))) (def: #export (executors target expander platform - analysis-bundle generation-bundle directive-bundle + analysis_bundle generation_bundle directive_bundle program extender) (All [anchor expression directive] (-> Text Expander (Platform IO anchor expression directive) @@ -70,12 +70,12 @@ Runner Definer])))) (do io.monad - [?state (platform.initialize target expander analysis-bundle platform generation-bundle directive-bundle program extender)] + [?state (platform.initialize target expander analysis_bundle platform generation_bundle directive_bundle program extender)] (in (do try.monad - [[directive-bundle directive-state] ?state - #let [generation-state (get@ [#directive.generation + [[directive_bundle directive_state] ?state + #let [generation_state (get@ [#directive.generation #directive.state] - directive-state)]] - (in [[directive-bundle directive-state] - (..runner platform generation-state) - (..definer platform generation-state)]))))) + directive_state)]] + (in [[directive_bundle directive_state] + (..runner platform generation_state) + (..definer platform generation_state)]))))) diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index d18d6b461..3ca5440bf 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -96,48 +96,48 @@ (in [caseS caseP])) )))) -(def: (let-spec run) +(def: (let_spec run) (-> Runner Test) (do r.monad - [value r.safe-frac] - (_.test (%.name (name-of synthesis.branch/let)) + [value r.safe_frac] + (_.test (%.name (name_of synthesis.branch/let)) (|> (synthesis.branch/let [(synthesis.f64 value) 0 (synthesis.variable/local 0)]) - (run "let-spec") + (run "let_spec") (verify value))))) -(def: (if-spec run) +(def: (if_spec run) (-> Runner Test) (do r.monad - [on-true r.safe-frac - on-false (|> r.safe-frac (r.only (|>> (f.= on-true) not))) + [on_true r.safe_frac + on_false (|> r.safe_frac (r.only (|>> (f.= on_true) not))) verdict r.bit] - (_.test (%.name (name-of synthesis.branch/if)) + (_.test (%.name (name_of synthesis.branch/if)) (|> (synthesis.branch/if [(synthesis.bit verdict) - (synthesis.f64 on-true) - (synthesis.f64 on-false)]) - (run "if-spec") - (verify (if verdict on-true on-false)))))) + (synthesis.f64 on_true) + (synthesis.f64 on_false)]) + (run "if_spec") + (verify (if verdict on_true on_false)))))) -(def: (case-spec run) +(def: (case_spec run) (-> Runner Test) (do r.monad [[inputS pathS] ..case - on-success r.safe-frac - on-failure (|> r.safe-frac (r.only (|>> (f.= on-success) not)))] - (_.test (%.name (name-of synthesis.branch/case)) + on_success r.safe_frac + on_failure (|> r.safe_frac (r.only (|>> (f.= on_success) not)))] + (_.test (%.name (name_of synthesis.branch/case)) (|> (synthesis.branch/case [inputS ($_ synthesis.path/alt ($_ synthesis.path/seq pathS - (synthesis.path/then (synthesis.f64 on-success))) - (synthesis.path/then (synthesis.f64 on-failure)))]) - (run "case-spec") - (verify on-success))))) + (synthesis.path/then (synthesis.f64 on_success))) + (synthesis.path/then (synthesis.f64 on_failure)))]) + (run "case_spec") + (verify on_success))))) -(def: special-input +(def: special_input Synthesis (let [_cursor_ (: Synthesis (synthesis.tuple (list (synthesis.text .prelude_module) @@ -146,13 +146,13 @@ _code_ (: (-> Synthesis Synthesis) (function (_ content) (synthesis.tuple (list _cursor_ content)))) - _nil_ (: Synthesis + _end_ (: Synthesis (synthesis.variant [0 #0 (synthesis.text "")])) - _cons_ (: (-> Synthesis Synthesis Synthesis) + _item_ (: (-> Synthesis Synthesis Synthesis) (function (_ head tail) (synthesis.variant [0 #1 (synthesis.tuple (list head tail))]))) _list_ (: (-> (List Synthesis) Synthesis) - (list\fold _cons_ _nil_))] + (list\fold _item_ _end_))] (let [__tuple__ (: (-> (List Synthesis) Synthesis) (|>> list.reverse _list_ [9 #0] synthesis.variant _code_)) __form__ (: (-> (List Synthesis) Synthesis) @@ -170,40 +170,40 @@ (synthesis.text short)))])))) __list__ (: (-> (List Synthesis) Synthesis) (list\fold (function (_ head tail) - (__form__ (list (__tag__ ["" "Cons"]) head tail))) - (__tag__ ["" "Nil"]))) + (__form__ (list (__tag__ ["" "Item"]) head tail))) + (__tag__ ["" "End"]))) __apply__ (: (-> Synthesis Synthesis Synthesis) (function (_ func arg) (__form__ (list func arg))))] - (|> _nil_ - (_cons_ (__apply__ (__identifier__ ["" "form$"]) + (|> _end_ + (_item_ (__apply__ (__identifier__ ["" "form$"]) (__list__ (list (__apply__ (__identifier__ ["" "tag$"]) (__tuple__ (list (__text__ .prelude_module) - (__text__ "Cons")))) + (__text__ "Item")))) (__identifier__ ["" "export?-meta"]) (__identifier__ ["" "tail"]))))) - (_cons_ (__tuple__ (list (__identifier__ ["" "tail"])))) + (_item_ (__tuple__ (list (__identifier__ ["" "tail"])))) )))) -(def: special-path +(def: special_path Path - (let [_nil_ (synthesis.path/side (#.Left 0)) - _cons_ (synthesis.path/side (#.Right 0)) + (let [_end_ (synthesis.path/side (#.Left 0)) + _item_ (synthesis.path/side (#.Right 0)) _head_ (synthesis.path/member (#.Left 0)) _tail_ (synthesis.path/member (#.Right 0)) _tuple_ (synthesis.path/side (#.Left 9))] ($_ synthesis.path/alt ($_ synthesis.path/seq - _cons_ + _item_ _head_ _head_ (synthesis.path/bind 2) synthesis.path/pop - _tail_ _tuple_ _cons_ + _tail_ _tuple_ _item_ _head_ (synthesis.path/bind 3) synthesis.path/pop _tail_ (synthesis.path/bind 4) synthesis.path/pop synthesis.path/pop synthesis.path/pop synthesis.path/pop synthesis.path/pop - _tail_ _cons_ + _tail_ _item_ _head_ (synthesis.path/bind 5) synthesis.path/pop - _tail_ _nil_ + _tail_ _end_ ## THEN (synthesis.path/then (synthesis.bit #1))) ($_ synthesis.path/seq @@ -211,31 +211,31 @@ ## THEN (synthesis.path/then (synthesis.bit #0)))))) -(def: special-pattern +(def: special_pattern analysis.Pattern - (let [## [_ (#Tuple (#Cons arg args'))] + (let [## [_ (#Tuple (#Item arg args'))] head (<| analysis.pattern/tuple (list (analysis.pattern/bind 2)) analysis.pattern/variant [9 #0] analysis.pattern/variant [0 #1] analysis.pattern/tuple (list (analysis.pattern/bind 3) (analysis.pattern/bind 4))) - ## (#Cons body #Nil) + ## (#Item body #End) tail (<| analysis.pattern/variant [0 #1] analysis.pattern/tuple (list (analysis.pattern/bind 5)) analysis.pattern/variant [0 #0] (analysis.pattern/unit))] - ## (#Cons ) + ## (#Item ) (<| analysis.pattern/variant [0 #1] (analysis.pattern/tuple (list head tail))))) -(def: special-pattern-path +(def: special_pattern_path Path ($_ synthesis.path/alt (<| try.assumed (phase.run [extension/synthesis.bundle synthesis.init]) (case.path phase/synthesis.phase - special-pattern) + special_pattern) (analysis.bit #1)) ($_ synthesis.path/seq (synthesis.path/bind 2) @@ -243,34 +243,34 @@ (synthesis.path/then (synthesis.bit #0))))) ## TODO: Get rid of this ASAP -(def: (special-spec run) +(def: (special_spec run) (-> Runner Test) ($_ _.and (_.test "===" - (and (text\= (synthesis.%path special-path) - (synthesis.%path special-pattern-path)) - (\ synthesis.path-equivalence = special-path special-pattern-path))) + (and (text\= (synthesis.%path special_path) + (synthesis.%path special_pattern_path)) + (\ synthesis.path_equivalence = special_path special_pattern_path))) (_.test "CODE" - (|> special-input - (run "special-input") + (|> special_input + (run "special_input") (case> (#try.Success output) true (#try.Failure _) false))) - (_.test "PATTERN-MATCHING 0" - (|> (synthesis.branch/case [special-input - special-path]) - (run "special-path") + (_.test "PATTERN_MATCHING 0" + (|> (synthesis.branch/case [special_input + special_path]) + (run "special_path") (case> (#try.Success output) true (#try.Failure _) false))) - (_.test "PATTERN-MATCHING 1" - (|> (synthesis.branch/case [special-input - special-pattern-path]) - (run "special-pattern-path") + (_.test "PATTERN_MATCHING 1" + (|> (synthesis.branch/case [special_input + special_pattern_path]) + (run "special_pattern_path") (case> (#try.Success output) true @@ -281,8 +281,8 @@ (def: #export (spec run) (-> Runner Test) ($_ _.and - (..special-spec run) - (..let-spec run) - (..if-spec run) - (..case-spec run) + (..special_spec run) + (..let_spec run) + (..if_spec run) + (..case_spec run) )) diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index bea185b99..1ef9f780b 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -30,14 +30,14 @@ (def: safe (-> Text Text) - (text.replace-all " " "_")) + (text.replace_all " " "_")) (def: (bit run) (-> Runner Test) (do r.monad [param r.i64 subject r.i64] - (with-expansions [ (template [ ] + (with_expansions [ (template [ ] [(_.test (|> (#synthesis.Extension (list (synthesis.i64 param) (synthesis.i64 subject))) @@ -47,30 +47,30 @@ (#try.Failure _) false) - (let [param ])))] + (let [param ])))] ["lux i64 and" i64.and param] ["lux i64 or" i64.or param] ["lux i64 xor" i64.xor param] - ["lux i64 left-shift" i64.left-shift (n.% 64 param)] - ["lux i64 logical-right-shift" i64.logic-right-shift (n.% 64 param)] + ["lux i64 left-shift" i64.left_shift (n.% 64 param)] + ["lux i64 logical-right-shift" i64.logic_right_shift (n.% 64 param)] )] - ($_ _.and - - (_.test "lux i64 arithmetic-right-shift" - (|> (#synthesis.Extension "lux i64 arithmetic-right-shift" - (list (synthesis.i64 subject) - (synthesis.i64 param))) - (run (..safe "lux i64 arithmetic-right-shift")) - (case> (#try.Success valueT) - ("lux i64 =" - (i64.arithmetic-right-shift param subject) - (:as I64 valueT)) - - (#try.Failure _) - false) - (let [param (n.% 64 param)]))) - )))) + ($_ _.and + + (_.test "lux i64 arithmetic-right-shift" + (|> (#synthesis.Extension "lux i64 arithmetic-right-shift" + (list (synthesis.i64 subject) + (synthesis.i64 param))) + (run (..safe "lux i64 arithmetic-right-shift")) + (case> (#try.Success valueT) + ("lux i64 =" + (i64.arithmetic_right_shift param subject) + (:as I64 valueT)) + + (#try.Failure _) + false) + (let [param (n.% 64 param)]))) + )))) (def: (i64 run) (-> Runner Test) @@ -78,7 +78,7 @@ [param (|> r.i64 (r.only (|>> ("lux i64 =" 0) not))) subject r.i64] (`` ($_ _.and - (~~ (template [ ] + (~~ (template [ ] [(_.test (|> (#synthesis.Extension (list (synthesis.i64 subject))) (run (..safe )) @@ -87,12 +87,12 @@ (#try.Failure _) false) - (let [subject ])))] + (let [subject ])))] ["lux i64 f64" Frac i.frac f.= subject] - ["lux i64 char" Text (|>> (:as Nat) text.from-code) text\= (|> subject + ["lux i64 char" Text (|>> (:as Nat) text.from_code) text\= (|> subject (:as Nat) - (n.% (i64.left-shift 8 1)) + (n.% (i64.left_shift 8 1)) (:as Int))] )) (~~ (template [ ] @@ -116,15 +116,15 @@ )) )))) -(def: simple-frac +(def: simple_frac (Random Frac) (|> r.nat (\ r.monad map (|>> (n.% 1000) .int i.frac)))) (def: (f64 run) (-> Runner Test) (do r.monad - [param (|> ..simple-frac (r.only (|>> (f.= +0.0) not))) - subject ..simple-frac] + [param (|> ..simple_frac (r.only (|>> (f.= +0.0) not))) + subject ..simple_frac] (`` ($_ _.and (~~ (template [ ] [(_.test @@ -175,30 +175,30 @@ (def: (text run) (-> Runner Test) (do {! r.monad} - [sample-size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 1)))) - sample-lower (r.ascii/lower-alpha sample-size) - sample-upper (r.ascii/upper-alpha sample-size) - sample-alpha (|> (r.ascii/alpha sample-size) - (r.only (|>> (text\= sample-upper) not))) - char-idx (|> r.nat (\ ! map (n.% sample-size))) - #let [sample-lowerS (synthesis.text sample-lower) - sample-upperS (synthesis.text sample-upper) - sample-alphaS (synthesis.text sample-alpha) - concatenatedS (#synthesis.Extension "lux text concat" (list sample-lowerS sample-upperS)) - pre-rep-once (format sample-lower sample-upper) - post-rep-once (format sample-lower sample-alpha) - pre-rep-all (|> (list.repeat sample-size sample-lower) (text.join-with sample-upper)) - post-rep-all (|> (list.repeat sample-size sample-lower) (text.join-with sample-alpha))]] + [sample_size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 1)))) + sample_lower (r.ascii/lower_alpha sample_size) + sample_upper (r.ascii/upper_alpha sample_size) + sample_alpha (|> (r.ascii/alpha sample_size) + (r.only (|>> (text\= sample_upper) not))) + char_idx (|> r.nat (\ ! map (n.% sample_size))) + #let [sample_lowerS (synthesis.text sample_lower) + sample_upperS (synthesis.text sample_upper) + sample_alphaS (synthesis.text sample_alpha) + concatenatedS (#synthesis.Extension "lux text concat" (list sample_lowerS sample_upperS)) + pre_rep_once (format sample_lower sample_upper) + post_rep_once (format sample_lower sample_alpha) + pre_rep_all (|> (list.repeat sample_size sample_lower) (text.join_with sample_upper)) + post_rep_all (|> (list.repeat sample_size sample_lower) (text.join_with sample_alpha))]] ($_ _.and (_.test "Can compare texts for equality." - (and (|> (#synthesis.Extension "lux text =" (list sample-lowerS sample-lowerS)) + (and (|> (#synthesis.Extension "lux text =" (list sample_lowerS sample_lowerS)) (run (..safe "lux text =")) (case> (#try.Success valueV) (:as Bit valueV) _ false)) - (|> (#synthesis.Extension "lux text =" (list sample-upperS sample-lowerS)) + (|> (#synthesis.Extension "lux text =" (list sample_upperS sample_lowerS)) (run (..safe "lux text =")) (case> (#try.Success valueV) (not (:as Bit valueV)) @@ -206,7 +206,7 @@ _ false)))) (_.test "Can compare texts for order." - (|> (#synthesis.Extension "lux text <" (list sample-lowerS sample-upperS)) + (|> (#synthesis.Extension "lux text <" (list sample_lowerS sample_upperS)) (run (..safe "lux text <")) (case> (#try.Success valueV) (:as Bit valueV) @@ -214,10 +214,10 @@ (#try.Failure _) false))) (_.test "Can get length of text." - (|> (#synthesis.Extension "lux text size" (list sample-lowerS)) + (|> (#synthesis.Extension "lux text size" (list sample_lowerS)) (run (..safe "lux text size")) (case> (#try.Success valueV) - (n.= sample-size (:as Nat valueV)) + (n.= sample_size (:as Nat valueV)) _ false))) @@ -225,13 +225,13 @@ (|> (#synthesis.Extension "lux text size" (list concatenatedS)) (run (..safe "lux text size")) (case> (#try.Success valueV) - (n.= (n.* 2 sample-size) (:as Nat valueV)) + (n.= (n.* 2 sample_size) (:as Nat valueV)) _ false))) (_.test "Can find index of sub-text." (and (|> (#synthesis.Extension "lux text index" - (list concatenatedS sample-lowerS + (list concatenatedS sample_lowerS (synthesis.i64 +0))) (run (..safe "lux text index")) (case> (^multi (#try.Success valueV) @@ -241,16 +241,16 @@ _ false)) (|> (#synthesis.Extension "lux text index" - (list concatenatedS sample-upperS + (list concatenatedS sample_upperS (synthesis.i64 +0))) (run (..safe "lux text index")) (case> (^multi (#try.Success valueV) {(:as (Maybe Nat) valueV) (#.Some valueV)}) - (n.= sample-size valueV) + (n.= sample_size valueV) _ false)))) - (let [test-clip (: (-> (I64 Any) (I64 Any) Text Bit) + (let [test_clip (: (-> (I64 Any) (I64 Any) Text Bit) (function (_ offset length expected) (|> (#synthesis.Extension "lux text clip" (list concatenatedS @@ -264,17 +264,17 @@ _ false))))] (_.test "Can clip text to extract sub-text." - (and (test-clip 0 sample-size sample-lower) - (test-clip sample-size sample-size sample-upper)))) + (and (test_clip 0 sample_size sample_lower) + (test_clip sample_size sample_size sample_upper)))) (_.test "Can extract individual characters from text." (|> (#synthesis.Extension "lux text char" - (list sample-lowerS - (synthesis.i64 char-idx))) + (list sample_lowerS + (synthesis.i64 char_idx))) (run (..safe "lux text char")) (case> (^multi (#try.Success valueV) {(:as (Maybe Int) valueV) (#.Some valueV)}) (text.contains? ("lux i64 char" valueV) - sample-lower) + sample_lower) _ false))) diff --git a/stdlib/source/specification/compositor/generation/function.lux b/stdlib/source/specification/compositor/generation/function.lux index 61f6d6656..5a5891088 100644 --- a/stdlib/source/specification/compositor/generation/function.lux +++ b/stdlib/source/specification/compositor/generation/function.lux @@ -24,13 +24,13 @@ [// [common (#+ Runner)]]]) -(def: max-arity +(def: max_arity Arity 10) (def: arity (Random Arity) - (|> r.nat (r\map (|>> (n.% max-arity) (n.max 1))))) + (|> r.nat (r\map (|>> (n.% max_arity) (n.max 1))))) (def: (local arity) (-> Arity (Random Register)) @@ -51,45 +51,45 @@ (-> Runner Test) (do {! r.monad} [[arity local functionS] ..function - partial-arity (|> r.nat (\ ! map (|>> (n.% arity) (n.max 1)))) - inputs (r.list arity r.safe-frac) + partial_arity (|> r.nat (\ ! map (|>> (n.% arity) (n.max 1)))) + inputs (r.list arity r.safe_frac) #let [expectation (maybe.assume (list.nth (dec local) inputs)) inputsS (list\map (|>> synthesis.f64) inputs)]] ($_ _.and (_.test "Can read arguments." (|> (synthesis.function/apply {#synthesis.function functionS #synthesis.arguments inputsS}) - (run "with-local") + (run "with_local") (//case.verify expectation))) (_.test "Can partially apply functions." (or (n.= 1 arity) - (let [preS (list.take partial-arity inputsS) - postS (list.drop partial-arity inputsS) + (let [preS (list.take partial_arity inputsS) + postS (list.drop partial_arity inputsS) partialS (synthesis.function/apply {#synthesis.function functionS #synthesis.arguments preS})] (|> (synthesis.function/apply {#synthesis.function partialS #synthesis.arguments postS}) - (run "partial-application") + (run "partial_application") (//case.verify expectation))))) (_.test "Can read environment." (or (n.= 1 arity) - (let [environment (|> partial-arity + (let [environment (|> partial_arity (enum.range n.enum 1) (list\map (|>> #reference.Local))) - variableS (if (n.<= partial-arity local) + variableS (if (n.<= partial_arity local) (synthesis.variable/foreign (dec local)) - (synthesis.variable/local (|> local (n.- partial-arity)))) - inner-arity (n.- partial-arity arity) + (synthesis.variable/local (|> local (n.- partial_arity)))) + inner_arity (n.- partial_arity arity) innerS (synthesis.function/abstraction {#synthesis.environment environment - #synthesis.arity inner-arity + #synthesis.arity inner_arity #synthesis.body variableS}) outerS (synthesis.function/abstraction {#synthesis.environment (list) - #synthesis.arity partial-arity + #synthesis.arity partial_arity #synthesis.body innerS})] (|> (synthesis.function/apply {#synthesis.function outerS #synthesis.arguments inputsS}) - (run "with-foreign") + (run "with_foreign") (//case.verify expectation))))) ))) diff --git a/stdlib/source/specification/compositor/generation/primitive.lux b/stdlib/source/specification/compositor/generation/primitive.lux index 3b6dd657b..2ddb9a02e 100644 --- a/stdlib/source/specification/compositor/generation/primitive.lux +++ b/stdlib/source/specification/compositor/generation/primitive.lux @@ -23,17 +23,17 @@ (def: (f/=' reference subject) (-> Frac Frac Bit) (or (f.= reference subject) - (and (f.not-a-number? reference) - (f.not-a-number? subject)))) + (and (f.not_a_number? reference) + (f.not_a_number? subject)))) (def: #export (spec run) (-> Runner Test) (`` ($_ _.and - (~~ (template [ ] + (~~ (template [ ] [(do r.monad [expected ] - (_.test (%.name (name-of )) - (|> (run ( expected)) + (_.test (%.name (name_of )) + (|> (run ( expected)) (case> (#try.Success actual) ( expected (:assume actual)) diff --git a/stdlib/source/specification/compositor/generation/reference.lux b/stdlib/source/specification/compositor/generation/reference.lux index 665175ab4..d5c3cfd34 100644 --- a/stdlib/source/specification/compositor/generation/reference.lux +++ b/stdlib/source/specification/compositor/generation/reference.lux @@ -21,14 +21,14 @@ (def: name (Random Name) - (let [name-part (r.ascii/upper-alpha 5)] - [(r.and name-part name-part)])) + (let [name_part (r.ascii/upper_alpha 5)] + [(r.and name_part name_part)])) (def: (definition define) (-> Definer Test) (do r.monad [name ..name - expected r.safe-frac] + expected r.safe_frac] (_.test "Definitions." (|> (define name (synthesis.f64 expected)) (case> (#try.Success actual) @@ -41,7 +41,7 @@ (-> Runner Test) (do {! r.monad} [register (|> r.nat (\ ! map (n.% 100))) - expected r.safe-frac] + expected r.safe_frac] (_.test "Local variables." (|> (synthesis.branch/let [(synthesis.f64 expected) register diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux index 355b98409..4cc4f0676 100644 --- a/stdlib/source/specification/compositor/generation/structure.lux +++ b/stdlib/source/specification/compositor/generation/structure.lux @@ -31,34 +31,34 @@ (def: (variant run) (-> Runner Test) (do {! r.monad} - [num-tags (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) - tag-in (|> r.nat (\ ! map (n.% num-tags))) - #let [last?-in (|> num-tags dec (n.= tag-in))] - value-in r.i64] - (_.test (%.name (name-of synthesis.variant)) - (|> (synthesis.variant {#analysis.lefts (if last?-in - (dec tag-in) - tag-in) - #analysis.right? last?-in - #analysis.value (synthesis.i64 value-in)}) + [num_tags (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) + tag_in (|> r.nat (\ ! map (n.% num_tags))) + #let [last?_in (|> num_tags dec (n.= tag_in))] + value_in r.i64] + (_.test (%.name (name_of synthesis.variant)) + (|> (synthesis.variant {#analysis.lefts (if last?_in + (dec tag_in) + tag_in) + #analysis.right? last?_in + #analysis.value (synthesis.i64 value_in)}) (run "variant") (case> (#try.Success valueT) (let [valueT (:as (Array Any) valueT)] (and (n.= 3 (array.size valueT)) - (let [tag-out (:as java/lang/Integer (maybe.assume (array.read 0 valueT))) - last?-out (array.read 1 valueT) - value-out (:as Any (maybe.assume (array.read 2 valueT))) - same-tag? (|> tag-out ffi.int-to-long (:as Nat) (n.= tag-in)) - same-flag? (case last?-out - (#.Some last?-out') - (and last?-in (text\= "" (:as Text last?-out'))) + (let [tag_out (:as java/lang/Integer (maybe.assume (array.read 0 valueT))) + last?_out (array.read 1 valueT) + value_out (:as Any (maybe.assume (array.read 2 valueT))) + same_tag? (|> tag_out ffi.int_to_long (:as Nat) (n.= tag_in)) + same_flag? (case last?_out + (#.Some last?_out') + (and last?_in (text\= "" (:as Text last?_out'))) #.None - (not last?-in)) - same-value? (|> value-out (:as Int) (i.= value-in))] - (and same-tag? - same-flag? - same-value?)))) + (not last?_in)) + same_value? (|> value_out (:as Int) (i.= value_in))] + (and same_tag? + same_flag? + same_value?)))) (#try.Failure _) false))))) @@ -67,16 +67,16 @@ (-> Runner Test) (do {! r.monad} [size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) - tuple-in (r.list size r.i64)] - (_.test (%.name (name-of synthesis.tuple)) - (|> (synthesis.tuple (list\map (|>> synthesis.i64) tuple-in)) + tuple_in (r.list size r.i64)] + (_.test (%.name (name_of synthesis.tuple)) + (|> (synthesis.tuple (list\map (|>> synthesis.i64) tuple_in)) (run "tuple") - (case> (#try.Success tuple-out) - (let [tuple-out (:as (Array Any) tuple-out)] - (and (n.= size (array.size tuple-out)) + (case> (#try.Success tuple_out) + (let [tuple_out (:as (Array Any) tuple_out)] + (and (n.= size (array.size tuple_out)) (list.every? (function (_ [left right]) (i.= left (:as Int right))) - (list.zipped/2 tuple-in (array.to_list tuple-out))))) + (list.zipped/2 tuple_in (array.to_list tuple_out))))) (#try.Failure _) false))))) diff --git a/stdlib/source/specification/lux/abstract/enum.lux b/stdlib/source/specification/lux/abstract/enum.lux index ddb2a80f1..6375b4829 100644 --- a/stdlib/source/specification/lux/abstract/enum.lux +++ b/stdlib/source/specification/lux/abstract/enum.lux @@ -9,10 +9,10 @@ [\\library ["." /]]) -(def: #export (spec (^open "\.") gen-sample) +(def: #export (spec (^open "\.") gen_sample) (All [a] (-> (/.Enum a) (Random a) Test)) (do random.monad - [sample gen-sample] + [sample gen_sample] (<| (_.for [/.Enum]) ($_ _.and (_.test "Successor and predecessor are inverse functions." diff --git a/stdlib/source/specification/lux/abstract/interval.lux b/stdlib/source/specification/lux/abstract/interval.lux index 5b74bc34d..c5d89aab3 100644 --- a/stdlib/source/specification/lux/abstract/interval.lux +++ b/stdlib/source/specification/lux/abstract/interval.lux @@ -10,11 +10,11 @@ [\\library ["." /]]) -(def: #export (spec (^open "@//.") gen-sample) +(def: #export (spec (^open "@//.") gen_sample) (All [a] (-> (/.Interval a) (Random a) Test)) (<| (_.for [/.Interval]) (do random.monad - [sample gen-sample] + [sample gen_sample] ($_ _.and (_.test "No value is bigger than the top." (@//< @//top sample)) diff --git a/stdlib/source/specification/lux/abstract/monoid.lux b/stdlib/source/specification/lux/abstract/monoid.lux index f8626fe74..592b98bb4 100644 --- a/stdlib/source/specification/lux/abstract/monoid.lux +++ b/stdlib/source/specification/lux/abstract/monoid.lux @@ -11,13 +11,13 @@ [// [equivalence (#+ Equivalence)]]]]) -(def: #export (spec (^open "\.") (^open "\.") gen-sample) +(def: #export (spec (^open "\.") (^open "\.") gen_sample) (All [a] (-> (Equivalence a) (/.Monoid a) (Random a) Test)) (do random.monad - [sample gen-sample - left gen-sample - mid gen-sample - right gen-sample] + [sample gen_sample + left gen_sample + mid gen_sample + right gen_sample] (<| (_.for [/.Monoid]) ($_ _.and (_.test "Left identity." diff --git a/stdlib/source/specification/lux/abstract/order.lux b/stdlib/source/specification/lux/abstract/order.lux index e620fd520..8d4844b2a 100644 --- a/stdlib/source/specification/lux/abstract/order.lux +++ b/stdlib/source/specification/lux/abstract/order.lux @@ -40,19 +40,19 @@ (@//< parameter extra)) lesser? (and (@//< extra parameter) (@//< extra subject)) - in-between? (and (@//< parameter extra) + in_between? (and (@//< parameter extra) (@//< extra subject))] (or greater? lesser? - in-between?)) + in_between?)) ## (@//< subject parameter) (let [greater? (and (@//< extra subject) (@//< extra parameter)) lesser? (and (@//< parameter extra) (@//< subject extra)) - in-between? (and (@//< subject extra) + in_between? (and (@//< subject extra) (@//< extra parameter))] (or greater? lesser? - in-between?))))) + in_between?))))) ))) diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 141573f6f..b38b61340 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -84,18 +84,18 @@ (if error? (exception.except shell.no_more_output []) (case state - (#.Cons head tail) + (#.Item head tail) (#try.Success [tail head]) - #.Nil + #.End (exception.except shell.no_more_output [])))) (def: (on_error state) (if error? (case state - (#.Cons head tail) + (#.Item head tail) (#try.Success [tail head]) - #.Nil + #.End (exception.except shell.no_more_output [])) (exception.except shell.no_more_output []))) (def: (on_write input state) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index de99ee775..bfdc93f30 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -972,6 +972,23 @@ (is? post (io.run (atom.read box))))))) )) +(def: identity/constant + (All [a] (-> a a)) + (function (_ value) + value)) + +(def: (identity/function value) + (All [a] (-> a a)) + value) + +(def: for_def: + Test + (do random.monad + [expected random.nat] + (_.cover [/.def:] + (and (is? expected (identity/constant expected)) + (is? expected (identity/function expected)))))) + (def: test Test (<| (_.covering /._) @@ -995,6 +1012,7 @@ ..for_value ..for_case ..for_control_flow + ..for_def: ..sub_tests ))) diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux index b5c39ad75..8e472db22 100644 --- a/stdlib/source/test/lux/abstract/enum.lux +++ b/stdlib/source/test/lux/abstract/enum.lux @@ -37,7 +37,7 @@ (/.range n.enum start end) (list.reverse (/.range n.enum end start))) every_element_is_a_successor? (case range - (#.Cons head tail) + (#.Item head tail) (|> (list\fold (function (_ next [verdict prev]) [(and verdict (n.= next (\ n.enum succ prev))) @@ -46,7 +46,7 @@ tail) product.left) - #.Nil + #.End false)] (and (n.= expected_size (list.size range)) expected_start? diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index 007382e60..10af6891d 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -45,10 +45,10 @@ (implementation (def: (= left right) (case [left right] - [#.Nil #.Nil] + [#.End #.End] true - [(#.Cons leftH lefT) (#.Cons rightH rightT)] + [(#.Item leftH lefT) (#.Item rightH rightT)] (and (n.= leftH rightH) (\ equivalence = lefT rightT)) diff --git a/stdlib/source/test/lux/abstract/predicate.lux b/stdlib/source/test/lux/abstract/predicate.lux index 0e902fb40..b821865de 100644 --- a/stdlib/source/test/lux/abstract/predicate.lux +++ b/stdlib/source/test/lux/abstract/predicate.lux @@ -80,10 +80,10 @@ (/.rec (function (_ recur) (function (_ values) (case values - #.Nil + #.End false - (#.Cons head tail) + (#.Item head tail) (or (even? head) (recur tail)))))))] (bit\= (list.any? even? samples) diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux index 678a8aa99..fe7773eea 100644 --- a/stdlib/source/test/lux/control/concatenative.lux +++ b/stdlib/source/test/lux/control/concatenative.lux @@ -266,12 +266,12 @@ (/.push |inc|) /.compose /.call))) - (_.cover [/.curry] + (_.cover [/.partial] (n.= (n.+ sample sample) (||> (/.push sample) (/.push sample) (/.push (/.apply/2 n.+)) - /.curry + /.partial /.call))) (_.cover [/.when] (n.= (if choice diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index 5c555ebfc..6d60c750f 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -51,15 +51,15 @@ (case amount_of_polls 0 (do async.monad [_ (async.future (\ sink close))] - (in #.Nil)) + (in #.End)) _ (do {! async.monad} [event channel] (case event #.None - (in #.Nil) + (in #.End) (#.Some [head tail]) - (\ ! map (|>> (#.Cons head)) + (\ ! map (|>> (#.Item head)) (take_amount (dec amount_of_polls) [channel sink])))))) (def: #export test diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux index 24944c49e..4103d1a1f 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -72,15 +72,15 @@ (/.Cont (List Nat) (List Nat))) (function (visit xs) (case xs - #.Nil - (_\in #.Nil) + #.End + (_\in #.End) - (#.Cons x xs') + (#.Item x xs') (do {! /.monad} [output (/.shift (function (_ k) (do ! [tail (k xs')] - (in (#.Cons x tail)))))] + (in (#.Item x tail)))))] (visit output)))))] (list\= elems (/.run (/.reset (visit elems)))))) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 382d17063..b71ab1256 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -110,7 +110,7 @@ (\ (list.equivalence n.equivalence) = expected+ actual))) (|> (list\map (|>> .int code.int) expected+) (/.run (/.some .nat)) - (match #.Nil + (match #.End #1)))) (_.cover [/.many] (and (|> (list\map code.nat expected+) diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index b8775be48..a9e977c0a 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -72,7 +72,7 @@ (def: as_list (-> /.Binary (List Nat)) (/.fold (function (_ head tail) - (#.Cons head tail)) + (#.Item head tail)) (list))) (def: #export test @@ -138,10 +138,10 @@ (and (\ /.equivalence = sample (/.drop 0 sample)) (\ /.equivalence = (/.create 0) (/.drop size sample)) (case (list.reverse (..as_list sample)) - #.Nil + #.End false - (#.Cons head tail) + (#.Item head tail) (n.= (list.fold n.+ 0 tail) (/.fold n.+ 0 (/.drop 1 sample)))))) (_.cover [/.copy] diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 207ba73d9..2374b2f21 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -238,20 +238,20 @@ [($_ _.and (_.cover [] (case [(
 sample) ( sample)]
-                                    [(#.Cons expected _) (#.Some actual)]
+                                    [(#.Item expected _) (#.Some actual)]
                                     (n.= expected actual)
 
-                                    [#.Nil #.None]
+                                    [#.End #.None]
                                     true
 
                                     _
                                     false))
                          (_.cover []
                                   (case [(
 sample) ( sample)]
-                                    [(#.Cons _ expected) (#.Some actual)]
+                                    [(#.Item _ expected) (#.Some actual)]
                                     (/\= (
 expected) actual)
 
-                                    [#.Nil #.None]
+                                    [#.End #.None]
                                     true
 
                                     _
diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux
index 3bc695aca..b394220ef 100644
--- a/stdlib/source/test/lux/data/collection/queue.lux
+++ b/stdlib/source/test/lux/data/collection/queue.lux
@@ -60,10 +60,10 @@
                             all_empty_queues_look_the_same!)))
             (_.cover [/.peek]
                      (case [members (/.peek sample)]
-                       [(#.Cons head tail) (#.Some first)]
+                       [(#.Item head tail) (#.Some first)]
                        (n.= head first)
                        
-                       [#.Nil #.None]
+                       [#.End #.None]
                        true
 
                        _
@@ -95,7 +95,7 @@
                             has_expected_order!)))
             (_.cover [/.pop]
                      (case members
-                       (#.Cons target expected)
+                       (#.Item target expected)
                        (let [popped (/.pop sample)
 
                              size_decreases!
@@ -113,7 +113,7 @@
                               popped_member_is_not_identified!
                               has_expected_order!))
                        
-                       #.Nil
+                       #.End
                        (and (/.empty? sample)
                             (/.empty? (/.pop sample)))))
             ))))
diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux
index fbbcc2414..1f52753d1 100644
--- a/stdlib/source/test/lux/target/jvm.lux
+++ b/stdlib/source/test/lux/target/jvm.lux
@@ -1030,7 +1030,7 @@
                   (..bytecode (|>> (:as Nat) (n.= sizesH)))
                   (do {! /.monad}
                     [_ (monad.map ! (|>> (:as java/lang/Long) ffi.long_to_int ..$Integer::literal)
-                                  (#.Cons sizesH sizesT))
+                                  (#.Item sizesH sizesT))
                      _ (/.multianewarray type (|> dimensions /unsigned.u1 try.assumed))
                      _ ?length]
                     $Long::wrap))))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux
index 0c1d1a712..4afc28a2d 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux
@@ -40,17 +40,17 @@
 (def: (exhaustive_weaving branchings)
   (-> (List (List Code)) (List (List Code)))
   (case branchings
-    #.Nil
-    #.Nil
+    #.End
+    #.End
 
-    (#.Cons head+ #.Nil)
+    (#.Item head+ #.End)
     (list\map (|>> list) head+)
 
-    (#.Cons head+ tail++)
+    (#.Item head+ tail++)
     (do list.monad
       [tail+ (exhaustive_weaving tail++)
        head head+]
-      (in (#.Cons head tail+)))))
+      (in (#.Item head tail+)))))
 
 (def: #export (exhaustive_branches allow_literals? variantTC inputC)
   (-> Bit (List [Code Code]) Code (Random (List Code)))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux
index b8a692f07..1cf61d839 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux
@@ -101,7 +101,7 @@
            partial_polyT1 (<| (type.function partial_poly_inputsT)
                               poly_inputT)
            partial_polyT2 (<| (type.univ_q 1)
-                              (type.function (#.Cons varT partial_poly_inputsT))
+                              (type.function (#.Item varT partial_poly_inputsT))
                               varT)
            dummy_function (#////analysis.Function (list) (#////analysis.Reference (////reference.local 1)))]]
     (<| (_.context (%.name (name_of /.apply)))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux
index 8eed2d440..e24fac097 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux
@@ -39,7 +39,7 @@
         [meta
          ["." archive]]]]]]]])
 
-(def: masking-test
+(def: masking_test
   Test
   (do {! random.monad}
     [maskedA //primitive.primitive
@@ -49,14 +49,14 @@
                    [[(#analysis.Bind temp)
                      (#analysis.Reference (////reference.local temp))]
                     (list)]])]]
-    (_.cover [/.synthesize-masking]
+    (_.cover [/.synthesize_masking]
              (|> maskA
                  (//.phase archive.empty)
                  (phase.run [///bundle.empty synthesis.init])
                  (try\map (//primitive.corresponds? maskedA))
                  (try.default false)))))
 
-(def: let-test
+(def: let_test
   Test
   (do random.monad
     [registerA random.nat
@@ -67,7 +67,7 @@
                   [[(#analysis.Bind registerA)
                     outputA]
                    (list)]])]]
-    (_.cover [/.synthesize-let]
+    (_.cover [/.synthesize_let]
              (|> letA
                  (//.phase archive.empty)
                  (phase.run [///bundle.empty synthesis.init])
@@ -79,7 +79,7 @@
                         _
                         false)))))
 
-(def: if-test
+(def: if_test
   Test
   (do random.monad
     [then|else random.bit
@@ -95,7 +95,7 @@
            ifA (if then|else
                  (analysis.control/case [inputA [thenB (list elseB)]])
                  (analysis.control/case [inputA [elseB (list thenB)]]))]]
-    (_.cover [/.synthesize-if]
+    (_.cover [/.synthesize_if]
              (|> ifA
                  (//.phase archive.empty)
                  (phase.run [///bundle.empty synthesis.init])
@@ -107,7 +107,7 @@
                         _
                         false)))))
 
-(def: random-member
+(def: random_member
   (Random synthesis.Member)
   (do {! random.monad}
     [lefts (|> random.nat (\ ! map (n.% 10)))
@@ -116,13 +116,13 @@
           (#.Right lefts)
           (#.Left lefts)))))
 
-(def: random-path
+(def: random_path
   (Random (analysis.Tuple synthesis.Member))
   (do {! random.monad}
-    [size-1 (|> random.nat (\ ! map (|>> (n.% 10) inc)))]
-    (random.list size-1 ..random-member)))
+    [size_1 (|> random.nat (\ ! map (|>> (n.% 10) inc)))]
+    (random.list size_1 ..random_member)))
 
-(def: (get-pattern path)
+(def: (get_pattern path)
   (-> (analysis.Tuple synthesis.Member)
       (Random [analysis.Pattern Register]))
   (do random.monad
@@ -142,19 +142,19 @@
                     (list.reverse path))
          @member])))
 
-(def: get-test
+(def: get_test
   Test
   (do {! random.monad}
     [recordA (|> random.nat
                  (\ ! map (|>> analysis.nat))
                  (random.list 10)
                  (\ ! map (|>> analysis.tuple)))
-     pathA ..random-path
-     [pattern @member] (get-pattern pathA)
+     pathA ..random_path
+     [pattern @member] (get_pattern pathA)
      #let [getA (analysis.control/case [recordA [[pattern
                                                   (#analysis.Reference (////reference.local @member))]
                                                  (list)]])]]
-    (_.cover [/.synthesize-get]
+    (_.cover [/.synthesize_get]
              (|> getA
                  (//.phase archive.empty)
                  (phase.run [///bundle.empty synthesis.init])
@@ -165,7 +165,7 @@
                         _
                         false)))))
 
-(def: random-bit
+(def: random_bit
   (Random [Path Match])
   (do {! random.monad}
     [test random.bit
@@ -180,9 +180,9 @@
           (list {#analysis.when (analysis.pattern/bit (not test))
                  #analysis.then (analysis.nat else)})]])))
 
-(def: (random-five hash random-element)
+(def: (random_five hash random_element)
   (All [a] (-> (Hash a) (Random a) (Random [a a a a a])))
-  (|> random-element
+  (|> random_element
       (random.set hash 5)
       (\ random.monad map (|>> set.to_list
                                (case> (^ (list s0 s1 s2 s3 s4))
@@ -195,8 +195,8 @@
   [(def: 
      (Random [Path Match])
      (do {! random.monad}
-       [[test/0 test/1 test/2 test/3 test/4] (random-five  )
-        [body/0 body/1 body/2 body/3 body/4] (random-five  )]
+       [[test/0 test/1 test/2 test/3 test/4] (random_five  )
+        [body/0 body/1 body/2 body/3 body/4] (random_five  )]
        (in [($_ #synthesis.Alt
                 (#synthesis.Seq ( test/0) (#synthesis.Then ( body/0)))
                 (#synthesis.Seq ( test/1) (#synthesis.Then ( body/1)))
@@ -209,30 +209,30 @@
                    {#analysis.when ( test/3) #analysis.then ( body/3)}
                    {#analysis.when ( test/4) #analysis.then ( body/4)})]])))]
 
-  [random-nat n.hash random.nat (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/nat analysis.nat]
-  [random-int int.hash random.int (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/int analysis.int]
-  [random-rev rev.hash random.rev (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/rev analysis.rev]
-  [random-frac frac.hash random.frac synthesis.path/f64 synthesis.f64 analysis.pattern/frac analysis.frac]
-  [random-text text.hash (random.unicode 1) synthesis.path/text synthesis.text analysis.pattern/text analysis.text]
+  [random_nat n.hash random.nat (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/nat analysis.nat]
+  [random_int int.hash random.int (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/int analysis.int]
+  [random_rev rev.hash random.rev (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/rev analysis.rev]
+  [random_frac frac.hash random.frac synthesis.path/f64 synthesis.f64 analysis.pattern/frac analysis.frac]
+  [random_text text.hash (random.unicode 1) synthesis.path/text synthesis.text analysis.pattern/text analysis.text]
   )
 
-(def: random-simple
+(def: random_simple
   ($_ random.either
-      ..random-bit
-      ..random-nat
-      ..random-int
-      ..random-rev
-      ..random-frac
-      ..random-text
+      ..random_bit
+      ..random_nat
+      ..random_int
+      ..random_rev
+      ..random_frac
+      ..random_text
       ))
 
-(def: random-variant
+(def: random_variant
   (Random [Path Match])
   (do {! random.monad}
-    [[lefts/0 lefts/1 lefts/2 lefts/3 lefts/4] (random-five n.hash random.nat)
-     [value/0 value/1 value/2 value/3 value/4] (random-five text.hash (random.unicode 1))
-     last-is-right? random.bit
-     [body/0 body/1 body/2 body/3 body/4] (random-five frac.hash random.frac)
+    [[lefts/0 lefts/1 lefts/2 lefts/3 lefts/4] (random_five n.hash random.nat)
+     [value/0 value/1 value/2 value/3 value/4] (random_five text.hash (random.unicode 1))
+     last_is_right? random.bit
+     [body/0 body/1 body/2 body/3 body/4] (random_five frac.hash random.frac)
      #let [path (: (-> Nat Bit Text Frac Path)
                    (function (_ lefts right? value body)
                      ($_ #synthesis.Seq
@@ -252,24 +252,24 @@
              (path lefts/1 false value/1 body/1)
              (path lefts/2 false value/2 body/2)
              (path lefts/3 false value/3 body/3)
-             (path lefts/4 last-is-right? value/4 body/4))
+             (path lefts/4 last_is_right? value/4 body/4))
          [(branch lefts/0 false value/0 body/0)
           (list (branch lefts/1 false value/1 body/1)
                 (branch lefts/2 false value/2 body/2)
                 (branch lefts/3 false value/3 body/3)
-                (branch lefts/4 last-is-right? value/4 body/4))]])))
+                (branch lefts/4 last_is_right? value/4 body/4))]])))
 
-(def: random-tuple
+(def: random_tuple
   (Random [Path Match])
   (do {! random.monad}
-    [mid-size (\ ! map (n.% 4) random.nat)
+    [mid_size (\ ! map (n.% 4) random.nat)
 
      value/first (random.unicode 1)
-     value/mid (random.list mid-size (random.unicode 1))
+     value/mid (random.list mid_size (random.unicode 1))
      value/last (random.unicode 1)
 
      body/first random.frac
-     body/mid (random.list mid-size random.frac)
+     body/mid (random.list mid_size random.frac)
      body/last random.frac
      #let [path (: (-> Nat Bit Text Frac Path)
                    (function (_ lefts right? value body)
@@ -299,9 +299,9 @@
                         #analysis.then (analysis.frac body)}))]]
     (in [(list\fold (function (_ left right)
                       (#synthesis.Alt left right))
-                    (path (inc mid-size) true value/last body/last)
+                    (path (inc mid_size) true value/last body/last)
                     (|> (list.zipped/2 value/mid body/mid)
-                        (#.Cons [value/first body/first])
+                        (#.Item [value/first body/first])
                         list.enumeration
                         (list\map (function (_ [lefts' [value body]])
                                     (path lefts' false value body)))
@@ -311,31 +311,31 @@
                             list.enumeration
                             (list\map (function (_ [lefts' [value body]])
                                         (branch (inc lefts') false value body))))
-                        (list (branch (inc mid-size) true value/last body/last)))]])))
+                        (list (branch (inc mid_size) true value/last body/last)))]])))
 
-(def: random-complex
+(def: random_complex
   ($_ random.either
-      ..random-variant
-      ..random-tuple
+      ..random_variant
+      ..random_tuple
       ))
 
-(def: random-case
+(def: random_case
   ($_ random.either
-      ..random-simple
-      ..random-complex
+      ..random_simple
+      ..random_complex
       ))
 
-(def: case-test
+(def: case_test
   Test
   (do {! random.monad}
-    [expected-input (\ ! map (|>> .i64 synthesis.i64) random.nat)
-     [expected-path match] ..random-case]
-    (_.cover [/.synthesize-case]
-             (|> (/.synthesize-case //.phase archive.empty expected-input match)
+    [expected_input (\ ! map (|>> .i64 synthesis.i64) random.nat)
+     [expected_path match] ..random_case]
+    (_.cover [/.synthesize_case]
+             (|> (/.synthesize_case //.phase archive.empty expected_input match)
                  (phase.run [///bundle.empty synthesis.init])
-                 (case> (^ (#try.Success (synthesis.branch/case [actual-input actual-path])))
-                        (and (\ synthesis.equivalence = expected-input actual-input)
-                             (\ synthesis.path-equivalence = expected-path actual-path))
+                 (case> (^ (#try.Success (synthesis.branch/case [actual_input actual_path])))
+                        (and (\ synthesis.equivalence = expected_input actual_input)
+                             (\ synthesis.path_equivalence = expected_path actual_path))
 
                         _
                         false)))))
@@ -345,9 +345,9 @@
   (<| (_.covering /._)
       (_.for [/.synthesize])
       ($_ _.and
-          ..masking-test
-          ..let-test
-          ..if-test
-          ..get-test
-          ..case-test
+          ..masking_test
+          ..let_test
+          ..if_test
+          ..get_test
+          ..case_test
           )))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux
index 63d9d9d20..4b9b9a9f3 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux
@@ -37,7 +37,7 @@
         [meta
          ["." archive]]]]]]]])
 
-(def: (n-function loop? arity body)
+(def: (n_function loop? arity body)
   (-> Bit Arity Synthesis Synthesis)
   (synthesis.function/abstraction
    {#synthesis.environment (list)
@@ -49,14 +49,14 @@
                         #synthesis.iteration body})
                       body)}))
 
-(def: (n-abstraction arity body)
+(def: (n_abstraction arity body)
   (-> Arity Analysis Analysis)
-  (list\fold (function (_ arity-1 body)
-               (case arity-1
+  (list\fold (function (_ arity_1 body)
+               (case arity_1
                  0 (#analysis.Function (list) body)
                  _ (#analysis.Function ($_ list\compose
                                            (list\map (|>> #variable.Foreign)
-                                                     (list.indices arity-1))
+                                                     (list.indices arity_1))
                                            (list (#variable.Local 1)))
                                        body)))
              body
@@ -78,7 +78,7 @@
 (type: Scenario
   (-> Bit (Random Circumstance)))
 
-(def: (random-unit output?)
+(def: (random_unit output?)
   Scenario
   (\ random.monad in
      [true
@@ -94,57 +94,57 @@
             ( value)
             ( value)])))]
 
-  [random-bit random.bit synthesis.bit analysis.bit]
-  [random-nat random.nat (|>> .i64 synthesis.i64) analysis.nat]
-  [random-int random.int (|>> .i64 synthesis.i64) analysis.int]
-  [random-rev random.rev (|>> .i64 synthesis.i64) analysis.rev]
-  [random-frac random.frac synthesis.f64 analysis.frac]
-  [random-text (random.unicode 1) synthesis.text analysis.text]
+  [random_bit random.bit synthesis.bit analysis.bit]
+  [random_nat random.nat (|>> .i64 synthesis.i64) analysis.nat]
+  [random_int random.int (|>> .i64 synthesis.i64) analysis.int]
+  [random_rev random.rev (|>> .i64 synthesis.i64) analysis.rev]
+  [random_frac random.frac synthesis.f64 analysis.frac]
+  [random_text (random.unicode 1) synthesis.text analysis.text]
   )
 
-(def: (random-primitive output?)
+(def: (random_primitive output?)
   Scenario
-  (random.either (random.either (..random-unit output?)
-                                (random.either (..random-bit output?)
-                                               (..random-nat output?)))
-                 (random.either (random.either (..random-int output?)
-                                               (..random-rev output?))
-                                (random.either (..random-frac output?)
-                                               (..random-text output?)))))
-
-(def: (random-variant random-value output?)
+  (random.either (random.either (..random_unit output?)
+                                (random.either (..random_bit output?)
+                                               (..random_nat output?)))
+                 (random.either (random.either (..random_int output?)
+                                               (..random_rev output?))
+                                (random.either (..random_frac output?)
+                                               (..random_text output?)))))
+
+(def: (random_variant random_value output?)
   (-> Scenario Scenario)
   (do {! random.monad}
     [lefts random.nat
      right? random.bit
-     [loop? expected-value actual-value] (random-value false)]
+     [loop? expected_value actual_value] (random_value false)]
     (in [loop?
          (synthesis.variant
           {#analysis.lefts lefts
            #analysis.right? right?
-           #analysis.value expected-value})
+           #analysis.value expected_value})
          (analysis.variant
           {#analysis.lefts lefts
            #analysis.right? right?
-           #analysis.value actual-value})])))
+           #analysis.value actual_value})])))
 
-(def: (random-tuple random-value output?)
+(def: (random_tuple random_value output?)
   (-> Scenario Scenario)
   (do {! random.monad}
-    [[loop?-left expected-left actual-left] (random-value false)
-     [loop?-right expected-right actual-right] (random-value false)]
-    (in [(and loop?-left
-              loop?-right)
-         (synthesis.tuple (list expected-left expected-right))
-         (analysis.tuple (list actual-left actual-right))])))
-
-(def: (random-structure random-value output?)
+    [[loop?_left expected_left actual_left] (random_value false)
+     [loop?_right expected_right actual_right] (random_value false)]
+    (in [(and loop?_left
+              loop?_right)
+         (synthesis.tuple (list expected_left expected_right))
+         (analysis.tuple (list actual_left actual_right))])))
+
+(def: (random_structure random_value output?)
   (-> Scenario Scenario)
   ($_ random.either
-      (..random-variant random-value output?)
-      (..random-tuple random-value output?)))
+      (..random_variant random_value output?)
+      (..random_tuple random_value output?)))
 
-(def: (random-variable arity output?)
+(def: (random_variable arity output?)
   (-> Arity Scenario)
   (do {! random.monad}
     [register (\ ! map (|>> (n.% arity) inc) random.nat)]
@@ -154,7 +154,7 @@
            (#analysis.Reference (reference.local 1))
            (#analysis.Reference (reference.foreign register)))])))
 
-(def: (random-constant output?)
+(def: (random_constant output?)
   Scenario
   (do {! random.monad}
     [module (random.unicode 1)
@@ -163,131 +163,131 @@
          (synthesis.constant [module short])
          (#analysis.Reference (reference.constant [module short]))])))
 
-(def: (random-reference arity output?)
+(def: (random_reference arity output?)
   (-> Arity Scenario)
-  (random.either (..random-variable arity output?)
-                 (..random-constant output?)))
+  (random.either (..random_variable arity output?)
+                 (..random_constant output?)))
 
-(def: (random-case arity random-value output?)
+(def: (random_case arity random_value output?)
   (-> Arity Scenario Scenario)
   (do {! random.monad}
-    [bit-test random.bit
-     i64-test random.nat
-     f64-test random.frac
-     text-test (random.unicode 1)
-     [loop?-input expected-input actual-input] (random-value false)
-     [loop?-output expected-output actual-output] (random-value output?)
+    [bit_test random.bit
+     i64_test random.nat
+     f64_test random.frac
+     text_test (random.unicode 1)
+     [loop?_input expected_input actual_input] (random_value false)
+     [loop?_output expected_output actual_output] (random_value output?)
      lefts (|> random.nat (\ ! map (n.% 10)))
      right? random.bit
      #let [side|member (if right?
                          (#.Right lefts)
                          (#.Left lefts))]]
-    (in [(and loop?-input
-              loop?-output)
-         (synthesis.branch/case [expected-input
+    (in [(and loop?_input
+              loop?_output)
+         (synthesis.branch/case [expected_input
                                  ($_ synthesis.path/alt
-                                     (synthesis.path/then expected-output)
-                                     (synthesis.path/seq (synthesis.path/bit bit-test)
-                                                         (synthesis.path/then expected-output))
-                                     (synthesis.path/seq (synthesis.path/i64 (.i64 i64-test))
-                                                         (synthesis.path/then expected-output))
-                                     (synthesis.path/seq (synthesis.path/f64 f64-test)
-                                                         (synthesis.path/then expected-output))
-                                     (synthesis.path/seq (synthesis.path/text text-test)
-                                                         (synthesis.path/then expected-output))
+                                     (synthesis.path/then expected_output)
+                                     (synthesis.path/seq (synthesis.path/bit bit_test)
+                                                         (synthesis.path/then expected_output))
+                                     (synthesis.path/seq (synthesis.path/i64 (.i64 i64_test))
+                                                         (synthesis.path/then expected_output))
+                                     (synthesis.path/seq (synthesis.path/f64 f64_test)
+                                                         (synthesis.path/then expected_output))
+                                     (synthesis.path/seq (synthesis.path/text text_test)
+                                                         (synthesis.path/then expected_output))
                                      (synthesis.path/seq (synthesis.path/bind (inc arity))
-                                                         (synthesis.path/then expected-output))
+                                                         (synthesis.path/then expected_output))
                                      ($_ synthesis.path/seq
                                          (synthesis.path/side side|member)
                                          (synthesis.path/bind (inc arity))
-                                         (synthesis.path/then expected-output))
+                                         (synthesis.path/then expected_output))
                                      (if right?
                                        ($_ synthesis.path/seq
                                            (synthesis.path/member side|member)
                                            (synthesis.path/bind (inc arity))
-                                           (synthesis.path/then expected-output)) 
+                                           (synthesis.path/then expected_output)) 
                                        ($_ synthesis.path/seq
                                            (synthesis.path/member side|member)
                                            (synthesis.path/bind (inc arity))
                                            synthesis.path/pop
-                                           (synthesis.path/then expected-output))))])
-         (#analysis.Case actual-input
+                                           (synthesis.path/then expected_output))))])
+         (#analysis.Case actual_input
                          [{#analysis.when (analysis.pattern/unit)
-                           #analysis.then actual-output}
-                          (list {#analysis.when (analysis.pattern/bit bit-test)
-                                 #analysis.then actual-output}
-                                {#analysis.when (analysis.pattern/nat (.nat i64-test))
-                                 #analysis.then actual-output}
-                                {#analysis.when (analysis.pattern/frac f64-test)
-                                 #analysis.then actual-output}
-                                {#analysis.when (analysis.pattern/text text-test)
-                                 #analysis.then actual-output}
+                           #analysis.then actual_output}
+                          (list {#analysis.when (analysis.pattern/bit bit_test)
+                                 #analysis.then actual_output}
+                                {#analysis.when (analysis.pattern/nat (.nat i64_test))
+                                 #analysis.then actual_output}
+                                {#analysis.when (analysis.pattern/frac f64_test)
+                                 #analysis.then actual_output}
+                                {#analysis.when (analysis.pattern/text text_test)
+                                 #analysis.then actual_output}
                                 {#analysis.when (#analysis.Bind 2)
-                                 #analysis.then actual-output}
+                                 #analysis.then actual_output}
                                 {#analysis.when (analysis.pattern/variant
                                                  {#analysis.lefts lefts
                                                   #analysis.right? right?
                                                   #analysis.value (#analysis.Bind 2)})
-                                 #analysis.then actual-output}
+                                 #analysis.then actual_output}
                                 {#analysis.when (analysis.pattern/tuple
                                                  (list\compose (list.repeat lefts (analysis.pattern/unit))
                                                                (if right?
                                                                  (list (analysis.pattern/unit) (#analysis.Bind 2))
                                                                  (list (#analysis.Bind 2) (analysis.pattern/unit)))))
-                                 #analysis.then actual-output})])])))
+                                 #analysis.then actual_output})])])))
 
-(def: (random-let arity random-value output?)
+(def: (random_let arity random_value output?)
   (-> Arity Scenario Scenario)
   (do {! random.monad}
-    [[loop?-input expected-input actual-input] (random-value false)
-     [loop?-output expected-output actual-output] (random-value output?)]
-    (in [(and loop?-input
-              loop?-output)
-         (synthesis.branch/let [expected-input
+    [[loop?_input expected_input actual_input] (random_value false)
+     [loop?_output expected_output actual_output] (random_value output?)]
+    (in [(and loop?_input
+              loop?_output)
+         (synthesis.branch/let [expected_input
                                 (inc arity)
-                                expected-output])
-         (#analysis.Case actual-input
+                                expected_output])
+         (#analysis.Case actual_input
                          [{#analysis.when (#analysis.Bind 2)
-                           #analysis.then actual-output}
+                           #analysis.then actual_output}
                           (list)])])))
 
-(def: (random-if random-value output?)
+(def: (random_if random_value output?)
   (-> Scenario Scenario)
   (do {! random.monad}
-    [[loop?-test expected-test actual-test] (random-value false)
-     [loop?-then expected-then actual-then] (random-value output?)
-     [loop?-else expected-else actual-else] (random-value output?)
+    [[loop?_test expected_test actual_test] (random_value false)
+     [loop?_then expected_then actual_then] (random_value output?)
+     [loop?_else expected_else actual_else] (random_value output?)
      flip? random.bit]
-    (in [(and loop?-test
-              loop?-then
-              loop?-else)
-         (synthesis.branch/if [expected-test
-                               expected-then
-                               expected-else])
+    (in [(and loop?_test
+              loop?_then
+              loop?_else)
+         (synthesis.branch/if [expected_test
+                               expected_then
+                               expected_else])
          (if flip?
-           (#analysis.Case actual-test
+           (#analysis.Case actual_test
                            [{#analysis.when (analysis.pattern/bit false)
-                             #analysis.then actual-else}
+                             #analysis.then actual_else}
                             (list {#analysis.when (analysis.pattern/bit true)
-                                   #analysis.then actual-then})])
-           (#analysis.Case actual-test
+                                   #analysis.then actual_then})])
+           (#analysis.Case actual_test
                            [{#analysis.when (analysis.pattern/bit true)
-                             #analysis.then actual-then}
+                             #analysis.then actual_then}
                             (list {#analysis.when (analysis.pattern/bit false)
-                                   #analysis.then actual-else})]))])))
+                                   #analysis.then actual_else})]))])))
 
-(def: (random-get random-value output?)
+(def: (random_get random_value output?)
   (-> Scenario Scenario)
   (do {! random.monad}
     [lefts (|> random.nat (\ ! map (n.% 10)))
      right? random.bit
-     [loop?-record expected-record actual-record] (random-value false)]
-    (in [loop?-record
+     [loop?_record expected_record actual_record] (random_value false)]
+    (in [loop?_record
          (synthesis.branch/get [(list (if right?
                                         (#.Right lefts)
                                         (#.Left lefts)))
-                                expected-record])
-         (#analysis.Case actual-record
+                                expected_record])
+         (#analysis.Case actual_record
                          [{#analysis.when (analysis.pattern/tuple
                                            (list\compose (list.repeat lefts (analysis.pattern/unit))
                                                          (if right?
@@ -296,17 +296,17 @@
                            #analysis.then (#analysis.Reference (reference.local 2))}
                           (list)])])))
 
-(def: (random-branch arity random-value output?)
+(def: (random_branch arity random_value output?)
   (-> Arity Scenario Scenario)
-  (random.either (random.either (..random-case arity random-value output?)
-                                (..random-let arity random-value output?))
-                 (random.either (..random-if random-value output?)
-                                (..random-get random-value output?))))
+  (random.either (random.either (..random_case arity random_value output?)
+                                (..random_let arity random_value output?))
+                 (random.either (..random_if random_value output?)
+                                (..random_get random_value output?))))
 
-(def: (random-recur arity random-value output?)
+(def: (random_recur arity random_value output?)
   (-> Arity Scenario Scenario)
   (do {! random.monad}
-    [resets (random.list arity (random-value false))]
+    [resets (random.list arity (random_value false))]
     (in [true
          (synthesis.loop/recur (list\map (|>> product.right product.left) resets))
          (analysis.apply [(#analysis.Reference (case arity
@@ -314,11 +314,11 @@
                                                  _ (reference.foreign 0)))
                           (list\map (|>> product.right product.right) resets)])])))
 
-(def: (random-scope arity output?)
+(def: (random_scope arity output?)
   (-> Arity Scenario)
   (do {! random.monad}
-    [resets (random.list arity (..random-variable arity output?))
-     [_ expected-output actual-output] (..random-nat output?)]
+    [resets (random.list arity (..random_variable arity output?))
+     [_ expected_output actual_output] (..random_nat output?)]
     (in [(list\fold (function (_ new old)
                       (and new old))
                     true
@@ -326,23 +326,23 @@
          (synthesis.loop/scope
           {#synthesis.start (inc arity)
            #synthesis.inits (list\map (|>> product.right product.left) resets)
-           #synthesis.iteration expected-output})
-         (analysis.apply [(..n-abstraction arity actual-output)
+           #synthesis.iteration expected_output})
+         (analysis.apply [(..n_abstraction arity actual_output)
                           (list\map (|>> product.right product.right) resets)])])))
 
-(def: (random-loop arity random-value output?)
+(def: (random_loop arity random_value output?)
   (-> Arity Scenario Scenario)
   (if output?
     ($_ random.either
-        (..random-recur arity random-value output?)
-        (..random-scope arity output?)
+        (..random_recur arity random_value output?)
+        (..random_scope arity output?)
         )
-    (..random-scope arity output?)))
+    (..random_scope arity output?)))
 
-(def: (random-abstraction' output?)
+(def: (random_abstraction' output?)
   Scenario
   (do {! random.monad}
-    [[loop?-output expected-output actual-output] (..random-nat output?)
+    [[loop?_output expected_output actual_output] (..random_nat output?)
      arity (|> random.nat (\ ! map (|>> (n.% 5) inc)))
      #let [environment ($_ list\compose
                            (list\map (|>> #variable.Foreign)
@@ -355,79 +355,79 @@
            #synthesis.body (synthesis.loop/scope
                             {#synthesis.start 1
                              #synthesis.inits (list)
-                             #synthesis.iteration expected-output})})
+                             #synthesis.iteration expected_output})})
          (#analysis.Function environment
-                             actual-output)])))
+                             actual_output)])))
 
-(def: (random-apply random-value output?)
+(def: (random_apply random_value output?)
   (-> Scenario Scenario)
   (do {! random.monad}
-    [[loop?-abstraction expected-abstraction actual-abstraction] (..random-nat output?)
+    [[loop?_abstraction expected_abstraction actual_abstraction] (..random_nat output?)
      arity (|> random.nat (\ ! map (|>> (n.% 5) inc)))
-     inputs (random.list arity (random-value false))]
+     inputs (random.list arity (random_value false))]
     (in [(list\fold (function (_ new old)
                       (and new old))
-                    loop?-abstraction
+                    loop?_abstraction
                     (list\map product.left inputs))
-         (synthesis.function/apply [expected-abstraction
+         (synthesis.function/apply [expected_abstraction
                                     (list\map (|>> product.right product.left) inputs)])
-         (analysis.apply [actual-abstraction
+         (analysis.apply [actual_abstraction
                           (list\map (|>> product.right product.right) inputs)])])))
 
-(def: (random-function random-value output?)
+(def: (random_function random_value output?)
   (-> Scenario Scenario)
   (if output?
-    (..random-apply random-value output?)
+    (..random_apply random_value output?)
     ($_ random.either
-        (..random-abstraction' output?)
-        (..random-apply random-value output?)
+        (..random_abstraction' output?)
+        (..random_apply random_value output?)
         )))
 
-(def: (random-control arity random-value output?)
+(def: (random_control arity random_value output?)
   (-> Arity Scenario Scenario)
   ($_ random.either
-      (..random-branch arity random-value output?)
-      (..random-loop arity random-value output?)
-      (..random-function random-value output?)
+      (..random_branch arity random_value output?)
+      (..random_loop arity random_value output?)
+      (..random_function random_value output?)
       ))
 
-(def: (random-extension random-value output?)
+(def: (random_extension random_value output?)
   (-> Scenario Scenario)
   (do {! random.monad}
     [name (random.unicode 1)
-     [loop?-first expected-first actual-first] (random-value false)
-     [loop?-second expected-second actual-second] (random-value false)
-     [loop?-third expected-third actual-third] (random-value false)]
-    (in [(and loop?-first
-              loop?-second
-              loop?-third)
-         (#synthesis.Extension name (list expected-first expected-second expected-third))
-         (#analysis.Extension name (list actual-first actual-second actual-third))])))
-
-(def: (random-body arity)
+     [loop?_first expected_first actual_first] (random_value false)
+     [loop?_second expected_second actual_second] (random_value false)
+     [loop?_third expected_third actual_third] (random_value false)]
+    (in [(and loop?_first
+              loop?_second
+              loop?_third)
+         (#synthesis.Extension name (list expected_first expected_second expected_third))
+         (#analysis.Extension name (list actual_first actual_second actual_third))])))
+
+(def: (random_body arity)
   (-> Arity Scenario)
-  (function (random-value output?)
+  (function (random_value output?)
     (random.rec
      (function (_ _)
        ($_ random.either
-           (..random-primitive output?)
-           (..random-structure random-value output?)
-           (..random-reference arity output?)
-           (..random-control arity random-value output?)
-           (..random-extension random-value output?))))))
+           (..random_primitive output?)
+           (..random_structure random_value output?)
+           (..random_reference arity output?)
+           (..random_control arity random_value output?)
+           (..random_extension random_value output?))))))
 
-(def: random-abstraction
+(def: random_abstraction
   (Random [Synthesis Analysis])
   (do {! random.monad}
     [arity (|> random.nat (\ ! map (|>> (n.% 5) inc)))
-     [loop? expected-body actual-body] (random-body arity true)]
-    (in [(..n-function loop? arity expected-body)
-         (..n-abstraction arity actual-body)])))
+     [loop? expected_body actual_body] (random_body arity true)]
+    (in [(..n_function loop? arity expected_body)
+         (..n_abstraction arity actual_body)])))
 
 (def: abstraction
   Test
   (do random.monad
-    [[expected input] ..random-abstraction]
+    [[expected input] ..random_abstraction]
     (_.cover [/.abstraction]
              (|> input
                  (//.phase archive.empty)
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux
index e46960793..e4ccec535 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux
@@ -44,11 +44,11 @@
 (def: #export (corresponds? analysis synthesis)
   (-> Analysis Synthesis Bit)
   (`` (case [analysis synthesis]
-        (~~ (template [   ]
+        (~~ (template [   ]
               [[(#////analysis.Primitive ( expected))
                 (#////synthesis.Primitive ( actual))]
-               (is? (|> expected )
-                    (|> actual ))]
+               (is? (|> expected )
+                    (|> actual ))]
 
               [#////analysis.Unit (:as Text) #////synthesis.Text (|>)]
               [#////analysis.Bit  (|>) #////synthesis.Bit (|>)]
@@ -72,12 +72,12 @@
 
 (def: #export test
   Test
-  (<| (_.context (%.name (name-of #////synthesis.Primitive)))
+  (<| (_.context (%.name (name_of #////synthesis.Primitive)))
       (`` ($_ _.and
               (~~ (template [  ]
                     [(do r.monad
                        [expected ]
-                       (_.test (%.name (name-of ))
+                       (_.test (%.name (name_of ))
                                (|> (#////analysis.Primitive ( expected))
                                    (//.phase archive.empty)
                                    (phase.run [///bundle.empty ////synthesis.init])
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux
index af665dd7a..36d59cfd9 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux
@@ -74,7 +74,7 @@
 
 (def: #export test
   Test
-  (<| (_.context (%.name (name-of #////synthesis.Structure)))
+  (<| (_.context (%.name (name_of #////synthesis.Structure)))
       ($_ _.and
           ..variant
           ..tuple
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
index 8fa9ad158..e9f9268ac 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
@@ -49,42 +49,42 @@
        (in [( value)
             ( value)])))]
 
-  [bit-scenario synthesis.bit random.bit]
-  [i64-scenario synthesis.i64 (\ ! map .i64 random.nat)]
-  [f64-scenario synthesis.f64 random.frac]
-  [text-scenario synthesis.text (random.unicode 1)]
+  [bit_scenario synthesis.bit random.bit]
+  [i64_scenario synthesis.i64 (\ ! map .i64 random.nat)]
+  [f64_scenario synthesis.f64 random.frac]
+  [text_scenario synthesis.text (random.unicode 1)]
   )
 
-(def: (primitive-scenario context)
+(def: (primitive_scenario context)
   (Scenario Synthesis)
-  (random.either (random.either (..bit-scenario context)
-                                (..i64-scenario context))
-                 (random.either (..f64-scenario context)
-                                (..text-scenario context))))
+  (random.either (random.either (..bit_scenario context)
+                                (..i64_scenario context))
+                 (random.either (..f64_scenario context)
+                                (..text_scenario context))))
 
-(def: (with-redundancy scenario context)
+(def: (with_redundancy scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   (do {! random.monad}
     [redundant? random.bit]
     (if redundant?
       (do !
         [let? random.bit
-         [expected-input actual-input] (..primitive-scenario context)
-         #let [fake-register (n.+ (get@ #redundants context)
+         [expected_input actual_input] (..primitive_scenario context)
+         #let [fake_register (n.+ (get@ #redundants context)
                                   (dictionary.size (get@ #necessary context)))]
-         [expected-output actual-output] (scenario (update@ #redundants inc context))]
-        (in [(synthesis.branch/case [expected-input
+         [expected_output actual_output] (scenario (update@ #redundants inc context))]
+        (in [(synthesis.branch/case [expected_input
                                      (#synthesis.Seq #synthesis.Pop
-                                                     (#synthesis.Then expected-output))])
+                                                     (#synthesis.Then expected_output))])
              (if let?
-               (synthesis.branch/let [actual-input fake-register actual-output])
-               (synthesis.branch/case [actual-input
-                                       (#synthesis.Seq (#synthesis.Bind fake-register)
+               (synthesis.branch/let [actual_input fake_register actual_output])
+               (synthesis.branch/case [actual_input
+                                       (#synthesis.Seq (#synthesis.Bind fake_register)
                                                        (#synthesis.Seq #synthesis.Pop
-                                                                       (#synthesis.Then actual-output)))]))]))
+                                                                       (#synthesis.Then actual_output)))]))]))
       (scenario context))))
 
-(def: (variant-scenario scenario context)
+(def: (variant_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   (do {! random.monad}
     [lefts random.nat
@@ -93,45 +93,45 @@
     (in [(synthesis.variant [lefts right? expected])
          (synthesis.variant [lefts right? input])])))
 
-(def: (tuple-scenario context)
+(def: (tuple_scenario context)
   (Scenario Synthesis)
   (let [registers (dictionary.entries (get@ #necessary context))]
     (\ random.monad in
        [(synthesis.tuple (list\map (|>> product.left synthesis.variable/local) registers))
         (synthesis.tuple (list\map (|>> product.right synthesis.variable/local) registers))])))
 
-(def: (structure-scenario context)
+(def: (structure_scenario context)
   (Scenario Synthesis)
-  (random.either (..variant-scenario (..with-redundancy ..tuple-scenario) context)
-                 (..tuple-scenario context)))
+  (random.either (..variant_scenario (..with_redundancy ..tuple_scenario) context)
+                 (..tuple_scenario context)))
 
-(def: (let-scenario scenario context)
+(def: (let_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   (do random.monad
     [_ (in [])
-     [expected-input actual-input] (scenario context)
-     #let [real-register (dictionary.size (get@ #necessary context))
-           fake-register (n.+ (get@ #redundants context)
+     [expected_input actual_input] (scenario context)
+     #let [real_register (dictionary.size (get@ #necessary context))
+           fake_register (n.+ (get@ #redundants context)
                               (dictionary.size (get@ #necessary context)))]
-     [expected-output actual-output] (scenario (update@ #necessary (dictionary.put real-register fake-register) context))]
-    (in [(synthesis.branch/let [expected-input real-register expected-output])
-         (synthesis.branch/let [actual-input fake-register actual-output])])))
+     [expected_output actual_output] (scenario (update@ #necessary (dictionary.put real_register fake_register) context))]
+    (in [(synthesis.branch/let [expected_input real_register expected_output])
+         (synthesis.branch/let [actual_input fake_register actual_output])])))
 
-(def: (if-scenario scenario context)
+(def: (if_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   (do random.monad
     [_ (in [])
-     [expected-test actual-test] (scenario context)
-     [expected-then actual-then] (scenario context)
-     [expected-else actual-else] (scenario context)]
-    (in [(synthesis.branch/if [expected-test
-                               expected-then
-                               expected-else])
-         (synthesis.branch/if [actual-test
-                               actual-then
-                               actual-else])])))
+     [expected_test actual_test] (scenario context)
+     [expected_then actual_then] (scenario context)
+     [expected_else actual_else] (scenario context)]
+    (in [(synthesis.branch/if [expected_test
+                               expected_then
+                               expected_else])
+         (synthesis.branch/if [actual_test
+                               actual_then
+                               actual_else])])))
 
-(def: random-member
+(def: random_member
   (Random Member)
   (do random.monad
     [lefts random.nat
@@ -140,51 +140,51 @@
           (#.Right lefts)
           (#.Left lefts)))))
 
-(def: (get-scenario scenario context)
+(def: (get_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   (do {! random.monad}
     [length (\ ! map (|>> (n.% 5) inc) random.nat)
-     path (random.list length ..random-member)
-     [expected-record actual-record] (scenario context)]
-    (in [(synthesis.branch/get [path expected-record])
-         (synthesis.branch/get [path actual-record])])))
+     path (random.list length ..random_member)
+     [expected_record actual_record] (scenario context)]
+    (in [(synthesis.branch/get [path expected_record])
+         (synthesis.branch/get [path actual_record])])))
 
-(def: random-side
+(def: random_side
   (Random Side)
-  ..random-member)
+  ..random_member)
 
-(def: (path-scenario scenario context)
+(def: (path_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Path))
   (`` ($_ random.either
           ($_ random.either
               (do {! random.monad}
                 [_ (in [])
-                 [expected-then actual-then] (scenario context)]
+                 [expected_then actual_then] (scenario context)]
                 (in [(#synthesis.Seq #synthesis.Pop
-                                     (#synthesis.Then expected-then))
+                                     (#synthesis.Then expected_then))
                      (#synthesis.Seq #synthesis.Pop
-                                     (#synthesis.Then actual-then))]))
+                                     (#synthesis.Then actual_then))]))
               (do {! random.monad}
                 [_ (in [])
-                 #let [real-register (dictionary.size (get@ #necessary context))
-                       fake-register (n.+ (get@ #redundants context)
+                 #let [real_register (dictionary.size (get@ #necessary context))
+                       fake_register (n.+ (get@ #redundants context)
                                           (dictionary.size (get@ #necessary context)))]
-                 [expected-then actual-then] (scenario (update@ #necessary (dictionary.put real-register fake-register) context))]
-                (in [(#synthesis.Seq (#synthesis.Bind real-register)
+                 [expected_then actual_then] (scenario (update@ #necessary (dictionary.put real_register fake_register) context))]
+                (in [(#synthesis.Seq (#synthesis.Bind real_register)
                                      (#synthesis.Seq #synthesis.Pop
-                                                     (#synthesis.Then expected-then)))
-                     (#synthesis.Seq (#synthesis.Bind fake-register)
+                                                     (#synthesis.Then expected_then)))
+                     (#synthesis.Seq (#synthesis.Bind fake_register)
                                      (#synthesis.Seq #synthesis.Pop
-                                                     (#synthesis.Then actual-then)))])))
+                                                     (#synthesis.Then actual_then)))])))
           ($_ random.either
               (~~ (template [ ]
                     [(do {! random.monad}
                        [test 
-                        [expected-then actual-then] (scenario context)]
+                        [expected_then actual_then] (scenario context)]
                        (in [(#synthesis.Seq (#synthesis.Test ( test))
-                                            (#synthesis.Then expected-then))
+                                            (#synthesis.Then expected_then))
                             (#synthesis.Seq (#synthesis.Test ( test))
-                                            (#synthesis.Then actual-then))]))]
+                                            (#synthesis.Then actual_then))]))]
 
                     [#synthesis.Bit random.bit]
                     [#synthesis.I64 (\ ! map .i64 random.nat)]
@@ -193,127 +193,127 @@
                     )))
           ($_ random.either
               (do {! random.monad}
-                [side ..random-side
-                 [expected-next actual-next] (path-scenario scenario context)]
+                [side ..random_side
+                 [expected_next actual_next] (path_scenario scenario context)]
                 (in [(#synthesis.Seq (#synthesis.Access (#synthesis.Side side))
-                                     expected-next)
+                                     expected_next)
                      (#synthesis.Seq (#synthesis.Access (#synthesis.Side side))
-                                     actual-next)]))
+                                     actual_next)]))
               (do {! random.monad}
-                [member ..random-member
-                 [expected-next actual-next] (path-scenario scenario context)]
+                [member ..random_member
+                 [expected_next actual_next] (path_scenario scenario context)]
                 (in [(#synthesis.Seq (#synthesis.Access (#synthesis.Member member))
-                                     expected-next)
+                                     expected_next)
                      (#synthesis.Seq (#synthesis.Access (#synthesis.Member member))
-                                     actual-next)])))
+                                     actual_next)])))
           (do {! random.monad}
             [_ (in [])
-             [expected-left actual-left] (path-scenario scenario context)
-             [expected-right actual-right] (path-scenario scenario context)]
-            (in [(#synthesis.Alt expected-left expected-right)
-                 (#synthesis.Alt actual-left actual-right)]))
+             [expected_left actual_left] (path_scenario scenario context)
+             [expected_right actual_right] (path_scenario scenario context)]
+            (in [(#synthesis.Alt expected_left expected_right)
+                 (#synthesis.Alt actual_left actual_right)]))
           )))
 
-(def: (case-scenario scenario context)
+(def: (case_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   (do {! random.monad}
     [_ (in [])
-     [expected-input actual-input] (scenario context)
-     [expected-path actual-path] (..path-scenario scenario context)]
-    (in [(synthesis.branch/case [expected-input expected-path])
-         (synthesis.branch/case [actual-input actual-path])])))
+     [expected_input actual_input] (scenario context)
+     [expected_path actual_path] (..path_scenario scenario context)]
+    (in [(synthesis.branch/case [expected_input expected_path])
+         (synthesis.branch/case [actual_input actual_path])])))
 
-(def: (branch-scenario scenario context)
+(def: (branch_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   ($_ random.either
-      (..let-scenario scenario context)
-      (..if-scenario scenario context)
-      (..get-scenario scenario context)
-      (..case-scenario scenario context)
+      (..let_scenario scenario context)
+      (..if_scenario scenario context)
+      (..get_scenario scenario context)
+      (..case_scenario scenario context)
       ))
 
-(def: scope-arity 5)
+(def: scope_arity 5)
 
-(def: (scope-scenario scenario context)
+(def: (scope_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   (do {! random.monad}
     [_ (in [])
-     #let [real-start (dictionary.size (get@ #necessary context))
-           fake-start (n.+ (get@ #redundants context)
-                           real-start)]
-     inits (random.list ..scope-arity (scenario context))
-     [expected-iteration actual-iteration] (scenario (update@ #necessary
+     #let [real_start (dictionary.size (get@ #necessary context))
+           fake_start (n.+ (get@ #redundants context)
+                           real_start)]
+     inits (random.list ..scope_arity (scenario context))
+     [expected_iteration actual_iteration] (scenario (update@ #necessary
                                                               (function (_ necessary)
                                                                 (list\fold (function (_ [idx _] context)
-                                                                             (dictionary.put (n.+ real-start idx)
-                                                                                             (n.+ fake-start idx)
+                                                                             (dictionary.put (n.+ real_start idx)
+                                                                                             (n.+ fake_start idx)
                                                                                              context))
                                                                            necessary
                                                                            (list.enumeration inits)))
                                                               context))]
-    (in [(synthesis.loop/scope [real-start (list\map product.left inits) expected-iteration])
-         (synthesis.loop/scope [fake-start (list\map product.right inits) actual-iteration])])))
+    (in [(synthesis.loop/scope [real_start (list\map product.left inits) expected_iteration])
+         (synthesis.loop/scope [fake_start (list\map product.right inits) actual_iteration])])))
 
-(def: (recur-scenario scenario context)
+(def: (recur_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   (do {! random.monad}
     [_ (in [])
-     resets (random.list ..scope-arity (scenario context))]
+     resets (random.list ..scope_arity (scenario context))]
     (in [(synthesis.loop/recur (list\map product.left resets))
          (synthesis.loop/recur (list\map product.right resets))])))
 
-(def: (loop-scenario scenario context)
+(def: (loop_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   ($_ random.either
-      (..scope-scenario scenario context)
-      (..recur-scenario scenario context)
+      (..scope_scenario scenario context)
+      (..recur_scenario scenario context)
       ))
 
-(def: (abstraction-scenario scenario context)
+(def: (abstraction_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   (do {! random.monad}
     [_ (in [])
      #let [registers (dictionary.entries (get@ #necessary context))
-           expected-environment (list\map (|>> product.left #variable.Local) registers)
-           actual-environment (list\map (|>> product.right #variable.Local) registers)]
-     [expected-body actual-body] (..primitive-scenario context)]
-    (in [(synthesis.function/abstraction [expected-environment 1 expected-body])
-         (synthesis.function/abstraction [actual-environment 1 actual-body])])))
+           expected_environment (list\map (|>> product.left #variable.Local) registers)
+           actual_environment (list\map (|>> product.right #variable.Local) registers)]
+     [expected_body actual_body] (..primitive_scenario context)]
+    (in [(synthesis.function/abstraction [expected_environment 1 expected_body])
+         (synthesis.function/abstraction [actual_environment 1 actual_body])])))
 
-(def: (apply-scenario scenario context)
+(def: (apply_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   (do {! random.monad}
     [abstraction (\ ! map (|>> synthesis.constant)
                     (random.and (random.unicode 1)
                                 (random.unicode 1)))
-     inputs (random.list ..scope-arity (scenario context))]
+     inputs (random.list ..scope_arity (scenario context))]
     (in [(synthesis.function/apply [abstraction (list\map product.left inputs)])
          (synthesis.function/apply [abstraction (list\map product.right inputs)])])))
 
-(def: (function-scenario scenario context)
+(def: (function_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   ($_ random.either
-      (..abstraction-scenario scenario context)
-      (..apply-scenario scenario context)
+      (..abstraction_scenario scenario context)
+      (..apply_scenario scenario context)
       ))
 
-(def: (control-scenario scenario context)
+(def: (control_scenario scenario context)
   (-> (Scenario Synthesis) (Scenario Synthesis))
   ($_ random.either
-      (..branch-scenario scenario context)
-      (..loop-scenario scenario context)
-      (..function-scenario scenario context)
+      (..branch_scenario scenario context)
+      (..loop_scenario scenario context)
+      (..function_scenario scenario context)
       ))
 
 (def: (scenario context)
   (Scenario Synthesis)
   ($_ random.either
-      (..primitive-scenario context)
-      (..structure-scenario context)
-      (..control-scenario (..with-redundancy
-                           (..control-scenario
-                            (..with-redundancy
-                             ..structure-scenario)))
+      (..primitive_scenario context)
+      (..structure_scenario context)
+      (..control_scenario (..with_redundancy
+                            (..control_scenario
+                             (..with_redundancy
+                               ..structure_scenario)))
                           context)
       ))
 
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux
index 4e4968462..48f1f9817 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux
@@ -24,15 +24,15 @@
   [\\
    ["." /]])
 
-(def: name-part^
+(def: name_part^
   (Random Text)
   (do {! r.monad}
     [size (|> r.nat (\ ! map (|>> (n.% 20) (n.max 1))))]
-    (r.ascii/lower-alpha size)))
+    (r.ascii/lower_alpha size)))
 
 (def: name^
   (Random Name)
-  (r.and name-part^ name-part^))
+  (r.and name_part^ name_part^))
 
 (def: code^
   (Random Code)
@@ -42,12 +42,12 @@
                         (|> r.nat (r\map code.nat))
                         (|> r.int (r\map code.int))
                         (|> r.rev (r\map code.rev))
-                        (|> r.safe-frac (r\map code.frac))))
+                        (|> r.safe_frac (r\map code.frac))))
         textual^ (: (Random Code)
                     ($_ r.either
                         (do r.monad
                           [size (|> r.nat (r\map (n.% 20)))]
-                          (|> (r.ascii/upper-alpha size) (r\map code.text)))
+                          (|> (r.ascii/upper_alpha size) (r\map code.text)))
                         (|> name^ (r\map code.identifier))
                         (|> name^ (r\map code.tag))))
         simple^ (: (Random Code)
@@ -77,9 +77,9 @@
     [sample code^]
     ($_ _.and
         (_.test "Can parse Lux code."
-                (case (let [source-code (%.code sample)]
-                        (/.parse "" (dictionary.new text.hash) (text.size source-code)
-                                 [location.dummy 0 source-code]))
+                (case (let [source_code (%.code sample)]
+                        (/.parse "" (dictionary.new text.hash) (text.size source_code)
+                                 [location.dummy 0 source_code]))
                   (#.Left error)
                   false
 
@@ -88,15 +88,15 @@
         (do !
           [other code^]
           (_.test "Can parse multiple Lux code nodes."
-                  (let [source-code (format (%.code sample) " " (%.code other))
-                        source-code//size (text.size source-code)]
-                    (case (/.parse "" (dictionary.new text.hash) source-code//size
-                                   [location.dummy 0 source-code])
+                  (let [source_code (format (%.code sample) " " (%.code other))
+                        source_code//size (text.size source_code)]
+                    (case (/.parse "" (dictionary.new text.hash) source_code//size
+                                   [location.dummy 0 source_code])
                       (#.Left error)
                       false
 
                       (#.Right [remaining =sample])
-                      (case (/.parse "" (dictionary.new text.hash) source-code//size
+                      (case (/.parse "" (dictionary.new text.hash) source_code//size
                                      remaining)
                         (#.Left error)
                         false
@@ -106,18 +106,18 @@
                              (\ code.equivalence = other =other)))))))
         )))
 
-(def: comment-text^
+(def: comment_text^
   (Random Text)
-  (let [char-gen (|> r.nat (r.only (|>> (n.= (`` (char (~~ (static text.new-line))))) not)))]
+  (let [char_gen (|> r.nat (r.only (|>> (n.= (`` (char (~~ (static text.new_line))))) not)))]
     (do r.monad
       [size (|> r.nat (r\map (n.% 20)))]
-      (r.text char-gen size))))
+      (r.text char_gen size))))
 
 (def: comment^
   (Random Text)
   (do r.monad
-    [comment comment-text^]
-    (in (format "## " comment text.new-line))))
+    [comment comment_text^]
+    (in (format "## " comment text.new_line))))
 
 (def: comments
   Test
@@ -126,10 +126,10 @@
      comment comment^]
     ($_ _.and
         (_.test "Can handle comments."
-                (case (let [source-code (format comment (%.code sample))
-                            source-code//size (text.size source-code)]
-                        (/.parse "" (dictionary.new text.hash) source-code//size
-                                 [location.dummy 0 source-code]))
+                (case (let [source_code (format comment (%.code sample))
+                            source_code//size (text.size source_code)]
+                        (/.parse "" (dictionary.new text.hash) source_code//size
+                                 [location.dummy 0 source_code]))
                   (#.Left error)
                   false
 
@@ -139,7 +139,7 @@
 
 (def: #export test
   Test
-  (<| (_.context (name.module (name-of /._)))
+  (<| (_.context (name.module (name_of /._)))
       ($_ _.and
           ..code
           ..comments
-- 
cgit v1.2.3