aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--documentation/book/the_lux_programming_language/chapter_4.md2
-rw-r--r--documentation/book/the_lux_programming_language/chapter_5.md374
-rw-r--r--stdlib/source/library/lux.lux42
-rw-r--r--stdlib/source/library/lux/control/concatenative.lux8
-rw-r--r--stdlib/source/library/lux/control/concurrency/actor.lux6
-rw-r--r--stdlib/source/library/lux/control/exception.lux4
-rw-r--r--stdlib/source/library/lux/control/parser.lux2
-rw-r--r--stdlib/source/library/lux/control/state.lux10
-rw-r--r--stdlib/source/library/lux/control/try.lux8
-rw-r--r--stdlib/source/library/lux/data/binary.lux60
-rw-r--r--stdlib/source/library/lux/data/collection/array.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/bits.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary.lux144
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/ordered.lux230
-rw-r--r--stdlib/source/library/lux/data/collection/list.lux43
-rw-r--r--stdlib/source/library/lux/data/collection/queue.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/row.lux26
-rw-r--r--stdlib/source/library/lux/data/collection/sequence.lux1
-rw-r--r--stdlib/source/library/lux/data/collection/set.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/set/multi.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/stack.lux3
-rw-r--r--stdlib/source/library/lux/data/collection/tree.lux16
-rw-r--r--stdlib/source/library/lux/data/color.lux4
-rw-r--r--stdlib/source/library/lux/data/color/named.lux31
-rw-r--r--stdlib/source/library/lux/data/format/binary.lux8
-rw-r--r--stdlib/source/library/lux/data/format/css.lux6
-rw-r--r--stdlib/source/library/lux/data/format/css/value.lux10
-rw-r--r--stdlib/source/library/lux/data/format/html.lux6
-rw-r--r--stdlib/source/library/lux/data/format/json.lux58
-rw-r--r--stdlib/source/library/lux/data/lazy.lux19
-rw-r--r--stdlib/source/library/lux/data/maybe.lux10
-rw-r--r--stdlib/source/library/lux/data/text.lux8
-rw-r--r--stdlib/source/library/lux/data/text/regex.lux4
-rw-r--r--stdlib/source/library/lux/data/text/unicode/block.lux2
-rw-r--r--stdlib/source/library/lux/debug.lux2
-rw-r--r--stdlib/source/library/lux/ffi.js.lux12
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux52
-rw-r--r--stdlib/source/library/lux/ffi.lua.lux14
-rw-r--r--stdlib/source/library/lux/ffi.old.lux36
-rw-r--r--stdlib/source/library/lux/ffi.php.lux20
-rw-r--r--stdlib/source/library/lux/ffi.py.lux12
-rw-r--r--stdlib/source/library/lux/ffi.rb.lux20
-rw-r--r--stdlib/source/library/lux/ffi.scm.lux4
-rw-r--r--stdlib/source/library/lux/locale.lux4
-rw-r--r--stdlib/source/library/lux/macro/syntax.lux2
-rw-r--r--stdlib/source/library/lux/math/number/complex.lux3
-rw-r--r--stdlib/source/library/lux/math/number/frac.lux12
-rw-r--r--stdlib/source/library/lux/math/number/i64.lux30
-rw-r--r--stdlib/source/library/lux/math/number/int.lux8
-rw-r--r--stdlib/source/library/lux/math/number/ratio.lux3
-rw-r--r--stdlib/source/library/lux/math/number/rev.lux8
-rw-r--r--stdlib/source/library/lux/math/random.lux20
-rw-r--r--stdlib/source/library/lux/meta.lux14
-rw-r--r--stdlib/source/library/lux/meta/annotation.lux16
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/constant/pool.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/encoding/signed.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type/alias.lux6
-rw-r--r--stdlib/source/library/lux/target/jvm/type/lux.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type/parser.lux6
-rw-r--r--stdlib/source/library/lux/target/r.lux2
-rw-r--r--stdlib/source/library/lux/test.lux2
-rw-r--r--stdlib/source/library/lux/time/duration.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux24
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux24
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux12
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux28
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux48
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/phase.lux2
-rw-r--r--stdlib/source/library/lux/type.lux28
-rw-r--r--stdlib/source/library/lux/type/abstract.lux2
-rw-r--r--stdlib/source/library/lux/type/check.lux2
-rw-r--r--stdlib/source/library/lux/type/implicit.lux2
-rw-r--r--stdlib/source/library/lux/type/unit.lux4
-rw-r--r--stdlib/source/library/lux/world/file.lux10
-rw-r--r--stdlib/source/library/lux/world/file/watch.lux2
-rw-r--r--stdlib/source/library/lux/world/net/http/client.lux4
-rw-r--r--stdlib/source/library/lux/world/net/http/request.lux4
-rw-r--r--stdlib/source/library/lux/world/program.lux6
-rw-r--r--stdlib/source/poly/lux/data/format/json.lux8
-rw-r--r--stdlib/source/program/aedifex/artifact/versioning.lux6
-rw-r--r--stdlib/source/program/aedifex/command/auto.lux2
-rw-r--r--stdlib/source/program/aedifex/command/build.lux4
-rw-r--r--stdlib/source/program/aedifex/dependency/resolution.lux6
-rw-r--r--stdlib/source/program/aedifex/metadata/snapshot.lux6
-rw-r--r--stdlib/source/program/aedifex/parser.lux44
-rw-r--r--stdlib/source/program/aedifex/pom.lux14
-rw-r--r--stdlib/source/program/scriptum.lux14
-rw-r--r--stdlib/source/specification/compositor/generation/common.lux8
-rw-r--r--stdlib/source/specification/lux/world/file.lux16
-rw-r--r--stdlib/source/specification/lux/world/shell.lux4
-rw-r--r--stdlib/source/test/aedifex/artifact/snapshot.lux2
-rw-r--r--stdlib/source/test/aedifex/artifact/snapshot/build.lux2
-rw-r--r--stdlib/source/test/aedifex/artifact/snapshot/stamp.lux2
-rw-r--r--stdlib/source/test/aedifex/artifact/snapshot/time.lux2
-rw-r--r--stdlib/source/test/aedifex/artifact/snapshot/version.lux2
-rw-r--r--stdlib/source/test/aedifex/artifact/time.lux4
-rw-r--r--stdlib/source/test/aedifex/artifact/time/date.lux4
-rw-r--r--stdlib/source/test/aedifex/artifact/time/time.lux2
-rw-r--r--stdlib/source/test/aedifex/artifact/versioning.lux4
-rw-r--r--stdlib/source/test/aedifex/cache.lux6
-rw-r--r--stdlib/source/test/aedifex/command/auto.lux2
-rw-r--r--stdlib/source/test/aedifex/command/build.lux6
-rw-r--r--stdlib/source/test/aedifex/command/clean.lux2
-rw-r--r--stdlib/source/test/aedifex/command/deploy.lux2
-rw-r--r--stdlib/source/test/aedifex/command/deps.lux2
-rw-r--r--stdlib/source/test/aedifex/command/install.lux4
-rw-r--r--stdlib/source/test/aedifex/command/pom.lux2
-rw-r--r--stdlib/source/test/aedifex/command/test.lux4
-rw-r--r--stdlib/source/test/aedifex/command/version.lux2
-rw-r--r--stdlib/source/test/aedifex/dependency/deployment.lux8
-rw-r--r--stdlib/source/test/aedifex/input.lux2
-rw-r--r--stdlib/source/test/aedifex/metadata/artifact.lux4
-rw-r--r--stdlib/source/test/aedifex/metadata/snapshot.lux2
-rw-r--r--stdlib/source/test/aedifex/package.lux2
-rw-r--r--stdlib/source/test/aedifex/project.lux6
-rw-r--r--stdlib/source/test/aedifex/repository/local.lux2
-rw-r--r--stdlib/source/test/aedifex/repository/remote.lux8
-rw-r--r--stdlib/source/test/aedifex/runtime.lux2
-rw-r--r--stdlib/source/test/lux.lux21
-rw-r--r--stdlib/source/test/lux/abstract/enum.lux4
-rw-r--r--stdlib/source/test/lux/control/concurrency/async.lux4
-rw-r--r--stdlib/source/test/lux/control/concurrency/semaphore.lux4
-rw-r--r--stdlib/source/test/lux/control/function/memo.lux2
-rw-r--r--stdlib/source/test/lux/control/parser.lux8
-rw-r--r--stdlib/source/test/lux/control/parser/environment.lux4
-rw-r--r--stdlib/source/test/lux/control/parser/text.lux2
-rw-r--r--stdlib/source/test/lux/control/state.lux4
-rw-r--r--stdlib/source/test/lux/control/try.lux6
-rw-r--r--stdlib/source/test/lux/data/binary.lux4
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary.lux2
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary/ordered.lux2
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary/plist.lux4
-rw-r--r--stdlib/source/test/lux/data/collection/queue/priority.lux4
-rw-r--r--stdlib/source/test/lux/data/collection/row.lux4
-rw-r--r--stdlib/source/test/lux/data/collection/tree.lux24
-rw-r--r--stdlib/source/test/lux/data/collection/tree/finger.lux8
-rw-r--r--stdlib/source/test/lux/data/collection/tree/zipper.lux40
-rw-r--r--stdlib/source/test/lux/data/format/json.lux12
-rw-r--r--stdlib/source/test/lux/data/format/tar.lux14
-rw-r--r--stdlib/source/test/lux/data/lazy.lux20
-rw-r--r--stdlib/source/test/lux/data/maybe.lux10
-rw-r--r--stdlib/source/test/lux/data/text.lux48
-rw-r--r--stdlib/source/test/lux/debug.lux14
-rw-r--r--stdlib/source/test/lux/ffi.jvm.lux63
-rw-r--r--stdlib/source/test/lux/macro.lux6
-rw-r--r--stdlib/source/test/lux/macro/syntax/type/variable.lux2
-rw-r--r--stdlib/source/test/lux/math/modular.lux2
-rw-r--r--stdlib/source/test/lux/math/number/frac.lux2
-rw-r--r--stdlib/source/test/lux/math/number/i64.lux48
-rw-r--r--stdlib/source/test/lux/math/number/int.lux14
-rw-r--r--stdlib/source/test/lux/math/number/ratio.lux4
-rw-r--r--stdlib/source/test/lux/math/number/rev.lux2
-rw-r--r--stdlib/source/test/lux/meta.lux40
-rw-r--r--stdlib/source/test/lux/meta/annotation.lux6
-rw-r--r--stdlib/source/test/lux/time.lux6
-rw-r--r--stdlib/source/test/lux/time/date.lux4
-rw-r--r--stdlib/source/test/lux/time/month.lux2
-rw-r--r--stdlib/source/test/lux/type.lux2
-rw-r--r--stdlib/source/test/lux/type/check.lux8
-rw-r--r--stdlib/source/test/lux/type/refinement.lux8
-rw-r--r--stdlib/source/test/lux/world/console.lux2
-rw-r--r--stdlib/source/test/lux/world/file/watch.lux2
-rw-r--r--stdlib/source/test/lux/world/net/http/client.lux2
-rw-r--r--stdlib/source/test/lux/world/program.lux2
-rw-r--r--stdlib/source/test/lux/world/shell.lux2
190 files changed, 1502 insertions, 1025 deletions
diff --git a/documentation/book/the_lux_programming_language/chapter_4.md b/documentation/book/the_lux_programming_language/chapter_4.md
index 8af46ccfc..088e531f6 100644
--- a/documentation/book/the_lux_programming_language/chapter_4.md
+++ b/documentation/book/the_lux_programming_language/chapter_4.md
@@ -171,5 +171,5 @@ We've also seen how to make functions, which is how you make your programs **do*
Next, we'll make things more interesting, with _branching_, _loops_ and _pattern-matching_!
-See you in the next chapter!
+See you in [the next chapter](chapter_5.md)!
diff --git a/documentation/book/the_lux_programming_language/chapter_5.md b/documentation/book/the_lux_programming_language/chapter_5.md
new file mode 100644
index 000000000..84fc98f76
--- /dev/null
+++ b/documentation/book/the_lux_programming_language/chapter_5.md
@@ -0,0 +1,374 @@
+# Chapter 5: Control Flow
+
+_Where you will learn how to give intelligence to your code._
+
+---
+
+## Branching
+
+So far, we've only seen very simple examples of program/function logic that are very straightforward.
+
+But real world programs are far from straightforward, and there's a lot of testing and decision-making involved in how they operate.
+
+The first important concept to master in any programming language is how to make decisions and _branch_ the path our program takes, and Lux offers one primary way of doing this: _pattern-matching_.
+
+But before we head into that, let's first see 2 weaker mechanisms for branching that might be familiar to programmers coming from other programming languages.
+
+### If
+
+We've already met the humble `if` expression in the previous chapter. As explained there, the expression takes the following form:
+
+```
+(if test
+ then
+ else)
+```
+
+Where `test`, `then` and `else` are arbitrary Lux expressions.
+
+In terms of types, it works like this:
+
+```
+(: X (if (: Bit test)
+ (: X then)
+ (: X else)))
+```
+
+Here is an example:
+
+```
+(if true
+ "Oh, yeah!"
+ "Aw, hell naw!")
+```
+
+So, both branches must produce the same type for the type-checker to let it pass.
+
+### Cond
+
+`cond` is like a more general version of the `if` macro.
+
+For those of you coming from conventional programming languages, `cond` is like a chain of _if-else_ statements/expressions, with a default _else_ branch at the end, in case all fails.
+
+It looks like this:
+
+```
+(cond test-1 then-1
+ test-2 then-2
+ ...
+ test-n then-n
+ else)
+```
+
+And, in terms of types, it looks like this:
+
+```
+(: X (cond (: Bit test-1) (: X then-1)
+ (: Bit test-2) (: X then-2)
+ ...
+ (: Bit test-n) (: X then-n)
+ (: X else)
+ ))
+```
+
+Here is an example:
+
+```
+(cond (n.even? num) "even"
+ (n.odd? num) "odd"
+ ## else-branch
+ "???")
+```
+
+So, it's easy to intuit how `cond` would desugar into several nested `if` expressions.
+
+Also, I'd like to point out that both `if` and `cond` are macros, instead of native Lux syntax.
+
+The reason for that is simply that they can both be implemented in terms of pattern-matching.
+
+## Pattern-Matching
+
+Some of you may not be familiar with the concept of pattern-matching if you come from non-functional programming languages, or from FP languages that lack pattern-matching (e.g. _Clojure_).
+
+Pattern-matching is similar to the branching expressions that we saw previously, except that instead of being based on making boolean tests, it's based on comparing patterns against data, and executing a branch if the pattern matches that data.
+
+The beautiful thing is that the pattern can be very complicated (even involving the binding of variables), and so the testing can be very powerful.
+
+We can see its power by looking at some examples.
+
+For instance, the `factorial'` function you saw in the previous chapter could have been written like this:
+
+```
+(def: (factorial' acc n)
+ (-> Nat Nat Nat)
+ (case n
+ 0 acc
+ _ (factorial' (n.* n acc) (dec n))
+ ))
+```
+
+As you may imagine, `case` is the pattern-matching macro. It takes the data you want to pattern-match against (in this case, the `n` variable), and then tests it against several patterns until it finds a match, in which case it executes its branch.
+
+Here, we test if `n` equals `0`. If it does, we just return the `acc` value. Otherwise, we have a _default_ branch with a pattern that doesn't test anything called `_`. That will handle the case where the input is greater than 0.
+
+The _"default"_ branch works because we're binding the value of `n` onto a variable called `_`, and binding always succeeds, which is why we can use that branch as a default.
+
+However, since it is binding a variable, that means we could have used `_` instead of `n` during our calculations; like this:
+
+```
+(def: (factorial' acc n)
+ (-> Nat Nat Nat)
+ (case n
+ 0 acc
+ _ (factorial' (n.* _ acc) (dec _))
+ ))
+```
+
+However, as a convention, `_` is used as the name for values we don't care about and don't plan to use in our code.
+
+---
+
+Pattern-matching doesn't limit itself only to `Nat`s, and can also be used with `Bit`s, `Int`s, `Rev`s, `Frac`s, `Text`s, variants, tuples, records, and much more!
+
+Regarding the _"much more"_ claim, you should check out [Appendix C](appendix_c.md), where I discuss a powerful extension mechanism called **pattern-matching macros**.
+
+Here are a couple more examples so you can see the possibilities.
+
+```
+(let [test true]
+ (case test
+ #1 "Oh, yeah!"
+ #0 "Aw, hell naw!"
+ ))
+```
+
+```
+(case (list 1 2 3)
+ (#.Item x (#.Item y (#.Item z #.End)))
+ (#.Some (n.+ x (n.* y z)))
+
+ _
+ #.None)
+```
+
+In the first example, you'll notice that we have rewritten the prior `if` example in terms of pattern-matching. Also, you'll notice the introduction of a new macro, called `let`.
+
+`let` is a simple way to create local-variables in Lux.
+It's syntax looks like this:
+
+```
+(: X (let [var-1 expr-1
+ var-2 expr-2
+ ...
+ var-n expr-n]
+ (: X body)))
+```
+
+Where the types of the variables will correspond to those of their matching expressions, and the type of the `let` expression will be the same as that of its body.
+
+Also, remember when I told you that you can use pattern-matching to bind variables?
+
+Well, guess what! `let` is implemented in terms of `case`, and it just gives you a more convenient way to bind variables than to go through all the trouble of doing pattern-matching.
+
+Now, in the second example, we're deconstructing a list in order to extract its individual elements.
+
+The `List` type is defined like this:
+
+```
+(type: (List a)
+ #End
+ (#Item a (List a)))
+```
+
+#.End represents the empty list, while #.Item constructs a list by prepending an element to the beginning of another list.
+
+With pattern-matching, we're opening our list up to 3 levels in order to extract its 3 items and do a simple math calculation.
+
+If the match succeeds, we produce a value of type `(Maybe Int)` by wrapping our result with the `#.Some` tag, from the `Maybe` type. If the match fails, we just produce nothing, by using the `#.None` tag, also from the `Maybe` type.
+
+While `List` allows you to group an arbitrary number of values into a single structure, `Maybe` is for values you may or may not have.
+
+Also, you may have noticed how different (and uncomfortable!) it is to pattern-match against a `List`, since you have to use its real syntax, with its tags; whereas to build the list we can just piggy-back on the `list` macro.
+
+Don't worry too much about it, because there's a better way to do it that also allows us to use the `list` macro. If you're curious about it, head over to [Appendix C](appendix_c.md) to learn more about pattern-matching macros.
+
+## Looping
+
+Alright. So, we know several ways to branch, and also how to bind variables. But we know life isn't just about making decisions. Sometimes, you just have to do your work over and over again until you're done.
+
+That's what _looping_ is for!
+
+### Recursion
+
+In functional programming, _recursion_ is the main mechanism for looping in your code.
+
+Recursion is nothing more than the capacity for a function to call itself (often with different parameters than the initial call). It's not hard to see how this mechanism can be used to loop in any way you want, and we've already seen examples of recursion in action.
+
+```
+(def: (factorial' acc n)
+ (-> Nat Nat Nat)
+ (if (n.= 0 n)
+ acc
+ (factorial' (n.* n acc) (dec n))))
+```
+
+The `factorial'` function calls itself with an ever increasing accumulator (that will hold the eventual result), and an ever decreasing input value.
+
+Recursion in many languages is seen as a potentially dangerous operation, since programming languages have what are called `"stacks"`, which are structures holding the parameters to functions and the return addresses for where to send the results once the functions are done.
+
+Every function call you issue puts a new frame onto the stack, and if enough frames are pushed, eventually the stack _"overflows"_ its capacity, causing the program to fail.
+
+However, an old trick that has been employed for a long time in programming languages is called _tail-call optimization_, and it allows you to optimize recursive calls that are in a _"tail position"_; that is, a position where the result of the call can just be returned immediately, instead of needing any further processing.
+
+Our example `factorial'` function has its recursive call in the _tail position_ (and thus, can benefit from that optimization).
+
+This alternative doesn't:
+
+```
+(def: (factorial' acc n)
+ (-> Nat Nat Nat)
+ (if (n.= 0 n)
+ acc
+ (n.+ 0 (factorial' (n.* n acc) (dec n)))))
+```
+
+Can you spot the difference?
+
+In the alternative, the result of the recursive call would have to be sent to the `n.+` function as its second parameter, so it wouldn't be a _tail-call_.
+
+The beautiful thing about tail-call optimization (or _TCO_) is that it removes the recursion altogether, eliminating the possibility for stack overflows.
+
+Pretty neat, huh?
+
+ For the sake of correctness, I must point out that Lux doesn't implement _full_ tail-call optimization, since that would require some extra power that Lux can't implement, since it's too low-level and (currently) the JVM doesn't offer the means to achieve that.
+
+ For that reason, going forward, I will refer to what Lux does as _tail-recursion optimization_ (or _TRO_), instead.
+
+### Loop
+
+Some of you may be more familiar with the _for loops_ or the _while loops_ of other programming languages and need some time to wrap your heads around recursion. That's OK.
+
+Lux also offers a macro that gives you a slightly similar experience to those kinds of loops, which can get your mind off recursion just a little bit.
+
+To see it in action, let's rewrite (once more!) our `factorial` function:
+
+```
+(def: (factorial n)
+ (-> Nat Nat)
+ (loop [acc 1
+ n n]
+ (if (n.= +0 n)
+ acc
+ (recur (n.* n acc) (dec n)))))
+```
+
+We have eliminated our dependency on the factorial' function.
+
+Just like with `let`, we're creating some local variables, but these are going to change on each iteration. Then, in the body, we perform the usual `if` test, and if the number is not 0, then I use the `recur` operator (which only works inside of loop) to update the values of my variables for the next iteration.
+
+## Piping
+
+Piping isn't really control-flow per se, but I include it here because it is a powerful technique for organizing code that involves taking multiple steps to perform a calculation.
+
+It's based on using a single macro, called `|>`, which allows you to write deeply nested code in a flat way, making it much easier to read and understand, and also giving it a bit of an imperative flavor.
+
+Here is a simple example to see how it works:
+
+```
+(|> elems
+ (map to_text)
+ (interpose " ")
+ (fold append_text ""))
+
+## =>
+## (fold append_text ""
+## (interpose " "
+## (map to_text elems)))
+```
+
+If you read carefully, you'll see that each element (from left to right) gets lodged at the end of the next expression and the pattern continues until everything has been nested.
+
+A good convention to follow in functional programming (and especially in Lux), is that the most important argument to a function (or its _subject_) ought to be the last argument the function takes. One of the really cool benefits of this convention is that your code becomes very amenable to piping, as the nesting is only done in one way.
+
+It's not hard to see how much easier to read and understand the piped version is, compared to the resulting code.
+
+Also, you might be interested to know that piping can also be extended in really cool ways (similarly to how pattern-matching can be extended). The way is to use piping macros (you may be noticing a theme here).
+
+If you want to know more about those, feel free to check out [Appendix D](appendix_d.md), where I review them in detail.
+
+Oh, and before I forget, there is also a macro for doing reverse piping (which can be very useful in some situations).
+
+Out previous example would look like this:
+
+```
+(<| (fold append_text "")
+ (interpose " ")
+ (map to_text)
+ elems)
+```
+
+## Higher-Order Functions
+
+I can't finish this chapter without talking about one of the coolest features in the world of functional programming.
+
+So far, we have seen several control-flow mechanisms that could potentially exist in any language/paradigm, but now we'll talk about something native to the FP landscape.
+
+You already know that in the world of functional programming, functions are _first-class values_. That just means functions can be treated like other values (such as `Int`s, `Bit`s and `Text`s). You can create new functions at run-time, you can pass functions around as arguments to other functions and you can combine functions in arbitrary ways.
+
+Well, we haven't really seen that in action yet.
+
+It's time to put that theory into practice... with an example:
+
+```
+(def: (iterate_list f list)
+ (All [a b] (-> (-> a b) (List a) (List b)))
+ (case list
+ #.End
+ #.End
+
+ (#.Item head tail)
+ (#.Item (f head) (iterate_list f tail))))
+```
+
+This is a function that allows you to transform lists in arbitrary ways.
+
+However, you may notice that we're seeing many new things. For instance, what is that `All` thingie over there, and what does it do? Is it even a type?
+
+Well, it's not a type. It's actually a macro for creating types (in the same way that `->` is a macro that creates types). The difference is that `All` allows you to create _universally-quantified types_. That's just a fancy way of saying that your types are not fixed to working in a particular way, but are flexible enough to allow some variability.
+
+Here, it's being used to make a function that can takes lists with elements of any type (denoted by the _type variable_ `a`), and can produce lists with elements of any other type (denoted by the _type variable_ `b`), so long as you give it a function `f`, that transforms values of type `a` into values of type `b`.
+
+That... is... mind-blowing!
+
+In other programming languages, whenever you want to process the elements of a sequence (say, an array) you have to write something like a _for loop_ with some index variable, some condition... and then the code for actually _working with the data_.
+
+But here, we're pretty much defining a function that takes care of all the ceremony, so you just need to give it the operation you wish to perform on each element, and the data.
+
+You could use it like this:
+
+```
+(iterate_list (n.* 5) (list 0 1 2 3 4 5 6 7 8 9))
+
+## => (list 0 5 10 15 20 25 30 35 40 45)
+```
+
+Pretty cool, huh!
+
+But this is just scratching the surface of what's possible.
+
+As it turns out, higher-order functions (that is, functions which take or produce other functions) are at the foundation of many advanced techniques in functional programming. Mastering this little trick will prove invaluable to you as you delve deeper into the mysteries of functional programming.
+
+---
+
+Alright.
+
+We've seen quite a lot so far.
+
+But, don't get complacent!
+
+You've only seen the basics of Lux and the next chapters are going to expose some of the more advanced features the language.
+
+Brace yourself, great power is coming!
+
+See you in the next chapter!
+
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 9bf50bba5..84d33d03b 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -63,7 +63,7 @@
(2 #0 (4 #0 1)
(9 #0 (4 #0 1) (4 #0 0))))))
[dummy_location
- (9 #1 (0 #1 [[dummy_location (7 #0 ["library/lux" "type-args"])]
+ (9 #1 (0 #1 [[dummy_location (7 #0 ["library/lux" "type_args"])]
[dummy_location (9 #0 (0 #1 [dummy_location (5 #0 "a")] (0 #0)))]]
(0 #1 [[dummy_location (7 #0 ["library/lux" "doc"])]
[dummy_location (5 #0 "A potentially empty list of values.")]]
@@ -167,7 +167,7 @@
## "lux.Some"
(4 #0 1))))
[dummy_location
- (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "type-args"])]
+ (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.")]]
@@ -223,7 +223,7 @@
[dummy_location
(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.")]]
- (#Item [[dummy_location (7 #0 ["library/lux" "type-rec?"])]
+ (#Item [[dummy_location (7 #0 ["library/lux" "type_rec?"])]
[dummy_location (0 #0 #1)]]
#End)))]
["Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"]
@@ -255,7 +255,7 @@
[dummy_location
(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.")]]
- (#Item [[dummy_location (7 #0 ["library/lux" "type-args"])]
+ (#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"]
@@ -307,7 +307,7 @@
(#Parameter 0))
(#Parameter 1)))))
[dummy_location
- (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "type-args"])]
+ (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"]
@@ -460,7 +460,7 @@
(#Apply (#Product (#Parameter 3)
(#Parameter 1))
List)))))
- (record$ (#Item [(tag$ ["library/lux" "type-args"])
+ (record$ (#Item [(tag$ ["library/lux" "type_args"])
(tuple$ (#Item (text$ "k") (#Item (text$ "v") #End)))]
#End))
["counter" "mappings"]
@@ -515,7 +515,7 @@
(#Parameter 3)
## "lux.Right"
(#Parameter 1)))))
- (record$ (#Item [(tag$ ["library/lux" "type-args"])
+ (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.")]
@@ -709,7 +709,7 @@
(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."))]
- (#Item [(tag$ ["library/lux" "type-args"])
+ (#Item [(tag$ ["library/lux" "type_args"])
(tuple$ (#Item (text$ "a") #End))]
#End)))
#1)
@@ -2985,7 +2985,7 @@
meta
_
- (` (#.Item [[(~ 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))))]]
@@ -2993,7 +2993,7 @@
(def:' (with_type_args args)
(-> (List Code) Code)
- (` {#.type-args [(~+ (list\map (function (_ arg) (text$ (code\encode arg)))
+ (` {#.type_args [(~+ (list\map (function (_ arg) (text$ (code\encode arg)))
args))]}))
(def:' (export^ tokens)
@@ -3590,7 +3590,9 @@
#None
(failure "Wrong syntax for implementation:"))))
-(def: (function\identity x) (All [a] (-> a a)) x)
+(def: (function\identity value)
+ (All [a] (-> a a))
+ value)
(macro: #export (type: tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -3649,7 +3651,7 @@
(#Some (` (.All (~ type_name) [(~+ args)] (~ type)))))))
total_meta (let [meta (process_def_meta meta)
meta (if rec?
- (` (#.Item (~ (flag_meta "type-rec?")) (~ meta)))
+ (` (#.Item (~ (flag_meta "type_rec?")) (~ meta)))
meta)]
(` [(~ location_code)
(#.Record (~ meta))]))]
@@ -4045,7 +4047,7 @@
cases)]
output))
-(def: (try_both f x1 x2)
+(def: (on_either f x1 x2)
(All [a b]
(-> (-> a (Maybe b)) a a (Maybe b)))
(case (f x1)
@@ -4066,13 +4068,13 @@
#inner _
#locals {#counter _ #mappings locals}
#captured {#counter _ #mappings closure}}
- (try_both (find (: (-> [Text [Type Any]] (Maybe Type))
- (function (_ [bname [type _]])
- (if (text\= name bname)
- (#Some type)
- #None))))
- (: (List [Text [Type Any]]) locals)
- (: (List [Text [Type Any]]) closure)))))
+ (on_either (find (: (-> [Text [Type Any]] (Maybe Type))
+ (function (_ [bname [type _]])
+ (if (text\= name bname)
+ (#Some type)
+ #None))))
+ (: (List [Text [Type Any]]) locals)
+ (: (List [Text [Type Any]]) closure)))))
scopes)))
(def: (definition_type name state)
diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux
index 9e3bfea18..2a9e61ac7 100644
--- a/stdlib/source/library/lux/control/concatenative.lux
+++ b/stdlib/source/library/lux/control/concatenative.lux
@@ -37,7 +37,7 @@
(|> (<>.and <c>.local_identifier <c>.any)
<>.some
<c>.record
- (<>.default (list))))
+ (<>.else (list))))
(def: bottom^
(Parser Nat)
@@ -98,8 +98,8 @@
[?bottomI ?bottomO]
(with_gensyms [g!stack]
(monad.do meta.monad
- [inputC (singleton (macro.full_expansion (stack_fold (get@ #top inputs) (maybe.default g!stack ?bottomI))))
- outputC (singleton (macro.full_expansion (stack_fold (get@ #top outputs) (maybe.default g!stack ?bottomO))))]
+ [inputC (singleton (macro.full_expansion (stack_fold (get@ #top inputs) (maybe.else g!stack ?bottomI))))
+ outputC (singleton (macro.full_expansion (stack_fold (get@ #top outputs) (maybe.else g!stack ?bottomO))))]
(in (list (` (All [(~ g!stack)]
(-> (~ (de_alias inputC))
(~ (de_alias outputC))))))))))))
@@ -124,7 +124,7 @@
(syntax: #export (word:
{export |export|.parser}
{name <c>.local_identifier}
- {annotations (<>.default |annotations|.empty |annotations|.parser)}
+ {annotations (<>.else |annotations|.empty |annotations|.parser)}
type
{commands (<>.some <c>.any)})
{#.doc (doc "A named concatenative function."
diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux
index 72d28a0b7..067cf0178 100644
--- a/stdlib/source/library/lux/control/concurrency/actor.lux
+++ b/stdlib/source/library/lux/control/concurrency/actor.lux
@@ -287,7 +287,7 @@
(syntax: #export (actor:
{export |export|.parser}
{[name vars] actor_decl^}
- {annotations (<>.default |annotations|.empty |annotations|.parser)}
+ {annotations (<>.else |annotations|.empty |annotations|.parser)}
state_type
{[?on_mail messages] behavior^})
{#.doc (doc "Defines a named actor, with its behavior and internal state."
@@ -335,7 +335,7 @@
(def: signature^
(Parser Signature)
(<code>.form ($_ <>.and
- (<>.default (list) (<code>.tuple (<>.some <code>.local_identifier)))
+ (<>.else (list) (<code>.tuple (<>.some <code>.local_identifier)))
<code>.local_identifier
(<>.some |input|.parser)
<code>.local_identifier
@@ -349,7 +349,7 @@
(syntax: #export (message:
{export |export|.parser}
{signature signature^}
- {annotations (<>.default |annotations|.empty |annotations|.parser)}
+ {annotations (<>.else |annotations|.empty |annotations|.parser)}
output_type
body)
{#.doc (doc "A message can access the actor's state through the state parameter."
diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux
index c57c9877b..e7cdd6d3e 100644
--- a/stdlib/source/library/lux/control/exception.lux
+++ b/stdlib/source/library/lux/control/exception.lux
@@ -90,7 +90,7 @@
(..except exception message)))
(syntax: #export (exception: {export |export|.parser}
- {t_vars (p.default (list) (s.tuple (p.some |type_variable|.parser)))}
+ {t_vars (p.else (list) (s.tuple (p.some |type_variable|.parser)))}
{[name inputs] (p.either (p.and s.local_identifier (in (list)))
(s.form (p.and s.local_identifier (p.some |input|.parser))))}
{body (p.maybe s.any)})
@@ -116,7 +116,7 @@
{#..label (~ g!descriptor)
#..constructor (function ((~ g!self) [(~+ (list\map (get@ #|input|.binding) inputs))])
((~! text\compose) (~ g!descriptor)
- (~ (maybe.default (' "") body))))})))))
+ (~ (maybe.else (' "") body))))})))))
)))
(def: (report' entries)
diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux
index 696ec7525..e8ba63499 100644
--- a/stdlib/source/library/lux/control/parser.lux
+++ b/stdlib/source/library/lux/control/parser.lux
@@ -241,7 +241,7 @@
(#try.Failure error)
(#try.Failure error))))
-(def: #export (default value parser)
+(def: #export (else value parser)
{#.doc "If the given parser fails, returns the default value."}
(All [s a] (-> a (Parser s a) (Parser s a)))
(function (_ input)
diff --git a/stdlib/source/library/lux/control/state.lux b/stdlib/source/library/lux/control/state.lux
index 8d9d3116a..ec576f9cd 100644
--- a/stdlib/source/library/lux/control/state.lux
+++ b/stdlib/source/library/lux/control/state.lux
@@ -117,18 +117,18 @@
[state a] (sFa state)]
(in [state (f a)])))))
-(type: #export (State' M s a)
+(type: #export (+State M s a)
{#.doc "Stateful computations decorated by a monad."}
(-> s (M [s a])))
(def: #export (run' state action)
{#.doc "Execute a stateful computation decorated by a monad."}
- (All [M s a] (-> s (State' M s a) (M [s a])))
+ (All [M s a] (-> s (+State M s a) (M [s a])))
(action state))
(implementation: #export (with monad)
{#.doc "A monad transformer to create composite stateful computations."}
- (All [M s] (-> (Monad M) (Monad (State' M s))))
+ (All [M s] (-> (Monad M) (Monad (+State M s))))
(def: &functor (with//functor (\ monad &functor)))
@@ -143,8 +143,8 @@
(sMa state')))))
(def: #export (lift monad ma)
- {#.doc "Lift monadic values to the State' wrapper."}
- (All [M s a] (-> (Monad M) (M a) (State' M s a)))
+ {#.doc "Lift monadic values to the +State wrapper."}
+ (All [M s a] (-> (Monad M) (M a) (+State M s a)))
(function (_ state)
(do monad
[a ma]
diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux
index 4a6a35678..c1a991628 100644
--- a/stdlib/source/library/lux/control/try.lux
+++ b/stdlib/source/library/lux/control/try.lux
@@ -131,14 +131,14 @@
(#Failure (`` (("lux in-module" (~~ (static .prelude_module)) .name\encode)
(name_of ..of_maybe))))))
-(macro: #export (default tokens compiler)
+(macro: #export (else tokens compiler)
{#.doc (doc "Allows you to provide a default value that will be used"
"if a (Try x) value turns out to be #Failure."
"Note: the expression for the default value will not be computed if the base computation succeeds."
(= "bar"
- (default "foo" (#..Success "bar")))
+ (else "foo" (#..Success "bar")))
(= "foo"
- (default "foo" (#..Failure "KABOOM!"))))}
+ (else "foo" (#..Failure "KABOOM!"))))}
(case tokens
(^ (list else try))
(#Success [compiler (list (` (case (~ try)
@@ -149,4 +149,4 @@
(~ else))))])
_
- (#Failure "Wrong syntax for default")))
+ (#Failure "Wrong syntax for else")))
diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux
index 185a142bf..6cd8c722b 100644
--- a/stdlib/source/library/lux/data/binary.lux
+++ b/stdlib/source/library/lux/data/binary.lux
@@ -137,7 +137,7 @@
## Default
(|> binary
(array.read idx)
- (maybe.default (: (I64 Any) 0))
+ (maybe.else (: (I64 Any) 0))
(:as I64))))
(template: (!!write <byte_type> <post> <write> idx value binary)
@@ -200,7 +200,7 @@
(-> Nat Binary (Try I64))
(if (n.< (..!size binary) (n.+ 1 idx))
(#try.Success ($_ i64.or
- (i64.left_shift 8 (!read idx binary))
+ (i64.left_shifted 8 (!read idx binary))
(!read (n.+ 1 idx) binary)))
(exception.except ..index_out_of_bounds [(..!size binary) idx])))
@@ -208,9 +208,9 @@
(-> Nat Binary (Try I64))
(if (n.< (..!size binary) (n.+ 3 idx))
(#try.Success ($_ i64.or
- (i64.left_shift 24 (!read idx binary))
- (i64.left_shift 16 (!read (n.+ 1 idx) binary))
- (i64.left_shift 8 (!read (n.+ 2 idx) binary))
+ (i64.left_shifted 24 (!read idx binary))
+ (i64.left_shifted 16 (!read (n.+ 1 idx) binary))
+ (i64.left_shifted 8 (!read (n.+ 2 idx) binary))
(!read (n.+ 3 idx) binary)))
(exception.except ..index_out_of_bounds [(..!size binary) idx])))
@@ -218,13 +218,13 @@
(-> Nat Binary (Try I64))
(if (n.< (..!size binary) (n.+ 7 idx))
(#try.Success ($_ i64.or
- (i64.left_shift 56 (!read idx binary))
- (i64.left_shift 48 (!read (n.+ 1 idx) binary))
- (i64.left_shift 40 (!read (n.+ 2 idx) binary))
- (i64.left_shift 32 (!read (n.+ 3 idx) binary))
- (i64.left_shift 24 (!read (n.+ 4 idx) binary))
- (i64.left_shift 16 (!read (n.+ 5 idx) binary))
- (i64.left_shift 8 (!read (n.+ 6 idx) binary))
+ (i64.left_shifted 56 (!read idx binary))
+ (i64.left_shifted 48 (!read (n.+ 1 idx) binary))
+ (i64.left_shifted 40 (!read (n.+ 2 idx) binary))
+ (i64.left_shifted 32 (!read (n.+ 3 idx) binary))
+ (i64.left_shifted 24 (!read (n.+ 4 idx) binary))
+ (i64.left_shifted 16 (!read (n.+ 5 idx) binary))
+ (i64.left_shifted 8 (!read (n.+ 6 idx) binary))
(!read (n.+ 7 idx) binary)))
(exception.except ..index_out_of_bounds [(..!size binary) idx])))
@@ -239,7 +239,7 @@
(-> Nat (I64 Any) Binary (Try Binary))
(if (n.< (..!size binary) (n.+ 1 idx))
(#try.Success (|> binary
- (!write idx (i64.right_shift 8 value))
+ (!write idx (i64.right_shifted 8 value))
(!write (n.+ 1 idx) value)))
(exception.except ..index_out_of_bounds [(..!size binary) idx])))
@@ -247,32 +247,32 @@
(-> Nat (I64 Any) Binary (Try Binary))
(if (n.< (..!size binary) (n.+ 3 idx))
(#try.Success (|> binary
- (!write idx (i64.right_shift 24 value))
- (!write (n.+ 1 idx) (i64.right_shift 16 value))
- (!write (n.+ 2 idx) (i64.right_shift 8 value))
+ (!write idx (i64.right_shifted 24 value))
+ (!write (n.+ 1 idx) (i64.right_shifted 16 value))
+ (!write (n.+ 2 idx) (i64.right_shifted 8 value))
(!write (n.+ 3 idx) value)))
(exception.except ..index_out_of_bounds [(..!size binary) idx])))
(def: #export (write/64 idx value binary)
(-> Nat (I64 Any) Binary (Try Binary))
(if (n.< (..!size binary) (n.+ 7 idx))
- (for {@.scheme (let [write_high (|>> (!write idx (i64.right_shift 56 value))
- (!write (n.+ 1 idx) (i64.right_shift 48 value))
- (!write (n.+ 2 idx) (i64.right_shift 40 value))
- (!write (n.+ 3 idx) (i64.right_shift 32 value)))
- write_low (|>> (!write (n.+ 4 idx) (i64.right_shift 24 value))
- (!write (n.+ 5 idx) (i64.right_shift 16 value))
- (!write (n.+ 6 idx) (i64.right_shift 8 value))
+ (for {@.scheme (let [write_high (|>> (!write idx (i64.right_shifted 56 value))
+ (!write (n.+ 1 idx) (i64.right_shifted 48 value))
+ (!write (n.+ 2 idx) (i64.right_shifted 40 value))
+ (!write (n.+ 3 idx) (i64.right_shifted 32 value)))
+ write_low (|>> (!write (n.+ 4 idx) (i64.right_shifted 24 value))
+ (!write (n.+ 5 idx) (i64.right_shifted 16 value))
+ (!write (n.+ 6 idx) (i64.right_shifted 8 value))
(!write (n.+ 7 idx) value))]
(|> binary write_high write_low #try.Success))}
(#try.Success (|> binary
- (!write idx (i64.right_shift 56 value))
- (!write (n.+ 1 idx) (i64.right_shift 48 value))
- (!write (n.+ 2 idx) (i64.right_shift 40 value))
- (!write (n.+ 3 idx) (i64.right_shift 32 value))
- (!write (n.+ 4 idx) (i64.right_shift 24 value))
- (!write (n.+ 5 idx) (i64.right_shift 16 value))
- (!write (n.+ 6 idx) (i64.right_shift 8 value))
+ (!write idx (i64.right_shifted 56 value))
+ (!write (n.+ 1 idx) (i64.right_shifted 48 value))
+ (!write (n.+ 2 idx) (i64.right_shifted 40 value))
+ (!write (n.+ 3 idx) (i64.right_shifted 32 value))
+ (!write (n.+ 4 idx) (i64.right_shifted 24 value))
+ (!write (n.+ 5 idx) (i64.right_shifted 16 value))
+ (!write (n.+ 6 idx) (i64.right_shifted 8 value))
(!write (n.+ 7 idx) value))))
(exception.except ..index_out_of_bounds [(..!size binary) idx])))
diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux
index 96b082211..330ea38eb 100644
--- a/stdlib/source/library/lux/data/collection/array.lux
+++ b/stdlib/source/library/lux/data/collection/array.lux
@@ -175,7 +175,7 @@
(All [a]
(-> Nat a (-> a a) (Array a) (Array a)))
(write! index
- (|> array (read index) (maybe.default default) transform)
+ (|> array (read index) (maybe.else default) transform)
array))
(def: #export (copy! length src_start src_array dest_start dest_array)
@@ -311,7 +311,7 @@
(if (n.= ..underflow idx)
output
(recur (dec idx)
- (#.Item (maybe.default default (read idx array))
+ (#.Item (maybe.else default (read idx array))
output)))))
(implementation: #export (equivalence (^open ",\."))
diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux
index 6066bd0c2..f45916a00 100644
--- a/stdlib/source/library/lux/data/collection/bits.lux
+++ b/stdlib/source/library/lux/data/collection/bits.lux
@@ -53,13 +53,13 @@
(let [[chunk_index bit_index] (n./% chunk_size index)]
(.and (n.< (array.size bits) chunk_index)
(|> (array.read chunk_index bits)
- (maybe.default empty_chunk)
+ (maybe.else empty_chunk)
(i64.set? bit_index)))))
(def: (chunk idx bits)
(-> Nat Bits Chunk)
(if (n.< (array.size bits) idx)
- (|> bits (array.read idx) (maybe.default empty_chunk))
+ (|> bits (array.read idx) (maybe.else empty_chunk))
empty_chunk))
(template [<name> <op>]
diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux
index 81ad72fbd..42e421952 100644
--- a/stdlib/source/library/lux/data/collection/dictionary.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary.lux
@@ -26,14 +26,14 @@
## Bitmaps are used to figure out which branches on a #Base node are
## populated. The number of bits that are 1s in a bitmap signal the
## size of the #Base node.
-(type: BitMap
+(type: Bit_Map
Nat)
-## Represents the position of a node in a BitMap.
+## Represents the position of a node in a Bit_Map.
## It's meant to be a single bit set on a 32-bit word.
## The position of the bit reflects whether an entry in an analogous
-## position exists within a #Base, as reflected in its BitMap.
-(type: BitPosition
+## position exists within a #Base, as reflected in its Bit_Map.
+(type: Bit_Position
Nat)
## An index into an array.
@@ -58,7 +58,7 @@
## Dictionaries.
(type: (Node k v)
(#Hierarchy Nat (Array (Node k v)))
- (#Base BitMap
+ (#Base Bit_Map
(Array (Either (Node k v)
[k v])))
(#Collisions Hash_Code (Array [k v])))
@@ -84,7 +84,7 @@
## Or 0x00000000.
## Which is 32 zeroes, since the branching factor is 32.
(def: clean_bitmap
- BitMap
+ Bit_Map
0)
## Bitmap position (while looking inside #Base nodes) is determined by
@@ -110,18 +110,18 @@
## which is 1/4 of the branching factor (or a left-shift 2).
(def: demotion_threshold
Nat
- (i64.left_shift (n.- 2 branching_exponent) 1))
+ (i64.left_shifted (n.- 2 branching_exponent) 1))
## The threshold on which #Base nodes are promoted to #Hierarchy nodes,
## which is 1/2 of the branching factor (or a left-shift 1).
(def: promotion_threshold
Nat
- (i64.left_shift (n.- 1 branching_exponent) 1))
+ (i64.left_shifted (n.- 1 branching_exponent) 1))
## The size of hierarchy-nodes, which is 2^(branching-exponent).
(def: hierarchy_nodes_size
Nat
- (i64.left_shift branching_exponent 1))
+ (i64.left_shifted branching_exponent 1))
## The cannonical empty node, which is just an empty #Base node.
(def: empty
@@ -163,7 +163,7 @@
(n.+ branching_exponent))
(def: hierarchy_mask
- BitMap
+ Bit_Map
(dec hierarchy_nodes_size))
## Gets the branching-factor sized section of the hash corresponding
@@ -171,20 +171,20 @@
(def: (level_index level hash)
(-> Level Hash_Code Index)
(i64.and ..hierarchy_mask
- (i64.right_shift level hash)))
+ (i64.right_shifted level hash)))
## A mechanism to go from indices to bit-positions.
(def: (to_bit_position index)
- (-> Index BitPosition)
- (i64.left_shift index 1))
+ (-> Index Bit_Position)
+ (i64.left_shifted index 1))
## The bit-position within a base that a given hash-code would have.
(def: (bit_position level hash)
- (-> Level Hash_Code BitPosition)
+ (-> Level Hash_Code Bit_Position)
(to_bit_position (level_index level hash)))
(def: (bit_position_is_set? bit bitmap)
- (-> BitPosition BitMap Bit)
+ (-> Bit_Position Bit_Map Bit)
(|> bitmap
(i64.and bit)
(n.= clean_bitmap)
@@ -192,48 +192,48 @@
## Figures out whether a bitmap only contains a single bit-position.
(def: only_bit_position?
- (-> BitPosition BitMap Bit)
+ (-> Bit_Position Bit_Map Bit)
n.=)
(def: (set_bit_position bit bitmap)
- (-> BitPosition BitMap BitMap)
+ (-> Bit_Position Bit_Map Bit_Map)
(i64.or bit bitmap))
(def: unset_bit_position
- (-> BitPosition BitMap BitMap)
+ (-> Bit_Position Bit_Map Bit_Map)
i64.xor)
## Figures out the size of a bitmap-indexed array by counting all the
## 1s within the bitmap.
(def: bitmap_size
- (-> BitMap Nat)
+ (-> Bit_Map Nat)
i64.count)
## A mask that, for a given bit position, only allows all the 1s prior
## to it, which would indicate the bitmap-size (and, thus, index)
## associated with it.
(def: bit_position_mask
- (-> BitPosition BitMap)
+ (-> Bit_Position Bit_Map)
dec)
## The index on the base array, based on its bit-position.
(def: (base_index bit_position bitmap)
- (-> BitPosition BitMap Index)
+ (-> Bit_Position Bit_Map Index)
(bitmap_size (i64.and (bit_position_mask bit_position)
bitmap)))
## Produces the index of a KV-pair within a #Collisions node.
-(def: (collision_index Hash<k> key colls)
+(def: (collision_index key_hash key colls)
(All [k v] (-> (Hash k) k (Collisions k v) (Maybe Index)))
(\ maybe.monad map product.left
(array.find+ (function (_ idx [key' val'])
- (\ Hash<k> = key key'))
+ (\ key_hash = key key'))
colls)))
## When #Hierarchy nodes grow too small, they're demoted to #Base
## nodes to save space.
(def: (demote_hierarchy except_idx [h_size h_array])
- (All [k v] (-> Index (Hierarchy k v) [BitMap (Base k v)]))
+ (All [k v] (-> Index (Hierarchy k v) [Bit_Map (Base k v)]))
(product.right (list\fold (function (_ idx [insertion_idx node])
(let [[bitmap base] node]
(case (array.read idx h_array)
@@ -252,11 +252,11 @@
## add some depth to the tree and help keep its balance.
(def: hierarchy_indices (List Index) (list.indices hierarchy_nodes_size))
-(def: (promote_base put' Hash<k> level bitmap base)
+(def: (promote_base put' key_hash level bitmap base)
(All [k v]
(-> (-> Level Hash_Code k v (Hash k) (Node k v) (Node k v))
(Hash k) Level
- BitMap (Base k v)
+ Bit_Map (Base k v)
(Array (Node k v))))
(product.right (list\fold (function (_ hierarchy_idx (^@ default [base_idx h_array]))
(if (bit_position_is_set? (to_bit_position hierarchy_idx)
@@ -268,7 +268,7 @@
(#.Some (#.Right [key' val']))
(array.write! hierarchy_idx
- (put' (level_up level) (\ Hash<k> hash key') key' val' Hash<k> empty)
+ (put' (level_up level) (\ key_hash hash key') key' val' key_hash empty)
h_array)
#.None
@@ -290,7 +290,7 @@
_
#0)))
-(def: (put' level hash key val Hash<k> node)
+(def: (put' level hash key val key_hash node)
(All [k v] (-> Level Hash_Code k v (Hash k) (Node k v) (Node k v)))
(case node
## For #Hierarchy nodes, check whether one can add the element to
@@ -304,10 +304,10 @@
_
[(inc _size) empty])]
(#Hierarchy _size'
- (update! idx (put' (level_up level) hash key val Hash<k> sub_node)
+ (update! idx (put' (level_up level) hash key val key_hash sub_node)
hierarchy)))
- ## For #Base nodes, check if the corresponding BitPosition has
+ ## For #Base nodes, check if the corresponding Bit_Position has
## already been used.
(#Base bitmap base)
(let [bit (bit_position level hash)]
@@ -317,17 +317,17 @@
(case (array.read idx base)
## If it's being used by a node, add the KV to it.
(#.Some (#.Left sub_node))
- (let [sub_node' (put' (level_up level) hash key val Hash<k> sub_node)]
+ (let [sub_node' (put' (level_up level) hash key val key_hash sub_node)]
(#Base bitmap (update! idx (#.Left sub_node') base)))
## Otherwise, if it's being used by a KV, compare the keys.
(#.Some (#.Right key' val'))
- (if (\ Hash<k> = key key')
+ (if (\ key_hash = key key')
## If the same key is found, replace the value.
(#Base bitmap (update! idx (#.Right key val) base))
## Otherwise, compare the hashes of the keys.
(#Base bitmap (update! idx
- (#.Left (let [hash' (\ Hash<k> hash key')]
+ (#.Left (let [hash' (\ key_hash hash key')]
(if (n.= hash hash')
## If the hashes are
## the same, a new
@@ -343,22 +343,22 @@
## to the empty one.
(let [next_level (level_up level)]
(|> empty
- (put' next_level hash' key' val' Hash<k>)
- (put' next_level hash key val Hash<k>))))))
+ (put' next_level hash' key' val' key_hash)
+ (put' next_level hash key val key_hash))))))
base)))
#.None
(undefined)))
- ## However, if the BitPosition has not been used yet, check
+ ## However, if the Bit_Position has not been used yet, check
## whether this #Base node is ready for a promotion.
(let [base_count (bitmap_size bitmap)]
(if (n.>= ..promotion_threshold base_count)
## If so, promote it to a #Hierarchy node, and add the new
## KV-pair as a singleton node to it.
(#Hierarchy (inc base_count)
- (|> (promote_base put' Hash<k> level bitmap base)
+ (|> (promote_base put' key_hash level bitmap base)
(array.write! (level_index level hash)
- (put' (level_up level) hash key val Hash<k> empty))))
+ (put' (level_up level) hash key val key_hash empty))))
## Otherwise, just resize the #Base node to accommodate the
## new KV-pair.
(#Base (set_bit_position bit bitmap)
@@ -369,7 +369,7 @@
(if (n.= hash _hash)
## If they're equal, that means the new KV contributes to the
## collisions.
- (case (collision_index Hash<k> key _colls)
+ (case (collision_index key_hash key _colls)
## If the key was already present in the collisions-list, its
## value gets updated.
(#.Some coll_idx)
@@ -383,10 +383,10 @@
(|> (#Base (bit_position level _hash)
(|> (array.new 1)
(array.write! 0 (#.Left node))))
- (put' level hash key val Hash<k>)))
+ (put' level hash key val key_hash)))
))
-(def: (remove' level hash key Hash<k> node)
+(def: (remove' level hash key key_hash node)
(All [k v] (-> Level Hash_Code k (Hash k) (Node k v) (Node k v)))
(case node
## For #Hierarchy nodes, find out if there's a valid sub-node for
@@ -400,7 +400,7 @@
## But if there is, try to remove the key from the sub-node.
(#.Some sub_node)
- (let [sub_node' (remove' (level_up level) hash key Hash<k> sub_node)]
+ (let [sub_node' (remove' (level_up level) hash key key_hash sub_node)]
## Then check if a removal was actually done.
(if (is? sub_node sub_node')
## If not, then there's nothing to change here either.
@@ -417,7 +417,7 @@
## just update the hiearchy branch.
(#Hierarchy h_size (update! idx sub_node' h_array)))))))
- ## For #Base nodes, check whether the BitPosition is set.
+ ## For #Base nodes, check whether the Bit_Position is set.
(#Base bitmap base)
(let [bit (bit_position level hash)]
(if (bit_position_is_set? bit bitmap)
@@ -426,7 +426,7 @@
## If set, check if it's a sub_node, and remove the KV
## from it.
(#.Some (#.Left sub_node))
- (let [sub_node' (remove' (level_up level) hash key Hash<k> sub_node)]
+ (let [sub_node' (remove' (level_up level) hash key key_hash sub_node)]
## Verify that it was removed.
(if (is? sub_node sub_node')
## If not, there's also nothing to change here.
@@ -449,8 +449,8 @@
## If, however, there was a KV-pair instead of a sub-node.
(#.Some (#.Right [key' val']))
## Check if the keys match.
- (if (\ Hash<k> = key key')
- ## If so, remove the KV-pair and unset the BitPosition.
+ (if (\ key_hash = key key')
+ ## If so, remove the KV-pair and unset the Bit_Position.
(#Base (unset_bit_position bit bitmap)
(remove! idx base))
## Otherwise, there's nothing to remove.
@@ -458,12 +458,12 @@
#.None
(undefined)))
- ## If the BitPosition is not set, there's nothing to remove.
+ ## If the Bit_Position is not set, there's nothing to remove.
node))
## For #Collisions nodes, It need to find out if the key already existst.
(#Collisions _hash _colls)
- (case (collision_index Hash<k> key _colls)
+ (case (collision_index key_hash key _colls)
## If not, then there's nothing to remove.
#.None
node
@@ -478,14 +478,14 @@
(#Collisions _hash (remove! idx _colls))))
))
-(def: (get' level hash key Hash<k> node)
+(def: (get' level hash key key_hash node)
(All [k v] (-> Level Hash_Code k (Hash k) (Node k v) (Maybe v)))
(case node
## For #Hierarchy nodes, just look-up the key on its children.
(#Hierarchy _size hierarchy)
(case (array.read (level_index level hash) hierarchy)
#.None #.None
- (#.Some sub_node) (get' (level_up level) hash key Hash<k> sub_node))
+ (#.Some sub_node) (get' (level_up level) hash key key_hash sub_node))
## For #Base nodes, check the leaves, and recursively check the branches.
(#Base bitmap base)
@@ -493,10 +493,10 @@
(if (bit_position_is_set? bit bitmap)
(case (array.read (base_index bit bitmap) base)
(#.Some (#.Left sub_node))
- (get' (level_up level) hash key Hash<k> sub_node)
+ (get' (level_up level) hash key key_hash sub_node)
(#.Some (#.Right [key' val']))
- (if (\ Hash<k> = key key')
+ (if (\ key_hash = key key')
(#.Some val')
#.None)
@@ -507,7 +507,7 @@
## For #Collisions nodes, do a linear scan of all the known KV-pairs.
(#Collisions _hash _colls)
(\ maybe.monad map product.right
- (array.find (|>> product.left (\ Hash<k> = key))
+ (array.find (|>> product.left (\ key_hash = key))
_colls))
))
@@ -561,25 +561,26 @@
(All [k v] (-> (Dictionary k v) (Hash k)))
(get@ #..hash))
-(def: #export (new Hash<k>)
+(def: #export (new key_hash)
+ {#.doc (doc "An empty dictionary.")}
(All [k v] (-> (Hash k) (Dictionary k v)))
- {#hash Hash<k>
+ {#hash key_hash
#root empty})
(def: #export (put key val dict)
(All [k v] (-> k v (Dictionary k v) (Dictionary k v)))
- (let [[Hash<k> node] dict]
- [Hash<k> (put' root_level (\ Hash<k> hash key) key val Hash<k> node)]))
+ (let [[key_hash node] dict]
+ [key_hash (put' root_level (\ key_hash hash key) key val key_hash node)]))
(def: #export (remove key dict)
(All [k v] (-> k (Dictionary k v) (Dictionary k v)))
- (let [[Hash<k> node] dict]
- [Hash<k> (remove' root_level (\ Hash<k> hash key) key Hash<k> node)]))
+ (let [[key_hash node] dict]
+ [key_hash (remove' root_level (\ key_hash hash key) key key_hash node)]))
(def: #export (get key dict)
(All [k v] (-> k (Dictionary k v) (Maybe v)))
- (let [[Hash<k> node] dict]
- (get' root_level (\ Hash<k> hash key) key Hash<k> node)))
+ (let [[key_hash node] dict]
+ (get' root_level (\ key_hash hash key) key key_hash node)))
(def: #export (key? dict key)
(All [k v] (-> (Dictionary k v) k Bit))
@@ -611,8 +612,8 @@
"Otherwise, puts a value by applying the function to a default.")}
(All [k v] (-> k v (-> v v) (Dictionary k v) (Dictionary k v)))
(..put key
- (f (maybe.default default
- (..get key dict)))
+ (f (maybe.else default
+ (..get key dict)))
dict))
(def: #export size
@@ -627,14 +628,14 @@
(All [k v] (-> (Dictionary k v) (List [k v])))
(|>> product.right ..entries'))
-(def: #export (of_list Hash<k> kvs)
+(def: #export (of_list key_hash kvs)
(All [k v] (-> (Hash k) (List [k v]) (Dictionary k v)))
(list\fold (function (_ [k v] dict)
(..put k v dict))
- (new Hash<k>)
+ (new key_hash)
kvs))
-(template [<name> <side>]
+(template [<side> <name>]
[(def: #export <name>
(All [k v] (-> (Dictionary k v) (List <side>)))
(|>> ..entries
@@ -642,8 +643,8 @@
(#.Item <side> bundle))
#.End)))]
- [keys k]
- [values v]
+ [k keys]
+ [v values]
)
(def: #export (merge dict2 dict1)
@@ -669,6 +670,7 @@
(entries dict2)))
(def: #export (re_bind from_key to_key dict)
+ {#.doc (doc "If there is a value under 'from_key', remove 'from_key' and store the value under 'to_key'.")}
(All [k v] (-> k k (Dictionary k v) (Dictionary k v)))
(case (get from_key dict)
#.None
@@ -680,14 +682,14 @@
(put to_key val))))
(def: #export (select keys dict)
- {#.doc "Creates a sub-set of the given dict, with only the specified keys."}
+ {#.doc "A sub-dictionary, with only the specified keys."}
(All [k v] (-> (List k) (Dictionary k v) (Dictionary k v)))
- (let [[Hash<k> _] dict]
+ (let [[key_hash _] dict]
(list\fold (function (_ key new_dict)
(case (get key dict)
#.None new_dict
(#.Some val) (put key val new_dict)))
- (new Hash<k>)
+ (new key_hash)
keys)))
(implementation: #export (equivalence (^open ",\."))
diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
index 0b8976411..8008cb8b0 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
@@ -147,113 +147,107 @@
<no_change>
))]
- [blacken #Red #Black self]
- [redden #Black #Red (error! error_message)]
+ [blackened #Red #Black self]
+ [reddened #Black #Red (error! error_message)]
)
-(def: (balance_left_add parent self)
- (All [k v] (-> (Node k v) (Node k v) (Node k v)))
- (with_expansions
- [<default_behavior> (as_is (black (get@ #key parent)
- (get@ #value parent)
- (#.Some self)
- (get@ #right parent)))]
- (case (get@ #color self)
- #Red
- (case (get@ #left self)
- (^multi (#.Some left)
- {(get@ #color left) #Red})
- (red (get@ #key self)
- (get@ #value self)
- (#.Some (blacken left))
- (#.Some (black (get@ #key parent)
- (get@ #value parent)
- (get@ #right self)
- (get@ #right parent))))
-
- _
- (case (get@ #right self)
- (^multi (#.Some right)
- {(get@ #color right) #Red})
- (red (get@ #key right)
- (get@ #value right)
- (#.Some (black (get@ #key self)
- (get@ #value self)
- (get@ #left self)
- (get@ #left right)))
- (#.Some (black (get@ #key parent)
- (get@ #value parent)
- (get@ #right right)
- (get@ #right parent))))
-
- _
- <default_behavior>))
-
- #Black
- <default_behavior>
- )))
-
-(def: (balance_right_add parent self)
- (All [k v] (-> (Node k v) (Node k v) (Node k v)))
- (with_expansions
- [<default_behavior> (as_is (black (get@ #key parent)
- (get@ #value parent)
- (get@ #left parent)
- (#.Some self)))]
- (case (get@ #color self)
- #Red
- (case (get@ #right self)
- (^multi (#.Some right)
- {(get@ #color right) #Red})
- (red (get@ #key self)
- (get@ #value self)
- (#.Some (black (get@ #key parent)
- (get@ #value parent)
- (get@ #left parent)
- (get@ #left self)))
- (#.Some (blacken right)))
-
- _
- (case (get@ #left self)
- (^multi (#.Some left)
- {(get@ #color left) #Red})
- (red (get@ #key left)
- (get@ #value left)
- (#.Some (black (get@ #key parent)
- (get@ #value parent)
- (get@ #left parent)
- (get@ #left left)))
- (#.Some (black (get@ #key self)
- (get@ #value self)
- (get@ #right left)
- (get@ #right self))))
-
- _
- <default_behavior>))
-
- #Black
- <default_behavior>
- )))
-
(def: (add_left addition center)
(All [k v] (-> (Node k v) (Node k v) (Node k v)))
(case (get@ #color center)
#Red
- (red (get@ #key center) (get@ #value center) (#.Some addition) (get@ #right center))
+ (red (get@ #key center)
+ (get@ #value center)
+ (#.Some addition)
+ (get@ #right center))
#Black
- (balance_left_add center addition)
- ))
+ (with_expansions
+ [<default_behavior> (as_is (black (get@ #key center)
+ (get@ #value center)
+ (#.Some addition)
+ (get@ #right center)))]
+ (case (get@ #color addition)
+ #Red
+ (case (get@ #left addition)
+ (^multi (#.Some left)
+ {(get@ #color left) #Red})
+ (red (get@ #key addition)
+ (get@ #value addition)
+ (#.Some (blackened left))
+ (#.Some (black (get@ #key center)
+ (get@ #value center)
+ (get@ #right addition)
+ (get@ #right center))))
+
+ _
+ (case (get@ #right addition)
+ (^multi (#.Some right)
+ {(get@ #color right) #Red})
+ (red (get@ #key right)
+ (get@ #value right)
+ (#.Some (black (get@ #key addition)
+ (get@ #value addition)
+ (get@ #left addition)
+ (get@ #left right)))
+ (#.Some (black (get@ #key center)
+ (get@ #value center)
+ (get@ #right right)
+ (get@ #right center))))
+
+ _
+ <default_behavior>))
+
+ #Black
+ <default_behavior>))))
(def: (add_right addition center)
(All [k v] (-> (Node k v) (Node k v) (Node k v)))
(case (get@ #color center)
#Red
- (red (get@ #key center) (get@ #value center) (get@ #left center) (#.Some addition))
+ (red (get@ #key center)
+ (get@ #value center)
+ (get@ #left center)
+ (#.Some addition))
#Black
- (balance_right_add center addition)
- ))
+ (with_expansions
+ [<default_behavior> (as_is (black (get@ #key center)
+ (get@ #value center)
+ (get@ #left center)
+ (#.Some addition)))]
+ (case (get@ #color addition)
+ #Red
+ (case (get@ #right addition)
+ (^multi (#.Some right)
+ {(get@ #color right) #Red})
+ (red (get@ #key addition)
+ (get@ #value addition)
+ (#.Some (black (get@ #key center)
+ (get@ #value center)
+ (get@ #left center)
+ (get@ #left addition)))
+ (#.Some (blackened right)))
+
+ _
+ (case (get@ #left addition)
+ (^multi (#.Some left)
+ {(get@ #color left) #Red})
+ (red (get@ #key left)
+ (get@ #value left)
+ (#.Some (black (get@ #key center)
+ (get@ #value center)
+ (get@ #left center)
+ (get@ #left left)))
+ (#.Some (black (get@ #key addition)
+ (get@ #value addition)
+ (get@ #right left)
+ (get@ #right addition))))
+
+ _
+ <default_behavior>))
+
+ #Black
+ <default_behavior>))))
(def: #export (put key value dict)
(All [k v] (-> k v (Dictionary k v) (Dictionary k v)))
@@ -284,7 +278,7 @@
))]
(set@ #root root' dict)))
-(def: (left_balance key value ?left ?right)
+(def: (left_balanced key value ?left ?right)
(All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v)))
(case ?left
(^multi (#.Some left)
@@ -293,7 +287,7 @@
{(get@ #color left>>left) #Red})
(red (get@ #key left)
(get@ #value left)
- (#.Some (blacken left>>left))
+ (#.Some (blackened left>>left))
(#.Some (black key value (get@ #right left) ?right)))
(^multi (#.Some left)
@@ -313,7 +307,7 @@
_
(black key value ?left ?right)))
-(def: (right_balance key value ?left ?right)
+(def: (right_balanced key value ?left ?right)
(All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v)))
(case ?right
(^multi (#.Some right)
@@ -323,7 +317,7 @@
(red (get@ #key right)
(get@ #value right)
(#.Some (black key value ?left (get@ #left right)))
- (#.Some (blacken right>>right)))
+ (#.Some (blackened right>>right)))
(^multi (#.Some right)
{(get@ #color right) #Red}
@@ -345,13 +339,13 @@
(case ?left
(^multi (#.Some left)
{(get@ #color left) #Red})
- (red key value (#.Some (blacken left)) ?right)
+ (red key value (#.Some (blackened left)) ?right)
_
(case ?right
(^multi (#.Some right)
{(get@ #color right) #Black})
- (right_balance key value ?left (#.Some (redden right)))
+ (right_balanced key value ?left (#.Some (reddened right)))
(^multi (#.Some right)
{(get@ #color right) #Red}
@@ -360,10 +354,10 @@
(red (get@ #key right>>left)
(get@ #value right>>left)
(#.Some (black key value ?left (get@ #left right>>left)))
- (#.Some (right_balance (get@ #key right)
- (get@ #value right)
- (get@ #right right>>left)
- (\ maybe.functor map redden (get@ #right right)))))
+ (#.Some (right_balanced (get@ #key right)
+ (get@ #value right)
+ (get@ #right right>>left)
+ (\ maybe.functor map reddened (get@ #right right)))))
_
(error! error_message))
@@ -374,13 +368,13 @@
(case ?right
(^multi (#.Some right)
{(get@ #color right) #Red})
- (red key value ?left (#.Some (blacken right)))
+ (red key value ?left (#.Some (blackened right)))
_
(case ?left
(^multi (#.Some left)
{(get@ #color left) #Black})
- (left_balance key value (#.Some (redden left)) ?right)
+ (left_balanced key value (#.Some (reddened left)) ?right)
(^multi (#.Some left)
{(get@ #color left) #Red}
@@ -388,17 +382,17 @@
{(get@ #color left>>right) #Black})
(red (get@ #key left>>right)
(get@ #value left>>right)
- (#.Some (left_balance (get@ #key left)
- (get@ #value left)
- (\ maybe.functor map redden (get@ #left left))
- (get@ #left left>>right)))
+ (#.Some (left_balanced (get@ #key left)
+ (get@ #value left)
+ (\ maybe.functor map reddened (get@ #left left))
+ (get@ #left left>>right)))
(#.Some (black key value (get@ #right left>>right) ?right)))
_
(error! error_message)
)))
-(def: (prepend ?left ?right)
+(def: (prepended ?left ?right)
(All [k v] (-> (Maybe (Node k v)) (Maybe (Node k v)) (Maybe (Node k v))))
(case [?left ?right]
[#.None _]
@@ -411,7 +405,7 @@
(case [(get@ #color left) (get@ #color right)]
[#Red #Red]
(do maybe.monad
- [fused (prepend (get@ #right left) (get@ #right right))]
+ [fused (prepended (get@ #right left) (get@ #right right))]
(case (get@ #color fused)
#Red
(in (red (get@ #key fused)
@@ -438,19 +432,19 @@
(#.Some (red (get@ #key left)
(get@ #value left)
(get@ #left left)
- (prepend (get@ #right left)
- ?right)))
+ (prepended (get@ #right left)
+ ?right)))
[#Black #Red]
(#.Some (red (get@ #key right)
(get@ #value right)
- (prepend ?left
- (get@ #left right))
+ (prepended ?left
+ (get@ #left right))
(get@ #right right)))
[#Black #Black]
(do maybe.monad
- [fused (prepend (get@ #right left) (get@ #left right))]
+ [fused (prepended (get@ #right left) (get@ #left right))]
(case (get@ #color fused)
#Red
(in (red (get@ #key fused)
@@ -490,8 +484,8 @@
(let [root_key (get@ #key root)
root_val (get@ #value root)]
(if (_\= root_key key)
- [(prepend (get@ #left root)
- (get@ #right root))
+ [(prepended (get@ #left root)
+ (get@ #right root))
#1]
(let [go_left? (_\< root_key key)]
(case (recur (if go_left?
@@ -530,7 +524,7 @@
dict)
(#.Some root)
- (set@ #root (#.Some (blacken root)) dict)
+ (set@ #root (#.Some (blackened root)) dict)
)))
(def: #export (update key transform dict)
diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux
index ee500594b..a584f9363 100644
--- a/stdlib/source/library/lux/data/collection/list.lux
+++ b/stdlib/source/library/lux/data/collection/list.lux
@@ -51,6 +51,7 @@
xs))
(def: #export (only keep? xs)
+ {#.doc (doc "A list with only values that satisfy the predicate.")}
(All [a]
(-> (Predicate a) (List a) (List a)))
(case xs
@@ -152,16 +153,16 @@
(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."}
+(def: #export (chunk size list)
+ {#.doc "Segment the list in chunks of the given size."}
(All [a] (-> Nat (List a) (List (List a))))
- (case xs
+ (case list
+ #.End
#.End
- (list)
_
- (let [[pre post] (split n xs)]
- (#.Item pre (chunk n post)))))
+ (let [[pre post] (split size list)]
+ (#.Item pre (chunk size post)))))
(def: #export (repeat n x)
{#.doc "A list of the value x, repeated n times."}
@@ -234,7 +235,7 @@
(all check xs')))))
(def: #export (find predicate xs)
- {#.doc "Returns the first value in the list for which the predicate is #1."}
+ {#.doc "Yields the first value in the list that satisfies the predicate."}
(All [a]
(-> (Predicate a) (List a) (Maybe a)))
(..one (function (_ value)
@@ -374,6 +375,7 @@
(def: join (|>> reverse (fold compose identity))))
(def: #export (sort < xs)
+ {#.doc (doc "A list ordered by a comparison function.")}
(All [a] (-> (-> a a Bit) (List a) (List a)))
(case xs
#.End
@@ -418,8 +420,8 @@
(#.Item x xs')
(#.Some <side>)))]
- [head a x "Returns the first element of a list."]
- [tail (List a) xs' "For a list of size N, returns the N-1 elements after the first one."]
+ [head a x "Yields the first element of a list."]
+ [tail (List a) xs' "For a list of size N, yields the N-1 elements after the first one."]
)
(def: #export (indices size)
@@ -433,7 +435,7 @@
(-> Text Code)
[["" 0 0] (#.Identifier "" name)])
-(def: (nat@encode value)
+(def: (nat\encode value)
(-> Nat Text)
(loop [input value
output ""]
@@ -459,13 +461,14 @@
{#.doc (doc "Create list zippers with the specified number of input lists."
(def: #export zipped/2 (zipped 2))
(def: #export zipped/3 (zipped 3))
+ (zipped/3 xs ys zs)
((zipped 3) xs ys zs))}
(case tokens
(^ (list [_ (#.Nat num_lists)]))
(if (n.> 0 num_lists)
(let [(^open ".") ..functor
indices (..indices num_lists)
- type_vars (: (List Code) (map (|>> nat@encode identifier$) indices))
+ type_vars (: (List Code) (map (|>> nat\encode identifier$) indices))
zipped_type (` (All [(~+ type_vars)]
(-> (~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var)))))
type_vars))
@@ -473,7 +476,7 @@
vars+lists (|> indices
(map inc)
(map (function (_ idx)
- (let [base (nat@encode idx)]
+ (let [base (nat\encode idx)]
[(identifier$ base)
(identifier$ ("lux text concat" base "'"))]))))
pattern (` [(~+ (map (function (_ [v vs]) (` (#.Item (~ v) (~ vs))))
@@ -503,6 +506,7 @@
{#.doc (doc "Create list zippers with the specified number of input lists."
(def: #export zipped_with/2 (zipped_with 2))
(def: #export zipped_with/3 (zipped_with 3))
+ (zipped_with/2 + xs ys)
((zipped_with 2) + xs ys))}
(case tokens
(^ (list [_ (#.Nat num_lists)]))
@@ -511,7 +515,7 @@
indices (..indices num_lists)
g!return_type (identifier$ "0return_type0")
g!func (identifier$ "0func0")
- type_vars (: (List Code) (map (|>> nat@encode identifier$) indices))
+ type_vars (: (List Code) (map (|>> nat\encode identifier$) indices))
zipped_type (` (All [(~+ type_vars) (~ g!return_type)]
(-> (-> (~+ type_vars) (~ g!return_type))
(~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var)))))
@@ -520,7 +524,7 @@
vars+lists (|> indices
(map inc)
(map (function (_ idx)
- (let [base (nat@encode idx)]
+ (let [base (nat\encode idx)]
[(identifier$ base)
(identifier$ ("lux text concat" base "'"))]))))
pattern (` [(~+ (map (function (_ [v vs]) (` (#.Item (~ v) (~ vs))))
@@ -559,8 +563,8 @@
(last xs')))
(def: #export (inits xs)
- {#.doc (doc "For a list of size N, returns the first N-1 elements."
- "Empty lists will result in a #.None value being returned instead.")}
+ {#.doc (doc "For a list of size N, yields the first N-1 elements."
+ "Will yield a #.None for empty lists.")}
(All [a] (-> (List a) (Maybe (List a))))
(case xs
#.End
@@ -578,11 +582,13 @@
(#.Some (#.Item x tail)))
))
-(def: #export (concat xss)
+(def: #export concat
+ {#.doc (doc "The sequential combination of all the lists.")}
(All [a] (-> (List (List a)) (List a)))
- (\ ..monad join xss))
+ (\ ..monad join))
(implementation: #export (with monad)
+ {#.doc (doc "Enhances a monad with List functionality.")}
(All [M] (-> (Monad M) (Monad (All [a] (M (List a))))))
(def: &functor (functor.compose (get@ #monad.&functor monad) ..functor))
@@ -600,6 +606,7 @@
(in (concat lla)))))
(def: #export (lift monad)
+ {#.doc (doc "Wraps a monadic value with List machinery.")}
(All [M a] (-> (Monad M) (-> (M a) (M (List a)))))
(\ monad map (\ ..monad in)))
diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux
index 5fc4b333d..8a0b6d08b 100644
--- a/stdlib/source/library/lux/data/collection/queue.lux
+++ b/stdlib/source/library/lux/data/collection/queue.lux
@@ -12,6 +12,7 @@
["n" nat]]]]])
(type: #export (Queue a)
+ {#.doc (doc "A first-in, first-out sequential data-structure.")}
{#front (List a)
#rear (List a)})
@@ -31,6 +32,7 @@
(list\compose front (list.reverse rear))))
(def: #export peek
+ {#.doc (doc "Yields the first value in the queue, if any.")}
(All [a] (-> (Queue a) (Maybe a)))
(|>> (get@ #front) list.head))
diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux
index a53c7fb0e..b5bbcbe30 100644
--- a/stdlib/source/library/lux/data/collection/row.lux
+++ b/stdlib/source/library/lux/data/collection/row.lux
@@ -62,7 +62,7 @@
(def: full_node_size
Nat
- (i64.left_shift branching_exponent 1))
+ (i64.left_shifted branching_exponent 1))
(def: branch_idx_mask
Nat
@@ -81,8 +81,8 @@
(if (n.< full_node_size row_size)
0
(|> (dec row_size)
- (i64.right_shift branching_exponent)
- (i64.left_shift branching_exponent))))
+ (i64.right_shifted branching_exponent)
+ (i64.left_shifted branching_exponent))))
(def: (new_path level tail)
(All [a] (-> Level (Base a) (Node a)))
@@ -99,7 +99,7 @@
(def: (push_tail size level tail parent)
(All [a] (-> Nat Level (Base a) (Hierarchy a) (Hierarchy a)))
- (let [sub_idx (branch_idx (i64.right_shift level (dec size)))
+ (let [sub_idx (branch_idx (i64.right_shifted level (dec size)))
## If we're currently on a bottom node
sub_node (if (n.= branching_exponent level)
## Just add the tail to it
@@ -128,7 +128,7 @@
(def: (put' level idx val hierarchy)
(All [a] (-> Level Index a (Hierarchy a) (Hierarchy a)))
- (let [sub_idx (branch_idx (i64.right_shift level idx))]
+ (let [sub_idx (branch_idx (i64.right_shifted level idx))]
(case (array.read sub_idx hierarchy)
(#.Some (#Hierarchy sub_node))
(|> (array.clone hierarchy)
@@ -146,7 +146,7 @@
(def: (pop_tail size level hierarchy)
(All [a] (-> Nat Level (Hierarchy a) (Maybe (Hierarchy a))))
- (let [sub_idx (branch_idx (i64.right_shift level (n.- 2 size)))]
+ (let [sub_idx (branch_idx (i64.right_shifted level (n.- 2 size)))]
(cond (n.= 0 sub_idx)
#.None
@@ -183,6 +183,7 @@
#.End))))
(type: #export (Row a)
+ {#.doc (doc "A sequential data-structure with fast random access.")}
{#level Level
#size Nat
#root (Hierarchy a)
@@ -211,8 +212,8 @@
## Otherwise, push tail into the tree
## --------------------------------------------------------
## Will the root experience an overflow with this addition?
- (|> (if (n.> (i64.left_shift (get@ #level row) 1)
- (i64.right_shift branching_exponent row_size))
+ (|> (if (n.> (i64.left_shifted (get@ #level row) 1)
+ (i64.right_shifted branching_exponent row_size))
## If so, a brand-new root must be established, that is
## 1-level taller.
(|> row
@@ -241,6 +242,7 @@
(exception: base_was_not_found)
(def: #export (within_bounds? row idx)
+ {#.doc (doc "Determines whether the index is within the bounds of the row.")}
(All [a] (-> (Row a) Nat Bit))
(n.< (get@ #size row) idx))
@@ -252,7 +254,7 @@
(loop [level (get@ #level row)
hierarchy (get@ #root row)]
(case [(n.> branching_exponent level)
- (array.read (branch_idx (i64.right_shift level idx)) hierarchy)]
+ (array.read (branch_idx (i64.right_shifted level idx)) hierarchy)]
[#1 (#.Some (#Hierarchy sub))]
(recur (level_down level) sub)
@@ -319,8 +321,8 @@
[new_tail (base_for (n.- 2 row_size) row)
#let [[level' root'] (let [init_level (get@ #level row)]
(loop [level init_level
- root (maybe.default (new_hierarchy [])
- (pop_tail row_size init_level (get@ #root row)))]
+ root (maybe.else (new_hierarchy [])
+ (pop_tail row_size init_level (get@ #root row)))]
(if (n.> branching_exponent level)
(case [(array.read 1 root) (array.read 0 root)]
[#.None (#.Some (#Hierarchy sub_node))]
@@ -358,7 +360,7 @@
(syntax: #export (row {elems (p.some s.any)})
{#.doc (doc "Row literals."
- (row +10 +20 +30 +40))}
+ (row 12 34 56 78 90))}
(in (list (` (..of_list (list (~+ elems)))))))
(implementation: (node_equivalence Equivalence<a>)
diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux
index d36ca16c4..4105e22e5 100644
--- a/stdlib/source/library/lux/data/collection/sequence.lux
+++ b/stdlib/source/library/lux/data/collection/sequence.lux
@@ -104,6 +104,7 @@
(//.pending [x (unfold step next)])))
(def: #export (only predicate sequence)
+ {#.doc (doc "A new sequence only with items that satisfy the predicate.")}
(All [a] (-> (-> a Bit) (Sequence a) (Sequence a)))
(let [[head tail] (//.run sequence)]
(if (predicate head)
diff --git a/stdlib/source/library/lux/data/collection/set.lux b/stdlib/source/library/lux/data/collection/set.lux
index 27049802d..6c0c58a65 100644
--- a/stdlib/source/library/lux/data/collection/set.lux
+++ b/stdlib/source/library/lux/data/collection/set.lux
@@ -16,6 +16,8 @@
["#" dictionary (#+ Dictionary)]])
(type: #export (Set a)
+ {#.doc (doc "An un-ordered data-structure with unique items."
+ "This means there is no repetition/duplication among the items.")}
(Dictionary a Any))
(def: #export member_hash
diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux
index 155217b81..fdbbe7b1b 100644
--- a/stdlib/source/library/lux/data/collection/set/multi.lux
+++ b/stdlib/source/library/lux/data/collection/set/multi.lux
@@ -57,7 +57,7 @@
(def: #export (multiplicity set elem)
(All [a] (-> (Set a) a Nat))
- (|> set :representation (dictionary.get elem) (maybe.default 0)))
+ (|> set :representation (dictionary.get elem) (maybe.else 0)))
(def: #export to_list
(All [a] (-> (Set a) (List a)))
diff --git a/stdlib/source/library/lux/data/collection/stack.lux b/stdlib/source/library/lux/data/collection/stack.lux
index 53b608c2c..3f720d9ac 100644
--- a/stdlib/source/library/lux/data/collection/stack.lux
+++ b/stdlib/source/library/lux/data/collection/stack.lux
@@ -13,6 +13,8 @@
(abstract: #export (Stack a)
(List a)
+ {#.doc (doc "A first-in, last-out sequential data-structure.")}
+
(def: #export empty
Stack
(:abstraction (list)))
@@ -26,6 +28,7 @@
(|>> :representation //.empty?))
(def: #export (peek stack)
+ {#.doc (doc "Yields the top value in the stack, if any.")}
(All [a] (-> (Stack a) (Maybe a)))
(case (:representation stack)
#.End
diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux
index 7a14946c5..23a957fb7 100644
--- a/stdlib/source/library/lux/data/collection/tree.lux
+++ b/stdlib/source/library/lux/data/collection/tree.lux
@@ -17,14 +17,16 @@
["." code]]]])
(type: #export (Tree a)
+ {#.doc (doc "A generic tree data-structure.")}
{#value a
#children (List (Tree a))})
-(def: #export (flatten tree)
+(def: #export (flat tree)
+ {#.doc (doc "All the leaf values of the tree, in order.")}
(All [a] (-> (Tree a) (List a)))
(|> tree
(get@ #children)
- (list\map flatten)
+ (list\map flat)
list\join
(#.Item (get@ #value tree))))
@@ -49,16 +51,16 @@
<>.rec
<>.some
<code>.record
- (<>.default (list))
+ (<>.else (list))
(<>.and <code>.any)))
(syntax: #export (tree {root tree^})
{#.doc (doc "Tree literals."
(: (Tree Nat)
- (tree 10
- {20 {}
- 30 {}
- 40 {}})))}
+ (tree 12
+ {34 {}
+ 56 {}
+ 78 {90 {}}})))}
(in (list (` (~ (loop [[value children] root]
(` {#value (~ value)
#children (list (~+ (list\map recur children)))})))))))
diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux
index 68cf97171..325d94db0 100644
--- a/stdlib/source/library/lux/data/color.lux
+++ b/stdlib/source/library/lux/data/color.lux
@@ -79,8 +79,8 @@
(def: (hash value)
(let [[r g b] (:representation value)]
($_ i64.or
- (i64.left_shift 16 r)
- (i64.left_shift 8 g)
+ (i64.left_shifted 16 r)
+ (i64.left_shifted 8 g)
b))))
(def: #export black
diff --git a/stdlib/source/library/lux/data/color/named.lux b/stdlib/source/library/lux/data/color/named.lux
index 8eb01d331..459ab6db8 100644
--- a/stdlib/source/library/lux/data/color/named.lux
+++ b/stdlib/source/library/lux/data/color/named.lux
@@ -1,16 +1,37 @@
(.module:
[library
[lux #*
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text
+ ["%" format (#+ format)]]]
+ [macro
+ ["." syntax (#+ syntax:)]
+ ["." code]]
[math
[number (#+ hex)]]]]
["." // (#+ Color)])
+(syntax: (documentation {<red> <code>.text}
+ {<green> <code>.text}
+ {<blue> <code>.text}
+ {<name> <code>.local_identifier})
+ (|> <name>
+ (text.replace_all "_" " ")
+ (format <red> <green> <blue> " | ")
+ code.text
+ list
+ in))
+
(template [<red> <green> <blue> <name>]
- [(def: #export <name>
- Color
- (//.of_rgb {#//.red (hex <red>)
- #//.green (hex <green>)
- #//.blue (hex <blue>)}))]
+ [(`` (def: #export <name>
+ {#.doc (doc (~~ (..documentation <red> <green> <blue> <name>)))}
+ Color
+ (//.of_rgb {#//.red (hex <red>)
+ #//.green (hex <green>)
+ #//.blue (hex <blue>)})))]
["F0" "F8" "FF" alice_blue]
["FA" "EB" "D7" antique_white]
diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux
index b12e9f2e1..b2464a488 100644
--- a/stdlib/source/library/lux/data/format/binary.lux
+++ b/stdlib/source/library/lux/data/format/binary.lux
@@ -33,16 +33,20 @@
(|>> (n.* i64.bits_per_byte) i64.mask))
(type: #export Mutation
+ {#.doc (doc "A mutation of binary data, tracking where in the data to transform.")}
(-> [Offset Binary] [Offset Binary]))
(type: #export Specification
+ {#.doc (doc "A description of how to transform binary data.")}
[Size Mutation])
(def: #export no_op
+ {#.doc (doc "A specification for empty binary data.")}
Specification
[0 function.identity])
(def: #export (instance [size mutation])
+ {#.doc (doc "Given a specification of how to construct binary data, yields a binary blob that matches it.")}
(-> Specification Binary)
(|> size binary.create [0] mutation product.right))
@@ -57,9 +61,11 @@
(|>> mutL mutR)]))
(type: #export (Writer a)
+ {#.doc (doc "An operation that knows how to write information into a binary blob.")}
(-> a Specification))
(def: #export (run writer value)
+ {#.doc (doc "Yields a binary blob with all the information written to it.")}
(All [a] (-> (Writer a) a Binary))
(..instance (writer value)))
@@ -104,6 +110,7 @@
(\ ..monoid compose (pre preV) (post postV))))
(def: #export (rec body)
+ {#.doc (doc "A combinator for recursive writers.")}
(All [a] (-> (-> (Writer a) (Writer a)) (Writer a)))
(function (recur value)
(body recur value)))
@@ -129,6 +136,7 @@
(|>> frac.to_bits ..bits/64))
(def: #export (segment size)
+ {#.doc (doc "Writes at most 'size' bytes of an input binary blob.")}
(-> Nat (Writer Binary))
(function (_ value)
[size
diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux
index f2f991da2..a3ff932e7 100644
--- a/stdlib/source/library/lux/data/format/css.lux
+++ b/stdlib/source/library/lux/data/format/css.lux
@@ -58,9 +58,9 @@
(list))]
(|> (list& ["font-family" (get@ #/font.family font)]
["src" (format "url(" (get@ #/font.source font) ")")]
- ["font-stretch" (|> font (get@ #/font.stretch) (maybe.default /value.normal_stretch) /value.value)]
- ["font-style" (|> font (get@ #/font.style) (maybe.default /value.normal_style) /value.value)]
- ["font-weight" (|> font (get@ #/font.weight) (maybe.default /value.normal_weight) /value.value)]
+ ["font-stretch" (|> font (get@ #/font.stretch) (maybe.else /value.normal_stretch) /value.value)]
+ ["font-style" (|> font (get@ #/font.style) (maybe.else /value.normal_style) /value.value)]
+ ["font-weight" (|> font (get@ #/font.weight) (maybe.else /value.normal_weight) /value.value)]
with_unicode)
(list\map (function (_ [property value])
(format property ": " value ";")))
diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux
index e49c06687..cff3affb0 100644
--- a/stdlib/source/library/lux/data/format/css/value.lux
+++ b/stdlib/source/library/lux/data/format/css/value.lux
@@ -1025,8 +1025,8 @@
(Value Filter))
(|> (list (:representation horizontal)
(:representation vertical)
- (|> blur (maybe.default ..default_shadow_length) :representation)
- (|> spread (maybe.default ..default_shadow_length) :representation)
+ (|> blur (maybe.else ..default_shadow_length) :representation)
+ (|> spread (maybe.else ..default_shadow_length) :representation)
(:representation color))
(text.join_with " ")
(list)
@@ -1101,8 +1101,8 @@
(list))]
(|> (list& (:representation horizontal)
(:representation vertical)
- (|> blur (maybe.default ..default_shadow_length) :representation)
- (|> spread (maybe.default ..default_shadow_length) :representation)
+ (|> blur (maybe.else ..default_shadow_length) :representation)
+ (|> spread (maybe.else ..default_shadow_length) :representation)
(:representation color)
with_inset)
(text.join_with " ")
@@ -1196,7 +1196,7 @@
(-> (List (List (Maybe (Value Grid)))) (Value Grid_Template))
(let [empty (: (Value Grid)
(:abstraction "."))]
- (|>> (list\map (|>> (list\map (|>> (maybe.default empty)
+ (|>> (list\map (|>> (list\map (|>> (maybe.else empty)
:representation))
(text.join_with ..grid_column_separator)
(text.enclosed ["'" "'"])))
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 419096680..6bbef9f5b 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -188,7 +188,7 @@
(-> Attributes (Maybe Script) Meta)
(|> inline
(maybe\map js.code)
- (maybe.default "")
+ (maybe.else "")
(..raw "script" attributes)))
(def: #export text
@@ -316,7 +316,7 @@
(-> Attributes Media (Maybe Content) Element)
(..tag <tag> attributes
(|> on_unsupported
- (maybe.default (..text ""))
+ (maybe.else (..text ""))
(..and media))))]
[audio "audio"]
@@ -357,7 +357,7 @@
[(def: #export (<name> attributes content)
(-> Attributes (Maybe Content) <type>)
(|> content
- (maybe.default (..text ""))
+ (maybe.else (..text ""))
(..tag <tag> attributes)))]
[text_area "textarea" Input]
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index 8f3293e56..daac4e81d 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -184,11 +184,11 @@
(and (n.= (row.size xs) (row.size ys))
(list\fold (function (_ idx prev)
(and prev
- (maybe.default #0
- (do maybe.monad
- [x' (row.nth idx xs)
- y' (row.nth idx ys)]
- (in (= x' y'))))))
+ (maybe.else #0
+ (do maybe.monad
+ [x' (row.nth idx xs)
+ y' (row.nth idx ys)]
+ (in (= x' y'))))))
#1
(list.indices (row.size xs))))
@@ -241,22 +241,22 @@
Text
<token>)]
- ["," separator]
+ ["," value_separator]
[":" entry_separator]
- ["[" open_array]
- ["]" close_array]
+ ["[" array_start]
+ ["]" array_end]
- ["{" open_object]
- ["}" close_object]
+ ["{" object_start]
+ ["}" object_end]
)
(def: (array_format format)
(-> (-> JSON Text) (-> Array Text))
(|>> (row\map format)
row.to_list
- (text.join_with ..separator)
- (text.enclosed [..open_array ..close_array])))
+ (text.join_with ..value_separator)
+ (text.enclosed [..array_start ..array_end])))
(def: (kv_format format [key value])
(-> (-> JSON Text) (-> [String JSON] Text))
@@ -270,8 +270,8 @@
(-> (-> JSON Text) (-> Object Text))
(|>> dictionary.entries
(list\map (..kv_format format))
- (text.join_with ..separator)
- (text.enclosed [..open_object ..close_object])))
+ (text.join_with ..value_separator)
+ (text.enclosed [..object_start ..object_end])))
(def: #export (format json)
(-> JSON Text)
@@ -295,11 +295,11 @@
(Parser Text)
(<text>.some <text>.space))
-(def: separator_parser
+(def: value_separator_parser
(Parser [Text Any Text])
($_ <>.and
..space_parser
- (<text>.this ..separator)
+ (<text>.this ..value_separator)
..space_parser))
(def: null_parser
@@ -330,16 +330,16 @@
(do {! <>.monad}
[signed? (<>.parses? (<text>.this "-"))
digits (<text>.many <text>.decimal)
- decimals (<>.default "0"
- (do !
- [_ (<text>.this ".")]
- (<text>.many <text>.decimal)))
- exp (<>.default ""
- (do !
- [mark (<text>.one_of "eE")
- signed?' (<>.parses? (<text>.this "-"))
- offset (<text>.many <text>.decimal)]
- (in ($_ text\compose mark (if signed?' "-" "") offset))))]
+ decimals (<>.else "0"
+ (do !
+ [_ (<text>.this ".")]
+ (<text>.many <text>.decimal)))
+ exp (<>.else ""
+ (do !
+ [mark (<text>.one_of "eE")
+ signed?' (<>.parses? (<text>.this "-"))
+ offset (<text>.many <text>.decimal)]
+ (in ($_ text\compose mark (if signed?' "-" "") offset))))]
(case (f\decode ($_ text\compose (if signed? "-" "") digits "." decimals exp))
(#try.Failure message)
(<>.failure message)
@@ -395,13 +395,13 @@
(do <>.monad
[_ (<text>.this <open>)
_ space_parser
- elems (<>.separated_by ..separator_parser <elem_parser>)
+ elems (<>.separated_by ..value_separator_parser <elem_parser>)
_ space_parser
_ (<text>.this <close>)]
(in (<prep> elems))))]
- [array_parser Array ..open_array ..close_array json_parser row.of_list]
- [object_parser Object ..open_object ..close_object (kv_parser json_parser) (dictionary.of_list text.hash)]
+ [array_parser Array ..array_start ..array_end json_parser row.of_list]
+ [object_parser Object ..object_start ..object_end (kv_parser json_parser) (dictionary.of_list text.hash)]
)
(def: json_parser
diff --git a/stdlib/source/library/lux/data/lazy.lux b/stdlib/source/library/lux/data/lazy.lux
index 016a5a18a..d3283cfc8 100644
--- a/stdlib/source/library/lux/data/lazy.lux
+++ b/stdlib/source/library/lux/data/lazy.lux
@@ -20,7 +20,7 @@
(abstract: #export (Lazy a)
(-> [] a)
- (def: (freeze' generator)
+ (def: (lazy' generator)
(All [a] (-> (-> [] a) (Lazy a)))
(let [cache (atom.atom #.None)]
(:abstraction (function (_ _)
@@ -33,36 +33,37 @@
(exec (io.run (atom.compare_and_swap _ (#.Some value) cache))
value)))))))
- (def: #export (thaw l_value)
+ (def: #export (value l_value)
(All [a] (-> (Lazy a) a))
((:representation l_value) [])))
-(syntax: #export (freeze expr)
+(syntax: #export (lazy expr)
(with_gensyms [g!_]
- (in (list (` ((~! freeze') (function ((~ g!_) (~ g!_)) (~ expr))))))))
+ (in (list (` ((~! lazy') (function ((~ g!_) (~ g!_)) (~ expr))))))))
(implementation: #export (equivalence (^open "_\."))
(All [a] (-> (Equivalence a) (Equivalence (Lazy a))))
(def: (= left right)
- (_\= (..thaw left) (..thaw right))))
+ (_\= (..value left)
+ (..value right))))
(implementation: #export functor
(Functor Lazy)
(def: (map f fa)
- (freeze (f (thaw fa)))))
+ (lazy (f (value fa)))))
(implementation: #export apply
(Apply Lazy)
(def: &functor ..functor)
(def: (apply ff fa)
- (freeze ((thaw ff) (thaw fa)))))
+ (lazy ((value ff) (value fa)))))
(implementation: #export monad
(Monad Lazy)
(def: &functor ..functor)
- (def: in (|>> freeze))
- (def: join thaw))
+ (def: in (|>> lazy))
+ (def: join value))
diff --git a/stdlib/source/library/lux/data/maybe.lux b/stdlib/source/library/lux/data/maybe.lux
index 155254f2e..b0cf1960e 100644
--- a/stdlib/source/library/lux/data/maybe.lux
+++ b/stdlib/source/library/lux/data/maybe.lux
@@ -114,14 +114,14 @@
(All [M a] (-> (Monad M) (-> (M a) (M (Maybe a)))))
(\ monad map (\ ..monad in)))
-(macro: #export (default tokens state)
+(macro: #export (else tokens state)
{#.doc (doc "Allows you to provide a default value that will be used"
"if a (Maybe x) value turns out to be #.None."
"Note: the expression for the default value will not be computed if the base computation succeeds."
- (default +20 (#.Some +10))
+ (else +20 (#.Some +10))
"=>"
+10
- (default +20 #.None)
+ (else +20 #.None)
"=>"
+20)}
(case tokens
@@ -135,11 +135,11 @@
(~ else))))]))
_
- (#.Left "Wrong syntax for default")))
+ (#.Left "Wrong syntax for else")))
(def: #export assume
(All [a] (-> (Maybe a) a))
- (|>> (..default (undefined))))
+ (|>> (..else (undefined))))
(def: #export (to_list value)
(All [a] (-> (Maybe a) (List a)))
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index d9abb0f48..b60a1f797 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -191,7 +191,7 @@
(def: #export (replace_once pattern replacement template)
(-> Text Text Text Text)
- (<| (maybe.default template)
+ (<| (maybe.else template)
(do maybe.monad
[[pre post] (..split_with pattern template)]
(in ($_ "lux text concat" pre replacement post)))))
@@ -289,7 +289,7 @@
(if (n.< length idx)
(recur (inc idx)
(|> hash
- (i64.left_shift 5)
+ (i64.left_shifted 5)
(n.- hash)
(n.+ ("lux text char" idx input))))
hash))))))
@@ -333,7 +333,7 @@
_
false))))
-(def: #export (lower_case value)
+(def: #export (lower_cased value)
(-> Text Text)
(for {@.old
(:as Text
@@ -356,7 +356,7 @@
(:as Text
("ruby object do" "downcase" value))}))
-(def: #export (upper_case value)
+(def: #export (upper_cased value)
(-> Text Text)
(for {@.old
(:as Text
diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux
index 691fccad7..ccbb1417a 100644
--- a/stdlib/source/library/lux/data/text/regex.lux
+++ b/stdlib/source/library/lux/data/text/regex.lux
@@ -220,7 +220,7 @@
quantifier (<text>.one_of "?*+")]
(case quantifier
"?"
- (in (` (<>.default "" (~ base))))
+ (in (` (<>.else "" (~ base))))
"*"
(in (` ((~! join_text^) (<>.some (~ base)))))
@@ -498,6 +498,6 @@
(with_gensyms [g!temp]
(in (list& (` (^multi (~ g!temp)
{((~! <text>.run) (..regex (~ (code.text pattern))) (~ g!temp))
- (#try.Success (~ (maybe.default g!temp bindings)))}))
+ (#try.Success (~ (maybe.else g!temp bindings)))}))
body
branches))))
diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux
index 24ddb34e2..e67eb3ae3 100644
--- a/stdlib/source/library/lux/data/text/unicode/block.lux
+++ b/stdlib/source/library/lux/data/text/unicode/block.lux
@@ -68,7 +68,7 @@
(def: &equivalence ..equivalence)
(def: (hash value)
- (i64.or (i64.left_shift 32 (..start value))
+ (i64.or (i64.left_shifted 32 (..start value))
(..end value))))
(template [<name> <start> <end>]
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux
index 2e6b46b4f..669bcbad3 100644
--- a/stdlib/source/library/lux/debug.lux
+++ b/stdlib/source/library/lux/debug.lux
@@ -559,7 +559,7 @@
(syntax: #export (here {targets (: (<code>.Parser (List Target))
(|> ..target
<>.some
- (<>.default (list))))})
+ (<>.else (list))))})
(do {! meta.monad}
[location meta.location
locals meta.locals
diff --git a/stdlib/source/library/lux/ffi.js.lux b/stdlib/source/library/lux/ffi.js.lux
index 81ecf4d82..0b641a3a6 100644
--- a/stdlib/source/library/lux/ffi.js.lux
+++ b/stdlib/source/library/lux/ffi.js.lux
@@ -186,9 +186,9 @@
(def: import
(Parser Import)
(<>.or (<>.and ..class_declaration
- (<>.default ["" (list)]
- (<code>.tuple (<>.and <code>.text
- (<>.some member)))))
+ (<>.else ["" (list)]
+ (<code>.tuple (<>.and <code>.text
+ (<>.some member)))))
(<code>.form ..common_method)))
(def: (with_io with? without)
@@ -280,7 +280,7 @@
(#Method method)
(case method
(#Static [method alias inputsT io? try? outputT])
- (..make_function (qualify (maybe.default method alias))
+ (..make_function (qualify (maybe.else method alias))
g!temp
(%.format real_class "." method)
inputsT
@@ -290,7 +290,7 @@
(#Virtual [method alias inputsT io? try? outputT])
(let [g!inputs (input_variables inputsT)]
- (` (def: ((~ (qualify (maybe.default method alias)))
+ (` (def: ((~ (qualify (maybe.else method alias)))
[(~+ (list\map product.right g!inputs))]
(~ g!object))
(All [(~+ class_parameters)]
@@ -310,7 +310,7 @@
members)))))
(#Function [name alias inputsT io? try? outputT])
- (in (list (..make_function (code.local_identifier (maybe.default name alias))
+ (in (list (..make_function (code.local_identifier (maybe.else name alias))
g!temp
name
inputsT
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index ba8499262..c5080d912 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -713,11 +713,11 @@
(Parser (List Annotation))
(do <>.monad
[anns?? (<>.maybe ..annotations^')]
- (in (maybe.default (list) anns??))))
+ (in (maybe.else (list) anns??))))
(def: (throws_decl^ type_vars)
(-> (List (Type Var)) (Parser (List (Type Class))))
- (<| (<>.default (list))
+ (<| (<>.else (list))
(do <>.monad
[_ (<code>.this! (' #throws))]
(<code>.tuple (<>.some (..class^ type_vars))))))
@@ -725,7 +725,7 @@
(def: (method_decl^ type_vars)
(-> (List (Type Var)) (Parser [Member_Declaration MethodDecl]))
(<code>.form (do <>.monad
- [tvars (<>.default (list) ..vars^)
+ [tvars (<>.else (list) ..vars^)
#let [total_vars (list\compose tvars type_vars)]
name <code>.local_identifier
anns ..annotations^
@@ -783,7 +783,7 @@
(<code>.form (do <>.monad
[pm privacy_modifier^
strict_fp? (<>.parses? (<code>.this! (' #strict)))
- method_vars (<>.default (list) ..vars^)
+ method_vars (<>.else (list) ..vars^)
#let [total_vars (list\compose class_vars method_vars)]
[_ self_name arguments] (<code>.form ($_ <>.and
(<code>.this! (' new))
@@ -804,7 +804,7 @@
[pm privacy_modifier^
strict_fp? (<>.parses? (<code>.this! (' #strict)))
final? (<>.parses? (<code>.this! (' #final)))
- method_vars (<>.default (list) ..vars^)
+ method_vars (<>.else (list) ..vars^)
#let [total_vars (list\compose class_vars method_vars)]
[name self_name arguments] (<code>.form ($_ <>.and
<code>.local_identifier
@@ -824,7 +824,7 @@
(<code>.form (do <>.monad
[strict_fp? (<>.parses? (<code>.this! (' #strict)))
owner_class ..declaration^
- method_vars (<>.default (list) ..vars^)
+ method_vars (<>.else (list) ..vars^)
#let [total_vars (list\compose (product.right (parser.declaration owner_class))
method_vars)]
[name self_name arguments] (<code>.form ($_ <>.and
@@ -846,7 +846,7 @@
[pm privacy_modifier^
strict_fp? (<>.parses? (<code>.this! (' #strict)))
_ (<code>.this! (' #static))
- method_vars (<>.default (list) ..vars^)
+ method_vars (<>.else (list) ..vars^)
#let [total_vars method_vars]
[name arguments] (<code>.form (<>.and <code>.local_identifier
(..arguments^ total_vars)))
@@ -864,7 +864,7 @@
(<code>.form (do <>.monad
[pm privacy_modifier^
_ (<code>.this! (' #abstract))
- method_vars (<>.default (list) ..vars^)
+ method_vars (<>.else (list) ..vars^)
#let [total_vars method_vars]
[name arguments] (<code>.form (<>.and <code>.local_identifier
(..arguments^ total_vars)))
@@ -881,7 +881,7 @@
(<code>.form (do <>.monad
[pm privacy_modifier^
_ (<code>.this! (' #native))
- method_vars (<>.default (list) ..vars^)
+ method_vars (<>.else (list) ..vars^)
#let [total_vars method_vars]
[name arguments] (<code>.form (<>.and <code>.local_identifier
(..arguments^ total_vars)))
@@ -948,15 +948,15 @@
enum_members (<>.some <code>.local_identifier)]
(in (#EnumDecl enum_members))))
(<code>.form (do <>.monad
- [tvars (<>.default (list) ..vars^)
+ [tvars (<>.else (list) ..vars^)
_ (<code>.identifier! ["" "new"])
?alias import_member_alias^
#let [total_vars (list\compose owner_vars tvars)]
?prim_mode (<>.maybe primitive_mode^)
args (..import_member_args^ total_vars)
[io? try? maybe?] import_member_return_flags^]
- (in (#ConstructorDecl [{#import_member_mode (maybe.default #AutoPrM ?prim_mode)
- #import_member_alias (maybe.default "new" ?alias)
+ (in (#ConstructorDecl [{#import_member_mode (maybe.else #AutoPrM ?prim_mode)
+ #import_member_alias (maybe.else "new" ?alias)
#import_member_kind #VirtualIMK
#import_member_tvars tvars
#import_member_args args
@@ -969,7 +969,7 @@
[kind (: (Parser ImportMethodKind)
(<>.or (<code>.tag! ["" "static"])
(in [])))
- tvars (<>.default (list) ..vars^)
+ tvars (<>.else (list) ..vars^)
name <code>.local_identifier
?alias import_member_alias^
#let [total_vars (list\compose owner_vars tvars)]
@@ -977,8 +977,8 @@
args (..import_member_args^ total_vars)
[io? try? maybe?] import_member_return_flags^
return (..return^ total_vars)]
- (in (#MethodDecl [{#import_member_mode (maybe.default #AutoPrM ?prim_mode)
- #import_member_alias (maybe.default name ?alias)
+ (in (#MethodDecl [{#import_member_mode (maybe.else #AutoPrM ?prim_mode)
+ #import_member_alias (maybe.else name ?alias)
#import_member_kind kind
#import_member_tvars tvars
#import_member_args args
@@ -994,7 +994,7 @@
gtype (..type^ owner_vars)
maybe? (<>.parses? (<code>.this! (' #?)))
setter? (<>.parses? (<code>.this! (' #!)))]
- (in (#FieldAccessDecl {#import_field_mode (maybe.default #AutoPrM ?prim_mode)
+ (in (#FieldAccessDecl {#import_field_mode (maybe.else #AutoPrM ?prim_mode)
#import_field_name name
#import_field_static? static?
#import_field_maybe? maybe?
@@ -1204,10 +1204,10 @@
{#let [! <>.monad]}
{im inheritance_modifier^}
{[full_class_name class_vars] (\ ! map parser.declaration ..declaration^)}
- {super (<>.default $Object
- (class^ class_vars))}
- {interfaces (<>.default (list)
- (<code>.tuple (<>.some (class^ class_vars))))}
+ {super (<>.else $Object
+ (class^ class_vars))}
+ {interfaces (<>.else (list)
+ (<code>.tuple (<>.some (class^ class_vars))))}
{annotations ..annotations^}
{fields (<>.some (..field_decl^ class_vars))}
{methods (<>.some (..method_def^ class_vars))})
@@ -1260,8 +1260,8 @@
(syntax: #export (interface:
{#let [! <>.monad]}
{[full_class_name class_vars] (\ ! map parser.declaration ..declaration^)}
- {supers (<>.default (list)
- (<code>.tuple (<>.some (class^ class_vars))))}
+ {supers (<>.else (list)
+ (<code>.tuple (<>.some (class^ class_vars))))}
{annotations ..annotations^}
{members (<>.some (..method_decl^ class_vars))})
{#.doc (doc "Allows defining JVM interfaces."
@@ -1275,10 +1275,10 @@
(syntax: #export (object
{class_vars ..vars^}
- {super (<>.default $Object
- (class^ class_vars))}
- {interfaces (<>.default (list)
- (<code>.tuple (<>.some (class^ class_vars))))}
+ {super (<>.else $Object
+ (class^ class_vars))}
+ {interfaces (<>.else (list)
+ (<code>.tuple (<>.some (class^ class_vars))))}
{constructor_args (..constructor_args^ class_vars)}
{methods (<>.some ..overriden_method_def^)})
{#.doc (doc "Allows defining anonymous classes."
diff --git a/stdlib/source/library/lux/ffi.lua.lux b/stdlib/source/library/lux/ffi.lua.lux
index 7a4825ea7..c004b3145 100644
--- a/stdlib/source/library/lux/ffi.lua.lux
+++ b/stdlib/source/library/lux/ffi.lua.lux
@@ -1,8 +1,8 @@
(.module:
[library
[lux #*
- ["." meta]
["@" target]
+ ["." meta]
[abstract
[monad (#+ do)]]
[control
@@ -164,9 +164,9 @@
(def: import
($_ <>.or
(<>.and <code>.local_identifier
- (<>.default ["" (list)]
- (<code>.tuple (<>.and <code>.text
- (<>.some member)))))
+ (<>.else ["" (list)]
+ (<code>.tuple (<>.and <code>.text
+ (<>.some member)))))
(<code>.form ..common_method)
..constant
))
@@ -257,7 +257,7 @@
(#Method method)
(case method
(#Static [method alias inputsT io? try? outputT])
- (..make_function (qualify (maybe.default method alias))
+ (..make_function (qualify (maybe.else method alias))
g!temp
(` ("lua object get" (~ (code.text method))
(:as (..Object .Any) (~ imported))))
@@ -268,7 +268,7 @@
(#Virtual [method alias inputsT io? try? outputT])
(let [g!inputs (input_variables inputsT)]
- (` (def: ((~ (qualify (maybe.default method alias)))
+ (` (def: ((~ (qualify (maybe.else method alias)))
[(~+ (list\map product.right g!inputs))]
(~ g!object))
(-> [(~+ (list\map nilable_type inputsT))]
@@ -287,7 +287,7 @@
members)))))
(#Function [name alias inputsT io? try? outputT])
- (in (list (..make_function (code.local_identifier (maybe.default name alias))
+ (in (list (..make_function (code.local_identifier (maybe.else name alias))
g!temp
(` ("lua constant" (~ (code.text (text.replace_all "/" "." name)))))
inputsT
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 16ff216e4..119c1d091 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -589,7 +589,7 @@
(|> ..type_param^
<>.some
<code>.tuple
- (<>.default (list))))
+ (<>.else (list))))
(def: class_decl^
(Parser Class_Declaration)
@@ -638,7 +638,7 @@
(Parser (List Annotation))
(do <>.monad
[anns?? (<>.maybe ..annotations^')]
- (in (maybe.default (list) anns??))))
+ (in (maybe.else (list) anns??))))
(def: (throws_decl'^ type_vars)
(-> (List Type_Parameter) (Parser (List GenericType)))
@@ -650,7 +650,7 @@
(-> (List Type_Parameter) (Parser (List GenericType)))
(do <>.monad
[exs? (<>.maybe (throws_decl'^ type_vars))]
- (in (maybe.default (list) exs?))))
+ (in (maybe.else (list) exs?))))
(def: (method_decl^ type_vars)
(-> (List Type_Parameter) (Parser [Member_Declaration MethodDecl]))
@@ -883,8 +883,8 @@
?prim_mode (<>.maybe primitive_mode^)
args (..import_member_args^ total_vars)
[io? try? maybe?] import_member_return_flags^]
- (in (#ConstructorDecl [{#import_member_mode (maybe.default #AutoPrM ?prim_mode)
- #import_member_alias (maybe.default "new" ?alias)
+ (in (#ConstructorDecl [{#import_member_mode (maybe.else #AutoPrM ?prim_mode)
+ #import_member_alias (maybe.else "new" ?alias)
#import_member_kind #VirtualIMK
#import_member_tvars tvars
#import_member_args args
@@ -905,8 +905,8 @@
args (..import_member_args^ total_vars)
[io? try? maybe?] import_member_return_flags^
return (..generic_type^ total_vars)]
- (in (#MethodDecl [{#import_member_mode (maybe.default #AutoPrM ?prim_mode)
- #import_member_alias (maybe.default name ?alias)
+ (in (#MethodDecl [{#import_member_mode (maybe.else #AutoPrM ?prim_mode)
+ #import_member_alias (maybe.else name ?alias)
#import_member_kind kind
#import_member_tvars tvars
#import_member_args args
@@ -923,7 +923,7 @@
gtype (..generic_type^ owner_vars)
maybe? (<>.parses? (<code>.this! (' #?)))
setter? (<>.parses? (<code>.this! (' #!)))]
- (in (#FieldAccessDecl {#import_field_mode (maybe.default #AutoPrM ?prim_mode)
+ (in (#FieldAccessDecl {#import_field_mode (maybe.else #AutoPrM ?prim_mode)
#import_field_name name
#import_field_static? static?
#import_field_maybe? maybe?
@@ -1170,10 +1170,10 @@
{class_decl ..class_decl^}
{#let [full_class_name (product.left class_decl)]}
{#let [class_vars (product.right class_decl)]}
- {super (<>.default object_super_class
- (..super_class_decl^ class_vars))}
- {interfaces (<>.default (list)
- (<code>.tuple (<>.some (..super_class_decl^ class_vars))))}
+ {super (<>.else object_super_class
+ (..super_class_decl^ class_vars))}
+ {interfaces (<>.else (list)
+ (<code>.tuple (<>.some (..super_class_decl^ class_vars))))}
{annotations ..annotations^}
{fields (<>.some (..field_decl^ class_vars))}
{methods (<>.some (..method_def^ class_vars))})
@@ -1228,8 +1228,8 @@
(syntax: #export (interface:
{class_decl ..class_decl^}
{#let [class_vars (product.right class_decl)]}
- {supers (<>.default (list)
- (<code>.tuple (<>.some (..super_class_decl^ class_vars))))}
+ {supers (<>.else (list)
+ (<code>.tuple (<>.some (..super_class_decl^ class_vars))))}
{annotations ..annotations^}
{members (<>.some (..method_decl^ class_vars))})
{#.doc (doc "Allows defining JVM interfaces."
@@ -1245,10 +1245,10 @@
(syntax: #export (object
{class_vars (<code>.tuple (<>.some ..type_param^))}
- {super (<>.default object_super_class
- (..super_class_decl^ class_vars))}
- {interfaces (<>.default (list)
- (<code>.tuple (<>.some (..super_class_decl^ class_vars))))}
+ {super (<>.else object_super_class
+ (..super_class_decl^ class_vars))}
+ {interfaces (<>.else (list)
+ (<code>.tuple (<>.some (..super_class_decl^ class_vars))))}
{constructor_args (..constructor_args^ class_vars)}
{methods (<>.some ..overriden_method_def^)})
{#.doc (doc "Allows defining anonymous classes."
diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux
index c9a0a584c..a8f0a7f06 100644
--- a/stdlib/source/library/lux/ffi.php.lux
+++ b/stdlib/source/library/lux/ffi.php.lux
@@ -175,9 +175,9 @@
($_ <>.and
<code>.local_identifier
(<>.maybe ..alias)
- (<>.default ["" (list)]
- (<code>.tuple (<>.and <code>.text
- (<>.some member)))))
+ (<>.else ["" (list)]
+ (<code>.tuple (<>.and <code>.text
+ (<>.some member)))))
(<code>.form ..common_method)
..constant
))
@@ -240,10 +240,10 @@
(let [qualify (: (-> Text Code)
(function (_ member_name)
(|> format
- (text.replace_all "#" (maybe.default class alias))
+ (text.replace_all "#" (maybe.else class alias))
(text.replace_all "." member_name)
code.local_identifier)))
- g!type (code.local_identifier (maybe.default class alias))
+ g!type (code.local_identifier (maybe.else class alias))
class_import (` ("php constant" (~ (code.text class))))]
(in (list& (` (type: (~ g!type)
(..Object (primitive (~ (code.text class))))))
@@ -251,7 +251,7 @@
(case member
(#Field [static? field alias fieldT])
(if static?
- (` ((~! syntax:) ((~ (qualify (maybe.default field alias))))
+ (` ((~! syntax:) ((~ (qualify (maybe.else field alias))))
(\ (~! meta.monad) (~' in)
(list (` (.:as (~ (nullable_type fieldT))
("php constant" (~ (code.text (%.format class "::" field))))))))))
@@ -266,7 +266,7 @@
(#Method method)
(case method
(#Static [method alias inputsT io? try? outputT])
- (..make_function (qualify (maybe.default method alias))
+ (..make_function (qualify (maybe.else method alias))
g!temp
(` ("php object get" (~ (code.text method))
(:as (..Object .Any)
@@ -278,7 +278,7 @@
(#Virtual [method alias inputsT io? try? outputT])
(let [g!inputs (input_variables inputsT)]
- (` (def: ((~ (qualify (maybe.default method alias)))
+ (` (def: ((~ (qualify (maybe.else method alias)))
[(~+ (list\map product.right g!inputs))]
(~ g!object))
(-> [(~+ (list\map nullable_type inputsT))]
@@ -298,7 +298,7 @@
(#Function [name alias inputsT io? try? outputT])
(let [imported (` ("php constant" (~ (code.text name))))]
- (in (list (..make_function (code.local_identifier (maybe.default name alias))
+ (in (list (..make_function (code.local_identifier (maybe.else name alias))
g!temp
imported
inputsT
@@ -308,7 +308,7 @@
(#Constant [_ name alias fieldT])
(let [imported (` ("php constant" (~ (code.text name))))]
- (in (list (` ((~! syntax:) ((~ (code.local_identifier (maybe.default name alias))))
+ (in (list (` ((~! syntax:) ((~ (code.local_identifier (maybe.else name alias))))
(\ (~! meta.monad) (~' in)
(list (` (.:as (~ (nullable_type fieldT)) (~ imported))))))))))
)))
diff --git a/stdlib/source/library/lux/ffi.py.lux b/stdlib/source/library/lux/ffi.py.lux
index 436f1c729..5c05710a7 100644
--- a/stdlib/source/library/lux/ffi.py.lux
+++ b/stdlib/source/library/lux/ffi.py.lux
@@ -166,9 +166,9 @@
(def: import
(Parser Import)
(<>.or (<>.and <code>.local_identifier
- (<>.default ["" (list)]
- (<code>.tuple (<>.and <code>.text
- (<>.some member)))))
+ (<>.else ["" (list)]
+ (<code>.tuple (<>.and <code>.text
+ (<>.some member)))))
(<code>.form ..common_method)))
(def: (with_io with? without)
@@ -268,7 +268,7 @@
(#Method method)
(case method
(#Static [method alias inputsT io? try? outputT])
- (..make_function (qualify (maybe.default method alias))
+ (..make_function (qualify (maybe.else method alias))
g!temp
(` ("python object get" (~ (code.text method))
(:as (..Object .Any) (~ imported))))
@@ -279,7 +279,7 @@
(#Virtual [method alias inputsT io? try? outputT])
(let [g!inputs (input_variables inputsT)]
- (` (def: ((~ (qualify (maybe.default method alias)))
+ (` (def: ((~ (qualify (maybe.else method alias)))
[(~+ (list\map product.right g!inputs))]
(~ g!object))
(-> [(~+ (list\map noneable_type inputsT))]
@@ -298,7 +298,7 @@
members)))))
(#Function [name alias inputsT io? try? outputT])
- (in (list (..make_function (code.local_identifier (maybe.default name alias))
+ (in (list (..make_function (code.local_identifier (maybe.else name alias))
g!temp
(` ("python constant" (~ (code.text name))))
inputsT
diff --git a/stdlib/source/library/lux/ffi.rb.lux b/stdlib/source/library/lux/ffi.rb.lux
index d22138957..70c2f21be 100644
--- a/stdlib/source/library/lux/ffi.rb.lux
+++ b/stdlib/source/library/lux/ffi.rb.lux
@@ -177,9 +177,9 @@
($_ <>.and
<code>.local_identifier
(<>.maybe ..alias)
- (<>.default ["" (list)]
- (<code>.tuple (<>.and <code>.text
- (<>.some member)))))
+ (<>.else ["" (list)]
+ (<code>.tuple (<>.and <code>.text
+ (<>.some member)))))
(<code>.form ..common_method)
..constant
)))
@@ -233,10 +233,10 @@
(let [qualify (: (-> Text Code)
(function (_ member_name)
(|> format
- (text.replace_all "#" (maybe.default class alias))
+ (text.replace_all "#" (maybe.else class alias))
(text.replace_all "." member_name)
code.local_identifier)))
- g!type (code.local_identifier (maybe.default class alias))
+ g!type (code.local_identifier (maybe.else class alias))
module_import (: (List Code)
(case ?module
(#.Some module)
@@ -251,7 +251,7 @@
(case member
(#Field [static? field alias fieldT])
(if static?
- (` ((~! syntax:) ((~ (qualify (maybe.default field alias))))
+ (` ((~! syntax:) ((~ (qualify (maybe.else field alias))))
(\ (~! meta.monad) (~' in)
(list (` (.:as (~ (nilable_type fieldT))
(.exec
@@ -268,7 +268,7 @@
(#Method method)
(case method
(#Static [method alias inputsT io? try? outputT])
- (..make_function (qualify (maybe.default method alias))
+ (..make_function (qualify (maybe.else method alias))
g!temp
(` ("ruby object get" (~ (code.text method))
(:as (..Object .Any)
@@ -282,7 +282,7 @@
(#Virtual [method alias inputsT io? try? outputT])
(let [g!inputs (input_variables inputsT)]
- (` (def: ((~ (qualify (maybe.default method alias)))
+ (` (def: ((~ (qualify (maybe.else method alias)))
[(~+ (list\map product.right g!inputs))]
(~ g!object))
(-> [(~+ (list\map nilable_type inputsT))]
@@ -309,7 +309,7 @@
#.None
(list)))
("ruby constant" (~ (code.text name)))))]
- (in (list (..make_function (code.local_identifier (maybe.default name alias))
+ (in (list (..make_function (code.local_identifier (maybe.else name alias))
g!temp
imported
inputsT
@@ -326,7 +326,7 @@
#.None
(list)))
("ruby constant" (~ (code.text name)))))]
- (in (list (` ((~! syntax:) ((~ (code.local_identifier (maybe.default name alias))))
+ (in (list (` ((~! syntax:) ((~ (code.local_identifier (maybe.else name alias))))
(\ (~! meta.monad) (~' in)
(list (` (.:as (~ (nilable_type fieldT)) (~ imported))))))))))
)))
diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux
index dddce2ebc..886f045d1 100644
--- a/stdlib/source/library/lux/ffi.scm.lux
+++ b/stdlib/source/library/lux/ffi.scm.lux
@@ -204,7 +204,7 @@
(case import
(#Function [name alias inputsT io? try? outputT])
(let [imported (` ("scheme constant" (~ (code.text name))))]
- (in (list (..make_function (code.local_identifier (maybe.default name alias))
+ (in (list (..make_function (code.local_identifier (maybe.else name alias))
g!temp
imported
inputsT
@@ -214,7 +214,7 @@
(#Constant [_ name alias fieldT])
(let [imported (` ("scheme constant" (~ (code.text name))))]
- (in (list (` ((~! syntax:) ((~ (code.local_identifier (maybe.default name alias))))
+ (in (list (` ((~! syntax:) ((~ (code.local_identifier (maybe.else name alias))))
(\ (~! meta.monad) (~' in)
(list (` (.:as (~ (nilable_type fieldT)) (~ imported))))))))))
)))
diff --git a/stdlib/source/library/lux/locale.lux b/stdlib/source/library/lux/locale.lux
index 381938c74..e77e88c89 100644
--- a/stdlib/source/library/lux/locale.lux
+++ b/stdlib/source/library/lux/locale.lux
@@ -26,10 +26,10 @@
(:abstraction (format (language.code language)
(|> territory
(maybe\map (|>> territory.long_code (format ..territory_separator)))
- (maybe.default ""))
+ (maybe.else ""))
(|> encoding
(maybe\map (|>> encoding.name (format ..encoding_separator)))
- (maybe.default "")))))
+ (maybe.else "")))))
(def: #export code
(-> Locale Text)
diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux
index 4108f7ced..35744c33f 100644
--- a/stdlib/source/library/lux/macro/syntax.lux
+++ b/stdlib/source/library/lux/macro/syntax.lux
@@ -53,7 +53,7 @@
{constructor_args (constructor_args^ imports class_vars)}
{methods (some (overriden_method_def^ imports))})
(let [def_code ($_ text\compose "anon-class:"
- (spaced (list (super_class_decl$ (maybe.default object_super_class super))
+ (spaced (list (super_class_decl$ (maybe.else object_super_class super))
(with_brackets (spaced (list\map super_class_decl$ interfaces)))
(with_brackets (spaced (list\map constructor_arg$ constructor_args)))
(with_brackets (spaced (list\map (method_def$ id) methods))))))]
diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux
index c374519b9..1a34bfbf5 100644
--- a/stdlib/source/library/lux/math/number/complex.lux
+++ b/stdlib/source/library/lux/math/number/complex.lux
@@ -33,8 +33,7 @@
"The imaginary part can be omitted if it's 0."
(complex real))}
(in (list (` {#..real (~ real)
- #..imaginary (~ (maybe.default (' +0.0)
- ?imaginary))}))))
+ #..imaginary (~ (maybe.else (' +0.0) ?imaginary))}))))
(def: #export i
(..complex +0.0 +1.0))
diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux
index 7b6f4df5d..5576109a7 100644
--- a/stdlib/source/library/lux/math/number/frac.lux
+++ b/stdlib/source/library/lux/math/number/frac.lux
@@ -294,16 +294,16 @@
(//i64.and ..exponent_mask))
mantissa_bits (..int mantissa)]
($_ //i64.or
- (//i64.left_shift ..sign_offset sign_bit)
- (//i64.left_shift ..exponent_offset exponent_bits)
+ (//i64.left_shifted ..sign_offset sign_bit)
+ (//i64.left_shifted ..exponent_offset exponent_bits)
(//i64.clear ..mantissa_size mantissa_bits)))
)))
(template [<getter> <size> <offset>]
[(def: <getter>
(-> (I64 Any) I64)
- (let [mask (|> 1 (//i64.left_shift <size>) dec (//i64.left_shift <offset>))]
- (|>> (//i64.and mask) (//i64.right_shift <offset>) .i64)))]
+ (let [mask (|> 1 (//i64.left_shifted <size>) dec (//i64.left_shifted <offset>))]
+ (|>> (//i64.and mask) (//i64.right_shifted <offset>) .i64)))]
[mantissa ..mantissa_size 0]
[exponent ..exponent_size ..mantissa_size]
@@ -417,8 +417,8 @@
#let [sign (if negative? 1 0)]]
(in (..of_bits
($_ //i64.or
- (//i64.left_shift ..sign_offset (.i64 sign))
- (//i64.left_shift ..mantissa_size (.i64 (//int.+ (.int ..double_bias) exponent)))
+ (//i64.left_shifted ..sign_offset (.i64 sign))
+ (//i64.left_shifted ..mantissa_size (.i64 (//int.+ (.int ..double_bias) exponent)))
(//i64.clear ..mantissa_size (.i64 mantissa))))))
(#try.Failure ("lux text concat" <error> representation))))))]
diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux
index f11eee2f4..6ddd718ec 100644
--- a/stdlib/source/library/lux/math/number/i64.lux
+++ b/stdlib/source/library/lux/math/number/i64.lux
@@ -31,8 +31,8 @@
[(I64 Any) xor "lux i64 xor" "Bitwise xor."]
[(I64 Any) and "lux i64 and" "Bitwise and."]
- [Nat left_shift "lux i64 left-shift" "Bitwise left-shift."]
- [Nat right_shift "lux i64 right-shift" "Unsigned/logic bitwise right-shift."]
+ [Nat left_shifted "lux i64 left-shift" "Bitwise left-shift."]
+ [Nat right_shifted "lux i64 right-shift" "Unsigned/logic bitwise right-shift."]
)
(type: #export Mask
@@ -40,7 +40,7 @@
(def: #export (bit position)
(-> Nat Mask)
- (|> 1 .i64 (..left_shift (n.% ..width position))))
+ (|> 1 .i64 (..left_shifted (n.% ..width position))))
(def: #export sign
Mask
@@ -65,19 +65,19 @@
0 ..false
bits (case (n.% ..width bits)
0 ..true
- bits (|> 1 .i64 (..left_shift (n.% ..width bits)) .dec))))
+ bits (|> 1 .i64 (..left_shifted (n.% ..width bits)) .dec))))
(def: (add_shift shift value)
(-> Nat Nat Nat)
- (|> value (right_shift shift) (n.+ value)))
+ (|> value (right_shifted shift) (n.+ value)))
(def: #export (count subject)
{#.doc "Count the number of 1s in a bit-map."}
(-> (I64 Any) Nat)
- (let [count' (n.- (|> subject (right_shift 1) (..and 6148914691236517205) i64)
+ (let [count' (n.- (|> subject (right_shifted 1) (..and 6148914691236517205) i64)
(i64 subject))]
(|> count'
- (right_shift 2) (..and 3689348814741910323) (n.+ (..and 3689348814741910323 count'))
+ (right_shifted 2) (..and 3689348814741910323) (n.+ (..and 3689348814741910323 count'))
(add_shift 4) (..and 1085102592571150095)
(add_shift 8)
(add_shift 16)
@@ -113,13 +113,13 @@
(..or (<forward> distance input)
(<backward> (n.- (n.% ..width distance) ..width) input)))]
- [rotate_left ..left_shift ..right_shift]
- [rotate_right ..right_shift ..left_shift]
+ [left_rotated ..left_shifted ..right_shifted]
+ [right_rotated ..right_shifted ..left_shifted]
)
(def: #export (region size offset)
(-> Nat Nat Mask)
- (..left_shift offset (..mask size)))
+ (..left_shifted offset (..mask size)))
(implementation: #export equivalence
(All [a] (Equivalence (I64 a)))
@@ -149,7 +149,7 @@
(All [a] (-> (I64 a) (I64 a)))
(let [swapper (: (-> Nat (All [a] (-> (I64 a) (I64 a))))
(function (_ power)
- (let [size (..left_shift power 1)
+ (let [size (..left_shifted power 1)
repetitions (: (-> Nat Text Text)
(function (_ times char)
(loop [iterations 1
@@ -164,10 +164,10 @@
(repetitions size "0")))
high (try.assumed (\ n.binary decode pattern))
- low (..rotate_right size high)]
+ low (..right_rotated size high)]
(function (_ value)
- (..or (..right_shift size (..and high value))
- (..left_shift size (..and low value)))))))
+ (..or (..right_shifted size (..and high value))
+ (..left_shifted size (..and low value)))))))
swap/01 (swapper 0)
swap/02 (swapper 1)
@@ -205,7 +205,7 @@
(def: &equivalence ..equivalence)
(def: width width)
(def: (narrow value)
- (..or (|> value (..and ..sign) (..right_shift sign_shift))
+ (..or (|> value (..and ..sign) (..right_shifted sign_shift))
(|> value (..and mantissa))))
(def: (widen value)
(.i64 (case (.nat (..and sign value))
diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux
index b5806e0db..9724bc766 100644
--- a/stdlib/source/library/lux/math/number/int.lux
+++ b/stdlib/source/library/lux/math/number/int.lux
@@ -189,12 +189,12 @@
(def: &enum ..enum)
(def: top
## +9,223,372,036,854,775,807
- (let [half (//i64.left_shift 62 +1)]
+ (let [half (//i64.left_shifted 62 +1)]
(+ half
(dec half))))
(def: bottom
## -9,223,372,036,854,775,808
- (//i64.left_shift 63 +1)))
+ (//i64.left_shifted 63 +1)))
(template [<name> <compose> <identity>]
[(implementation: #export <name>
@@ -253,8 +253,8 @@
(def: &equivalence ..equivalence)
(def: hash .nat))
-(def: #export (right_shift parameter subject)
+(def: #export (right_shifted parameter subject)
{#.doc "Signed/arithmetic bitwise right-shift."}
(-> Nat Int Int)
(//i64.or (//i64.and //i64.sign subject)
- (//i64.right_shift parameter subject)))
+ (//i64.right_shifted parameter subject)))
diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux
index 3ad54b2bd..c97849629 100644
--- a/stdlib/source/library/lux/math/number/ratio.lux
+++ b/stdlib/source/library/lux/math/number/ratio.lux
@@ -45,8 +45,7 @@
"The denominator can be omitted if it is 1."
(ratio numerator))}
(in (list (` ((~! ..normal) {#..numerator (~ numerator)
- #..denominator (~ (maybe.default (' 1)
- ?denominator))})))))
+ #..denominator (~ (maybe.else (' 1) ?denominator))})))))
(def: #export (= parameter subject)
(-> Ratio Ratio Bit)
diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux
index 431f44ed1..72073f421 100644
--- a/stdlib/source/library/lux/math/number/rev.lux
+++ b/stdlib/source/library/lux/math/number/rev.lux
@@ -23,7 +23,7 @@
(template [<power> <name>]
[(def: #export <name>
Rev
- (.rev (//i64.left_shift (//nat.- <power> //i64.width) 1)))]
+ (.rev (//i64.left_shifted (//nat.- <power> //i64.width) 1)))]
[01 /2]
[02 /4]
@@ -118,12 +118,12 @@
..high
("lux i64 +" top))))
-(def: even_one (//i64.rotate_right 1 1))
+(def: even_one (//i64.right_rotated 1 1))
(def: odd_one (dec 0))
(def: (even_reciprocal numerator)
(-> Nat Nat)
- (//nat./ (//i64.right_shift 1 numerator)
+ (//nat./ (//i64.right_shifted 1 numerator)
..even_one))
(def: (odd_reciprocal numerator)
@@ -293,7 +293,7 @@
(def: (digits::get idx digits)
(-> Nat Digits Nat)
- (|> digits (array.read idx) (maybe.default 0)))
+ (|> digits (array.read idx) (maybe.else 0)))
(def: digits::put
(-> Nat Nat Digits Digits)
diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux
index f0a912431..c4f307a7b 100644
--- a/stdlib/source/library/lux/math/random.lux
+++ b/stdlib/source/library/lux/math/random.lux
@@ -124,7 +124,7 @@
(let [[prng left] (prng [])
[prng right] (prng [])]
[prng (|> left
- (i64.left_shift 32)
+ (i64.left_shifted 32)
("lux i64 +" right))])))
(template [<name> <type> <cast>]
@@ -143,7 +143,7 @@
(def: #export safe_frac
(Random Frac)
- (let [mantissa_range (.int (i64.left_shift 53 1))
+ (let [mantissa_range (.int (i64.left_shifted 53 1))
mantissa_max (i.frac (dec mantissa_range))]
(\ ..monad map
(|>> (i.% mantissa_range)
@@ -359,12 +359,12 @@
(let [magic 6364136223846793005]
(function (_ _)
[(|> seed .nat (n.* magic) ("lux i64 +" increase) [increase] pcg32)
- (let [rot (|> seed .i64 (i64.right_shift 59))]
+ (let [rot (|> seed .i64 (i64.right_shifted 59))]
(|> seed
- (i64.right_shift 18)
+ (i64.right_shifted 18)
(i64.xor seed)
- (i64.right_shift 27)
- (i64.rotate_right rot)
+ (i64.right_shifted 27)
+ (i64.right_rotated rot)
.i64))])))
(def: #export (xoroshiro_128+ [s0 s1])
@@ -374,10 +374,10 @@
(function (_ _)
[(let [s01 (i64.xor s0 s1)]
(xoroshiro_128+ [(|> s0
- (i64.rotate_left 55)
+ (i64.left_rotated 55)
(i64.xor s01)
- (i64.xor (i64.left_shift 14 s01)))
- (i64.rotate_left 36 s01)]))
+ (i64.xor (i64.left_shifted 14 s01)))
+ (i64.left_rotated 36 s01)]))
("lux i64 +" s0 s1)]))
## https://en.wikipedia.org/wiki/Xorshift#Initialization
@@ -387,7 +387,7 @@
(-> Nat PRNG)
(let [twist (: (-> Nat Nat Nat)
(function (_ shift value)
- (i64.xor (i64.right_shift shift value)
+ (i64.xor (i64.right_shifted shift value)
value)))
mix n.*]
(..prng (n.+ (hex "9E,37,79,B9,7F,4A,7C,15"))
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index 728e969b8..5c7d102fe 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -214,7 +214,7 @@
#.None
#0)])))
-(def: (try_both f x1 x2)
+(def: (on_either f x1 x2)
(All [a b]
(-> (-> a (Maybe b)) a a (Maybe b)))
(case (f x1)
@@ -262,11 +262,11 @@
(list.any? test (: (List [Text [Type Any]])
(get@ [#.captured #.mappings] env)))))
(get@ #.scopes compiler))
- [_ [type _]] (try_both (list.find test)
- (: (List [Text [Type Any]])
- (get@ [#.locals #.mappings] scope))
- (: (List [Text [Type Any]])
- (get@ [#.captured #.mappings] scope)))]
+ [_ [type _]] (on_either (list.find test)
+ (: (List [Text [Type Any]])
+ (get@ [#.locals #.mappings] scope))
+ (: (List [Text [Type Any]])
+ (get@ [#.captured #.mappings] scope)))]
(in type))
(#.Some var_type)
((clean_type var_type) compiler)
@@ -291,7 +291,7 @@
(#try.Success [compiler definition])
_
- (let [current_module (|> compiler (get@ #.current_module) (maybe.default "???"))
+ (let [current_module (|> compiler (get@ #.current_module) (maybe.else "???"))
separator ($_ text\compose text.new_line " ")]
(#try.Failure ($_ text\compose
"Unknown definition: " (name\encode name) text.new_line
diff --git a/stdlib/source/library/lux/meta/annotation.lux b/stdlib/source/library/lux/meta/annotation.lux
index 27512d5f6..a9892473f 100644
--- a/stdlib/source/library/lux/meta/annotation.lux
+++ b/stdlib/source/library/lux/meta/annotation.lux
@@ -61,7 +61,7 @@
(def: #export (flagged? flag)
(-> Name Annotation Bit)
- (|>> (..bit flag) (maybe.default false)))
+ (|>> (..bit flag) (maybe.else false)))
(template [<name> <tag>]
[(def: #export <name>
@@ -69,7 +69,7 @@
(..flagged? (name_of <tag>)))]
[implementation? #.implementation?]
- [recursive_type? #.type-rec?]
+ [recursive_type? #.type_rec?]
[signature? #.sig?]
)
@@ -85,11 +85,11 @@
(template [<name> <tag>]
[(def: #export (<name> ann)
(-> Annotation (List Text))
- (maybe.default (list)
- (do {! maybe.monad}
- [args (..tuple (name_of <tag>) ann)]
- (monad.map ! ..text_parser args))))]
+ (<| (maybe.else (list))
+ (do {! maybe.monad}
+ [args (..tuple (name_of <tag>) ann)]
+ (monad.map ! ..text_parser args))))]
- [function_arguments #.func-args]
- [type_arguments #.type-args]
+ [function_arguments #.func_args]
+ [type_arguments #.type_args]
)
diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux
index 8571aeece..8ca668f99 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode.lux
@@ -7,7 +7,7 @@
["." monad (#+ Monad do)]]
[control
["." writer (#+ Writer)]
- ["." state (#+ State')]
+ ["." state (#+ +State)]
["." function]
["." try (#+ Try)]
["." exception (#+ exception:)]]
@@ -98,7 +98,7 @@
(_\compose left_instruction right_instruction)]))))))
(type: #export (Bytecode a)
- (State' Try [Pool Environment Tracker] (Writer Relative a)))
+ (+State Try [Pool Environment Tracker] (Writer Relative a)))
(def: #export new_label
(Bytecode Label)
@@ -149,7 +149,7 @@
(do try.monad
[[actual environment] (/environment.continue (|> environment
(get@ #/environment.stack)
- (maybe.default /stack.empty))
+ (maybe.else /stack.empty))
environment)]
<success>))))))
@@ -157,7 +157,7 @@
(Monad Bytecode)
(<| (:as (Monad Bytecode))
(writer.with ..relative_monoid)
- (: (Monad (State' Try [Pool Environment Tracker])))
+ (: (Monad (+State Try [Pool Environment Tracker])))
state.with
(: (Monad Try))
try.monad))
diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux
index 18b6a9c61..e2c12039e 100644
--- a/stdlib/source/library/lux/target/jvm/constant/pool.lux
+++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux
@@ -6,7 +6,7 @@
[equivalence (#+ Equivalence)]
[monad (#+ Monad do)]]
[control
- ["." state (#+ State')]
+ ["." state (#+ +State)]
["." try (#+ Try)]]
[data
["." product]
@@ -44,7 +44,7 @@
//.equivalence))))
(type: #export (Resource a)
- (State' Try Pool a))
+ (+State Try Pool a))
(def: #export monad
(Monad Resource)
diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux
index 1958ea63c..dfdcedbb6 100644
--- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux
+++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux
@@ -61,7 +61,7 @@
(def: #export <constructor>
(-> Int (Try <name>))
(let [positive (|> <bytes> (n.* i64.bits_per_byte) i64.mask)
- negative (|> positive .int (i.right_shift 1) i64.not)]
+ negative (|> positive .int (i.right_shifted 1) i64.not)]
(function (_ value)
(if (i.= (if (i.< +0 value)
(i64.or negative value)
diff --git a/stdlib/source/library/lux/target/jvm/type/alias.lux b/stdlib/source/library/lux/target/jvm/type/alias.lux
index e7cc570c1..365460dc6 100644
--- a/stdlib/source/library/lux/target/jvm/type/alias.lux
+++ b/stdlib/source/library/lux/target/jvm/type/alias.lux
@@ -37,7 +37,7 @@
[var //parser.var']
(in (|> aliasing
(dictionary.get var)
- (maybe.default var)
+ (maybe.else var)
//.var))))
(def: (class parameter)
@@ -47,7 +47,7 @@
parameters (|> (<>.some parameter)
(<>.after (<text>.this //signature.parameters_start))
(<>.before (<text>.this //signature.parameters_end))
- (<>.default (list)))]
+ (<>.else (list)))]
(in (//.class name parameters)))
(<>.after (<text>.this //descriptor.class_prefix))
(<>.before (<text>.this //descriptor.class_suffix))))
@@ -123,7 +123,7 @@
[type_variables (|> (<>.some (..bound_type_var aliasing))
(<>.after (<text>.this //signature.parameters_start))
(<>.before (<text>.this //signature.parameters_end))
- (<>.default (list)))
+ (<>.else (list)))
inputs (..inputs aliasing)
return (..return aliasing)
exceptions (<>.some (..exception aliasing))]
diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux
index 6b6fc2b5f..79104adaa 100644
--- a/stdlib/source/library/lux/target/jvm/type/lux.lux
+++ b/stdlib/source/library/lux/target/jvm/type/lux.lux
@@ -133,7 +133,7 @@
parameters (|> (<>.some parameter)
(<>.after (<text>.this //signature.parameters_start))
(<>.before (<text>.this //signature.parameters_end))
- (<>.default (list)))]
+ (<>.else (list)))]
(in (do {! check.monad}
[parameters (monad.seq ! parameters)]
(in (#.Primitive name parameters)))))
diff --git a/stdlib/source/library/lux/target/jvm/type/parser.lux b/stdlib/source/library/lux/target/jvm/type/parser.lux
index b955ce0f7..5dbada115 100644
--- a/stdlib/source/library/lux/target/jvm/type/parser.lux
+++ b/stdlib/source/library/lux/target/jvm/type/parser.lux
@@ -117,7 +117,7 @@
parameters (|> (<>.some parameter)
(<>.after (<text>.this //signature.parameters_start))
(<>.before (<text>.this //signature.parameters_end))
- (<>.default (list)))]
+ (<>.else (list)))]
(in [name parameters]))
(<>.after (<text>.this //descriptor.class_prefix))
(<>.before (<text>.this //descriptor.class_suffix))))
@@ -217,7 +217,7 @@
(|> (<>.some ..var)
(<>.after (<text>.this //signature.parameters_start))
(<>.before (<text>.this //signature.parameters_end))
- (<>.default (list)))
+ (<>.else (list)))
..inputs
..return
(<>.some ..exception)))]
@@ -253,7 +253,7 @@
(|> (<>.some ..var)
(<>.after (<text>.this //signature.parameters_start))
(<>.before (<text>.this //signature.parameters_end))
- (<>.default (list))))
+ (<>.else (list))))
(<>.after (<text>.this //descriptor.class_prefix))
(<>.before (<text>.this //descriptor.class_suffix))))
diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux
index 11d080762..01deac3a2 100644
--- a/stdlib/source/library/lux/target/r.lux
+++ b/stdlib/source/library/lux/target/r.lux
@@ -337,7 +337,7 @@
(.function (_ parameter value preparation)
(|> value
(maybe\map (|>> :representation preparation (format ", " parameter " = ")))
- (maybe.default ""))))]
+ (maybe.else ""))))]
(..self_contained
(format "tryCatch("
(.._block (:representation body))
diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux
index 8af624e4c..ee3604c0a 100644
--- a/stdlib/source/library/lux/test.lux
+++ b/stdlib/source/library/lux/test.lux
@@ -221,7 +221,7 @@
5 ## XX.XX
4 ## X.XX
))
- (maybe.default raw)
+ (maybe.else raw)
(text.suffix "%"))))))]
(exception.report
["Duration" (%.duration duration)]
diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux
index 5e0907481..72ee9debc 100644
--- a/stdlib/source/library/lux/time/duration.lux
+++ b/stdlib/source/library/lux/time/duration.lux
@@ -164,7 +164,7 @@
"" (<t>.this suffix)
_ (<>.after (<>.not (<t>.this false_suffix))
(<t>.this suffix))))
- (<>.default 0))))]
+ (<>.else 0))))]
(do <>.monad
[sign (<>.or (<t>.this ..negative_sign)
(<t>.this ..positive_sign))
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index cde736979..c5f2cfb8e 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -319,7 +319,7 @@
(|> dependence
lens
(dictionary.get module)
- (maybe.default ..empty))))
+ (maybe.else ..empty))))
transitive_depends_on (transitive_dependency (get@ #depends_on) import)
transitive_depended_by (transitive_dependency (get@ #depended_by) module)
update_dependence (: (-> [Module (Set Module)] [Module (Set Module)]
@@ -351,7 +351,7 @@
(let [targets (|> dependence
relationship
(dictionary.get from)
- (maybe.default ..empty))]
+ (maybe.else ..empty))]
(set.member? targets to))))]
(or (dependence? import (get@ #depends_on) module)
(dependence? module (get@ #depended_by) import))))
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 e48d2b1f8..291cf89c2 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
@@ -194,8 +194,8 @@
(.case inputT'
(#.Product _)
(let [subs (type.flat_tuple inputT')
- num_subs (maybe.default (list.size subs)
- num_tags)
+ num_subs (maybe.else (list.size subs)
+ num_tags)
num_sub_patterns (list.size sub_patterns)
matches (cond (n.< num_subs num_sub_patterns)
(let [[prefix suffix] (list.split (dec num_sub_patterns) subs)]
@@ -253,7 +253,7 @@
(#.Sum _)
(let [flat_sum (type.flat_variant inputT')
size_sum (list.size flat_sum)
- num_cases (maybe.default size_sum num_tags)
+ num_cases (maybe.else size_sum num_tags)
idx (/.tag lefts right?)]
(.case (list.nth idx flat_sum)
(^multi (#.Some caseT)
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 99e1730f1..3760c86cc 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
@@ -29,7 +29,7 @@
(def: cases
(-> (Maybe Nat) Nat)
- (|>> (maybe.default 0)))
+ (|>> (maybe.else 0)))
(def: known_cases?
(-> Nat Bit)
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 863975408..31ce0998c 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
@@ -85,8 +85,8 @@
(#.Right [state #.None])
(#.Item top_outer _)
- (let [[ref_type init_ref] (maybe.default (undefined)
- (..reference name top_outer))
+ (let [[ref_type init_ref] (maybe.else (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))
@@ -169,7 +169,7 @@
state)])
(#try.Success [[bundle' state'] output])
(#try.Success [[bundle' (update@ #.scopes
- (|>> list.tail (maybe.default (list)))
+ (|>> list.tail (maybe.else (list)))
state')]
output])
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 b34743db7..3804bcec2 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
@@ -1117,7 +1117,7 @@
(#.Some name)
(|> aliasing
(dictionary.get name)
- (maybe.default name)
+ (maybe.else name)
jvm.var)
#.None
@@ -1147,7 +1147,7 @@
(#.Some name)
(|> aliasing
(dictionary.get name)
- (maybe.default name)
+ (maybe.else name)
jvm.var)
#.None
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 4fd8d5842..602c40504 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
@@ -101,7 +101,7 @@
(/.install "or" (binary _.logior/2))
(/.install "xor" (binary _.logxor/2))
(/.install "left-shift" (binary _.ash/2))
- (/.install "right-shift" (binary (product.uncurry //runtime.i64//right_shift)))
+ (/.install "right-shift" (binary (product.uncurry //runtime.i64//right_shifted)))
(/.install "=" (binary _.=/2))
(/.install "<" (binary _.</2))
(/.install "+" (binary _.+/2))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
index e84d5cdf7..da9bbc7f8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
@@ -52,8 +52,8 @@
(Binary Expression)
(<op> subjectG (//runtime.i64//to_number paramG)))]
- [i64//left_shift //runtime.i64//left_shift]
- [i64//right_shift //runtime.i64//right_shift]
+ [i64//left_shifted //runtime.i64//left_shifted]
+ [i64//right_shifted //runtime.i64//right_shifted]
)
## [[Numbers]]
@@ -132,8 +132,8 @@
(/.install "and" (binary (product.uncurry //runtime.i64//and)))
(/.install "or" (binary (product.uncurry //runtime.i64//or)))
(/.install "xor" (binary (product.uncurry //runtime.i64//xor)))
- (/.install "left-shift" (binary i64//left_shift))
- (/.install "right-shift" (binary i64//right_shift))
+ (/.install "left-shift" (binary i64//left_shifted))
+ (/.install "right-shift" (binary i64//right_shifted))
(/.install "=" (binary (product.uncurry //runtime.i64//=)))
(/.install "<" (binary (product.uncurry //runtime.i64//<)))
(/.install "+" (binary (product.uncurry //runtime.i64//+)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux
index eed3eb6ce..354537c19 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux
@@ -182,8 +182,8 @@
shiftG ..jvm_int
<op> (///value.wrap type.long)))]
- [i64::left_shift _.lshl]
- [i64::right_shift _.lushr]
+ [i64::left_shifted _.lshl]
+ [i64::right_shifted _.lushr]
)
(template [<name> <type> <op>]
@@ -272,8 +272,8 @@
(/////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 "right-shift" (binary ..i64::right_shift))
+ (/////bundle.install "left-shift" (binary ..i64::left_shifted))
+ (/////bundle.install "right-shift" (binary ..i64::right_shifted))
(/////bundle.install "=" (binary ..i64::=))
(/////bundle.install "<" (binary ..i64::<))
(/////bundle.install "+" (binary ..i64::+))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
index 9827c2480..58ac1efc1 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
@@ -889,7 +889,7 @@
(^ (//////synthesis.variable var))
(|> mapping
(dictionary.get var)
- (maybe.default var)
+ (maybe.else var)
//////synthesis.variable)
(^ (//////synthesis.branch/case [inputS pathS]))
@@ -916,7 +916,7 @@
(^ (//////synthesis.variable local))
(|> mapping
(dictionary.get local)
- (maybe.default local)
+ (maybe.else local)
//////synthesis.variable)
_
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux
index 519ed6563..3925bec4b 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux
@@ -105,7 +105,7 @@
(/.install "try" (unary //runtime.lux//try))
))
-(def: (left_shift [parameter subject])
+(def: (left_shifted [parameter subject])
(Binary Expression)
(_.bit_shl (_.% (_.int +64) parameter) subject))
@@ -116,8 +116,8 @@
(/.install "and" (binary (product.uncurry _.bit_and)))
(/.install "or" (binary (product.uncurry _.bit_or)))
(/.install "xor" (binary (product.uncurry _.bit_xor)))
- (/.install "left-shift" (binary ..left_shift))
- (/.install "right-shift" (binary (product.uncurry //runtime.i64//right_shift)))
+ (/.install "left-shift" (binary ..left_shifted))
+ (/.install "right-shift" (binary (product.uncurry //runtime.i64//right_shifted)))
(/.install "=" (binary (product.uncurry _.==)))
(/.install "<" (binary (product.uncurry _.<)))
(/.install "+" (binary (product.uncurry //runtime.i64//+)))
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 1853971a6..ee472fe92 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
@@ -29,18 +29,18 @@
(bundle.install "is" (binary (product.uncurry _.eq)))
(bundle.install "try" (unary ///runtime.lux//try))))
-(def: (i64//left_shift [paramG subjectG])
+(def: (i64//left_shifted [paramG subjectG])
(Binary (Expression Any))
(_.ash (_.rem (_.int +64) paramG) subjectG))
-(def: (i64//arithmetic_right_shift [paramG subjectG])
+(def: (i64//arithmetic_right_shifted [paramG subjectG])
(Binary (Expression Any))
(_.ash (|> paramG (_.rem (_.int +64)) (_.* (_.int -1)))
subjectG))
-(def: (i64//logic_right_shift [paramG subjectG])
+(def: (i64//logic_right_shifted [paramG subjectG])
(Binary (Expression Any))
- (///runtime.i64//logic_right_shift (_.rem (_.int +64) paramG) subjectG))
+ (///runtime.i64//logic_right_shifted (_.rem (_.int +64) paramG) subjectG))
(def: i64_procs
Bundle
@@ -49,9 +49,9 @@
(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_shifted))
+ (bundle.install "logical-right-shift" (binary i64//logic_right_shifted))
+ (bundle.install "arithmetic-right-shift" (binary i64//arithmetic_right_shifted))
(bundle.install "=" (binary (product.uncurry _.=)))
(bundle.install "<" (binary (product.uncurry _.<)))
(bundle.install "+" (binary (product.uncurry _.+)))
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 fd0e7a780..6b390352b 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
@@ -226,7 +226,7 @@
@tuple//right
@sum//get))
-(runtime: (i64//right_shift shift input)
+(runtime: (i64//right_shifted shift input)
(_.if (_.=/2 [(_.int +0) shift])
input
(let [anti_shift (_.-/2 [shift (_.int +64)])
@@ -239,7 +239,7 @@
(def: runtime//i64
(List (Expression Any))
- (list @i64//right_shift))
+ (list @i64//right_shifted))
(runtime: (text//clip offset length text)
(_.subseq/3 [text offset (_.+/2 [offset length])]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
index 506a957c7..94fe61c3e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
@@ -64,11 +64,11 @@
(def: #export high
(-> (I64 Any) (I64 Any))
- (i64.right_shift 32))
+ (i64.right_shifted 32))
(def: #export low
(-> (I64 Any) (I64 Any))
- (let [mask (dec (i64.left_shift 32 1))]
+ (let [mask (dec (i64.left_shifted 32 1))]
(|>> (i64.and mask))))
(def: #export unit
@@ -416,7 +416,7 @@
(-> Var Expression)
(|>> (_.< (_.i32 +32))))
-(runtime: (i64//left_shift input shift)
+(runtime: (i64//left_shifted input shift)
($_ _.then
(..cap_shift! shift)
(_.return (<| (..no_shift! shift input)
@@ -429,7 +429,7 @@
(..i64 high (_.i32 +0)))))
))
-(runtime: (i64//arithmetic_right_shift input shift)
+(runtime: (i64//arithmetic_right_shifted input shift)
($_ _.then
(..cap_shift! shift)
(_.return (<| (..no_shift! shift input)
@@ -444,7 +444,7 @@
low (|> input (_.the ..i64_high_field) (_.arithmetic_right_shift (_.- (_.i32 +32) shift)))]
(..i64 high low))))))
-(runtime: (i64//right_shift input shift)
+(runtime: (i64//right_shifted input shift)
($_ _.then
(..cap_shift! shift)
(_.return (<| (..no_shift! shift input)
@@ -465,9 +465,9 @@
@i64//or
@i64//xor
@i64//not
- @i64//left_shift
- @i64//arithmetic_right_shift
- @i64//right_shift
+ @i64//left_shifted
+ @i64//arithmetic_right_shifted
+ @i64//right_shifted
))
(runtime: (i64//- parameter subject)
@@ -557,11 +557,11 @@
[(i64//= i64//min parameter)
(_.return i64//one)])
(with_vars [approximation]
- (let [subject/2 (..i64//arithmetic_right_shift subject (_.i32 +1))]
+ (let [subject/2 (..i64//arithmetic_right_shifted subject (_.i32 +1))]
($_ _.then
- (_.define approximation (i64//left_shift (i64/// parameter
- subject/2)
- (_.i32 +1)))
+ (_.define approximation (i64//left_shifted (i64/// parameter
+ subject/2)
+ (_.i32 +1)))
(_.if (i64//= i64//zero approximation)
(_.return (_.? (negative? parameter)
i64//one
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
index 86a980c95..80315db66 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
@@ -608,4 +608,4 @@
## This shift is done to avoid the possibility of forged labels
## to be in the range of the labels that are generated automatically
## during the evaluation of Bytecode expressions.
- (\ ////.monad map (i64.left_shift shift) generation.next)))
+ (\ ////.monad map (i64.left_shifted shift) generation.next)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux
index 3c9054abf..b51cd2930 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux
@@ -65,7 +65,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
@@ -103,7 +103,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/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
index 1565f7c0e..7d92f48d3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
@@ -260,10 +260,10 @@
(def: cap_shift
(_.% (_.int +64)))
-(runtime: (i64//left_shift param subject)
+(runtime: (i64//left_shifted param subject)
(_.return (_.bit_shl (..cap_shift param) subject)))
-(runtime: (i64//right_shift param subject)
+(runtime: (i64//right_shifted param subject)
(let [mask (|> (_.int +1)
(_.bit_shl (_.- param (_.int +64)))
(_.- (_.int +1)))]
@@ -294,8 +294,8 @@
(def: runtime//i64
Statement
($_ _.then
- @i64//left_shift
- @i64//right_shift
+ @i64//left_shifted
+ @i64//right_shifted
@i64//division
@i64//remainder
))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
index 9729815b6..6c08b4ed0 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
@@ -338,14 +338,14 @@
(def: #export high
(-> (I64 Any) (I64 Any))
- (i64.right_shift 32))
+ (i64.right_shifted 32))
(def: #export low
(-> (I64 Any) (I64 Any))
- (let [mask (dec (i64.left_shift 32 1))]
+ (let [mask (dec (i64.left_shifted 32 1))]
(|>> (i64.and mask))))
-(runtime: (i64//right_shift param subject)
+(runtime: (i64//right_shifted param subject)
(let [## The mask has to be calculated this way instead of in a more straightforward way
## because in some languages, 1<<63 = max_negative_value
## and max_negative_value-1 = max_positive_value.
@@ -376,13 +376,13 @@
_.iconv/3))))
(runtime: (i64//+ parameter subject)
- (let [high_16 (..i64//right_shift (_.int +16))
+ (let [high_16 (..i64//right_shifted (_.int +16))
low_16 (_.bit_and (_.int (.int (hex "FFFF"))))
cap_16 low_16
- hh (..i64//right_shift (_.int +48))
- hl (|>> (..i64//right_shift (_.int +32)) cap_16)
- lh (|>> (..i64//right_shift (_.int +16)) cap_16)
+ hh (..i64//right_shifted (_.int +48))
+ hl (|>> (..i64//right_shifted (_.int +32)) cap_16)
+ lh (|>> (..i64//right_shifted (_.int +16)) cap_16)
ll cap_16
up_16 (_.bit_shl (_.int +16))]
@@ -435,13 +435,13 @@
(_.return (..i64//+ (..i64//negate parameter) subject)))
(runtime: (i64//* parameter subject)
- (let [high_16 (..i64//right_shift (_.int +16))
+ (let [high_16 (..i64//right_shifted (_.int +16))
low_16 (_.bit_and (_.int (.int (hex "FFFF"))))
cap_16 low_16
- hh (..i64//right_shift (_.int +48))
- hl (|>> (..i64//right_shift (_.int +32)) cap_16)
- lh (|>> (..i64//right_shift (_.int +16)) cap_16)
+ hh (..i64//right_shifted (_.int +48))
+ hl (|>> (..i64//right_shifted (_.int +32)) cap_16)
+ lh (|>> (..i64//right_shifted (_.int +16)) cap_16)
ll cap_16
up_16 (_.bit_shl (_.int +16))]
@@ -492,7 +492,7 @@
(def: runtime//i64
Statement
($_ _.then
- @i64//right_shift
+ @i64//right_shifted
@i64//char
@i64//+
@i64//negate
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
index 440f208ba..44ea19376 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
@@ -298,12 +298,12 @@
(def: as_nat
(_.% ..i64::+iteration))
-(runtime: (i64::left_shift param subject)
+(runtime: (i64::left_shifted param subject)
(_.return (|> subject
(_.bit_shl (_.% (_.int +64) param))
..i64::64)))
-(runtime: (i64::right_shift param subject)
+(runtime: (i64::right_shifted param subject)
($_ _.then
(_.set (list param) (_.% (_.int +64) param))
(_.return (_.? (_.= (_.int +0) param)
@@ -354,8 +354,8 @@
(Statement Any)
($_ _.then
@i64::64
- @i64::left_shift
- @i64::right_shift
+ @i64::left_shifted
+ @i64::right_shifted
@i64::division
@i64::remainder
@i64::and
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 225d32a81..b650c7e8d 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
@@ -163,9 +163,9 @@
Binary
(<op> (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_shifted runtimeT.bit//left_shifted]
+ [bit//arithmetic_right_shifted runtimeT.bit//arithmetic_right_shifted]
+ [bit//logical_right_shifted runtimeT.bit//logical_right_shifted]
)
(def: bit_procs
@@ -175,9 +175,9 @@
(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_shifted))
+ (install "logical-right-shift" (binary bit//logical_right_shifted))
+ (install "arithmetic-right-shift" (binary bit//arithmetic_right_shifted))
)))
## [[Numbers]]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
index 06ae68255..dba43659e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
@@ -199,7 +199,7 @@
(def: high_32
(-> Nat Nat)
- (i64.right_shift 32))
+ (i64.right_shifted 32))
(def: low_32
(-> Nat Nat)
@@ -214,7 +214,7 @@
(def: #export (lux_i64 high low)
(-> Int Int Int)
(|> high
- (i64.left_shift 32)
+ (i64.left_shifted 32)
(i64.or low)))
(template [<name> <value>]
@@ -387,7 +387,7 @@
[(|> shift (_.= (_.int +0)))
input])
-(runtime: (i64::left_shift shift input)
+(runtime: (i64::left_shifted shift input)
($_ _.then
(limit_shift! shift)
(_.cond (list (no_shift_clause shift input)
@@ -403,26 +403,26 @@
(_.bit_shl (|> shift (_.- (_.int +32)))))]
(i64::new high (_.int +0))))))
-(runtime: (i64::arithmetic_right_shift_32 shift input)
+(runtime: (i64::arithmetic_right_shifted_32 shift input)
(let [top_bit (|> input (_.bit_and (_.as::integer (_.int (hex "+80000000")))))]
(|> input
(_.bit_ushr shift)
(_.bit_or top_bit))))
-(runtime: (i64::arithmetic_right_shift shift input)
+(runtime: (i64::arithmetic_right_shifted shift input)
($_ _.then
(limit_shift! shift)
(_.cond (list (no_shift_clause shift input)
[(|> shift (_.< (_.int +32)))
(let [mid (|> (i64_high input) (_.bit_shl (|> (_.int +32) (_.- shift))))
high (|> (i64_high input)
- (i64::arithmetic_right_shift_32 shift))
+ (i64::arithmetic_right_shifted_32 shift))
low (|> (i64_low input)
(_.bit_ushr shift)
(_.bit_or mid))]
(i64::new high low))])
(let [low (|> (i64_high input)
- (i64::arithmetic_right_shift_32 (|> shift (_.- (_.int +32)))))
+ (i64::arithmetic_right_shifted_32 (|> shift (_.- (_.int +32)))))
high (_.if (|> (i64_high input) (_.>= (_.int +0)))
(_.int +0)
(_.int -1))]
@@ -447,9 +447,9 @@
($_ _.then
(_.set! approximation
(|> subject
- (i64::arithmetic_right_shift (_.int +1))
+ (i64::arithmetic_right_shifted (_.int +1))
(i64::/ param)
- (i64::left_shift (_.int +1))))
+ (i64::left_shifted (_.int +1))))
(_.if (|> approximation (i64::= i64::zero))
(_.if (negative? param)
i64::one
@@ -647,7 +647,7 @@
[i64::xor _.bit_xor]
)
-(runtime: (i64::right_shift shift input)
+(runtime: (i64::right_shifted shift input)
($_ _.then
(limit_shift! shift)
(_.cond (list (no_shift_clause shift input)
@@ -682,10 +682,10 @@
@i64::or
@i64::xor
@i64::not
- @i64::left_shift
- @i64::arithmetic_right_shift_32
- @i64::arithmetic_right_shift
- @i64::right_shift
+ @i64::left_shifted
+ @i64::arithmetic_right_shifted_32
+ @i64::arithmetic_right_shifted
+ @i64::right_shifted
@i64::zero
@i64::one
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
index 1a19be4a3..1ab1ab616 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
@@ -275,12 +275,12 @@
(def: as_nat
(_.% (_.manual "0x10000000000000000")))
-(runtime: (i64//left_shift param subject)
+(runtime: (i64//left_shifted param subject)
(_.return (|> subject
(_.bit_shl (_.% (_.int +64) param))
..i64//64)))
-(runtime: (i64//right_shift param subject)
+(runtime: (i64//right_shifted param subject)
($_ _.then
(_.set (list param) (_.% (_.int +64) param))
(_.return (_.? (_.= (_.int +0) param)
@@ -309,8 +309,8 @@
($_ _.then
@i64//64
@i64//nat_top
- @i64//left_shift
- @i64//right_shift
+ @i64//left_shifted
+ @i64//right_shifted
@i64//and
@i64//or
@i64//xor
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 9d9c62b18..79d8950ce 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
@@ -183,7 +183,7 @@
[/////synthesis.side/right true inc])
(^ (/////synthesis.member/left 0))
- (///////phase\in (..push_cursor! (_.vector-ref/2 ..peek (_.int +0))))
+ (///////phase\in (..push_cursor! (_.vector_ref/2 ..peek (_.int +0))))
(^template [<pm> <getter>]
[(^ (<pm> lefts))
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 6b976b9b6..a3a598808 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
@@ -39,23 +39,23 @@
(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))
- (-> (-> (..Vector (~ (code.nat arity)) Expression) Computation)
- Handler)
- (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!inputs))
- (case (~ g!inputs)
- (^ (list (~+ g!input+)))
- (do /////.monad
- [(~+ (|> g!input+
- (list\map (function (_ g!input)
- (list g!input (` ((~ g!phase) (~ g!input))))))
- list.concat))]
- ((~' in) ((~ g!extension) [(~+ g!input+)])))
-
- (~' _)
- (/////.except /////extension.incorrect_arity [(~ g!name) 1 (list.size (~ 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))
+ (-> (-> (..Vector (~ (code.nat arity)) Expression) Computation)
+ Handler)
+ (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!inputs))
+ (case (~ g!inputs)
+ (^ (list (~+ g!input+)))
+ (do /////.monad
+ [(~+ (|> g!input+
+ (list\map (function (_ g!input)
+ (list g!input (` ((~ g!phase) (~ g!input))))))
+ list.concat))]
+ ((~' in) ((~ g!extension) [(~+ g!input+)])))
+
+ (~' _)
+ (/////.except /////extension.incorrect_arity [(~ g!name) 1 (list.size (~ g!inputs))]))))))))))
(arity: nullary 0)
(arity: unary 1)
@@ -86,19 +86,19 @@
[i64::xor _.bit_xor/2]
)
-(def: (i64::left_shift [subjectO paramO])
+(def: (i64::left_shifted [subjectO paramO])
Binary
(_.arithmetic_shift/2 (_.remainder/2 (_.int +64) paramO)
subjectO))
-(def: (i64::arithmetic_right_shift [subjectO paramO])
+(def: (i64::arithmetic_right_shifted [subjectO paramO])
Binary
(_.arithmetic_shift/2 (|> paramO (_.remainder/2 (_.int +64)) (_.*/2 (_.int -1)))
subjectO))
-(def: (i64::logical_right_shift [subjectO paramO])
+(def: (i64::logical_right_shifted [subjectO paramO])
Binary
- (///runtime.i64//logical_right_shift (_.remainder/2 (_.int +64) paramO) subjectO))
+ (///runtime.i64//logical_right_shifted (_.remainder/2 (_.int +64) paramO) subjectO))
(template [<name> <op>]
[(def: (<name> [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_shifted))
+ (bundle.install "logical-right-shift" (binary i64::logical_right_shifted))
+ (bundle.install "arithmetic-right-shift" (binary i64::arithmetic_right_shifted))
(bundle.install "+" (binary i64::+))
(bundle.install "-" (binary i64::-))
(bundle.install "*" (binary i64::*))
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 140b72106..2e5c8d495 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
@@ -265,7 +265,7 @@
))
input))))
-(runtime: (i64//left_shift param subject)
+(runtime: (i64//left_shifted param subject)
(|> subject
(_.arithmetic_shift/2 (_.remainder/2 (_.int +64) param))
..i64//64))
@@ -273,7 +273,7 @@
(def: as_nat
(_.remainder/2 ..i64//+iteration))
-(runtime: (i64//right_shift shift subject)
+(runtime: (i64//right_shifted shift subject)
(_.let (list [shift (_.remainder/2 (_.int +64) shift)])
(_.if (_.=/2 (_.int +0) shift)
subject
@@ -296,8 +296,8 @@
(def: runtime//i64
Computation
(_.begin (list @i64//64
- @i64//left_shift
- @i64//right_shift
+ @i64//left_shifted
+ @i64//right_shifted
@i64//or
@i64//xor
@i64//and
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
index 10a5c6eec..4dc984bae 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
@@ -72,7 +72,7 @@
_
(/.loop/scope [start inits iteration])))))
- (maybe.default <apply>))))
+ (maybe.else <apply>))))
(in <apply>))
(^ (/.function/apply [funcS' argsS']))
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 956c59cd6..80d3eb556 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
@@ -369,7 +369,7 @@
[redundancy output] (optimization' [redundancy output])
#let [redundant? (|> redundancy
(dictionary.get register)
- (maybe.default ..necessary!))]]
+ (maybe.else ..necessary!))]]
(in [(dictionary.remove register redundancy)
(#/.Control (if redundant?
(#/.Branch (#/.Case input
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 e304e237c..a54350ccf 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
@@ -469,7 +469,7 @@
(!failure ..full_name_parser where offset source_code))
(#.Right [source'' [(|> aliases
(dictionary.get simple)
- (maybe.default simple))
+ (maybe.else simple))
complex]])))
<simple>)))))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
index 37e5f7cfa..c51151b68 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
@@ -76,7 +76,7 @@
(-> Graph Module Module Bit)
(let [target_ancestry (|> ancestry
(dictionary.get target)
- (maybe.default ..fresh))]
+ (maybe.else ..fresh))]
(set.member? target_ancestry source)))
(type: #export Order
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
index 6a25f1094..b1735f389 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
@@ -142,7 +142,7 @@
(Try java/util/jar/JarOutputStream))
(let [class_path (|> custom
(maybe\map (|>> name.internal name.read))
- (maybe.default (runtime.class_name [module artifact]))
+ (maybe.else (runtime.class_name [module artifact]))
(text.suffix (get@ #static.artifact_extension static)))]
(do try.monad
[_ (java/util/jar/JarOutputStream::putNextEntry (java/util/jar/JarEntry::new class_path) sink)]
diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux
index 845ba3dba..0554592a0 100644
--- a/stdlib/source/library/lux/tool/compiler/phase.lux
+++ b/stdlib/source/library/lux/tool/compiler/phase.lux
@@ -25,7 +25,7 @@
[archive (#+ Archive)]]])
(type: #export (Operation s o)
- (state.State' Try s o))
+ (state.+State Try s o))
(def: #export monad
(All [s] (Monad (Operation s)))
diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux
index f3f79adc2..ce3b32921 100644
--- a/stdlib/source/library/lux/type.lux
+++ b/stdlib/source/library/lux/type.lux
@@ -90,10 +90,10 @@
(list\fold (function.flip text\compose) ""))
")")
- (^template [<tag> <open> <close> <flatten>]
+ (^template [<tag> <open> <close> <flat>]
[(<tag> _)
($_ text\compose <open>
- (|> (<flatten> type)
+ (|> (<flat> type)
(list\map format)
list.reverse
(list.interpose " ")
@@ -160,17 +160,17 @@
[#.ExQ])
(#.Parameter idx)
- (maybe.default (error! ($_ text\compose
- "Unknown type parameter" text.new_line
- " Index: " (n\encode idx) text.new_line
- "Environment: " (|> env
- list.enumeration
- (list\map (.function (_ [index type])
- ($_ text\compose
- (n\encode index)
- " " (..format type))))
- (text.join_with (text\compose text.new_line " ")))))
- (list.nth idx env))
+ (maybe.else (error! ($_ text\compose
+ "Unknown type parameter" text.new_line
+ " Index: " (n\encode idx) text.new_line
+ "Environment: " (|> env
+ list.enumeration
+ (list\map (.function (_ [index type])
+ ($_ text\compose
+ (n\encode index)
+ " " (..format type))))
+ (text.join_with (text\compose text.new_line " ")))))
+ (list.nth idx env))
_
type
@@ -346,7 +346,7 @@
(#.Apply A F)
(|> (..applied (list A) F)
(\ maybe.monad map quantified?)
- (maybe.default #0))
+ (maybe.else #0))
(^or (#.UnivQ _) (#.ExQ _))
#1
diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux
index f6b6b35ac..66560bc4f 100644
--- a/stdlib/source/library/lux/type/abstract.lux
+++ b/stdlib/source/library/lux/type/abstract.lux
@@ -209,7 +209,7 @@
{export |export|.parser}
{[name type_vars] declaration}
representation_type
- {annotations (<>.default |annotations|.empty |annotations|.parser)}
+ {annotations (<>.else |annotations|.empty |annotations|.parser)}
{primitives (<>.some <code>.any)})
(do meta.monad
[current_module meta.current_module_name
diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux
index 4e6bcdc3d..03dd7b89e 100644
--- a/stdlib/source/library/lux/type/check.lux
+++ b/stdlib/source/library/lux/type/check.lux
@@ -376,7 +376,7 @@
then)
(do ..monad
[?bound (read id)]
- (else (maybe.default (#.Var id) ?bound)))))
+ (else (maybe.else (#.Var id) ?bound)))))
## TODO: "link_2" can be optimized...
(def: (link_2 left right)
diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux
index f44509aaa..2063b9de1 100644
--- a/stdlib/source/library/lux/type/implicit.lux
+++ b/stdlib/source/library/lux/type/implicit.lux
@@ -133,7 +133,7 @@
(do meta.monad
[local_batches meta.locals
#let [total_locals (list\fold (function (_ [name type] table)
- (try.default table (dictionary.try_put name type table)))
+ (try.else table (dictionary.try_put name type table)))
(: (Dictionary Text Type)
(dictionary.new text.hash))
(list\join local_batches))]]
diff --git a/stdlib/source/library/lux/type/unit.lux b/stdlib/source/library/lux/type/unit.lux
index 790aa77ad..9d2bbd9bf 100644
--- a/stdlib/source/library/lux/type/unit.lux
+++ b/stdlib/source/library/lux/type/unit.lux
@@ -87,7 +87,7 @@
{export |export|.parser}
{type_name <code>.local_identifier}
{unit_name <code>.local_identifier}
- {annotations (<>.default |annotations|.empty |annotations|.parser)})
+ {annotations (<>.else |annotations|.empty |annotations|.parser)})
(do meta.monad
[@ meta.current_module_name
#let [g!type (code.local_identifier type_name)]]
@@ -118,7 +118,7 @@
{type_name <code>.local_identifier}
{scale_name <code>.local_identifier}
{(^slots [#ratio.numerator #ratio.denominator]) ..scale}
- {annotations (<>.default |annotations|.empty |annotations|.parser)})
+ {annotations (<>.else |annotations|.empty |annotations|.parser)})
(do meta.monad
[@ meta.current_module_name
#let [g!scale (code.local_identifier type_name)]]
diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux
index 962636aa9..db20b54a4 100644
--- a/stdlib/source/library/lux/world/file.lux
+++ b/stdlib/source/library/lux/world/file.lux
@@ -98,7 +98,7 @@
(All [!] (-> (System !) Path Text))
(|> (..un_nest fs path)
(maybe\map product.right)
- (maybe.default path)))
+ (maybe.else path)))
(def: #export (async fs)
(-> (System IO) (System Async))
@@ -210,7 +210,7 @@
[(def: <name>
(|>> java/io/File::new
<method>
- (io\map (|>> (try.default false)))))]
+ (io\map (|>> (try.else false)))))]
[file? java/io/File::isFile]
[directory? java/io/File::isDirectory]
@@ -580,7 +580,7 @@
(~~ (template [<name> <method>]
[(def: <name>
(|>> <method>
- (io\map (|>> (try.default false)))))]
+ (io\map (|>> (try.else false)))))]
[file? os/path::isfile]
[directory? os/path::isdir]
@@ -706,7 +706,7 @@
(~~ (template [<name> <test>]
[(def: <name>
(|>> <test>
- (io\map (|>> (try.default false)))))]
+ (io\map (|>> (try.else false)))))]
[file? RubyFile::file?]
[directory? RubyFile::directory?]
@@ -1181,7 +1181,7 @@
(\ stm.monad map
(|>> (<retrieve> separator path)
(try\map (function.constant true))
- (try.default false)))
+ (try.else false)))
stm.commit))]
[file? ..retrieve_mock_file!]
diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux
index eea669a47..e1e572023 100644
--- a/stdlib/source/library/lux/world/file/watch.lux
+++ b/stdlib/source/library/lux/world/file/watch.lux
@@ -433,7 +433,7 @@
(do async.monad
[?concern (stop path)]
(do (try.with async.monad)
- [key (..default_start (..watch_events (..also (try.default ..none ?concern)
+ [key (..default_start (..watch_events (..also (try.else ..none ?concern)
concern))
watcher
path)]
diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux
index 02cc6ed91..0861d7d96 100644
--- a/stdlib/source/library/lux/world/net/http/client.lux
+++ b/stdlib/source/library/lux/world/net/http/client.lux
@@ -110,7 +110,7 @@
(def: (default_body input)
(-> java/io/BufferedInputStream (//.Body IO))
(|>> (maybe\map (|>> [true]))
- (maybe.default [false ..default_buffer_size])
+ (maybe.else [false ..default_buffer_size])
(case> [_ 0]
(do (try.with io.monad)
[_ (java/lang/AutoCloseable::close input)]
@@ -165,7 +165,7 @@
(do !
[?value (java/net/URLConnection::getHeaderField index connection)]
(recur (inc index)
- (dictionary.put name (maybe.default "" ?value) headers)))
+ (dictionary.put name (maybe.else "" ?value) headers)))
#.None
(in headers)))))
diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux
index a65f5b2c0..7ef59466b 100644
--- a/stdlib/source/library/lux/world/net/http/request.lux
+++ b/stdlib/source/library/lux/world/net/http/request.lux
@@ -85,7 +85,7 @@
(let [full (get@ #//.uri resource)
[uri query] (|> full
(text.split_with "?")
- (maybe.default [full ""]))]
+ (maybe.else [full ""]))]
(case (do try.monad
[query (//query.parameters query)
input (context.run query property)]
@@ -118,7 +118,7 @@
(case (do try.monad
[cookies (|> (get@ #//.headers message)
(dictionary.get "Cookie")
- (maybe.default "")
+ (maybe.else "")
//cookie.get)]
(context.run cookies property))
(#try.Success input)
diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux
index 730a2001a..f73621cae 100644
--- a/stdlib/source/library/lux/world/program.lux
+++ b/stdlib/source/library/lux/world/program.lux
@@ -252,7 +252,7 @@
(do !
[?output (LuaFile::read ["*l"] file)
_ (LuaFile::close [] file)]
- (in (maybe.default default ?output)))
+ (in (maybe.else default ?output)))
#.None
(in default))
@@ -378,7 +378,7 @@
(def: home
(io.run
(with_expansions [<default> (io.io "~")
- <jvm> (io.io (maybe.default "" (java/lang/System::getProperty "user.home")))]
+ <jvm> (io.io (maybe.else "" (java/lang/System::getProperty "user.home")))]
(for {@.old <jvm>
@.jvm <jvm>
@.js (if ffi.on_node_js?
@@ -401,7 +401,7 @@
(def: directory
(io.run
(with_expansions [<default> "."
- <jvm> (io.io (maybe.default "" (java/lang/System::getProperty "user.dir")))]
+ <jvm> (io.io (maybe.else "" (java/lang/System::getProperty "user.dir")))]
(for {@.old <jvm>
@.jvm <jvm>
@.js (if ffi.on_node_js?
diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux
index 9ce3b6a6e..d8eecd816 100644
--- a/stdlib/source/poly/lux/data/format/json.lux
+++ b/stdlib/source/poly/lux/data/format/json.lux
@@ -55,14 +55,14 @@
(function (_ input)
(non_rec (rec_encode non_rec) input)))
-(def: low_mask Nat (|> 1 (i64.left_shift 32) dec))
-(def: high_mask Nat (|> low_mask (i64.left_shift 32)))
+(def: low_mask Nat (|> 1 (i64.left_shifted 32) dec))
+(def: high_mask Nat (|> low_mask (i64.left_shifted 32)))
(implementation: nat_codec
(codec.Codec JSON Nat)
(def: (encode input)
- (let [high (|> input (i64.and high_mask) (i64.right_shift 32))
+ (let [high (|> input (i64.and high_mask) (i64.right_shifted 32))
low (i64.and low_mask input)]
(#/.Array (row (|> high .int int.frac #/.Number)
(|> low .int int.frac #/.Number)))))
@@ -71,7 +71,7 @@
(do <>.monad
[high </>.number
low </>.number]
- (in (n.+ (|> high frac.int .nat (i64.left_shift 32))
+ (in (n.+ (|> high frac.int .nat (i64.left_shifted 32))
(|> low frac.int .nat))))))))
(implementation: int_codec
diff --git a/stdlib/source/program/aedifex/artifact/versioning.lux b/stdlib/source/program/aedifex/artifact/versioning.lux
index 37adedea1..44973b54e 100644
--- a/stdlib/source/program/aedifex/artifact/versioning.lux
+++ b/stdlib/source/program/aedifex/artifact/versioning.lux
@@ -84,9 +84,9 @@
(Parser Versioning)
(<| (<xml>.node ..<versioning>)
($_ <>.and
- (<>.default #//snapshot.Local (<xml>.somewhere //snapshot.parser))
- (<>.default //time.epoch (<xml>.somewhere ..last_updated_parser))
- (<| (<>.default (list))
+ (<>.else #//snapshot.Local (<xml>.somewhere //snapshot.parser))
+ (<>.else //time.epoch (<xml>.somewhere ..last_updated_parser))
+ (<| (<>.else (list))
<xml>.somewhere
(<xml>.node ..<snapshot_versions>)
(<>.some //snapshot/version.parser))
diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux
index 994f192fe..975ee26ba 100644
--- a/stdlib/source/program/aedifex/command/auto.lux
+++ b/stdlib/source/program/aedifex/command/auto.lux
@@ -30,7 +30,7 @@
(let [! async.monad]
(|> path
(\ fs sub_directories)
- (\ ! map (|>> (try.default (list))
+ (\ ! map (|>> (try.else (list))
(monad.map ! (targets fs))))
(\ ! join)
(\ ! map (|>> list.concat (list& path))))))
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux
index b675bb5cd..072e6e094 100644
--- a/stdlib/source/program/aedifex/command/build.lux
+++ b/stdlib/source/program/aedifex/command/build.lux
@@ -233,8 +233,8 @@
Bit
(|> (java/lang/System::getProperty "os.name")
io.run
- (try.default "")
- text.lower_case
+ (try.else "")
+ text.lower_cased
(text.starts_with? "windows")))
(def: jvm_class_path_separator
diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux
index 3bd510675..97ed8eb4c 100644
--- a/stdlib/source/program/aedifex/dependency/resolution.lux
+++ b/stdlib/source/program/aedifex/dependency/resolution.lux
@@ -90,7 +90,7 @@
actual (|> output
(text.split_all_with " ")
list.head
- (maybe.default output)
+ (maybe.else output)
(\ codec decode))
_ (exception.assert exception [artifact extension output]
(\ ///hash.equivalence = (hash library) actual))]
@@ -233,12 +233,12 @@
[#let [sub_dependencies (|> package
///package.dependencies
(try\map set.to_list)
- (try.default (list)))
+ (try.else (list)))
## For security reasons, it's not a good idea to allow dependencies to introduce repositories.
## package_repositories (|> package
## ///package.repositories
## (try\map set.to_list)
- ## (try.default (list))
+ ## (try.else (list))
## (list\map new_repository))
## sub_repositories (list\compose repositories package_repositories)
sub_repositories repositories]
diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux
index c96957740..6a9d812c9 100644
--- a/stdlib/source/program/aedifex/metadata/snapshot.lux
+++ b/stdlib/source/program/aedifex/metadata/snapshot.lux
@@ -103,9 +103,9 @@
versions
versions)))))
- (<>.default {#///artifact/versioning.snapshot #///artifact/snapshot.Local
- #///artifact/versioning.last_updated ///artifact/time.epoch
- #///artifact/versioning.versions (list <default_version>)})))]
+ (<>.else {#///artifact/versioning.snapshot #///artifact/snapshot.Local
+ #///artifact/versioning.last_updated ///artifact/time.epoch
+ #///artifact/versioning.versions (list <default_version>)})))]
(in {#artifact {#///artifact.group group
#///artifact.name name
#///artifact.version version}
diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux
index ca5fe3be3..49384a986 100644
--- a/stdlib/source/program/aedifex/parser.lux
+++ b/stdlib/source/program/aedifex/parser.lux
@@ -89,10 +89,10 @@
($_ <>.and
(..singular input "name" ..name)
(..singular input "url" ..url)
- (<>.default #/.Repo
- (..singular input "type"
- (<>.or (<code>.this! (' #repo))
- (<code>.this! (' #manual))))))))
+ (<>.else #/.Repo
+ (..singular input "type"
+ (<>.or (<code>.this! (' #repo))
+ (<code>.this! (' #manual))))))))
(def: organization
(Parser /.Organization)
@@ -133,10 +133,10 @@
(<>.maybe (..singular input "url" ..url))
(<>.maybe (..singular input "scm" ..scm))
(<>.maybe (..singular input "description" ..description))
- (<>.default (list) (..plural input "licenses" ..license))
+ (<>.else (list) (..plural input "licenses" ..license))
(<>.maybe (..singular input "organization" ..organization))
- (<>.default (list) (..plural input "developers" ..developer))
- (<>.default (list) (..plural input "contributors" ..contributor))
+ (<>.else (list) (..plural input "developers" ..developer))
+ (<>.else (list) (..plural input "contributors" ..contributor))
)))
(def: repository
@@ -152,7 +152,7 @@
(<code>.tuple
($_ <>.and
..artifact'
- (<>.default //artifact/type.lux_library ..type)
+ (<>.else //artifact/type.lux_library ..type)
)))
(def: source
@@ -186,8 +186,8 @@
(<code>.record (<>.some (<>.and <code>.local_tag
<code>.any))))
#let [^parents (: (Parser (List /.Name))
- (<>.default (list)
- (..plural input "parents" <code>.text)))
+ (<>.else (list)
+ (..plural input "parents" <code>.text)))
^identity (: (Parser (Maybe Artifact))
(<>.maybe
(..singular input "identity" ..artifact)))
@@ -197,23 +197,23 @@
^repositories (: (Parser (Set //repository.Address))
(|> (..plural input "repositories" ..repository)
(\ ! map (set.of_list text.hash))
- (<>.default (set.new text.hash))
+ (<>.else (set.new text.hash))
(\ ! map (set.add /.default_repository))))
^dependencies (: (Parser (Set //dependency.Dependency))
(|> (..plural input "dependencies" ..dependency)
(\ ! map (set.of_list //dependency.hash))
- (<>.default (set.new //dependency.hash))))
+ (<>.else (set.new //dependency.hash))))
^compiler (|> ..dependency
(..singular input "compiler")
- (<>.default /.default_compiler))
+ (<>.else /.default_compiler))
^sources (: (Parser (Set /.Source))
(|> (..plural input "sources" ..source)
(\ ! map (set.of_list text.hash))
- (<>.default (set.of_list text.hash (list /.default_source)))))
+ (<>.else (set.of_list text.hash (list /.default_source)))))
^target (: (Parser /.Target)
(|> ..target
(..singular input "target")
- (<>.default /.default_target)))
+ (<>.else /.default_target)))
^program (: (Parser (Maybe Module))
(<>.maybe
(..singular input "program" ..module)))
@@ -222,23 +222,23 @@
(..singular input "test" ..module)))
^deploy_repositories (: (Parser (Dictionary Text //repository.Address))
(<| (\ ! map (dictionary.of_list text.hash))
- (<>.default (list))
+ (<>.else (list))
(..singular input "deploy_repositories" ..deploy_repository)))
^java (|> ..runtime
(..singular input "java")
- (<>.default //runtime.default_java))
+ (<>.else //runtime.default_java))
^js (|> ..runtime
(..singular input "js")
- (<>.default //runtime.default_js))
+ (<>.else //runtime.default_js))
^python (|> ..runtime
(..singular input "python")
- (<>.default //runtime.default_python))
+ (<>.else //runtime.default_python))
^lua (|> ..runtime
(..singular input "lua")
- (<>.default //runtime.default_lua))
+ (<>.else //runtime.default_lua))
^ruby (|> ..runtime
(..singular input "ruby")
- (<>.default //runtime.default_ruby))]]
+ (<>.else //runtime.default_ruby))]]
($_ <>.and
^parents
^identity
@@ -262,7 +262,7 @@
(Parser Project)
(let [default_profile (: (Parser Project)
(\ <>.monad map
- (|>> [/.default] (list) (dictionary.of_list text.hash))
+ (|>> [/.else] (list) (dictionary.of_list text.hash))
..profile))
multi_profile (: (Parser Project)
(\ <>.monad map
diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux
index 145d65f6e..e37bbe0e9 100644
--- a/stdlib/source/program/aedifex/pom.lux
+++ b/stdlib/source/program/aedifex/pom.lux
@@ -114,7 +114,7 @@
(-> /.Developer (List XML))
(list& (..property "name" name)
(..property "email" email)
- (|> organization (maybe\map ..developer_organization) (maybe.default (list)))))
+ (|> organization (maybe\map ..developer_organization) (maybe.else (list)))))
(template [<name> <type> <tag>]
[(def: <name>
@@ -177,12 +177,12 @@
#//artifact.name artifact
#//artifact.version (|> properties
(dictionary.get ["" ..version_tag])
- (maybe.default "")
+ (maybe.else "")
(text.replace_all "${project.version}" own_version)
(text.replace_all "${project.parent.version}" parent_version))}
#//dependency.type (|> properties
(dictionary.get ["" "type"])
- (maybe.default //artifact/type.jvm_library))})))))
+ (maybe.else //artifact/type.jvm_library))})))))
(def: (dependencies_parser own_version parent_version)
(-> Text Text (Parser (List Dependency)))
@@ -213,16 +213,16 @@
(def: #export parser
(Parser /.Profile)
(do {! <>.monad}
- [own_version (<>.default "" (<xml>.somewhere ..own_version))
- parent_version (<>.default "" (<xml>.somewhere ..parent_version))]
+ [own_version (<>.else "" (<xml>.somewhere ..own_version))
+ parent_version (<>.else "" (<xml>.somewhere ..parent_version))]
(<| (<xml>.node ["" ..project_tag])
(do !
[dependencies (|> (..dependencies_parser own_version parent_version)
<xml>.somewhere
- (<>.default (list)))
+ (<>.else (list)))
repositories (|> ..repositories_parser
<xml>.somewhere
- (<>.default (list)))
+ (<>.else (list)))
_ (<>.some <xml>.ignore)]
(in (|> (\ /.monoid identity)
(update@ #/.dependencies (function (_ empty)
diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux
index fd66e6d61..a440042c4 100644
--- a/stdlib/source/program/scriptum.lux
+++ b/stdlib/source/program/scriptum.lux
@@ -176,9 +176,9 @@
([#.Var "⌈v:" "⌋"]
[#.Ex "⟨e:" "⟩"])
- (^template [<tag> <name> <flatten>]
+ (^template [<tag> <name> <flat>]
[[_ (<tag> _)]
- (let [[level' body] (<flatten> type)
+ (let [[level' body] (<flat> type)
args (level_to_args level level')
body_doc (pprint_type_definition (n.+ level level') type_func_info tags module signature? recursive_type? body)]
(format "(" <name> " " "[" (text.join_with " " args) "]"
@@ -241,9 +241,9 @@
([#.Var "⌈" "⌋"]
[#.Ex "⟨" "⟩"])
- (^template [<tag> <name> <flatten>]
+ (^template [<tag> <name> <flat>]
[(<tag> _)
- (let [[level' body] (<flatten> type)
+ (let [[level' body] (<flat> type)
args (level_to_args level level')
body_doc (pprint_type (n.+ level level') type_func_name module body)]
(format "(" <name> " " "[" (|> args (list.interpose " ") (text.join_with "")) "]"
@@ -371,7 +371,7 @@
(|> type
(unravel_type_func nesting)
(when> [(new> recursive_type? [])] [unrecurse_type])
- (pprint_type_definition (dec nesting) [_name type_arguments] (maybe.default (list) tags) module signature? recursive_type?)
+ (pprint_type_definition (dec nesting) [_name type_arguments] (maybe.else (list) tags) module signature? recursive_type?)
(text.split_all_with text.new_line)
(list\map (|>> (format " ")))
(text.join_with text.new_line))
@@ -411,7 +411,7 @@
($_ md.then
(md.heading/3 name)
(<| (: (Markdown Block))
- (maybe.default md.empty)
+ (maybe.else md.empty)
(do maybe.monad
[documentation (annotation.documentation def_annotations)]
(in (md.code documentation))))))))
@@ -463,7 +463,7 @@
[#let [(^slots [#types #macros #implementations #values]) organization
annotations (|> module
(get@ #.module_annotations)
- (maybe.default (' {}))
+ (maybe.else (' {}))
annotation.documentation)
description (case annotations
(#.Some doc_text)
diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux
index 1ef9f780b..c13cd9eae 100644
--- a/stdlib/source/specification/compositor/generation/common.lux
+++ b/stdlib/source/specification/compositor/generation/common.lux
@@ -52,8 +52,8 @@
["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_shifted (n.% 64 param)]
+ ["lux i64 logical-right-shift" i64.logic_right_shifted (n.% 64 param)]
)]
($_ _.and
<binary>
@@ -64,7 +64,7 @@
(run (..safe "lux i64 arithmetic-right-shift"))
(case> (#try.Success valueT)
("lux i64 ="
- (i64.arithmetic_right_shift param subject)
+ (i64.arithmetic_right_shifted param subject)
(:as I64 valueT))
(#try.Failure _)
@@ -92,7 +92,7 @@
["lux i64 f64" Frac i.frac f.= subject]
["lux i64 char" Text (|>> (:as Nat) text.from_code) text\= (|> subject
(:as Nat)
- (n.% (i64.left_shift 8 1))
+ (n.% (i64.left_shifted 8 1))
(:as Int))]
))
(~~ (template [<extension> <reference> <outputT> <comp>]
diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux
index 910dfde68..79eb871fe 100644
--- a/stdlib/source/specification/lux/world/file.lux
+++ b/stdlib/source/specification/lux/world/file.lux
@@ -67,7 +67,7 @@
(|> (/.nest fs parent child)
(/.parent fs)
(maybe\map (text\= parent))
- (maybe.default false)))
+ (maybe.else false)))
(_.cover' [/.name]
(|> (/.nest fs parent child)
(/.name fs)
@@ -106,7 +106,7 @@
appended? (\ fs append appendix path)
post_file_size (\ fs file_size path)
post_content (\ fs read path)]
- (in (<| (try.default false)
+ (in (<| (try.else false)
(do {! try.monad}
[pre_file_size!
(\ ! map (n.= expected_file_size) pre_file_size)
@@ -131,7 +131,7 @@
(do async.monad
[modified? (\ fs modify expected_time path)
last_modified (\ fs last_modified path)]
- (in (<| (try.default false)
+ (in (<| (try.else false)
(do {! try.monad}
[_ modified?]
(\ ! map (instant\= expected_time) last_modified))))))
@@ -145,15 +145,15 @@
directory_files (\ fs directory_files parent)
sub_directories (\ fs sub_directories parent)
#let [(^open "list\.") (list.equivalence text.equivalence)]]
- (in (<| (try.default false)
+ (in (<| (try.else false)
(do try.monad
[_ made_sub?]
(in (and (|> directory_files
(try\map (list\= (list child)))
- (try.default false))
+ (try.else false))
(|> sub_directories
(try\map (list\= (list sub_dir)))
- (try.default false))))))))))
+ (try.else false))))))))))
(def: (move&delete fs parent child alternate_child)
(-> (/.System Async) /.Path Text Text (Async Bit))
@@ -166,7 +166,7 @@
(\ ! map not))
found? (\ fs file? destination)
deleted? (\ fs delete destination)]
- (in (<| (try.default false)
+ (in (<| (try.else false)
(do try.monad
[_ moved?
_ deleted?]
@@ -208,7 +208,7 @@
can_execute?
(|> path
(\ fs can_execute?)
- (\ ! map (|>> (try.default true) not)))
+ (\ ! map (|>> (try.else true) not)))
directory_files&sub_directories
(..directory_files&sub_directories fs parent sub_dir child)
diff --git a/stdlib/source/specification/lux/world/shell.lux b/stdlib/source/specification/lux/world/shell.lux
index f7d8f28e7..16e0b6db8 100644
--- a/stdlib/source/specification/lux/world/shell.lux
+++ b/stdlib/source/specification/lux/world/shell.lux
@@ -37,7 +37,7 @@
(-> (/.Process Async) _.Assertion)
(|> (\ process await [])
(async\map (|>> (try\map (i.= /.normal))
- (try.default false)
+ (try.else false)
(_.cover' [/.Exit /.normal])))
async\join))
@@ -45,7 +45,7 @@
(-> Text (/.Process Async) (Async Bit))
(|> (\ process read [])
(async\map (|>> (try\map (text\= expected))
- (try.default false)))))
+ (try.else false)))))
(def: (can_destroy! process)
(-> (/.Process Async) (Async Bit))
diff --git a/stdlib/source/test/aedifex/artifact/snapshot.lux b/stdlib/source/test/aedifex/artifact/snapshot.lux
index 931fefd17..d8ececcd4 100644
--- a/stdlib/source/test/aedifex/artifact/snapshot.lux
+++ b/stdlib/source/test/aedifex/artifact/snapshot.lux
@@ -41,7 +41,7 @@
list
(<xml>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false))))
+ (try.else false))))
$/build.test
$/stamp.test
diff --git a/stdlib/source/test/aedifex/artifact/snapshot/build.lux b/stdlib/source/test/aedifex/artifact/snapshot/build.lux
index 8b0be9f1d..55bdc0a42 100644
--- a/stdlib/source/test/aedifex/artifact/snapshot/build.lux
+++ b/stdlib/source/test/aedifex/artifact/snapshot/build.lux
@@ -35,5 +35,5 @@
list
(<xml>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false))))
+ (try.else false))))
))))
diff --git a/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux b/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux
index 00be1c227..deea0e954 100644
--- a/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux
+++ b/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux
@@ -42,5 +42,5 @@
/.format
(<xml>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false))))
+ (try.else false))))
)))
diff --git a/stdlib/source/test/aedifex/artifact/snapshot/time.lux b/stdlib/source/test/aedifex/artifact/snapshot/time.lux
index 820214cba..05e575e64 100644
--- a/stdlib/source/test/aedifex/artifact/snapshot/time.lux
+++ b/stdlib/source/test/aedifex/artifact/snapshot/time.lux
@@ -37,6 +37,6 @@
/.format
(<text>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false)))
+ (try.else false)))
))
)))
diff --git a/stdlib/source/test/aedifex/artifact/snapshot/version.lux b/stdlib/source/test/aedifex/artifact/snapshot/version.lux
index a4a090246..c63dc4f51 100644
--- a/stdlib/source/test/aedifex/artifact/snapshot/version.lux
+++ b/stdlib/source/test/aedifex/artifact/snapshot/version.lux
@@ -44,7 +44,7 @@
list
(<xml>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false))))
+ (try.else false))))
/value.test
)))
diff --git a/stdlib/source/test/aedifex/artifact/time.lux b/stdlib/source/test/aedifex/artifact/time.lux
index 9ac9be6ae..982d2b0f7 100644
--- a/stdlib/source/test/aedifex/artifact/time.lux
+++ b/stdlib/source/test/aedifex/artifact/time.lux
@@ -44,7 +44,7 @@
/.format
(<text>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false))))
+ (try.else false))))
(do random.monad
[expected ..random]
(_.cover [/.instant /.of_instant]
@@ -52,7 +52,7 @@
/.instant
/.of_instant
(try\map (\ /.equivalence = expected))
- (try.default false))))
+ (try.else false))))
(_.cover [/.epoch]
(instant\= instant.epoch (/.instant /.epoch)))
diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux
index 4d44b5358..5dd7156fc 100644
--- a/stdlib/source/test/aedifex/artifact/time/date.lux
+++ b/stdlib/source/test/aedifex/artifact/time/date.lux
@@ -50,13 +50,13 @@
/.format
(<text>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false)))
+ (try.else false)))
(_.cover [/.value /.date]
(|> expected
/.value
/.date
(try\map (\ /.equivalence = expected))
- (try.default false)))
+ (try.else false)))
(_.cover [/.year_is_out_of_range]
(case (/.date candidate)
(#try.Success date)
diff --git a/stdlib/source/test/aedifex/artifact/time/time.lux b/stdlib/source/test/aedifex/artifact/time/time.lux
index dd4b63904..904e34aec 100644
--- a/stdlib/source/test/aedifex/artifact/time/time.lux
+++ b/stdlib/source/test/aedifex/artifact/time/time.lux
@@ -34,5 +34,5 @@
/.format
(<text>.run /.parser)
(try\map (\ time.equivalence = expected))
- (try.default false))))
+ (try.else false))))
)))
diff --git a/stdlib/source/test/aedifex/artifact/versioning.lux b/stdlib/source/test/aedifex/artifact/versioning.lux
index a16794e98..79d063123 100644
--- a/stdlib/source/test/aedifex/artifact/versioning.lux
+++ b/stdlib/source/test/aedifex/artifact/versioning.lux
@@ -43,12 +43,12 @@
list
(<xml>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false))))
+ (try.else false))))
(_.cover [/.init]
(|> /.init
/.format
list
(<xml>.run /.parser)
(try\map (\ /.equivalence = /.init))
- (try.default false)))
+ (try.else false)))
)))
diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux
index 2a2d3d2e4..4b7fcc885 100644
--- a/stdlib/source/test/aedifex/cache.lux
+++ b/stdlib/source/test/aedifex/cache.lux
@@ -83,7 +83,7 @@
[[main_dependency main_package] ..package
dependencies (|> (//package.dependencies main_package)
(\ try.monad map set.to_list)
- (try.default (list))
+ (try.else (list))
(monad.map ! (function (_ dependency)
(do !
[pom (random.one (function (_ [identity profile pom])
@@ -111,7 +111,7 @@
[wrote! (/.write_one program fs dependency expected_package)
read! (/.read_one program fs dependency)]
(_.cover' [/.write_one /.read_one]
- (<| (try.default false)
+ (<| (try.else false)
(do try.monad
[_ wrote!
actual_package read!]
@@ -132,7 +132,7 @@
[wrote! (/.write_all program fs expected)
read! (/.read_all program fs (dictionary.keys expected) //dependency/resolution.empty)]
(_.cover' [/.write_all /.read_all]
- (<| (try.default false)
+ (<| (try.else false)
(do try.monad
[_ wrote!
actual read!]
diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux
index e27fd039a..fd08f541c 100644
--- a/stdlib/source/test/aedifex/command/auto.lux
+++ b/stdlib/source/test/aedifex/command/auto.lux
@@ -122,5 +122,5 @@
(in (#try.Success (and correct_number_of_runs!
no_dangling_process!)))))]
(_.cover' [/.do!]
- (try.default false verdict))))
+ (try.else false verdict))))
))))
diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux
index b38b61340..1a1ff7f60 100644
--- a/stdlib/source/test/aedifex/command/build.lux
+++ b/stdlib/source/test/aedifex/command/build.lux
@@ -199,7 +199,7 @@
/.ruby_compiler_name
/.start
/.success]
- (try.default false verdict)))))
+ (try.else false verdict)))))
(do !
[#let [console (@version.echo "")]
[compiler resolution] ..resolution]
@@ -213,7 +213,7 @@
(in (and (text\= /.start start)
(text\= /.failure end))))]
(_.cover' [/.failure]
- (try.default false verdict)))))
+ (try.else false verdict)))))
(do !
[expected/0 (random.ascii/alpha 5)
expected/1 (random.ascii/alpha 5)
@@ -243,7 +243,7 @@
(text\= expected/2 actual/2)
end!)))]
(_.cover' [<log!>]
- (try.default false verdict)))))]
+ (try.else false verdict)))))]
[#0 /.log_output!]
[#1 /.log_error!]
diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux
index 238fa824b..36ed10b8e 100644
--- a/stdlib/source/test/aedifex/command/clean.lux
+++ b/stdlib/source/test/aedifex/command/clean.lux
@@ -116,4 +116,4 @@
(not sub_exists!/post))
(text\= (/.success target_path) logging))))]
(_.cover' [/.do! /.success]
- (try.default false verdict)))))))
+ (try.else false verdict)))))))
diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux
index 41a997d6f..b34584b19 100644
--- a/stdlib/source/test/aedifex/command/deploy.lux
+++ b/stdlib/source/test/aedifex/command/deploy.lux
@@ -125,4 +125,4 @@
deployed_sha-1!
deployed_md5!)))]
(_.cover' [/.do! /.success]
- (try.default false verdict)))))))
+ (try.else false verdict)))))))
diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux
index c00c88078..165c859b8 100644
--- a/stdlib/source/test/aedifex/command/deps.lux
+++ b/stdlib/source/test/aedifex/command/deps.lux
@@ -127,4 +127,4 @@
had_dependee_after!
had_depender_after!)))]
(_.cover' [/.do!]
- (try.default false verdict)))))))
+ (try.else false verdict)))))))
diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux
index a9de141ff..f68fcb732 100644
--- a/stdlib/source/test/aedifex/command/install.lux
+++ b/stdlib/source/test/aedifex/command/install.lux
@@ -93,7 +93,7 @@
library_exists!
pom_exists!)))]
(_.cover' [/.do! /.success]
- (try.default false verdict))))
+ (try.else false verdict))))
(in (do {! async.monad}
[#let [fs (file.mock /)
program (program.async (program.mock environment.empty home working_directory))]
@@ -101,5 +101,5 @@
(_.cover' [/.failure]
(|> logging
(try\map (text\= /.failure))
- (try.default false)))))
+ (try.else false)))))
))))
diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux
index ebc0ae09e..6578e793f 100644
--- a/stdlib/source/test/aedifex/command/pom.lux
+++ b/stdlib/source/test/aedifex/command/pom.lux
@@ -58,7 +58,7 @@
(in (and logging!
expected_content!)))]
(_.cover' [/.do! /.success]
- (try.default false verdict)))
+ (try.else false verdict)))
(#try.Failure error)
(_.cover' [/.do!]
diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux
index 93c6642f7..b82a32678 100644
--- a/stdlib/source/test/aedifex/command/test.lux
+++ b/stdlib/source/test/aedifex/command/test.lux
@@ -76,7 +76,7 @@
(text\= /.success test_end)))))]
(_.cover' [/.do!
/.start /.success]
- (try.default false verdict)))))
+ (try.else false verdict)))))
(let [fs (file.mock (\ file.default separator))
console (@version.echo "")]
(in (do async.monad
@@ -111,5 +111,5 @@
(and (text\= /.start test_start)
(text\= /.failure test_end)))))]
(_.cover' [/.failure]
- (try.default false verdict)))))
+ (try.else false verdict)))))
))))
diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux
index 30c7d3f80..f87424ab6 100644
--- a/stdlib/source/test/aedifex/command/version.lux
+++ b/stdlib/source/test/aedifex/command/version.lux
@@ -76,4 +76,4 @@
(in (text\= (version.format language/lux.version)
logging)))]
(_.cover' [/.do!]
- (try.default false verdict)))))))
+ (try.else false verdict)))))))
diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux
index 3688e56aa..e62e7b2e4 100644
--- a/stdlib/source/test/aedifex/dependency/deployment.lux
+++ b/stdlib/source/test/aedifex/dependency/deployment.lux
@@ -107,7 +107,7 @@
(and (|> cache
(dictionary.get library_url)
(maybe\map (binary\= expected_library))
- (maybe.default false))
+ (maybe.else false))
(dictionary.key? cache (format library_url artifact/extension.sha-1))
(dictionary.key? cache (format library_url artifact/extension.md5)))
@@ -115,7 +115,7 @@
(and (|> cache
(dictionary.get pom_url)
(maybe\map (binary\= expected_pom))
- (maybe.default false))
+ (maybe.else false))
(dictionary.key? cache (format pom_url artifact/extension.sha-1))
(dictionary.key? cache (format pom_url artifact/extension.md5)))
@@ -162,7 +162,7 @@
(_.cover' [/.one]
(|> ?outcome
(try\map (verify_one 1 address package cache expected_artifact))
- (try.default false))))))
+ (try.else false))))))
(do {! random.monad}
[#let [hash (: (Hash [Dependency Artifact Package])
(\ hash.functor map (|>> product.right product.left product.left)
@@ -200,5 +200,5 @@
bundles)]
(and expected_deployments!
every_deployment_was_correct!))))
- (try.default false))))))
+ (try.else false))))))
))))
diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux
index 0cea854c4..e86efa6dd 100644
--- a/stdlib/source/test/aedifex/input.lux
+++ b/stdlib/source/test/aedifex/input.lux
@@ -63,4 +63,4 @@
(update@ #//.repositories ..with_default_repository))
actual)))]
(_.cover' [/.read]
- (try.default false verdict)))))))
+ (try.else false verdict)))))))
diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux
index acd0575a0..0d291d368 100644
--- a/stdlib/source/test/aedifex/metadata/artifact.lux
+++ b/stdlib/source/test/aedifex/metadata/artifact.lux
@@ -77,7 +77,7 @@
#///artifact.version (|> expected
(get@ #/.versions)
list.head
- (maybe.default ""))}]]
+ (maybe.else ""))}]]
($_ _.and
(_.for [/.equivalence]
($equivalence.spec /.equivalence ..random))
@@ -90,7 +90,7 @@
list
(<xml>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false))))
+ (try.else false))))
(_.cover [/.uri]
(text\= (//.remote_project_uri artifact)
(/.uri artifact)))
diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux
index c9787d8bb..ff11ff7ab 100644
--- a/stdlib/source/test/aedifex/metadata/snapshot.lux
+++ b/stdlib/source/test/aedifex/metadata/snapshot.lux
@@ -102,7 +102,7 @@
list
(<xml>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false)))
+ (try.else false)))
(_.cover [/.uri]
(text\= (//.remote_artifact_uri artifact)
(/.uri artifact)))
diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux
index 8896b731d..9c6adfcf2 100644
--- a/stdlib/source/test/aedifex/package.lux
+++ b/stdlib/source/test/aedifex/package.lux
@@ -95,7 +95,7 @@
[xml_pom (\ utf8.codec decode binary_pom)
decoded_pom (\ xml.codec decode xml_pom)]
(in (\ xml.equivalence = actual_pom decoded_pom)))
- (try.default false))
+ (try.else false))
(case pom_status
(#//status.Verified actual_sha1 expected_md5)
(and (//hash\= expected_sha1 actual_sha1)
diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux
index 4df06a337..58ee8c577 100644
--- a/stdlib/source/test/aedifex/project.lux
+++ b/stdlib/source/test/aedifex/project.lux
@@ -75,13 +75,13 @@
(_.cover [/.profile]
(and (|> (/.profile super_name project)
(try\map (\ //.equivalence = super_profile))
- (try.default false))
+ (try.else false))
(|> (/.profile dummy_name project)
(try\map (\ //.equivalence = dummy_profile))
- (try.default false))
+ (try.else false))
(|> (/.profile sub_name project)
(try\map (\ //.equivalence = (\ //.monoid compose sub_profile super_profile)))
- (try.default false))))
+ (try.else false))))
(_.cover [/.unknown_profile]
(case (/.profile fake_name project)
(#try.Success _)
diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux
index 180ea404a..eab07411f 100644
--- a/stdlib/source/test/aedifex/repository/local.lux
+++ b/stdlib/source/test/aedifex/repository/local.lux
@@ -48,5 +48,5 @@
(#try.Failure _) true)
(|> actual
(try\map (binary\= expected))
- (try.default false))))))
+ (try.else false))))))
))))
diff --git a/stdlib/source/test/aedifex/repository/remote.lux b/stdlib/source/test/aedifex/repository/remote.lux
index 5f74cab9d..cad0fe873 100644
--- a/stdlib/source/test/aedifex/repository/remote.lux
+++ b/stdlib/source/test/aedifex/repository/remote.lux
@@ -49,7 +49,7 @@
(if (|> headers
(dictionary.get "User-Agent")
(maybe\map (is? /.user_agent))
- (maybe.default false))
+ (maybe.else false))
(case [method input]
[#@http.Get #.None]
[http/status.ok
@@ -60,7 +60,7 @@
(if (|> headers
(dictionary.get "Authorization")
(maybe\map (text\= (//identity.basic_auth user password)))
- (maybe.default false))
+ (maybe.else false))
[http/status.created
{#@http.headers (http.headers (list))
#@http.body (..url_body url)}]
@@ -103,11 +103,11 @@
(try\map (\ utf8.codec decode))
try\join
(try\map (text\= (format address uri)))
- (try.default false))
+ (try.else false))
(|> (\ repo upload uri content)
io.run
(try\map (function.constant true))
- (try.default false)))))
+ (try.else false)))))
(_.cover [/.upload_failure]
(let [repo (/.repository (..good_http user password)
#.None
diff --git a/stdlib/source/test/aedifex/runtime.lux b/stdlib/source/test/aedifex/runtime.lux
index cb6d1a8fe..bd87377bc 100644
--- a/stdlib/source/test/aedifex/runtime.lux
+++ b/stdlib/source/test/aedifex/runtime.lux
@@ -62,5 +62,5 @@
(get@ #/.parameters)
list.last
(maybe\map (text\= path))
- (maybe.default false)))))
+ (maybe.else false)))))
)))))
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index 11e3b6c73..04f6bea3f 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -779,7 +779,11 @@
Test
(do random.monad
[left random.nat
- right (random.ascii/lower 1)]
+ right (random.ascii/lower 1)
+
+ item/0 random.nat
+ item/1 random.nat
+ item/2 random.nat]
($_ _.and
(_.cover [/.Either]
(and (exec
@@ -833,6 +837,21 @@
(and (/.is? left left)
(and (n.= not_left left)
(not (/.is? not_left left))))))
+ (_.cover [/.Rec]
+ (let [list (: (/.Rec NList
+ (Maybe [Nat NList]))
+ (#.Some [item/0
+ (#.Some [item/1
+ (#.Some [item/2
+ #.None])])]))]
+ (case list
+ (#.Some [actual/0 (#.Some [actual/1 (#.Some [actual/2 #.None])])])
+ (and (is? item/0 actual/0)
+ (is? item/1 actual/1)
+ (is? item/2 actual/2))
+
+ _
+ false)))
)))
(type: (Pair l r)
diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux
index 8e472db22..b389a9c8b 100644
--- a/stdlib/source/test/lux/abstract/enum.lux
+++ b/stdlib/source/test/lux/abstract/enum.lux
@@ -31,8 +31,8 @@
($_ _.and
(_.cover [/.range]
(let [expected_size (|> end (n.- start) inc)
- expected_start? (|> range list.head (maybe\map (n.= start)) (maybe.default false))
- expected_end? (|> range list.last (maybe\map (n.= end)) (maybe.default false))
+ expected_start? (|> range list.head (maybe\map (n.= start)) (maybe.else false))
+ expected_end? (|> range list.last (maybe\map (n.= end)) (maybe.else false))
can_be_backwards? (\ (list.equivalence n.equivalence) =
(/.range n.enum start end)
(list.reverse (/.range n.enum end start)))
diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux
index 5a92f595a..8b7bafff8 100644
--- a/stdlib/source/test/lux/control/concurrency/async.lux
+++ b/stdlib/source/test/lux/control/concurrency/async.lux
@@ -47,8 +47,8 @@
(def: delay
(for {@.js
- (i64.left_shift 4 1)}
- (i64.left_shift 3 1)))
+ (i64.left_shifted 4 1)}
+ (i64.left_shifted 3 1)))
(def: #export test
Test
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux
index 3dff3aba1..f5b851104 100644
--- a/stdlib/source/test/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux
@@ -31,8 +31,8 @@
(def: delay
(for {@.js
- (i64.left_shift 4 1)}
- (i64.left_shift 3 1)))
+ (i64.left_shifted 4 1)}
+ (i64.left_shifted 3 1)))
(def: semaphore
Test
diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux
index edc74a9c0..67824f3f3 100644
--- a/stdlib/source/test/lux/control/function/memo.lux
+++ b/stdlib/source/test/lux/control/function/memo.lux
@@ -52,7 +52,7 @@
## and other issues that might mess with duration
(def: wiggle_room
Nat
- (i64.left_shift 4 1))
+ (i64.left_shifted 4 1))
(def: #export test
Test
diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux
index 7370e0db0..209944969 100644
--- a/stdlib/source/test/lux/control/parser.lux
+++ b/stdlib/source/test/lux/control/parser.lux
@@ -245,11 +245,11 @@
(\ (list.equivalence code.equivalence) =
(list\map code.nat expected+)
actual))))
- (_.cover [/.default]
- (and (|> (/.run (/.default wrong (\ /.monad in expected)) (list))
+ (_.cover [/.else]
+ (and (|> (/.run (/.else wrong (\ /.monad in expected)) (list))
(match actual (n.= expected actual)))
- (|> (/.run (/.default expected (: (Parser (List Code) Nat)
- (/.failure "yolo")))
+ (|> (/.run (/.else expected (: (Parser (List Code) Nat)
+ (/.failure "yolo")))
(list))
(match actual (n.= expected actual)))
))
diff --git a/stdlib/source/test/lux/control/parser/environment.lux b/stdlib/source/test/lux/control/parser/environment.lux
index 017795418..756fa38be 100644
--- a/stdlib/source/test/lux/control/parser/environment.lux
+++ b/stdlib/source/test/lux/control/parser/environment.lux
@@ -31,7 +31,7 @@
(_.cover [/.run]
(|> (/.run (//\in expected) /.empty)
(\ try.functor map (n.= expected))
- (try.default false))))
+ (try.else false))))
(do random.monad
[property (random.ascii/alpha 1)
expected (random.ascii/alpha 1)]
@@ -40,7 +40,7 @@
(dictionary.put property expected)
(/.run (/.property property))
(\ try.functor map (text\= expected))
- (try.default false))))
+ (try.else false))))
(do random.monad
[property (random.ascii/alpha 1)]
(_.cover [/.unknown_property]
diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux
index 055a2f858..b3031cc26 100644
--- a/stdlib/source/test/lux/control/parser/text.lux
+++ b/stdlib/source/test/lux/control/parser/text.lux
@@ -62,7 +62,7 @@
(|> expected
(/.run parser)
(\ try.functor map (text\= expected))
- (try.default false)))
+ (try.else false)))
(def: (should_pass! expected parser)
(-> Text (/.Parser /.Slice) Bit)
diff --git a/stdlib/source/test/lux/control/state.lux b/stdlib/source/test/lux/control/state.lux
index d537ca4de..e64833259 100644
--- a/stdlib/source/test/lux/control/state.lux
+++ b/stdlib/source/test/lux/control/state.lux
@@ -108,8 +108,8 @@
left random.nat
right random.nat]
(let [(^open "io\.") io.monad]
- (_.cover [/.State' /.with /.lift /.run']
- (|> (: (/.State' io.IO Nat Nat)
+ (_.cover [/.+State /.with /.lift /.run']
+ (|> (: (/.+State io.IO Nat Nat)
(do (/.with io.monad)
[a (/.lift io.monad (io\in left))
b (in right)]
diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux
index 4fbf42fd2..4959014f7 100644
--- a/stdlib/source/test/lux/control/try.lux
+++ b/stdlib/source/test/lux/control/try.lux
@@ -74,11 +74,11 @@
_
false))
- (_.cover [/.default]
+ (_.cover [/.else]
(and (n.= expected
- (/.default alternative (#/.Success expected)))
+ (/.else alternative (#/.Success expected)))
(n.= alternative
- (/.default alternative (: (Try Nat) (#/.Failure error))))))
+ (/.else alternative (: (Try Nat) (#/.Failure error))))))
(_.cover [/.with /.lifted]
(let [lifted (/.lifted io.monad)]
(|> (do (/.with io.monad)
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux
index a9e977c0a..638668ec5 100644
--- a/stdlib/source/test/lux/data/binary.lux
+++ b/stdlib/source/test/lux/data/binary.lux
@@ -53,11 +53,11 @@
(def: (binary_io power read write value)
(-> Nat (-> Nat Binary (Try Nat)) (-> Nat Nat Binary (Try Any)) Nat Bit)
- (let [bytes (i64.left_shift power 1)
+ (let [bytes (i64.left_shifted power 1)
binary (/.create bytes)
cap (case bytes
8 (dec 0)
- _ (|> 1 (i64.left_shift (n.* 8 bytes)) dec))
+ _ (|> 1 (i64.left_shifted (n.* 8 bytes)) dec))
capped_value (i64.and cap value)]
(and (..succeed
(do try.monad
diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux
index d51067799..2cec43439 100644
--- a/stdlib/source/test/lux/data/collection/dictionary.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary.lux
@@ -81,7 +81,7 @@
(|> dict
(/.get key)
(maybe\map (n.= value))
- (maybe.default false)))
+ (maybe.else false)))
entries)]
(and correct_size!
unique_keys!
diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
index 0b98204a9..8302cdf38 100644
--- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
@@ -132,5 +132,5 @@
(/.update extra_key (n.+ shift))
(/.get extra_key)
(maybe\map (n.= (n.+ shift extra_value)))
- (maybe.default false)))
+ (maybe.else false)))
))))
diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux
index 7916da3eb..5ba785919 100644
--- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux
@@ -75,14 +75,14 @@
(/.put extra_key extra_value)
(/.get extra_key)
(maybe\map (n.= extra_value))
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.update]
(|> sample
(/.put extra_key extra_value)
(/.update extra_key (n.+ shift))
(/.get extra_key)
(maybe\map (n.= (n.+ shift extra_value)))
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.remove]
(|> sample
(/.put extra_key extra_value)
diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux
index 06238c4c8..07eff44ac 100644
--- a/stdlib/source/test/lux/data/collection/queue/priority.lux
+++ b/stdlib/source/test/lux/data/collection/queue/priority.lux
@@ -80,7 +80,7 @@
(/.push /.max max_member)
/.peek
(maybe\map (n.= max_member))
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.min]
(|> /.empty
(/.push /.max max_member)
@@ -88,6 +88,6 @@
/.pop
/.peek
(maybe\map (n.= min_member))
- (maybe.default false)))
+ (maybe.else false)))
))
))))
diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux
index 407fcde8e..3ac6e8965 100644
--- a/stdlib/source/test/lux/data/collection/row.lux
+++ b/stdlib/source/test/lux/data/collection/row.lux
@@ -99,13 +99,13 @@
(#try.Failure error)
false))
(_.cover [/.put]
- (<| (try.default false)
+ (<| (try.else false)
(do try.monad
[sample (/.put good_index non_member sample)
actual (/.nth good_index sample)]
(in (is? non_member actual)))))
(_.cover [/.update]
- (<| (try.default false)
+ (<| (try.else false)
(do try.monad
[sample (/.put good_index non_member sample)
sample (/.update good_index inc sample)
diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux
index a263b2451..ea58f8f72 100644
--- a/stdlib/source/test/lux/data/collection/tree.lux
+++ b/stdlib/source/test/lux/data/collection/tree.lux
@@ -47,15 +47,15 @@
(do random.monad
[[size sample] (..tree random.nat)]
- (_.cover [/.flatten]
+ (_.cover [/.flat]
(n.= size
- (list.size (/.flatten sample)))))
+ (list.size (/.flat sample)))))
(do random.monad
[expected random.nat]
(_.cover [/.leaf]
(\ (list.equivalence n.equivalence) =
(list expected)
- (/.flatten (/.leaf expected)))))
+ (/.flat (/.leaf expected)))))
(do {! random.monad}
[value random.nat
num_children (\ ! map (n.% 3) random.nat)
@@ -63,7 +63,7 @@
(_.cover [/.branch]
(\ (list.equivalence n.equivalence) =
(list& value children)
- (/.flatten (/.branch value (list\map /.leaf children))))))
+ (/.flat (/.branch value (list\map /.leaf children))))))
(do random.monad
[expected/0 random.nat
expected/1 random.nat
@@ -74,18 +74,18 @@
(_.cover [/.tree]
(and (\ (list.equivalence n.equivalence) =
(list expected/0)
- (/.flatten (/.tree expected/0)))
+ (/.flat (/.tree expected/0)))
(\ (list.equivalence n.equivalence) =
(list expected/0 expected/1 expected/2)
- (/.flatten (/.tree expected/0
- {expected/1 {}
- expected/2 {}})))
+ (/.flat (/.tree expected/0
+ {expected/1 {}
+ expected/2 {}})))
(\ (list.equivalence n.equivalence) =
(list expected/0 expected/1 expected/2
expected/3 expected/4 expected/5)
- (/.flatten (/.tree expected/0
- {expected/1 {}
- expected/2 {expected/3 {}
- expected/4 {expected/5 {}}}})))
+ (/.flat (/.tree expected/0
+ {expected/1 {}
+ expected/2 {expected/3 {}
+ expected/4 {expected/5 {}}}})))
)))
)))
diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux
index d14c4d27f..496c25865 100644
--- a/stdlib/source/test/lux/data/collection/tree/finger.lux
+++ b/stdlib/source/test/lux/data/collection/tree/finger.lux
@@ -96,13 +96,13 @@
(|> (\ ..builder leaf tag_left expected_left)
(/.one (text.contains? tag_left))
(maybe\map (n.= expected_left))
- (maybe.default false))
+ (maybe.else false))
cannot_find_incorrect_one!
(|> (\ ..builder leaf tag_right expected_right)
(/.one (text.contains? tag_left))
(maybe\map (n.= expected_left))
- (maybe.default false)
+ (maybe.else false)
not)
can_find_left!
@@ -111,7 +111,7 @@
(\ ..builder leaf tag_right expected_right))
(/.one (text.contains? tag_left))
(maybe\map (n.= expected_left))
- (maybe.default false))
+ (maybe.else false))
can_find_right!
(|> (\ ..builder branch
@@ -119,7 +119,7 @@
(\ ..builder leaf tag_right expected_right))
(/.one (text.contains? tag_right))
(maybe\map (n.= expected_right))
- (maybe.default false))]
+ (maybe.else false))]
(and can_find_correct_one!
cannot_find_incorrect_one!
can_find_left!
diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux
index df7333db5..749a8c59b 100644
--- a/stdlib/source/test/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux
@@ -37,7 +37,7 @@
(do> maybe.monad
[/.down]
[/.value (n.= expected) in])
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.up]
(|> (tree.branch expected (list (tree.leaf dummy)))
/.zipper
@@ -45,7 +45,7 @@
[/.down]
[/.up]
[/.value (n.= expected) in])
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.right]
(|> (tree.branch dummy (list (tree.leaf dummy) (tree.leaf expected)))
/.zipper
@@ -53,7 +53,7 @@
[/.down]
[/.right]
[/.value (n.= expected) in])
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.rightmost]
(|> (tree.branch dummy
(list (tree.leaf dummy)
@@ -65,7 +65,7 @@
[/.down]
[/.rightmost]
[/.value (n.= expected) in])
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.left]
(|> (tree.branch dummy (list (tree.leaf expected) (tree.leaf dummy)))
/.zipper
@@ -74,7 +74,7 @@
[/.right]
[/.left]
[/.value (n.= expected) in])
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.leftmost]
(|> (tree.branch dummy
(list (tree.leaf expected)
@@ -87,7 +87,7 @@
[/.rightmost]
[/.leftmost]
[/.value (n.= expected) in])
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.next]
(and (|> (tree.branch dummy
(list (tree.leaf expected)
@@ -96,7 +96,7 @@
(do> maybe.monad
[/.next]
[/.value (n.= expected) in])
- (maybe.default false))
+ (maybe.else false))
(|> (tree.branch dummy
(list (tree.leaf dummy)
(tree.leaf expected)))
@@ -105,7 +105,7 @@
[/.next]
[/.next]
[/.value (n.= expected) in])
- (maybe.default false))))
+ (maybe.else false))))
(_.cover [/.end]
(|> (tree.branch dummy
(list (tree.leaf dummy)
@@ -116,7 +116,7 @@
(do> maybe.monad
[/.end]
[/.value (n.= expected) in])
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.start]
(|> (tree.branch expected
(list (tree.leaf dummy)
@@ -128,7 +128,7 @@
[/.end]
[/.start]
[/.value (n.= expected) in])
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.previous]
(and (|> (tree.branch expected
(list (tree.leaf dummy)
@@ -138,7 +138,7 @@
[/.next]
[/.previous]
[/.value (n.= expected) in])
- (maybe.default false))
+ (maybe.else false))
(|> (tree.branch dummy
(list (tree.leaf expected)
(tree.leaf dummy)))
@@ -148,7 +148,7 @@
[/.next]
[/.previous]
[/.value (n.= expected) in])
- (maybe.default false))))
+ (maybe.else false))))
)))
(def: #export test
@@ -198,7 +198,7 @@
/.zipper
/.end
(maybe\map /.end?)
- (maybe.default false))))
+ (maybe.else false))))
(_.cover [/.interpose]
(let [cursor (|> (tree.branch dummy (list (tree.leaf dummy)))
/.zipper
@@ -208,13 +208,13 @@
(do> maybe.monad
[/.down]
[/.value (n.= expected) in])
- (maybe.default false))
+ (maybe.else false))
(|> cursor
(do> maybe.monad
[/.down]
[/.down]
[/.value (n.= dummy) in])
- (maybe.default false)))))
+ (maybe.else false)))))
(_.cover [/.adopt]
(let [cursor (|> (tree.branch dummy (list (tree.leaf dummy)))
/.zipper
@@ -224,13 +224,13 @@
(do> maybe.monad
[/.down]
[/.value (n.= expected) in])
- (maybe.default false))
+ (maybe.else false))
(|> cursor
(do> maybe.monad
[/.down]
[/.right]
[/.value (n.= dummy) in])
- (maybe.default false)))))
+ (maybe.else false)))))
(_.cover [/.insert_left]
(|> (tree.branch dummy (list (tree.leaf dummy)))
/.zipper
@@ -239,7 +239,7 @@
[(/.insert_left expected)]
[/.left]
[/.value (n.= expected) in])
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.insert_right]
(|> (tree.branch dummy (list (tree.leaf dummy)))
/.zipper
@@ -248,7 +248,7 @@
[(/.insert_right expected)]
[/.right]
[/.value (n.= expected) in])
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.remove]
(|> (tree.branch dummy (list (tree.leaf dummy)))
/.zipper
@@ -257,5 +257,5 @@
[(/.insert_left expected)]
[/.remove]
[/.value (n.= expected) in])
- (maybe.default false)))
+ (maybe.else false)))
))))
diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux
index e9acae043..063d3ef2f 100644
--- a/stdlib/source/test/lux/data/format/json.lux
+++ b/stdlib/source/test/lux/data/format/json.lux
@@ -86,7 +86,7 @@
/.format
(\ /.codec decode)
(try\map (\= expected))
- (try.default false))))
+ (try.else false))))
(do random.monad
[keys (random.set text.hash 3 (random.ascii/alpha 1))
values (random.set frac.hash 3 random.safe_frac)
@@ -107,7 +107,7 @@
(list.every? (function (_ [key expected])
(|> (/.get key object)
(try\map (\= expected))
- (try.default false)))
+ (try.else false)))
expected))
))
(do random.monad
@@ -116,14 +116,14 @@
(random.ascii/alpha 1))
expected random.safe_frac]
(_.cover [/.set]
- (<| (try.default false)
+ (<| (try.else false)
(do try.monad
[object (/.set key (#/.Number expected) (/.object (list)))
#let [can_find_known_key!
(|> object
(/.get key)
(try\map (\= (#/.Number expected)))
- (try.default false))
+ (try.else false))
cannot_find_unknown_key!
(case (/.get unknown object)
@@ -142,7 +142,7 @@
(|> (/.object (list [key (<tag> value)]))
(<get> key)
(try\map (\ <equivalence> = value))
- (try.default false))))]
+ (try.else false))))]
[/.Boolean /.get_boolean #/.Boolean random.bit bit.equivalence]
[/.Number /.get_number #/.Number random.safe_frac frac.equivalence]
@@ -180,7 +180,7 @@
<key3> <string>
<key4> [#null <boolean> <number> <string>]
<key5> {<key6> <number>}})]
- (<| (try.default false)
+ (<| (try.else false)
(do try.monad
[value0 (/.get <key0> object)
value1 (/.get <key1> object)
diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux
index 8dfe9635d..13c713f7f 100644
--- a/stdlib/source/test/lux/data/format/tar.lux
+++ b/stdlib/source/test/lux/data/format/tar.lux
@@ -181,7 +181,7 @@
_
false)))
- (try.default false)))]
+ (try.else false)))]
[/.Symbolic_Link #/.Symbolic_Link]
[/.Directory #/.Directory]
@@ -216,7 +216,7 @@
_
false)))
- (try.default false)))]
+ (try.else false)))]
[/.Normal #/.Normal]
[/.Contiguous #/.Contiguous]
@@ -268,7 +268,7 @@
_
false)))
- (try.default false)))
+ (try.else false)))
(~~ (template [<expected_mode>]
[(_.cover [<expected_mode>]
(|> (do try.monad
@@ -291,7 +291,7 @@
_
false)))
- (try.default false)))]
+ (try.else false)))]
[/.none]
@@ -360,7 +360,7 @@
_
false)))
- (try.default false)))
+ (try.else false)))
(_.cover [/.anonymous /.no_id]
(|> (do try.monad
[path (/.path path)
@@ -388,7 +388,7 @@
_
false)))
- (try.default false)))
+ (try.else false)))
))))
(def: #export test
@@ -403,7 +403,7 @@
(format.run /.writer)
(<b>.run /.parser)
(\ try.monad map row.empty?)
- (try.default false)))
+ (try.else false)))
(_.cover [/.invalid_end_of_archive]
(let [dump (format.run /.writer row.empty)]
(case (<b>.run /.parser (binary\compose dump dump))
diff --git a/stdlib/source/test/lux/data/lazy.lux b/stdlib/source/test/lux/data/lazy.lux
index 0c93ae612..4fb2f6642 100644
--- a/stdlib/source/test/lux/data/lazy.lux
+++ b/stdlib/source/test/lux/data/lazy.lux
@@ -20,7 +20,7 @@
(def: injection
(Injection Lazy)
- (|>> /.freeze))
+ (|>> /.lazy))
(def: comparison
(Comparison Lazy)
@@ -29,7 +29,7 @@
(def: #export lazy
(All [a] (-> (Random a) (Random (Lazy a))))
- (\ random.functor map (|>> /.freeze)))
+ (\ random.functor map (|>> /.lazy)))
(def: #export test
Test
@@ -52,16 +52,16 @@
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
- (_.cover [/.freeze]
- (let [lazy (/.freeze <eager>)
+ (_.cover [/.lazy]
+ (let [lazy (/.lazy <eager>)
(^open "\=") (product.equivalence n.equivalence n.equivalence)]
(\= expected
- (/.thaw lazy))))
+ (/.value lazy))))
- (_.cover [/.thaw]
- (let [lazy (/.freeze <eager>)]
+ (_.cover [/.value]
+ (let [lazy (/.lazy <eager>)]
(and (not (is? expected
- (/.thaw lazy)))
- (is? (/.thaw lazy)
- (/.thaw lazy)))))
+ (/.value lazy)))
+ (is? (/.value lazy)
+ (/.value lazy)))))
))))))
diff --git a/stdlib/source/test/lux/data/maybe.lux b/stdlib/source/test/lux/data/maybe.lux
index c2baca4fa..9aa890d9f 100644
--- a/stdlib/source/test/lux/data/maybe.lux
+++ b/stdlib/source/test/lux/data/maybe.lux
@@ -63,12 +63,12 @@
(do random.monad
[default random.nat
value random.nat]
- (_.cover [/.default]
- (and (is? default (/.default default
- #.None))
+ (_.cover [/.else]
+ (and (is? default (/.else default
+ #.None))
- (is? value (/.default default
- (#.Some value))))))
+ (is? value (/.else default
+ (#.Some value))))))
(do random.monad
[value random.nat]
(_.cover [/.assume]
diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux
index f39c25c01..e1f9c1e4f 100644
--- a/stdlib/source/test/lux/data/text.lux
+++ b/stdlib/source/test/lux/data/text.lux
@@ -91,54 +91,54 @@
(/.contains? outer full))))
(_.cover [/.index_of]
(and (|> (/.index_of inner (\ /.monoid compose inner outer))
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= 0))
(|> (/.index_of outer (\ /.monoid compose inner outer))
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= 1))))
(_.cover [/.index_of']
(let [full (\ /.monoid compose inner outer)]
(and (|> (/.index_of' inner 0 full)
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= 0))
(|> (/.index_of' inner 1 full)
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= fake_index))
(|> (/.index_of' outer 0 full)
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= 1))
(|> (/.index_of' outer 1 full)
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= 1))
(|> (/.index_of' outer 2 full)
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= fake_index)))))
(_.cover [/.last_index_of]
(let [full ($_ (\ /.monoid compose) outer inner outer)]
(and (|> (/.last_index_of inner full)
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= 1))
(|> (/.last_index_of outer full)
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= 2)))))
(_.cover [/.last_index_of']
(let [full ($_ (\ /.monoid compose) outer inner outer)]
(and (|> (/.last_index_of' inner 0 full)
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= 1))
(|> (/.last_index_of' inner 2 full)
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= fake_index))
(|> (/.last_index_of' outer 0 full)
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= 2))
(|> (/.last_index_of' outer 2 full)
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= 2))
(|> (/.last_index_of' outer 3 full)
- (maybe.default fake_index)
+ (maybe.else fake_index)
(n.= fake_index)))))
)))
@@ -234,42 +234,42 @@
#.None
false))
- (_.cover [/.lower_case]
+ (_.cover [/.lower_cased]
(let [effectiveness!
(|> upper
- /.lower_case
+ /.lower_cased
(\ /.equivalence = upper)
not)
idempotence!
(|> lower
- /.lower_case
+ /.lower_cased
(\ /.equivalence = lower))
inverse!
(|> lower
- /.upper_case
- /.lower_case
+ /.upper_cased
+ /.lower_cased
(\ /.equivalence = lower))]
(and effectiveness!
idempotence!
inverse!)))
- (_.cover [/.upper_case]
+ (_.cover [/.upper_cased]
(let [effectiveness!
(|> lower
- /.upper_case
+ /.upper_cased
(\ /.equivalence = lower)
not)
idempotence!
(|> upper
- /.upper_case
+ /.upper_cased
(\ /.equivalence = upper))
inverse!
(|> upper
- /.lower_case
- /.upper_case
+ /.lower_cased
+ /.upper_cased
(\ /.equivalence = upper))]
(and effectiveness!
idempotence!
diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux
index a7741082a..9089e080f 100644
--- a/stdlib/source/test/lux/debug.lux
+++ b/stdlib/source/test/lux/debug.lux
@@ -58,7 +58,7 @@
(in (`` (and (~~ (template [<type> <format> <sample>]
[(|> (/.representation <type> <sample>)
(try\map (text\= (<format> <sample>)))
- (try.default false))]
+ (try.else false))]
[Bit %.bit sample_bit]
[Nat %.nat sample_nat]
@@ -93,7 +93,7 @@
## (try\map (text\= (format "(" (%.nat <lefts>)
## " " (%.bit <right?>)
## " " (<format> <value>) ")")))
- ## (try.default false))]
+ ## (try.else false))]
## [0 #0 sample_bit %.bit]
## [1 #0 sample_int %.int]
@@ -114,7 +114,7 @@
(in (`` (and (~~ (template [<type> <format> <sample>]
[(|> (/.representation <type> <sample>)
(try\map (text\= (<format> <sample>)))
- (try.default false))]
+ (try.else false))]
[Ratio %.ratio sample_ratio]
[Name %.name sample_name]
@@ -137,7 +137,7 @@
(in (`` (and (~~ (template [<type> <format> <sample>]
[(|> (/.representation <type> <sample>)
(try\map (text\= (<format> <sample>)))
- (try.default false))]
+ (try.else false))]
[Instant %.instant sample_instant]
[Duration %.duration sample_duration]
@@ -168,14 +168,14 @@
(|> (/.representation .Any sample_frac)
(try\map (text\= "[]"))
- (try.default false))
+ (try.else false))
(|> (/.representation (type (List Nat)) (: (List Nat) (list sample_nat)))
(try\map (text\= (%.list %.nat (list sample_nat))))
- (try.default false))
+ (try.else false))
(~~ (template [<sample>]
[(|> (/.representation (type (Maybe Nat)) (: (Maybe Nat) <sample>))
(try\map (text\= (%.maybe %.nat <sample>)))
- (try.default false))]
+ (try.else false))]
[(#.Some sample_nat)]
[#.None]
diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux
index b5d9fffbf..96da12763 100644
--- a/stdlib/source/test/lux/ffi.jvm.lux
+++ b/stdlib/source/test/lux/ffi.jvm.lux
@@ -19,7 +19,7 @@
[syntax (#+ syntax:)]
["." code]]
[math
- ["." random]
+ ["." random (#+ Random)]
[number
["n" nat]
["i" int ("#\." equivalence)]
@@ -464,9 +464,27 @@
["#::."
(new [])])
+(/.class: #final (test/TestClass9 a) []
+ ## Fields
+ (#private value9 a)
+ ## Constructors
+ (#public [] (new self {value a}) []
+ (:= ::value9 value))
+ ## Methods
+ (#public (set_actual9 self {value a}) void
+ (:= ::value9 value))
+ (#public (get_actual9 self) a
+ ::value9))
+
+(/.import: (test/TestClass9 a)
+ ["#::."
+ (new [a])
+ (set_actual9 [a] void)
+ (get_actual9 [] a)])
+
(def: for_class
Test
- (do random.monad
+ (do {! random.monad}
[expected random.nat
left random.int
right random.int
@@ -521,16 +539,37 @@
(let [expected (i.+ left right)
object/8 (test/TestClass8::new)]
(i.= expected
- (test/TestInterface4::actual4 left right right object/8)))]]
- (_.cover [/.class: /.import:]
- (and example/0!
- example/1!
- example/2!
- example/3!
- example/4!
- example/5!
- example/7!
- example/8!))))
+ (test/TestInterface4::actual4 left right right object/8)))]
+
+ #let [random_long (: (Random java/lang/Long)
+ (\ ! map (|>> (:as java/lang/Long))
+ random.int))]
+ dummy/0 random_long
+ dummy/1 random_long
+ dummy/2 random_long
+ #let [object/9 (/.do_to (: (test/TestClass9 java/lang/Long)
+ (test/TestClass9::new dummy/0))
+ (test/TestClass9::set_actual9 dummy/1)
+ (test/TestClass9::set_actual9 dummy/2))
+
+ example/9!
+ (|> object/9
+ test/TestClass9::get_actual9
+ (:as java/lang/Long)
+ (is? dummy/2))]]
+ ($_ _.and
+ (_.cover [/.class: /.import:]
+ (and example/0!
+ example/1!
+ example/2!
+ example/3!
+ example/4!
+ example/5!
+ example/7!
+ example/8!))
+ (_.cover [/.do_to]
+ example/9!)
+ )))
(def: #export test
(<| (_.covering /._)
diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux
index 115b5168e..248a63400 100644
--- a/stdlib/source/test/lux/macro.lux
+++ b/stdlib/source/test/lux/macro.lux
@@ -125,17 +125,17 @@
(meta.run lux)
(try\map (\ (list.equivalence code.equivalence) =
(list <expansion>)))
- (try.default false)))
+ (try.else false)))
(_.cover [<logger>]
(and (|> (/.single_expansion (` (<logger> (~' #omit) (..pow/4 (~ pow/1)))))
(meta.run lux)
(try\map (\ (list.equivalence code.equivalence) = (list)))
- (try.default false))
+ (try.else false))
(|> (/.single_expansion (` (<logger> (..pow/4 (~ pow/1)))))
(meta.run lux)
(try\map (\ (list.equivalence code.equivalence) = (list <expansion>)))
- (try.default false))))]
+ (try.else false))))]
[/.single_expansion /.log_single_expansion! single_expansion]
[/.expansion /.log_expansion! expansion]
diff --git a/stdlib/source/test/lux/macro/syntax/type/variable.lux b/stdlib/source/test/lux/macro/syntax/type/variable.lux
index 18197bf3e..48882172a 100644
--- a/stdlib/source/test/lux/macro/syntax/type/variable.lux
+++ b/stdlib/source/test/lux/macro/syntax/type/variable.lux
@@ -33,5 +33,5 @@
(|> (list (/.format expected))
(<code>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false))))
+ (try.else false))))
)))
diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux
index e8865d207..cafc576eb 100644
--- a/stdlib/source/test/lux/math/modular.lux
+++ b/stdlib/source/test/lux/math/modular.lux
@@ -105,7 +105,7 @@
#.None
(not co_prime?))))
(_.cover [/.adapter]
- (<| (try.default false)
+ (<| (try.else false)
(do try.monad
[copy\\% (//.modulus (//.divisor subject\\%))
adapt (/.adapter subject\\% copy\\%)]
diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux
index 23ede5834..41f1bc29c 100644
--- a/stdlib/source/test/lux/math/number/frac.lux
+++ b/stdlib/source/test/lux/math/number/frac.lux
@@ -85,7 +85,7 @@
(_.cover [/.int]
(|> expected i.frac /.int (i.= expected))))
(do {! random.monad}
- [expected (\ ! map (|>> (i64.left_shift 52) .rev)
+ [expected (\ ! map (|>> (i64.left_shifted 52) .rev)
random.nat)]
(_.cover [/.rev]
(|> expected r.frac /.rev (r.= expected))))
diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux
index 94260d6ee..d6f531613 100644
--- a/stdlib/source/test/lux/math/number/i64.lux
+++ b/stdlib/source/test/lux/math/number/i64.lux
@@ -49,21 +49,21 @@
($_ _.and
(do !
[idx (\ ! map (|>> (n.% (dec /.width)) inc) random.nat)]
- (_.cover [/.left_shift /.right_shift]
+ (_.cover [/.left_shifted /.right_shifted]
(let [nullity!
- (and (\= pattern (/.left_shift 0 pattern))
- (\= pattern (/.right_shift 0 pattern)))
+ (and (\= pattern (/.left_shifted 0 pattern))
+ (\= pattern (/.right_shifted 0 pattern)))
idempotency!
- (and (\= pattern (/.left_shift /.width pattern))
- (\= pattern (/.right_shift /.width pattern)))
+ (and (\= pattern (/.left_shifted /.width pattern))
+ (\= pattern (/.right_shifted /.width pattern)))
movement!
(let [shift (n.- idx /.width)]
(\= (/.and (/.mask idx) pattern)
(|> pattern
- (/.left_shift shift)
- (/.right_shift shift))))]
+ (/.left_shifted shift)
+ (/.right_shifted shift))))]
(and nullity!
idempotency!
movement!))))
@@ -106,13 +106,13 @@
0 (\= /.false (/.region size offset))
_ (\= (|> pattern
## NNNNYYYYNNNN
- (/.right_shift offset)
+ (/.right_shifted offset)
## ____NNNNYYYY
- (/.left_shift spare)
+ (/.left_shifted spare)
## YYYY________
- (/.right_shift spare)
+ (/.right_shifted spare)
## ________YYYY
- (/.left_shift offset)
+ (/.left_shifted offset)
## ____YYYY____
)
(/.and (/.region size offset) pattern)))))
@@ -208,39 +208,39 @@
(/.count (/.not pattern))))]
(and clear&set!
complementarity!)))
- (_.cover [/.rotate_left /.rotate_right]
+ (_.cover [/.left_rotated /.right_rotated]
(let [false!
- (and (\= /.false (/.rotate_left idx /.false))
- (\= /.false (/.rotate_right idx /.false)))
+ (and (\= /.false (/.left_rotated idx /.false))
+ (\= /.false (/.right_rotated idx /.false)))
true!
- (and (\= /.true (/.rotate_left idx /.true))
- (\= /.true (/.rotate_right idx /.true)))
+ (and (\= /.true (/.left_rotated idx /.true))
+ (\= /.true (/.right_rotated idx /.true)))
inverse!
(and (|> pattern
- (/.rotate_left idx)
- (/.rotate_right idx)
+ (/.left_rotated idx)
+ (/.right_rotated idx)
(\= pattern))
(|> pattern
- (/.rotate_right idx)
- (/.rotate_left idx)
+ (/.right_rotated idx)
+ (/.left_rotated idx)
(\= pattern)))
nullity!
(and (|> pattern
- (/.rotate_left 0)
+ (/.left_rotated 0)
(\= pattern))
(|> pattern
- (/.rotate_right 0)
+ (/.right_rotated 0)
(\= pattern)))
futility!
(and (|> pattern
- (/.rotate_left /.width)
+ (/.left_rotated /.width)
(\= pattern))
(|> pattern
- (/.rotate_right /.width)
+ (/.right_rotated /.width)
(\= pattern)))]
(and false!
true!
diff --git a/stdlib/source/test/lux/math/number/int.lux b/stdlib/source/test/lux/math/number/int.lux
index 00b66d700..d7d3d6122 100644
--- a/stdlib/source/test/lux/math/number/int.lux
+++ b/stdlib/source/test/lux/math/number/int.lux
@@ -185,23 +185,23 @@
(do {! random.monad}
[pattern random.int
idx (\ ! map (n.% i64.width) random.nat)]
- (_.cover [/.right_shift]
+ (_.cover [/.right_shifted]
(let [nullity!
- (/.= pattern (/.right_shift 0 pattern))
+ (/.= pattern (/.right_shifted 0 pattern))
idempotency!
- (/.= pattern (/.right_shift i64.width pattern))
+ (/.= pattern (/.right_shifted i64.width pattern))
- sign_mask (i64.left_shift (dec i64.width) 1)
+ sign_mask (i64.left_shifted (dec i64.width) 1)
mantissa_mask (i64.not sign_mask)
sign_preservation!
(/.= (i64.and sign_mask pattern)
- (i64.and sign_mask (/.right_shift idx pattern)))
+ (i64.and sign_mask (/.right_shifted idx pattern)))
mantissa_parity!
- (/.= (i64.and mantissa_mask (i64.right_shift idx pattern))
- (i64.and mantissa_mask (/.right_shift idx pattern)))]
+ (/.= (i64.and mantissa_mask (i64.right_shifted idx pattern))
+ (i64.and mantissa_mask (/.right_shifted idx pattern)))]
(and nullity!
idempotency!
sign_preservation!
diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux
index b4c9799cc..9383f97e3 100644
--- a/stdlib/source/test/lux/math/number/ratio.lux
+++ b/stdlib/source/test/lux/math/number/ratio.lux
@@ -68,13 +68,13 @@
(|> (/.ratio numerator)
/.nat
(maybe\map (n\= numerator))
- (maybe.default false))
+ (maybe.else false))
denominator_1!
(|> (/.ratio numerator 1)
/.nat
(maybe\map (n\= numerator))
- (maybe.default false))
+ (maybe.else false))
with_denominator!
(case (/.nat (/.ratio numerator denominator))
diff --git a/stdlib/source/test/lux/math/number/rev.lux b/stdlib/source/test/lux/math/number/rev.lux
index e99a1f656..63c8c7135 100644
--- a/stdlib/source/test/lux/math/number/rev.lux
+++ b/stdlib/source/test/lux/math/number/rev.lux
@@ -92,7 +92,7 @@
random.rev)
divisor (\ ! map (|>> (i64.and (hex "F"))
(i64.or (hex "1"))
- (i64.rotate_right 8)
+ (i64.right_rotated 8)
.rev)
random.nat)]
dividend (random.only (/.> .0) dividend)
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index 43a7ec41a..2356772ec 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -247,20 +247,20 @@
(/.run expected_lux)
(try\map (\ (list.equivalence text.equivalence) =
(list imported_module_name)))
- (try.default false))
+ (try.else false))
(|> (/.imported_modules imported_module_name)
(/.run expected_lux)
(try\map (\ (list.equivalence text.equivalence) =
(list)))
- (try.default false))))
+ (try.else false))))
(_.cover [/.imported_by?]
(|> (/.imported_by? imported_module_name expected_current_module)
(/.run expected_lux)
- (try.default false)))
+ (try.else false)))
(_.cover [/.imported?]
(|> (/.imported? imported_module_name)
(/.run expected_lux)
- (try.default false)))
+ (try.else false)))
(_.cover [/.normal]
(and (|> (/.normal ["" expected_short])
(/.run expected_lux)
@@ -335,7 +335,7 @@
(|> /.type_context
(/.run expected_lux)
(try\map (is? type_context))
- (try.default false)))
+ (try.else false)))
)))
(def: definition_related
@@ -575,11 +575,11 @@
(and (|> (/.de_aliased [expected_macro_module expected_short])
(/.run expected_lux)
(try\map (name\= [expected_macro_module expected_short]))
- (try.default false))
+ (try.else false))
(|> (/.de_aliased [expected_current_module expected_short])
(/.run expected_lux)
(try\map (name\= [expected_macro_module expected_short]))
- (try.default false)))))
+ (try.else false)))))
(_.cover [/.definition]
(let [[current_globals macro_globals expected_lux]
(expected_lux expected_exported? (#.Some expected_type))
@@ -713,12 +713,12 @@
(|> (/.tag_lists tag_module)
(/.run expected_lux)
(try\map (\ equivalence = (list [tags_1 type_1])))
- (try.default false))))
+ (try.else false))))
(_.cover [/.tags_of]
(|> (/.tags_of [tag_module name_1])
(/.run expected_lux)
(try\map (\ (maybe.equivalence (list.equivalence name.equivalence)) = (#.Some tags_1)))
- (try.default false)))
+ (try.else false)))
(_.cover [/.resolve_tag]
(|> tags_1
list.enumeration
@@ -826,49 +826,49 @@
(try\map (\ equivalence = (list (list [name_3 type_3])
(list [name_1 type_1]
[name_2 type_2]))))
- (try.default false))))
+ (try.else false))))
(_.cover [/.var_type]
(and (|> (/.var_type name_0)
(/.run expected_lux)
(try\map (\ type.equivalence = type_0))
- (try.default false))
+ (try.else false))
(|> (/.var_type name_1)
(/.run expected_lux)
(try\map (\ type.equivalence = type_1))
- (try.default false))
+ (try.else false))
(|> (/.var_type name_2)
(/.run expected_lux)
(try\map (\ type.equivalence = type_2))
- (try.default false))
+ (try.else false))
(|> (/.var_type name_3)
(/.run expected_lux)
(try\map (\ type.equivalence = type_3))
- (try.default false))))
+ (try.else false))))
(_.cover [/.type]
(and (|> (/.type ["" name_0])
(/.run expected_lux)
(try\map (\ type.equivalence = type_0))
- (try.default false))
+ (try.else false))
(|> (/.type ["" name_1])
(/.run expected_lux)
(try\map (\ type.equivalence = type_1))
- (try.default false))
+ (try.else false))
(|> (/.type ["" name_2])
(/.run expected_lux)
(try\map (\ type.equivalence = type_2))
- (try.default false))
+ (try.else false))
(|> (/.type ["" name_3])
(/.run expected_lux)
(try\map (\ type.equivalence = type_3))
- (try.default false))
+ (try.else false))
(|> (/.type [current_module name_4])
(/.run expected_lux)
(try\map (\ type.equivalence = type_4))
- (try.default false))
+ (try.else false))
(|> (/.type ["" name_4])
(/.run expected_lux)
(try\map (\ type.equivalence = type_4))
- (try.default false))))
+ (try.else false))))
)))
(def: injection
diff --git a/stdlib/source/test/lux/meta/annotation.lux b/stdlib/source/test/lux/meta/annotation.lux
index f080ee0c6..0447e3e6a 100644
--- a/stdlib/source/test/lux/meta/annotation.lux
+++ b/stdlib/source/test/lux/meta/annotation.lux
@@ -114,7 +114,7 @@
<definition>)))))]
[/.implementation? #.implementation?]
- [/.recursive_type? #.type-rec?]
+ [/.recursive_type? #.type_rec?]
[/.signature? #.sig?]
))
))))
@@ -137,8 +137,8 @@
<definition>
(\ (list.equivalence text.equivalence) = (list))))))]
- [/.function_arguments #.func-args]
- [/.type_arguments #.type-args]
+ [/.function_arguments #.func_args]
+ [/.type_arguments #.type_args]
))
))))
diff --git a/stdlib/source/test/lux/time.lux b/stdlib/source/test/lux/time.lux
index 86e8ddc45..593dc0d5c 100644
--- a/stdlib/source/test/lux/time.lux
+++ b/stdlib/source/test/lux/time.lux
@@ -54,7 +54,7 @@
/.clock
/.time
(try\map (\ /.equivalence = expected))
- (try.default false)))))
+ (try.else false)))))
(def: for_ranges
Test
@@ -124,7 +124,7 @@
/.to_millis
/.of_millis
(try\map (\ /.equivalence = expected))
- (try.default false)))
+ (try.else false)))
(_.cover [/.time_exceeds_a_day]
(case (/.of_millis out_of_bounds)
(#try.Success _)
@@ -141,7 +141,7 @@
(\ /.codec encode)
(<text>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false)))
+ (try.else false)))
..for_ranges
(_.for [/.Clock]
..for_clock)
diff --git a/stdlib/source/test/lux/time/date.lux b/stdlib/source/test/lux/time/date.lux
index 6f9832198..0aa6674b6 100644
--- a/stdlib/source/test/lux/time/date.lux
+++ b/stdlib/source/test/lux/time/date.lux
@@ -46,7 +46,7 @@
(/.month expected)
(/.day_of_month expected))
(try\map (\ /.equivalence = expected))
- (try.default false))))
+ (try.else false))))
(do random.monad
[expected random.date]
(_.cover [/.invalid_day]
@@ -75,7 +75,7 @@
(|> (\ /.codec encode expected)
(<text>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false))))
+ (try.else false))))
(do {! random.monad}
[year (\ ! map (|>> (n.% 10,000) inc)
random.nat)
diff --git a/stdlib/source/test/lux/time/month.lux b/stdlib/source/test/lux/time/month.lux
index 3e2a8b451..ec1c8134c 100644
--- a/stdlib/source/test/lux/time/month.lux
+++ b/stdlib/source/test/lux/time/month.lux
@@ -61,7 +61,7 @@
/.number
/.by_number
(try\map (\ /.equivalence = expected))
- (try.default false)))
+ (try.else false)))
(_.cover [/.invalid_month]
(case (/.by_number invalid)
(#try.Failure error)
diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux
index 521ca4851..24097be23 100644
--- a/stdlib/source/test/lux/type.lux
+++ b/stdlib/source/test/lux/type.lux
@@ -109,7 +109,7 @@
))
)))
(_.cover [/.applied]
- (and (<| (maybe.default #0)
+ (and (<| (maybe.else #0)
(do maybe.monad
[partial (/.applied (list Bit) Ann)
full (/.applied (list Int) partial)]
diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux
index 982234fb1..a7cac630c 100644
--- a/stdlib/source/test/lux/type/check.lux
+++ b/stdlib/source/test/lux/type/check.lux
@@ -180,7 +180,7 @@
(in (and (not pre)
post)))
(/.run /.fresh_context)
- (try.default false))
+ (try.else false))
(|> (do /.monad
[[var_id var/0] /.var
pre (/.bound? var_id)
@@ -190,7 +190,7 @@
(in (and (not pre)
(not post))))
(/.run /.fresh_context)
- (try.default false)))))
+ (try.else false)))))
(do random.monad
[nominal (random.ascii/upper 10)]
(_.cover [/.cannot_rebind_var]
@@ -688,7 +688,7 @@
(in (type\= (type_shape varT)
cleanedT)))
(/.run /.fresh_context)
- (try.default false))
+ (try.else false))
(|> (do /.monad
[[var_id varT] /.var
[_ replacementT] /.existential
@@ -697,7 +697,7 @@
(in (type\= (type_shape replacementT)
cleanedT)))
(/.run /.fresh_context)
- (try.default false))
+ (try.else false))
))))
(def: #export test
diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux
index ecfbe8aab..80294a765 100644
--- a/stdlib/source/test/lux/type/refinement.lux
+++ b/stdlib/source/test/lux/type/refinement.lux
@@ -46,23 +46,23 @@
(_.cover [/.predicate]
(|> (/.refinement predicate modulus)
(maybe\map (|>> /.predicate (is? predicate)))
- (maybe.default false)))
+ (maybe.else false)))
))
(_.cover [/.value]
(|> (/.refinement predicate modulus)
(maybe\map (|>> /.value (n.= modulus)))
- (maybe.default false)))
+ (maybe.else false)))
(_.cover [/.lift]
(and (|> (/.refinement predicate modulus)
(maybe\map (/.lift (n.+ modulus)))
maybe\join
(maybe\map (|>> /.value (n.= (n.+ modulus modulus))))
- (maybe.default false))
+ (maybe.else false))
(|> (/.refinement predicate modulus)
(maybe\map (/.lift (n.+ (inc modulus))))
maybe\join
(maybe\map (|>> /.value (n.= (n.+ modulus (inc modulus)))))
- (maybe.default false)
+ (maybe.else false)
not)))
(_.cover [/.only]
(let [expected (list.only predicate raws)
diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux
index c007b3ea8..5a815c294 100644
--- a/stdlib/source/test/lux/world/console.lux
+++ b/stdlib/source/test/lux/world/console.lux
@@ -62,7 +62,7 @@
(do io.monad
[?_ (/.write_line expected console)
?actual (\ console read_line [])]
- (in (<| (try.default false)
+ (in (<| (try.else false)
(do try.monad
[_ ?_
actual ?actual]
diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux
index 7d09023cf..88af80fdf 100644
--- a/stdlib/source/test/lux/world/file/watch.lux
+++ b/stdlib/source/test/lux/world/file/watch.lux
@@ -182,7 +182,7 @@
after_modification!
after_deletion!)))]
(_.cover' [/.mock /.polling]
- (try.default false verdict)))))
+ (try.else false verdict)))))
(do random.monad
[directory (random.ascii/alpha 5)
#let [/ "/"
diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux
index 1979003f0..8a74d3e21 100644
--- a/stdlib/source/test/lux/world/net/http/client.lux
+++ b/stdlib/source/test/lux/world/net/http/client.lux
@@ -74,7 +74,7 @@
[product.right (\ utf8.codec decode)]
[(\ nat.decimal decode)]
[(nat.= <expected>) in])
- (try.default false)))]
+ (try.else false)))]
[/.post on_post]
[/.get on_get]
diff --git a/stdlib/source/test/lux/world/program.lux b/stdlib/source/test/lux/world/program.lux
index 6760865e7..9940220ac 100644
--- a/stdlib/source/test/lux/world/program.lux
+++ b/stdlib/source/test/lux/world/program.lux
@@ -64,7 +64,7 @@
(|> environment
(dictionary.get key)
(maybe\map (text\= value))
- (maybe.default false)))))))))))
+ (maybe.else false)))))))))))
(_.cover [/.unknown_environment_variable]
(let [program (/.mock environment home directory)]
(|> unknown
diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux
index 4008c4c5a..ecea6d8b9 100644
--- a/stdlib/source/test/lux/world/shell.lux
+++ b/stdlib/source/test/lux/world/shell.lux
@@ -124,5 +124,5 @@
destroyed!
(i.= exit await))))]
(_.cover' [/.Shell]
- (try.default false verdict)))))
+ (try.else false verdict)))))
)))