From 62b3abfcc014ca1c19d62aacdd497f6a250b372c Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 25 Jul 2021 03:12:17 -0400 Subject: Better syntax for "library/lux.^multi". --- .../the_lux_programming_language/introduction.md | 31 + lux-mode/lux-mode.el | 2 +- stdlib/source/library/lux.lux | 213 +++--- .../library/lux/abstract/functor/contravariant.lux | 2 + stdlib/source/library/lux/abstract/monad.lux | 2 +- .../source/library/lux/control/concatenative.lux | 2 +- .../library/lux/control/concurrency/actor.lux | 90 ++- .../library/lux/control/concurrency/atom.lux | 2 + .../source/library/lux/control/concurrency/frp.lux | 34 +- .../library/lux/control/concurrency/promise.lux | 35 +- .../library/lux/control/concurrency/semaphore.lux | 8 + .../source/library/lux/control/concurrency/stm.lux | 5 +- .../library/lux/control/concurrency/thread.lux | 6 +- .../library/lux/control/function/contract.lux | 10 +- .../source/library/lux/control/function/memo.lux | 6 +- .../source/library/lux/control/function/mixin.lux | 11 +- .../source/library/lux/control/function/mutual.lux | 28 + stdlib/source/library/lux/control/parser.lux | 2 +- .../source/library/lux/control/parser/binary.lux | 28 +- stdlib/source/library/lux/control/parser/cli.lux | 2 +- stdlib/source/library/lux/control/parser/json.lux | 2 +- stdlib/source/library/lux/control/parser/text.lux | 16 +- stdlib/source/library/lux/control/parser/type.lux | 22 +- stdlib/source/library/lux/control/remember.lux | 2 +- stdlib/source/library/lux/control/try.lux | 21 +- .../source/library/lux/data/collection/array.lux | 2 +- .../library/lux/data/collection/dictionary.lux | 2 +- .../lux/data/collection/dictionary/ordered.lux | 58 +- stdlib/source/library/lux/data/collection/list.lux | 6 +- .../source/library/lux/data/collection/queue.lux | 2 +- .../library/lux/data/collection/queue/priority.lux | 4 +- stdlib/source/library/lux/data/collection/row.lux | 4 +- .../library/lux/data/collection/sequence.lux | 9 +- stdlib/source/library/lux/data/collection/set.lux | 2 +- .../library/lux/data/collection/set/multi.lux | 10 +- .../library/lux/data/collection/set/ordered.lux | 10 +- .../library/lux/data/collection/tree/finger.lux | 6 +- stdlib/source/library/lux/data/color.lux | 110 +-- stdlib/source/library/lux/data/color/named.lux | 6 +- stdlib/source/library/lux/data/format/binary.lux | 17 +- .../library/lux/data/format/css/property.lux | 18 +- .../library/lux/data/format/css/selector.lux | 4 +- .../source/library/lux/data/format/css/value.lux | 750 ++++++++++----------- stdlib/source/library/lux/data/format/html.lux | 2 +- stdlib/source/library/lux/data/format/json.lux | 72 +- stdlib/source/library/lux/data/format/tar.lux | 10 +- stdlib/source/library/lux/data/format/xml.lux | 6 +- stdlib/source/library/lux/data/text.lux | 4 +- stdlib/source/library/lux/data/text/escape.lux | 4 +- stdlib/source/library/lux/data/text/format.lux | 2 +- stdlib/source/library/lux/data/text/regex.lux | 8 +- .../source/library/lux/data/text/unicode/set.lux | 4 +- stdlib/source/library/lux/debug.lux | 32 +- stdlib/source/library/lux/ffi.js.lux | 2 +- stdlib/source/library/lux/ffi.jvm.lux | 8 +- stdlib/source/library/lux/ffi.lua.lux | 2 +- stdlib/source/library/lux/ffi.old.lux | 12 +- stdlib/source/library/lux/ffi.py.lux | 2 +- stdlib/source/library/lux/locale/language.lux | 4 +- stdlib/source/library/lux/locale/territory.lux | 2 +- stdlib/source/library/lux/macro/poly.lux | 26 +- stdlib/source/library/lux/macro/template.lux | 24 +- stdlib/source/library/lux/math/logic/fuzzy.lux | 6 +- stdlib/source/library/lux/math/modulus.lux | 2 +- stdlib/source/library/lux/math/number.lux | 20 +- stdlib/source/library/lux/math/number/frac.lux | 10 +- stdlib/source/library/lux/math/number/i64.lux | 2 +- stdlib/source/library/lux/math/random.lux | 18 +- stdlib/source/library/lux/meta.lux | 8 +- stdlib/source/library/lux/meta/annotation.lux | 4 +- stdlib/source/library/lux/target/common_lisp.lux | 14 +- stdlib/source/library/lux/target/js.lux | 12 +- stdlib/source/library/lux/target/jvm/attribute.lux | 4 +- .../library/lux/target/jvm/attribute/code.lux | 1 - stdlib/source/library/lux/target/jvm/bytecode.lux | 12 +- .../library/lux/target/jvm/bytecode/address.lux | 2 +- .../jvm/bytecode/environment/limit/registry.lux | 4 +- .../lux/target/jvm/bytecode/instruction.lux | 53 +- stdlib/source/library/lux/target/jvm/class.lux | 4 +- stdlib/source/library/lux/target/jvm/constant.lux | 4 +- .../library/lux/target/jvm/constant/pool.lux | 2 +- .../source/library/lux/target/jvm/constant/tag.lux | 2 +- stdlib/source/library/lux/target/jvm/loader.lux | 26 +- stdlib/source/library/lux/target/jvm/magic.lux | 2 +- stdlib/source/library/lux/target/jvm/method.lux | 2 +- stdlib/source/library/lux/target/jvm/modifier.lux | 2 +- .../source/library/lux/target/jvm/type/alias.lux | 2 +- .../library/lux/target/jvm/type/category.lux | 2 +- .../source/library/lux/target/jvm/type/parser.lux | 14 +- stdlib/source/library/lux/target/jvm/version.lux | 4 +- stdlib/source/library/lux/target/lua.lux | 6 +- stdlib/source/library/lux/target/php.lux | 6 +- stdlib/source/library/lux/target/python.lux | 2 +- stdlib/source/library/lux/target/r.lux | 6 +- stdlib/source/library/lux/target/ruby.lux | 6 +- stdlib/source/library/lux/target/scheme.lux | 12 +- stdlib/source/library/lux/test.lux | 8 +- stdlib/source/library/lux/time.lux | 26 +- stdlib/source/library/lux/time/date.lux | 32 +- stdlib/source/library/lux/time/duration.lux | 6 +- stdlib/source/library/lux/time/instant.lux | 97 +-- .../library/lux/tool/compiler/default/init.lux | 4 +- .../library/lux/tool/compiler/default/platform.lux | 206 +++--- .../compiler/language/lux/phase/analysis/case.lux | 6 +- .../language/lux/phase/analysis/case/coverage.lux | 10 +- .../language/lux/phase/analysis/inference.lux | 4 +- .../language/lux/phase/analysis/structure.lux | 6 +- .../language/lux/phase/extension/analysis/jvm.lux | 36 +- .../language/lux/phase/extension/bundle.lux | 2 +- .../language/lux/phase/extension/directive/jvm.lux | 2 +- .../language/lux/phase/extension/directive/lux.lux | 14 +- .../lux/phase/extension/generation/js/common.lux | 4 +- .../lux/phase/extension/generation/js/host.lux | 2 +- .../lux/phase/extension/generation/jvm/common.lux | 2 +- .../lux/phase/extension/generation/php/common.lux | 2 +- .../language/lux/phase/generation/js/runtime.lux | 12 +- .../jvm/function/field/variable/partial/count.lux | 2 +- .../phase/generation/jvm/function/method/apply.lux | 2 +- .../phase/generation/jvm/function/method/init.lux | 2 +- .../language/lux/phase/generation/jvm/program.lux | 2 +- .../language/lux/phase/generation/jvm/runtime.lux | 4 +- .../language/lux/phase/generation/lua/loop.lux | 4 +- .../language/lux/phase/generation/php/loop.lux | 4 +- .../language/lux/phase/generation/python/loop.lux | 4 +- .../language/lux/phase/generation/r/runtime.lux | 14 +- .../compiler/language/lux/phase/synthesis/case.lux | 2 +- .../language/lux/phase/synthesis/variable.lux | 10 +- .../lux/tool/compiler/language/lux/syntax.lux | 84 +-- .../library/lux/tool/compiler/meta/archive.lux | 4 +- .../lux/tool/compiler/meta/archive/document.lux | 14 +- .../library/lux/tool/compiler/meta/io/archive.lux | 12 +- .../lux/tool/compiler/meta/packager/jvm.lux | 1 - .../lux/tool/compiler/meta/packager/scheme.lux | 16 +- .../lux/tool/compiler/meta/packager/script.lux | 12 +- stdlib/source/library/lux/tool/compiler/phase.lux | 2 +- stdlib/source/library/lux/tool/interpreter.lux | 166 ++--- stdlib/source/library/lux/type.lux | 72 +- stdlib/source/library/lux/type/check.lux | 2 +- stdlib/source/library/lux/type/implicit.lux | 18 +- stdlib/source/library/lux/type/refinement.lux | 6 +- stdlib/source/library/lux/world/file.lux | 22 +- stdlib/source/library/lux/world/file/watch.lux | 14 +- .../source/library/lux/world/net/http/client.lux | 2 +- .../source/library/lux/world/net/http/request.lux | 2 +- stdlib/source/library/lux/world/program.lux | 4 +- stdlib/source/library/lux/world/shell.lux | 4 +- stdlib/source/poly/lux/abstract/equivalence.lux | 33 +- stdlib/source/poly/lux/data/format/json.lux | 52 +- stdlib/source/program/aedifex/artifact/time.lux | 6 +- stdlib/source/program/aedifex/command/build.lux | 14 +- stdlib/source/program/aedifex/command/deps.lux | 4 +- .../program/aedifex/dependency/deployment.lux | 4 +- stdlib/source/program/aedifex/input.lux | 8 +- .../source/program/aedifex/metadata/artifact.lux | 4 +- stdlib/source/program/aedifex/parser.lux | 24 +- stdlib/source/program/aedifex/pom.lux | 24 +- stdlib/source/program/aedifex/project.lux | 2 +- stdlib/source/program/aedifex/runtime.lux | 2 +- stdlib/source/program/compositor.lux | 32 +- stdlib/source/program/compositor/export.lux | 4 +- stdlib/source/program/scriptum.lux | 34 +- .../specification/compositor/generation/case.lux | 6 +- .../specification/compositor/generation/common.lux | 18 +- stdlib/source/specification/lux/abstract/order.lux | 12 +- stdlib/source/specification/lux/world/file.lux | 16 +- stdlib/source/test/aedifex/artifact/extension.lux | 2 +- stdlib/source/test/aedifex/artifact/time.lux | 4 +- stdlib/source/test/aedifex/artifact/type.lux | 2 +- stdlib/source/test/aedifex/cache.lux | 4 +- stdlib/source/test/aedifex/cli.lux | 28 +- stdlib/source/test/aedifex/command/auto.lux | 4 +- stdlib/source/test/aedifex/command/deps.lux | 14 +- stdlib/source/test/aedifex/command/version.lux | 4 +- .../source/test/aedifex/dependency/resolution.lux | 42 +- stdlib/source/test/aedifex/metadata/artifact.lux | 4 +- stdlib/source/test/aedifex/metadata/snapshot.lux | 4 +- stdlib/source/test/aedifex/parser.lux | 6 +- stdlib/source/test/aedifex/profile.lux | 4 +- stdlib/source/test/aedifex/project.lux | 22 +- stdlib/source/test/aedifex/runtime.lux | 2 +- stdlib/source/test/lux.lux | 10 +- stdlib/source/test/lux/abstract/equivalence.lux | 2 +- stdlib/source/test/lux/abstract/interval.lux | 4 +- stdlib/source/test/lux/abstract/monad.lux | 6 +- stdlib/source/test/lux/abstract/order.lux | 2 +- stdlib/source/test/lux/abstract/predicate.lux | 6 +- stdlib/source/test/lux/control/concatenative.lux | 8 +- .../source/test/lux/control/concurrency/actor.lux | 3 +- .../source/test/lux/control/concurrency/atom.lux | 2 +- stdlib/source/test/lux/control/concurrency/frp.lux | 20 +- .../test/lux/control/concurrency/promise.lux | 2 +- stdlib/source/test/lux/control/exception.lux | 2 +- stdlib/source/test/lux/control/function.lux | 2 +- stdlib/source/test/lux/control/function/mixin.lux | 6 +- stdlib/source/test/lux/control/parser.lux | 32 +- stdlib/source/test/lux/control/parser/binary.lux | 8 +- stdlib/source/test/lux/control/parser/cli.lux | 12 +- stdlib/source/test/lux/control/parser/code.lux | 2 +- stdlib/source/test/lux/control/parser/json.lux | 22 +- .../source/test/lux/control/parser/synthesis.lux | 2 +- stdlib/source/test/lux/control/parser/text.lux | 144 ++-- stdlib/source/test/lux/control/parser/tree.lux | 4 +- stdlib/source/test/lux/control/parser/type.lux | 14 +- stdlib/source/test/lux/control/parser/xml.lux | 6 +- stdlib/source/test/lux/control/region.lux | 26 +- stdlib/source/test/lux/control/try.lux | 43 +- stdlib/source/test/lux/data/binary.lux | 4 +- stdlib/source/test/lux/data/collection/array.lux | 24 +- .../source/test/lux/data/collection/dictionary.lux | 36 +- .../lux/data/collection/dictionary/ordered.lux | 14 +- .../test/lux/data/collection/dictionary/plist.lux | 6 +- stdlib/source/test/lux/data/collection/list.lux | 18 +- stdlib/source/test/lux/data/collection/queue.lux | 12 +- .../test/lux/data/collection/queue/priority.lux | 28 +- stdlib/source/test/lux/data/collection/row.lux | 20 +- .../source/test/lux/data/collection/sequence.lux | 4 +- stdlib/source/test/lux/data/collection/set.lux | 10 +- .../source/test/lux/data/collection/set/multi.lux | 16 +- .../test/lux/data/collection/set/ordered.lux | 18 +- stdlib/source/test/lux/data/collection/stack.lux | 10 +- .../test/lux/data/collection/tree/finger.lux | 40 +- .../test/lux/data/collection/tree/zipper.lux | 4 +- stdlib/source/test/lux/data/color.lux | 38 +- stdlib/source/test/lux/data/color/named.lux | 4 +- stdlib/source/test/lux/data/format/json.lux | 4 +- stdlib/source/test/lux/data/format/tar.lux | 10 +- stdlib/source/test/lux/data/product.lux | 4 +- stdlib/source/test/lux/data/sum.lux | 4 +- stdlib/source/test/lux/data/text.lux | 24 +- stdlib/source/test/lux/data/text/encoding.lux | 4 +- stdlib/source/test/lux/data/text/escape.lux | 40 +- stdlib/source/test/lux/data/text/format.lux | 2 +- stdlib/source/test/lux/data/text/regex.lux | 8 +- stdlib/source/test/lux/data/text/unicode/block.lux | 6 +- stdlib/source/test/lux/ffi.jvm.lux | 6 +- stdlib/source/test/lux/ffi.old.lux | 4 +- stdlib/source/test/lux/locale/language.lux | 24 +- stdlib/source/test/lux/locale/territory.lux | 28 +- stdlib/source/test/lux/macro/code.lux | 32 +- stdlib/source/test/lux/macro/template.lux | 8 +- stdlib/source/test/lux/math/logic/fuzzy.lux | 12 +- stdlib/source/test/lux/math/modular.lux | 6 +- stdlib/source/test/lux/math/modulus.lux | 2 +- stdlib/source/test/lux/math/number/complex.lux | 2 +- stdlib/source/test/lux/math/number/frac.lux | 12 +- stdlib/source/test/lux/math/number/int.lux | 6 +- stdlib/source/test/lux/math/number/nat.lux | 4 +- stdlib/source/test/lux/math/number/ratio.lux | 12 +- stdlib/source/test/lux/math/number/rev.lux | 10 +- stdlib/source/test/lux/meta.lux | 172 ++--- stdlib/source/test/lux/meta/annotation.lux | 4 +- stdlib/source/test/lux/target.lux | 2 +- stdlib/source/test/lux/target/jvm.lux | 52 +- stdlib/source/test/lux/test.lux | 12 +- stdlib/source/test/lux/time.lux | 6 +- stdlib/source/test/lux/time/date.lux | 4 +- stdlib/source/test/lux/time/duration.lux | 6 +- stdlib/source/test/lux/time/instant.lux | 10 +- stdlib/source/test/lux/time/month.lux | 10 +- stdlib/source/test/lux/time/year.lux | 8 +- .../compiler/language/lux/phase/analysis/case.lux | 10 +- .../language/lux/phase/analysis/function.lux | 98 +-- .../language/lux/phase/analysis/primitive.lux | 22 +- .../language/lux/phase/analysis/reference.lux | 60 +- .../language/lux/phase/analysis/structure.lux | 194 +++--- .../language/lux/phase/extension/analysis/lux.lux | 106 +-- .../compiler/language/lux/phase/synthesis/loop.lux | 36 +- .../test/lux/tool/compiler/language/lux/syntax.lux | 2 +- stdlib/source/test/lux/type.lux | 102 +-- stdlib/source/test/lux/type/check.lux | 2 +- stdlib/source/test/lux/type/quotient.lux | 2 +- stdlib/source/test/lux/type/refinement.lux | 8 +- stdlib/source/test/lux/type/unit.lux | 4 +- stdlib/source/test/lux/world/console.lux | 6 +- stdlib/source/test/lux/world/file/watch.lux | 4 +- stdlib/source/test/lux/world/input/keyboard.lux | 4 +- stdlib/source/test/lux/world/net/http/status.lux | 4 +- .../test/lux/world/output/video/resolution.lux | 2 +- stdlib/source/test/lux/world/shell.lux | 2 +- 279 files changed, 2782 insertions(+), 2679 deletions(-) create mode 100644 documentation/book/the_lux_programming_language/introduction.md diff --git a/documentation/book/the_lux_programming_language/introduction.md b/documentation/book/the_lux_programming_language/introduction.md new file mode 100644 index 000000000..11ee6b52a --- /dev/null +++ b/documentation/book/the_lux_programming_language/introduction.md @@ -0,0 +1,31 @@ +# Introduction + +The Lux programming language is a functional language belonging to the Lisp family. +It features a flexible and expressive static type-system, and it's meant to run in a variety of different platforms. + +Lux is currently in development. +Some of the features expected of the language have yet to be added (in particular, more compilers to support more platforms). + +Despite this, Lux has already come far enough in its development that it can be used to write a variety of programs that can run on the Java Virtual Machine, the first platform targeted by Lux. + +The semantics of Lux are in no way tied to those of the JVM, and as such, Lux should be understood as a universal language; meant to express programs in a way that is as cross-platform as possible, while at the same time able to tap into the richness that each particular platform has got to offer. + +Besides the focus on targeting multiple platforms, Lux's design also covers several other important topics in computer science and software engineering. + +Lux is committed to the functional style of program design, being a purely-functional programming language, while also adopting eager-evaluation over lazy-evaluation, to promote simpler reasoning over the performance and behavior of programs. + +Lux also offers novel features in the area of meta-programming, with first-class types that can be examined and constructed at compile-time, monadic macros with access to the state of the compiler, and a style of macro definition that promotes composition and easy interaction between different macros. + +While the richness and variety of what Lux has got to offer is much larger than what can be described in this introduction, hopefully I've already mentioned enough to stimulate the curiosity of those interested in advanced concepts in programming languages and computer science, and those engineers seeking powerful tools for both program design and implementation. + +Lux is both a simple and a complex language. +It's design allows you to make effective programs with just a small subset of what it has to offer, but the goal of the language is to provide its users with an arsenal of powerful tools to suit their various needs in their projects. + +Finally, I must note that Lux is a practical language, meant for day-to-day usage by software engineers, instead of just research and experimentation by academics. +It may seem unnecessary to point that out, but both Lisp-like languages and functional languages have earned a reputation for being academic in nature. +While Lux's design does involve a lot of advanced ideas in computer science, it is with the intention of turning Lux into a powerful and effective tool for day-to-day software engineering. + +It is my hope that within these pages the reader will find both a host of new ideas to enrich his/her perspective on programming, and the promise of great power, should they choose to add Lux to their arsenal of programming languages. + +I wish you, my dear reader, good luck on this journey, and much fun! + diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index f36d3edfc..84896f3e5 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -326,7 +326,7 @@ Called by `imenu--generic-function'." (control//contract (altRE "pre" "post")) ;; Type (type//syntax (altRE "|" "&" "->" "All" "Ex" "Rec" "primitive" "\\$" "type")) - (type//checking (altRE ":" ":as" ":let" ":~" ":assume" ":of" ":cast" ":share" ":by_example" ":hole")) + (type//checking (altRE ":" ":as" ":let" ":~" ":assume" ":of" ":cast" ":sharing" ":by_example" ":hole")) (type//abstract (altRE "abstract:" ":abstraction" ":representation" ":transmutation" "\\^:representation")) (type//unit (altRE "unit:" "scale:")) (type//poly (altRE "poly:" "derived:")) diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 4d3141587..eb2676ee3 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -1088,7 +1088,7 @@ code} code)) -(def:'' (parse_quantified_args args next) +(def:'' (quantified_args_parser args next) #Nil ## (-> (List Code) (-> (List Text) (Meta (List Code))) (Meta (List Code))) (#Function ($' List Code) @@ -1099,7 +1099,7 @@ (next #Nil) (#Cons [_ (#Identifier "" arg_name)] args') - (parse_quantified_args args' (function'' [names] (next (#Cons arg_name names)))) + (quantified_args_parser args' (function'' [names] (next (#Cons arg_name names)))) _ (fail "Expected identifier.")} @@ -1149,28 +1149,28 @@ ["" tokens]} tokens) ({(#Cons [_ (#Tuple args)] (#Cons body #Nil)) - (parse_quantified_args args - (function'' [names] - (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code)) - (function'' [name' body'] - (form$ (#Cons (tag$ ["library/lux" "UnivQ"]) - (#Cons (tag$ ["library/lux" "Nil"]) - (#Cons (replace_syntax (#Cons [name' (make_parameter 1)] #Nil) - (update_parameters body')) #Nil)))))) - body - names) - (return (#Cons ({[#1 _] - body' - - [_ #Nil] - body' - - [#0 _] - (replace_syntax (#Cons [self_name (make_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] - #Nil) - body')} - [(text\= "" self_name) names]) - #Nil))))) + (quantified_args_parser args + (function'' [names] + (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code)) + (function'' [name' body'] + (form$ (#Cons (tag$ ["library/lux" "UnivQ"]) + (#Cons (tag$ ["library/lux" "Nil"]) + (#Cons (replace_syntax (#Cons [name' (make_parameter 1)] #Nil) + (update_parameters body')) #Nil)))))) + body + names) + (return (#Cons ({[#1 _] + body' + + [_ #Nil] + body' + + [#0 _] + (replace_syntax (#Cons [self_name (make_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] + #Nil) + body')} + [(text\= "" self_name) names]) + #Nil))))) _ (fail "Wrong syntax for All")} @@ -1193,28 +1193,28 @@ ["" tokens]} tokens) ({(#Cons [_ (#Tuple args)] (#Cons body #Nil)) - (parse_quantified_args args - (function'' [names] - (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code)) - (function'' [name' body'] - (form$ (#Cons (tag$ ["library/lux" "ExQ"]) - (#Cons (tag$ ["library/lux" "Nil"]) - (#Cons (replace_syntax (#Cons [name' (make_parameter 1)] #Nil) - (update_parameters body')) #Nil)))))) - body - names) - (return (#Cons ({[#1 _] - body' - - [_ #Nil] - body' - - [#0 _] - (replace_syntax (#Cons [self_name (make_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] - #Nil) - body')} - [(text\= "" self_name) names]) - #Nil))))) + (quantified_args_parser args + (function'' [names] + (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code)) + (function'' [name' body'] + (form$ (#Cons (tag$ ["library/lux" "ExQ"]) + (#Cons (tag$ ["library/lux" "Nil"]) + (#Cons (replace_syntax (#Cons [name' (make_parameter 1)] #Nil) + (update_parameters body')) #Nil)))))) + body + names) + (return (#Cons ({[#1 _] + body' + + [_ #Nil] + body' + + [#0 _] + (replace_syntax (#Cons [self_name (make_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] + #Nil) + body')} + [(text\= "" self_name) names]) + #Nil))))) _ (fail "Wrong syntax for Ex")} @@ -1750,7 +1750,7 @@ (identifier$ ["library/lux" "List"])))] (form$ (list (text$ "lux type check") type expression)))) -(def:''' (splice replace? untemplate elems) +(def:''' (spliced replace? untemplate elems) #Nil (-> Bit (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) ({#1 @@ -1862,13 +1862,13 @@ [_ [meta (#Form elems)]] (do meta_monad - [output (splice replace? (untemplate replace? subst) elems) + [output (spliced replace? (untemplate replace? subst) elems) #let [[_ output'] (wrap_meta (form$ (list (tag$ ["library/lux" "Form"]) output)))]] (wrap [meta output'])) [_ [meta (#Tuple elems)]] (do meta_monad - [output (splice replace? (untemplate replace? subst) elems) + [output (spliced replace? (untemplate replace? subst) elems) #let [[_ output'] (wrap_meta (form$ (list (tag$ ["library/lux" "Tuple"]) output)))]] (wrap [meta output'])) @@ -3296,17 +3296,18 @@ (#Some x) (nth ("lux i64 -" 1 idx) xs')))) -(def: (beta_reduce env type) +## https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction +(def: (reduced env type) (-> (List Type) Type Type) (case type (#Sum left right) - (#Sum (beta_reduce env left) (beta_reduce env right)) + (#Sum (reduced env left) (reduced env right)) (#Product left right) - (#Product (beta_reduce env left) (beta_reduce env right)) + (#Product (reduced env left) (reduced env right)) (#Apply arg func) - (#Apply (beta_reduce env arg) (beta_reduce env func)) + (#Apply (reduced env arg) (reduced env func)) (#UnivQ ?local_env ?local_def) (case ?local_env @@ -3325,7 +3326,7 @@ type) (#Function ?input ?output) - (#Function (beta_reduce env ?input) (beta_reduce env ?output)) + (#Function (reduced env ?input) (reduced env ?output)) (#Parameter idx) (case (nth idx env) @@ -3336,7 +3337,7 @@ type) (#Named name type) - (beta_reduce env type) + (reduced env type) _ type @@ -3346,10 +3347,10 @@ (-> Type Type (Maybe Type)) (case type_fn (#UnivQ env body) - (#Some (beta_reduce (list& type_fn param env) body)) + (#Some (reduced (list& type_fn param env) body)) (#ExQ env body) - (#Some (beta_reduce (list& type_fn param env) body)) + (#Some (reduced (list& type_fn param env) body)) (#Apply A F) (do maybe_monad @@ -3372,16 +3373,16 @@ _ (list type)))] - [flatten_variant #Sum] - [flatten_tuple #Product] - [flatten_lambda #Function] + [flat_variant #Sum] + [flat_tuple #Product] + [flat_lambda #Function] ) -(def: (flatten_app type) +(def: (flat_app type) (-> Type [Type (List Type)]) (case type (#Apply head func') - (let [[func tail] (flatten_app func')] + (let [[func tail] (flat_app func')] [func (#Cons head tail)]) _ @@ -3391,7 +3392,7 @@ (-> Type (Maybe (List Type))) (case type (#Product _) - (#Some (flatten_tuple type)) + (#Some (flat_tuple type)) (#Apply arg func) (do maybe_monad @@ -3717,7 +3718,7 @@ (fail "#only/#+ and #exclude/#- require identifiers.")))) defs)) -(def: (parse_referrals tokens) +(def: (referrals_parser tokens) (-> (List Code) (Meta [Referrals (List Code)])) (case tokens (^or (^ (list& [_ (#Form (list& [_ (#Tag ["" "+"])] defs))] tokens')) @@ -3743,7 +3744,7 @@ _ (return [#Nothing tokens]))) -(def: (parse_openings parts) +(def: (openings_parser parts) (-> (List Code) (Meta [(List Openings) (List Code)])) (case parts #.Nil @@ -3760,7 +3761,7 @@ _ (fail "Expected all implementations of opening form to be identifiers."))) structs) - next+remainder (parse_openings parts')] + next+remainder (openings_parser parts')] (let [[next remainder] next+remainder] (return [(#.Cons [prefix structs'] next) remainder]))) @@ -3902,7 +3903,7 @@ #import_alias import_alias #import_refer import_refer})) -(def: (parse_imports nested? relative_root context_alias imports) +(def: (imports_parser nested? relative_root context_alias imports) (-> Bit Text Text (List Code) (Meta (List Importation))) (do meta_monad [imports' (monad\map meta_monad @@ -3927,11 +3928,11 @@ #.None (clean_module nested? relative_root m_name)) - referral+extra (parse_referrals extra) + referral+extra (referrals_parser extra) #let [[referral extra] referral+extra] - openings+extra (parse_openings extra) + openings+extra (openings_parser extra) #let [[openings extra] openings+extra] - sub_imports (parse_imports #1 import_name context_alias extra)] + sub_imports (imports_parser #1 import_name context_alias extra)] (wrap (case [referral openings] [#Nothing #Nil] sub_imports @@ -3951,12 +3952,12 @@ #.None (clean_module nested? relative_root m_name)) - referral+extra (parse_referrals extra) + referral+extra (referrals_parser extra) #let [[referral extra] referral+extra] - openings+extra (parse_openings extra) + openings+extra (openings_parser extra) #let [[openings extra] openings+extra de_aliased (de_alias context_alias m_name alias)] - sub_imports (parse_imports #1 import_name de_aliased extra)] + sub_imports (imports_parser #1 import_name de_aliased extra)] (wrap (case [referral openings] [#Ignore #Nil] sub_imports @@ -4019,7 +4020,7 @@ code\encode)))) )) -(def: (filter p xs) +(def: (only p xs) (All [a] (-> (-> a Bit) (List a) (List a))) (case xs #Nil @@ -4027,8 +4028,8 @@ (#Cons x xs') (if (p x) - (#Cons x (filter p xs')) - (filter p xs')))) + (#Cons x (only p xs')) + (only p xs')))) (def: (is_member? cases name) (-> (List Text) Text Bit) @@ -4196,13 +4197,13 @@ ($_ text\compose "(" name " " (|> params (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")")) (#Sum _) - ($_ text\compose "(| " (|> (flatten_variant type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")") + ($_ text\compose "(| " (|> (flat_variant type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")") (#Product _) - ($_ text\compose "[" (|> (flatten_tuple type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) "]") + ($_ text\compose "[" (|> (flat_tuple type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) "]") (#Function _) - ($_ text\compose "(-> " (|> (flatten_lambda type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")") + ($_ text\compose "(-> " (|> (flat_lambda type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")") (#Parameter id) (nat\encode id) @@ -4220,7 +4221,7 @@ ($_ text\compose "(Ex " (type\encode body) ")") (#Apply _) - (let [[func args] (flatten_app type)] + (let [[func args] (flat_app type)] ($_ text\compose "(" (type\encode func) " " (|> args (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) @@ -4470,9 +4471,9 @@ (def: (read_refer module_name options) (-> Text (List Code) (Meta Refer)) (do meta_monad - [referral+options (parse_referrals options) + [referral+options (referrals_parser options) #let [[referral options] referral+options] - openings+options (parse_openings options) + openings+options (openings_parser options) #let [[openings options] openings+options] current_module current_module_name] (case options @@ -4514,7 +4515,7 @@ (do meta_monad [*defs (exported_definitions module_name) _ (test_referrals module_name *defs _defs)] - (wrap (filter (|>> (is_member? _defs) not) *defs))) + (wrap (..only (|>> (is_member? _defs) not) *defs))) #Ignore (wrap (list)) @@ -4599,7 +4600,7 @@ _ [(list) tokens]))] current_module current_module_name - imports (parse_imports #0 current_module "" _imports) + imports (imports_parser #0 current_module "" _imports) #let [=imports (|> imports (list\map (: (-> Importation Code) (function (_ [m_name m_alias =refer]) @@ -4798,20 +4799,20 @@ (macro: #export (^template tokens) {#.doc (text$ ($_ "lux text concat" "## It's similar to template, but meant to be used during pattern-matching." ..\n - "(def: (beta_reduce env type)" ..\n + "(def: (reduced env type)" ..\n " (-> (List Type) Type Type)" ..\n " (case type" ..\n " (#.Primitive name params)" ..\n - " (#.Primitive name (list\map (beta_reduce env) params))" + " (#.Primitive name (list\map (reduced env) params))" __paragraph " (^template []" ..\n " [( left right)" ..\n - " ( (beta_reduce env left) (beta_reduce env right))])" ..\n + " ( (reduced env left) (reduced env right))])" ..\n " ([#.Sum] [#.Product])" __paragraph " (^template []" ..\n " [( left right)" ..\n - " ( (beta_reduce env left) (beta_reduce env right))])" ..\n + " ( (reduced env left) (reduced env right))])" ..\n " ([#.Function] [#.Apply])" __paragraph " (^template []" ..\n @@ -5241,7 +5242,7 @@ _ (fail "Wrong syntax for with_expansions"))) -(def: (flatten_alias type) +(def: (flat_alias type) (-> Type Type) (case type (^template [] @@ -5255,7 +5256,7 @@ ["Text"]) (#Named _ type') - (flatten_alias type') + (flat_alias type') _ type)) @@ -5265,7 +5266,7 @@ (do meta_monad [type+value (find_def_value name) #let [[type value] type+value]] - (case (flatten_alias type) + (case (flat_alias type) (^template [ ] [(#Named ["library/lux" ] _) (wrap ( (:as value)))]) @@ -5330,7 +5331,7 @@ (def: (case_level^ level) (-> Code (Meta [Code Code])) (case level - (^ [_ (#Tuple (list expr binding))]) + (^ [_ (#Record (list [expr binding]))]) (return [expr binding]) _ @@ -5373,7 +5374,8 @@ "Useful in situations where the result of a branch depends on further refinements on the values being matched." "For example:" (case (split (size static) uri) - (^multi (#.Some [chunk uri']) [(text\= static chunk) #1]) + (^multi (#.Some [chunk uri']) + {(text\= static chunk) #1}) (match_uri endpoint? parts' uri') _ @@ -5382,7 +5384,8 @@ "Short-cuts can be taken when using bit tests." "The example above can be rewritten as..." (case (split (size static) uri) - (^multi (#.Some [chunk uri']) (text\= static chunk)) + (^multi (#.Some [chunk uri']) + (text\= static chunk)) (match_uri endpoint? parts' uri') _ @@ -5453,7 +5456,7 @@ (macro: #export ($ tokens) {#.doc (doc "Allows you to refer to the type-variables in a polymorphic function's type, by their index." "In the example below, 0 corresponds to the 'a' variable." - (def: #export (from_list list) + (def: #export (of_list list) (All [a] (-> (List a) (Row a))) (list\fold add (: (Row ($ 0)) @@ -5580,7 +5583,7 @@ _ (fail (..wrong_syntax_error (name_of ..:of))))) -(def: (parse_complex_declaration tokens) +(def: (complex_declaration_parser tokens) (-> (List Code) (Meta [[Text (List Text)] (List Code)])) (case tokens (^ (list& [_ (#Form (list& [_ (#Identifier ["" name])] args'))] tokens')) @@ -5600,7 +5603,7 @@ (fail "Could not parse a complex declaration.") )) -(def: (parse_any tokens) +(def: (any_parser tokens) (-> (List Code) (Meta [Code (List Code)])) (case tokens (^ (list& token tokens')) @@ -5610,7 +5613,7 @@ (fail "Could not parse anything.") )) -(def: (parse_many tokens) +(def: (many_parser tokens) (-> (List Code) (Meta [(List Code) (List Code)])) (case tokens (^ (list& head tail)) @@ -5620,7 +5623,7 @@ (fail "Could not parse anything.") )) -(def: (parse_end tokens) +(def: (end_parser tokens) (-> (List Code) (Meta Any)) (case tokens (^ (list)) @@ -5630,7 +5633,7 @@ (fail "Expected input Codes to be empty.") )) -(def: (parse_anns tokens) +(def: (anns_parser tokens) (-> (List Code) (Meta [Code (List Code)])) (case tokens (^ (list& [_ (#Record _anns)] tokens')) @@ -5647,13 +5650,13 @@ (* x x)))} (do meta_monad [#let [[export? tokens] (export^ tokens)] - name+args|tokens (parse_complex_declaration tokens) + name+args|tokens (complex_declaration_parser tokens) #let [[[name args] tokens] name+args|tokens] - anns|tokens (parse_anns tokens) + anns|tokens (anns_parser tokens) #let [[anns tokens] anns|tokens] - input_templates|tokens (parse_many tokens) + input_templates|tokens (many_parser tokens) #let [[input_templates tokens] input_templates|tokens] - _ (parse_end tokens) + _ (end_parser tokens) g!tokens (gensym "tokens") g!compiler (gensym "compiler") g!_ (gensym "_") @@ -5706,7 +5709,7 @@ [identifier (..resolve_global_identifier identifier) type+value (..find_def_value identifier) #let [[type value] type+value]] - (case (..flatten_alias type) + (case (..flat_alias type) (^or (#Primitive "#Text" #Nil) (#Named ["library/lux" "Text"] (#Primitive "#Text" #Nil))) (wrap (:as ..Text value)) diff --git a/stdlib/source/library/lux/abstract/functor/contravariant.lux b/stdlib/source/library/lux/abstract/functor/contravariant.lux index db66f1265..f7df0a73d 100644 --- a/stdlib/source/library/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/library/lux/abstract/functor/contravariant.lux @@ -3,6 +3,8 @@ [lux #*]]) (interface: #export (Functor f) + {#.doc (doc "The contravariant functor.")} + (: (All [a b] (-> (-> b a) (-> (f a) (f b)))) diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index a99baf75b..ef7138593 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -148,7 +148,7 @@ (!\map (|>> (#.Cons _x)) (recur xs')))) !\join))))) -(def: #export (filter monad f) +(def: #export (only monad f) {#.doc "Filter the values in a list with a monadic function."} (All [! a b] (-> (Monad !) (-> a (! Bit)) (List a) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index 2143a0c97..3ab6c0f05 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -115,7 +115,7 @@ (~ type) (|>> (~+ commands))))))) -(syntax: #export (apply {arity (|> .nat (<>.filter (n.> 0)))}) +(syntax: #export (apply {arity (|> .nat (<>.only (n.> 0)))}) (with_gensyms [g! g!func g!stack g!output] (monad.do {! meta.monad} [g!inputs (|> (macro.gensym "input") (list.repeat arity) (monad.seq !))] diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index 78ed99765..355a7885e 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -1,6 +1,7 @@ (.module: {#.doc "The actor model of concurrency."} [library [lux #* + ["." debug] [abstract monad] [control @@ -29,7 +30,7 @@ ["n" nat]]] ["." meta (#+ monad) ["." annotation]] - [type (#+ :share) + [type (#+ :sharing) ["." abstract (#+ abstract: :representation :abstraction)]]]] [// ["." atom (#+ Atom atom)] @@ -67,28 +68,32 @@ (Resolver )] #mailbox (Atom )} + {#.doc (doc "An entity that can react to messages (mail) sent to it concurrently.")} + (type: #export (Mail s) + {#.doc (doc "A one-way message sent to an actor, without expecting a reply.")} ) (type: #export (Obituary s) + {#.doc (doc "Details on the death of an actor.")} ) (type: #export (Behavior o s) - {#.doc "An actor's behavior when mail is received and when a fatal error occurs."} + {#.doc (doc "An actor's behavior when mail is received and when a fatal error occurs.")} {#on_init (-> o s) #on_mail (-> (Mail s) s (Actor s) (Promise (Try s)))}) (def: #export (spawn! behavior init) - {#.doc "Given a behavior and initial state, spawns an actor and returns it."} + {#.doc (doc "Given a behavior and initial state, spawns an actor and returns it.")} (All [o s] (-> (Behavior o s) o (IO (Actor s)))) (io (let [[on_init on_mail] behavior - self (:share [o s] - (Behavior o s) - behavior - - (Actor s) - (:abstraction {#obituary (promise.promise []) - #mailbox (atom (promise.promise []))})) + self (:sharing [o s] + (Behavior o s) + behavior + + (Actor s) + (:abstraction {#obituary (promise.promise []) + #mailbox (atom (promise.promise []))})) process (loop [state (on_init init) [|mailbox| _] (io.run (atom.read (get@ #mailbox (:representation self))))] (do {! promise.monad} @@ -125,13 +130,14 @@ (promise.poll obituary))) (def: #export await + {#.doc (doc "Await for an actor to end working.")} (All [s] (-> (Actor s) (Promise (Obituary s)))) (|>> :representation (get@ #obituary) product.left)) (def: #export (mail! mail actor) - {#.doc "Send mail to an actor.."} + {#.doc (doc "Send mail to an actor.")} (All [s] (-> (Mail s) (Actor s) (IO (Try Any)))) (do {! io.monad} [alive? (..alive? actor)] @@ -157,17 +163,18 @@ (wrap (exception.throw ..dead []))))) (type: #export (Message s o) + {#.doc (doc "A two-way message sent to an actor, expecting a reply.")} (-> s (Actor s) (Promise (Try [s o])))) (def: (mail message) (All [s o] (-> (Message s o) [(Promise (Try o)) (Mail s)])) - (let [[promise resolve] (:share [s o] - (Message s o) - message - - [(Promise (Try o)) - (Resolver (Try o))] - (promise.promise []))] + (let [[promise resolve] (:sharing [s o] + (Message s o) + message + + [(Promise (Try o)) + (Resolver (Try o))] + (promise.promise []))] [promise (function (_ state self) (do {! promise.monad} @@ -182,7 +189,7 @@ (promise.resolved (#try.Failure error))))))])) (def: #export (tell! message actor) - {#.doc "Communicate with an actor through message passing."} + {#.doc (doc "Communicate with an actor through message-passing.")} (All [s o] (-> (Message s o) (Actor s) (Promise (Try o)))) (let [[promise mail] (..mail message)] (do promise.monad @@ -201,6 +208,7 @@ (mail state self)) (def: #export default + {#.doc (doc "Default actor behavior.")} (All [s] (Behavior s s)) {#on_init function.identity #on_mail ..default_on_mail}) @@ -254,23 +262,26 @@ ((on_mail mail state self) (do (try.with promise.monad) - [#let [_ (log! "BEFORE")] + [#let [_ (debug.log! "BEFORE")] output (mail state self) - #let [_ (log! "AFTER")]] + #let [_ (debug.log! "AFTER")]] (wrap output))) - (message: #export (push {value a} state self (List a)) + (message: #export (push {value a} state self) + (List a) (let [state' (#.Cons value state)] (promise.resolved (#try.Success [state' state']))))) (actor: #export Counter Nat - (message: #export (count! {increment Nat} state self Any) + (message: #export (count! {increment Nat} state self) + Any (let [state' (n.+ increment state)] (promise.resolved (#try.Success [state' state'])))) - (message: #export (read! state self Nat) + (message: #export (read! state self) + Nat (promise.resolved (#try.Success [state state])))))] (syntax: #export (actor: {export |export|.parser} @@ -278,7 +289,7 @@ {annotations (<>.default |annotations|.empty |annotations|.parser)} state_type {[?on_mail messages] behavior^}) - {#.doc (doc "Defines an actor, with its behavior and internal state." + {#.doc (doc "Defines a named actor, with its behavior and internal state." "Messages for the actor must be defined after the on_mail handler." )} (with_gensyms [g!_] @@ -299,6 +310,12 @@ (syntax: #export (actor {[state_type init] (.record (<>.and .any .any))} {[?on_mail messages] behavior^}) + {#.doc (doc "Defines an anonymous actor, with its behavior and internal state." + "Messages for the actor must be defined after the on_mail handler." + (actor {Nat + 123} + ((on_mail message state self) + (message (inc state) self))))} (with_gensyms [g!_] (wrap (list (` (: ((~! io.IO) (..Actor (~ state_type))) (..spawn! (: (..Behavior (~ state_type) (~ state_type)) @@ -312,8 +329,7 @@ #name Text #inputs (List |input|.Input) #state Text - #self Text - #output Code}) + #self Text}) (def: signature^ (Parser Signature) @@ -322,8 +338,7 @@ .local_identifier (<>.some |input|.parser) .local_identifier - .local_identifier - .any))) + .local_identifier))) (def: reference^ (Parser [Name (List Text)]) @@ -334,6 +349,7 @@ {export |export|.parser} {signature signature^} {annotations (<>.default |annotations|.empty |annotations|.parser)} + output_type body) {#.doc (doc "A message can access the actor's state through the state parameter." "A message can also access the actor itself through the self parameter." @@ -357,24 +373,28 @@ (All [(~+ g!all_vars)] (-> (~+ g!inputsT) (..Message (~ (get@ #abstract.abstraction actor_scope)) - (~ (get@ #output signature))))) + (~ output_type)))) (function ((~ g!_) (~ g!state) (~ g!self)) (let [(~ g!state) (:as (~ (get@ #abstract.representation actor_scope)) (~ g!state))] (|> (~ body) (: ((~! promise.Promise) ((~! try.Try) [(~ (get@ #abstract.representation actor_scope)) - (~ (get@ #output signature))]))) + (~ output_type)]))) (:as ((~! promise.Promise) ((~! try.Try) [(~ (get@ #abstract.abstraction actor_scope)) - (~ (get@ #output signature))])))))))) + (~ output_type)])))))))) )))))) (type: #export Stop + {#.doc (doc "A signal to stop an actor from observing a channel.")} (IO Any)) (def: continue! true) (def: stop! false) (def: #export (observe action channel actor) + {#.doc (doc "Use an actor to observe a channel by transforming each datum" + "flowing through the channel into mail the actor can process." + "Can stop observing the channel by executing the Stop value.")} (All [e s] (-> (-> e Stop (Mail s)) (Channel e) (Actor s) (IO Any))) (let [signal (: (Atom Bit) (atom.atom ..continue!)) @@ -384,8 +404,8 @@ (do {! io.monad} [continue? (atom.read signal)] (if continue? - (do ! - [outcome (..mail! (action event stop) actor)] - (wrap (try.to_maybe outcome))) + (|> actor + (..mail! (action event stop)) + (\ ! map try.maybe)) (wrap #.None)))) channel))) diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux index 057bfd5b2..ba1d2af55 100644 --- a/stdlib/source/library/lux/control/concurrency/atom.lux +++ b/stdlib/source/library/lux/control/concurrency/atom.lux @@ -97,6 +97,8 @@ (recur []))))) (def: #export (write value atom) + {#.doc (doc "Writes the given value to an atom." + "If it fails to write it (because some other process wrote to it first), it will retry until it succeeds.")} (All [a] (-> a (Atom a) (IO a))) (|> atom (..update (function.constant value)) diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux index 416b8c7c4..f69a88369 100644 --- a/stdlib/source/library/lux/control/concurrency/frp.lux +++ b/stdlib/source/library/lux/control/concurrency/frp.lux @@ -2,7 +2,6 @@ [library [lux #* [abstract - [predicate (#+ Predicate)] [equivalence (#+ Equivalence)] [functor (#+ Functor)] [apply (#+ Apply)] @@ -13,7 +12,7 @@ ["." io (#+ IO io)]] [data ["." maybe ("#\." functor)]] - [type (#+ :share) + [type (#+ :sharing) abstract]]] [// ["." atom (#+ Atom)] @@ -26,6 +25,7 @@ (exception: #export channel_is_already_closed) (interface: #export (Sink a) + {#.doc (doc "The tail-end of a channel, which can be written-to to fee the channel.")} (: (IO (Try Any)) close) (: (-> a (IO (Try Any))) @@ -58,13 +58,13 @@ (loop [_ []] (do {! io.monad} [current (atom.read sink) - #let [[next resolve_next] (:share [a] - (promise.Resolver (Maybe [a (Channel a)])) - current - - [(Promise (Maybe [a (Channel a)])) - (promise.Resolver (Maybe [a (Channel a)]))] - (promise.promise []))] + #let [[next resolve_next] (:sharing [a] + (promise.Resolver (Maybe [a (Channel a)])) + current + + [(Promise (Maybe [a (Channel a)])) + (promise.Resolver (Maybe [a (Channel a)]))] + (promise.promise []))] fed? (current (#.Some [value next]))] (if fed? ## I fed the sink. @@ -81,6 +81,7 @@ (recur [])))))))))) (def: #export (channel _) + {#.doc (doc "Creates a brand-new channel and hands it over, along with the sink to write to it.")} (All [a] (-> Any [(Channel a) (Sink a)])) (let [[promise resolve] (promise.promise [])] [promise (..sink resolve)])) @@ -148,6 +149,7 @@ output)))) (type: #export (Subscriber a) + {#.doc (doc "A function that can receive every value fed into a channel.")} (-> a (IO (Maybe Any)))) (def: #export (subscribe subscriber channel) @@ -169,13 +171,15 @@ (wrap []))))) []))) -(def: #export (filter pass? channel) - (All [a] (-> (Predicate a) (Channel a) (Channel a))) +(def: #export (only pass? channel) + {#.doc (doc "Produces a new channel based on the old one, only with values" + "that pass the test.")} + (All [a] (-> (-> a Bit) (Channel a) (Channel a))) (do promise.monad [cons channel] (case cons (#.Some [head tail]) - (let [tail' (filter pass? tail)] + (let [tail' (only pass? tail)] (if (pass? head) (wrap (#.Some [head tail'])) tail')) @@ -183,7 +187,8 @@ #.None (wrap #.None)))) -(def: #export (from_promise promise) +(def: #export (of_promise promise) + {#.doc (doc "A one-element channel containing the output from a promise.")} (All [a] (-> (Promise a) (Channel a))) (promise\map (function (_ value) (#.Some [value ..empty])) @@ -206,7 +211,6 @@ (fold f init' tail))))) (def: #export (folds f init channel) - {#.doc "A channel of folds."} (All [a b] (-> (-> b a (Promise a)) a (Channel b) (Channel a))) @@ -272,7 +276,6 @@ (wrap #.None)))) (def: #export (consume channel) - {#.doc "Reads the entirety of a channel's content and returns it as a list."} (All [a] (-> (Channel a) (Promise (List a)))) (do {! promise.monad} [cons channel] @@ -285,6 +288,7 @@ (wrap #.Nil)))) (def: #export (sequential milli_seconds values) + {#.doc (doc "Transforms the given list into a channel with the same elements.")} (All [a] (-> Nat (List a) (Channel a))) (case values #.Nil diff --git a/stdlib/source/library/lux/control/concurrency/promise.lux b/stdlib/source/library/lux/control/concurrency/promise.lux index ad94bbff8..24618fa5a 100644 --- a/stdlib/source/library/lux/control/concurrency/promise.lux +++ b/stdlib/source/library/lux/control/concurrency/promise.lux @@ -11,7 +11,7 @@ ["." io (#+ IO io)]] [data ["." product]] - [type (#+ :share) + [type (#+ :sharing) abstract]]] [// ["." thread] @@ -23,10 +23,12 @@ {#.doc "Represents values produced by asynchronous computations (unlike IO, which is synchronous)."} (type: #export (Resolver a) + {#.doc (doc "The function used to give a value to a promise." + "Will signal 'true' if the promise has been resolved for the 1st time, 'false' otherwise.")} (-> a (IO Bit))) (def: (resolver promise) - {#.doc "Sets an promise's value if it has not been done yet."} + {#.doc "Sets a promise's value if it has not been done yet."} (All [a] (-> (Promise a) (Resolver a))) (function (resolve value) (let [promise (:representation promise)] @@ -48,22 +50,25 @@ (resolve value)))))))) (def: #export (resolved value) + {#.doc (doc "Produces a promise that has already been resolved to the given value.")} (All [a] (-> a (Promise a))) (:abstraction (atom [(#.Some value) (list)]))) (def: #export (promise _) + {#.doc (doc "Creates a fresh promise that has not been resolved yet.")} (All [a] (-> Any [(Promise a) (Resolver a)])) (let [promise (:abstraction (atom [#.None (list)]))] [promise (..resolver promise)])) (def: #export poll - {#.doc "Polls a promise's value."} + {#.doc "Polls a promise for its value."} (All [a] (-> (Promise a) (IO (Maybe a)))) (|>> :representation atom.read (\ io.functor map product.left))) (def: #export (await f promise) + {#.doc (doc "Executes the given function as soon as the promise has been resolved.")} (All [a] (-> (-> a (IO Any)) (Promise a) (IO Any))) (do {! io.monad} [#let [promise (:representation promise)] @@ -125,15 +130,15 @@ ma)))) (def: #export (and left right) - {#.doc "Sequencing combinator."} + {#.doc (doc "Combines the results of both promises, in-order.")} (All [a b] (-> (Promise a) (Promise b) (Promise [a b]))) - (let [[read! write!] (:share [a b] - [(Promise a) (Promise b)] - [left right] + (let [[read! write!] (:sharing [a b] + [(Promise a) (Promise b)] + [left right] - [(Promise [a b]) - (Resolver [a b])] - (..promise [])) + [(Promise [a b]) + (Resolver [a b])] + (..promise [])) _ (io.run (..await (function (_ left) (..await (function (_ right) (write! [left right])) @@ -142,7 +147,8 @@ read!)) (def: #export (or left right) - {#.doc "Heterogeneous alternative combinator."} + {#.doc (doc "Yields the results of whichever promise gets resolved first." + "You can tell which one was resolved first through pattern-matching.")} (All [a b] (-> (Promise a) (Promise b) (Promise (| a b)))) (let [[a|b resolve] (..promise [])] (with_expansions @@ -156,7 +162,8 @@ a|b)))) (def: #export (either left right) - {#.doc "Homogeneous alternative combinator."} + {#.doc (doc "Yields the results of whichever promise gets resolved first." + "You cannot tell which one was resolved first.")} (All [a] (-> (Promise a) (Promise a) (Promise a))) (let [[left||right resolve] (..promise [])] (`` (exec (~~ (template [] @@ -168,7 +175,7 @@ (def: #export (schedule millis_delay computation) {#.doc (doc "Runs an I/O computation on its own thread (after a specified delay)." - "Returns a Promise that will eventually host its result.")} + "Returns a aromise that will eventually host its result.")} (All [a] (-> Nat (IO a) (Promise a))) (let [[!out resolve] (..promise [])] (exec (|> (do io.monad @@ -180,7 +187,7 @@ (def: #export future {#.doc (doc "Runs an I/O computation on its own thread." - "Returns a Promise that will eventually host its result.")} + "Returns a promise that will eventually host its result.")} (All [a] (-> (IO a) (Promise a))) (..schedule 0)) diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux index 597e96306..821250fb3 100644 --- a/stdlib/source/library/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux @@ -46,6 +46,8 @@ #waiting_list queue.empty})))) (def: #export (wait semaphore) + {#.doc (doc "Wait on a semaphore until there are open positions." + "After finishing your work, you must 'signal' to the semaphore that you're done.")} (Ex [k] (-> Semaphore (Promise Any))) (let [semaphore (:representation semaphore) [signal sink] (: [(Promise Any) (Resolver Any)] @@ -70,6 +72,7 @@ ["Max Positions" (%.nat max_positions)])) (def: #export (signal semaphore) + {#.doc (doc "Signal to a semaphore that you're done with your work, and that there is a new open position.")} (Ex [k] (-> Semaphore (Promise (Try Int)))) (let [semaphore (:representation semaphore)] (promise.future @@ -100,6 +103,7 @@ {#.doc "A mutual-exclusion lock that can only be acquired by one process at a time."} (def: #export (mutex _) + {#.doc (doc "Creates a brand-new mutex.")} (-> Any Mutex) (:abstraction (semaphore 1))) @@ -112,6 +116,7 @@ (|>> :representation ..signal)) (def: #export (synchronize mutex procedure) + {#.doc (doc "Runs the procedure with exclusive control of the mutex.")} (All [a] (-> Mutex (IO (Promise a)) (Promise a))) (do promise.monad [_ (..acquire mutex) @@ -121,9 +126,11 @@ ) (def: #export limit + {#.doc (doc "Produce a limit for a barrier.")} (refinement.refinement (n.> 0))) (type: #export Limit + {#.doc (doc "A limit for barriers.")} (:~ (refinement.type limit))) (abstract: #export Barrier @@ -167,6 +174,7 @@ ) (def: #export (block barrier) + {#.doc (doc "Wait on a barrier until all processes have arrived and met the barrier's limit.")} (-> Barrier (Promise Any)) (do promise.monad [_ (..start barrier)] diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index 081d2f3d9..833dff059 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -41,7 +41,7 @@ (All [a] (-> (Sink a) (Var a) (IO Any))) (do io.monad [_ (atom.update (function (_ [value observers]) - [value (list.filter (|>> (is? sink) not) observers)]) + [value (list.only (|>> (is? sink) not) observers)]) (:representation var))] (wrap []))) @@ -131,7 +131,6 @@ (update_tx_value var value tx'))))) (def: #export (write value var) - {#.doc "Writes value to var."} (All [a] (-> a (Var a) (STM Any))) (function (_ tx) (case (find_var_value var tx) @@ -177,7 +176,7 @@ (ma tx'))))) (def: #export (update f var) - {#.doc "Will update a Var's value, and return a tuple with the old and the new values."} + {#.doc "Update a var's value, and return a tuple with the old and the new values."} (All [a] (-> (-> a a) (Var a) (STM [a a]))) (do ..monad [a (..read var) diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux index 9c9bf6549..3d288f8a6 100644 --- a/stdlib/source/library/lux/control/concurrency/thread.lux +++ b/stdlib/source/library/lux/control/concurrency/thread.lux @@ -65,6 +65,7 @@ )) (def: #export parallelism + {#.doc (doc "How many processes can run in parallel.")} Nat (with_expansions [ (|> (java/lang/Runtime::getRuntime) (java/lang/Runtime::availableProcessors) @@ -101,6 +102,7 @@ [])) (def: #export (schedule milli_seconds action) + {#.doc (doc "Executes an I/O procedure after some milli-seconds.")} (-> Nat (IO Any) (IO Any)) (with_expansions [ (as_is (let [runnable (ffi.object [] [java/lang/Runnable] [] @@ -141,8 +143,10 @@ ## Default (as_is (exception: #export cannot_continue_running_threads) - + + ## https://en.wikipedia.org/wiki/Event_loop (def: #export run! + {#.doc (doc "Starts the event-loop.")} (IO Any) (loop [_ []] (do {! io.monad} diff --git a/stdlib/source/library/lux/control/function/contract.lux b/stdlib/source/library/lux/control/function/contract.lux index 149053230..414445ac1 100644 --- a/stdlib/source/library/lux/control/function/contract.lux +++ b/stdlib/source/library/lux/control/function/contract.lux @@ -34,8 +34,9 @@ "Otherwise, an error is raised." (pre (i.= +4 (i.+ +2 +2)) (foo +123 +456 +789)))} - (wrap (list (` (exec ((~! ..assert!) (~ (code.text (exception.construct ..pre_condition_failed test))) - (~ test)) + (wrap (list (` (exec + ((~! ..assert!) (~ (code.text (exception.construct ..pre_condition_failed test))) + (~ test)) (~ expr)))))) (syntax: #export (post test expr) @@ -47,6 +48,7 @@ (i.+ +2 +2)))} (with_gensyms [g!output] (wrap (list (` (let [(~ g!output) (~ expr)] - (exec ((~! ..assert!) (~ (code.text (exception.construct ..post_condition_failed test))) - ((~ test) (~ g!output))) + (exec + ((~! ..assert!) (~ (code.text (exception.construct ..post_condition_failed test))) + ((~ test) (~ g!output))) (~ g!output)))))))) diff --git a/stdlib/source/library/lux/control/function/memo.lux b/stdlib/source/library/lux/control/function/memo.lux index 4c50a0695..e2b734cae 100644 --- a/stdlib/source/library/lux/control/function/memo.lux +++ b/stdlib/source/library/lux/control/function/memo.lux @@ -41,7 +41,7 @@ (All [i o] (:let [Memory (Dictionary i o)] (-> (Memo i o) (-> [Memory i] [Memory o])))) - (let [memo (//.mixin (//.inherit ..memoization (//.from_recursive memo)))] + (let [memo (//.mixin (//.inherit ..memoization (//.of_recursive memo)))] (function (_ [memory input]) (|> input memo (state.run memory))))) @@ -50,7 +50,7 @@ "Memoized results will be re-used during recursive invocations, but cannot be accessed after the main invocation has ended.")} (All [i o] (-> (Hash i) (Memo i o) (-> i o))) - (let [memo (//.mixin (//.inherit ..memoization (//.from_recursive memo))) + (let [memo (//.mixin (//.inherit ..memoization (//.of_recursive memo))) empty (dictionary.new hash)] (|>> memo (state.run empty) product.right))) @@ -59,6 +59,6 @@ "This is useful as a test control when measuring the effect of using memoization.")} (All [i o] (-> (Hash i) (Memo i o) (-> i o))) - (let [memo (//.mixin (//.from_recursive memo)) + (let [memo (//.mixin (//.of_recursive memo)) empty (dictionary.new hash)] (|>> memo (state.run empty) product.right))) diff --git a/stdlib/source/library/lux/control/function/mixin.lux b/stdlib/source/library/lux/control/function/mixin.lux index 8c3443339..8248b2055 100644 --- a/stdlib/source/library/lux/control/function/mixin.lux +++ b/stdlib/source/library/lux/control/function/mixin.lux @@ -10,19 +10,23 @@ [monad (#+ Monad do)]]]]) (type: #export (Mixin i o) + {#.doc (doc "A function which can be mixed with others to inherit their behavior.")} (-> (-> i o) (-> i o) (-> i o))) (def: #export (mixin f) + {#.doc (doc "Given a mixin, produces a normal function.")} (All [i o] (-> (Mixin i o) (-> i o))) (function (mix input) ((f mix mix) input))) (def: #export nothing + {#.doc (doc "A mixin that does nothing and just delegates work to the next mixin.")} Mixin (function (_ delegate recur) delegate)) (def: #export (inherit parent child) + {#.doc (doc "Produces a new mixin, where the behavior of the child can make use of the behavior of the parent.")} (All [i o] (-> (Mixin i o) (Mixin i o) (Mixin i o))) (function (_ delegate recur) (parent (child delegate recur) recur))) @@ -34,6 +38,7 @@ (def: compose ..inherit)) (def: #export (advice when then) + {#.doc (doc "Only apply then mixin when the input meets some criterion.")} (All [i o] (-> (Predicate i) (Mixin i o) (Mixin i o))) (function (_ delegate recur input) (if (when input) @@ -41,6 +46,7 @@ (delegate input)))) (def: #export (before monad action) + {#.doc (doc "Executes an action before doing the main work.")} (All [! i o] (-> (Monad !) (-> i (! Any)) (Mixin i (! o)))) (function (_ delegate recur input) (do monad @@ -48,6 +54,7 @@ (delegate input)))) (def: #export (after monad action) + {#.doc (doc "Executes an action after doing the main work.")} (All [! i o] (-> (Monad !) (-> i o (! Any)) (Mixin i (! o)))) (function (_ delegate recur input) (do monad @@ -56,9 +63,11 @@ (wrap output)))) (type: #export (Recursive i o) + {#.doc (doc "An indirectly recursive function.")} (-> (-> i o) (-> i o))) -(def: #export (from_recursive recursive) +(def: #export (of_recursive recursive) + {#.doc (doc "Transform an indirectly recursive function into a mixin.")} (All [i o] (-> (Recursive i o) (Mixin i o))) (function (_ delegate recur) (recursive recur))) diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux index dcc4791e1..4ceaaa61f 100644 --- a/stdlib/source/library/lux/control/function/mutual.lux +++ b/stdlib/source/library/lux/control/function/mutual.lux @@ -1,4 +1,5 @@ (.module: + {#.doc (.doc "Macros for implementing mutually-recursive functions.")} [library [lux (#- Definition let def:) ["." meta] @@ -54,6 +55,20 @@ (syntax: #export (let {functions (.tuple (<>.some ..mutual))} body) + {#.doc (doc "Locally-defined mutually-recursive functions." + (let [(even? number) + (-> Nat Bit) + (case number + 0 true + _ (odd? (dec number))) + + (odd? number) + (-> Nat Bit) + (case number + 0 false + _ (even? (dec number)))] + (and (even? 4) + (odd? 5))))} (case functions #.Nil (wrap (list body)) @@ -105,6 +120,19 @@ ..mutual))) (syntax: #export (def: {functions (<>.many ..definition)}) + {#.doc (doc "Globally-defined mutually-recursive functions." + (def: + [#export (even? number) + (-> Nat Bit) + (case number + 0 true + _ (odd? (dec number)))] + + [#export (odd? number) + (-> Nat Bit) + (case number + 0 false + _ (even? (dec number)))]))} (case functions #.Nil (wrap (list)) diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux index fad957e27..3dc90e1d2 100644 --- a/stdlib/source/library/lux/control/parser.lux +++ b/stdlib/source/library/lux/control/parser.lux @@ -271,7 +271,7 @@ _ param] (wrap output))) -(def: #export (filter test parser) +(def: #export (only test parser) (All [s a] (-> (-> a Bit) (Parser s a) (Parser s a))) (do ..monad [output parser diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux index af28caeae..ec06bec54 100644 --- a/stdlib/source/library/lux/control/parser/binary.lux +++ b/stdlib/source/library/lux/control/parser/binary.lux @@ -1,7 +1,7 @@ (.module: [library [lux (#- and or nat int rev list type) - [type (#+ :share)] + [type (#+ :sharing)] [abstract [hash (#+ Hash)] [monad (#+ do)]] @@ -97,7 +97,7 @@ (def: #export frac (Parser Frac) - (//\map frac.from_bits ..bits/64)) + (//\map frac.of_bits ..bits/64)) (exception: #export (invalid_tag {range Nat} {byte Nat}) (exception.report @@ -111,8 +111,8 @@ (`` (case flag (^template [ ] [ (\ ! map (|>> ) )]) - ((~~ (template.splice +))) - _ (//.lift (exception.throw ..invalid_tag [(~~ (template.count +)) flag])))))) + ((~~ (template.spliced +))) + _ (//.lift (exception.throw ..invalid_tag [(~~ (template.amount +)) flag])))))) (def: #export (or left right) (All [l r] (-> (Parser l) (Parser r) (Parser (| l r)))) @@ -185,16 +185,16 @@ [(def: #export ( valueP) (All [v] (-> (Parser v) (Parser (Row v)))) (do //.monad - [count (: (Parser Nat) - )] + [amount (: (Parser Nat) + )] (loop [index 0 - output (:share [v] - (Parser v) - valueP - - (Row v) - row.empty)] - (if (n.< count index) + output (:sharing [v] + (Parser v) + valueP + + (Row v) + row.empty)] + (if (n.< amount index) (do //.monad [value valueP] (recur (.inc index) @@ -223,7 +223,7 @@ (All [a] (-> (Hash a) (Parser a) (Parser (Set a)))) (do //.monad [raw (..list value) - #let [output (set.from_list hash raw)] + #let [output (set.of_list hash raw)] _ (//.assert (exception.construct ..set_elements_are_not_unique []) (n.= (list.size raw) (set.size output)))] diff --git a/stdlib/source/library/lux/control/parser/cli.lux b/stdlib/source/library/lux/control/parser/cli.lux index 34b061afc..7cacdd086 100644 --- a/stdlib/source/library/lux/control/parser/cli.lux +++ b/stdlib/source/library/lux/control/parser/cli.lux @@ -56,7 +56,7 @@ [[remaining raw] (any inputs)] (if (text\= reference raw) (wrap [remaining []]) - (try.fail (format "Missing token: '" reference "'")))))) + (#try.Failure (format "Missing token: '" reference "'")))))) (def: #export (somewhere cli) {#.doc "Given a parser, tries to parse it somewhere in the inputs (i.e. not necessarily parsing the immediate inputs)."} diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux index 12fb90dd3..0c53041b9 100644 --- a/stdlib/source/library/lux/control/parser/json.lux +++ b/stdlib/source/library/lux/control/parser/json.lux @@ -204,4 +204,4 @@ (|>> (//.and ..string) //.some ..object - (//\map (dictionary.from_list text.hash)))) + (//\map (dictionary.of_list text.hash)))) diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux index cfd1ab891..6d4998419 100644 --- a/stdlib/source/library/lux/control/parser/text.lux +++ b/stdlib/source/library/lux/control/parser/text.lux @@ -82,7 +82,7 @@ (function (_ [offset tape]) (case (/.nth offset tape) (#.Some output) - (#try.Success [[("lux i64 +" 1 offset) tape] (/.from_code output)]) + (#try.Success [[("lux i64 +" 1 offset) tape] (/.of_code output)]) _ (exception.throw ..cannot_parse [])))) @@ -148,7 +148,7 @@ (function (_ (^@ input [offset tape])) (case (/.nth offset tape) (#.Some output) - (#try.Success [input (/.from_code output)]) + (#try.Success [input (/.of_code output)]) _ (exception.throw ..cannot_parse [])))) @@ -165,7 +165,7 @@ (do //.monad [char any #let [char' (maybe.assume (/.nth 0 char))] - _ (//.assert ($_ /\compose "Character is not within range: " (/.from_code bottom) "-" (/.from_code top)) + _ (//.assert ($_ /\compose "Character is not within range: " (/.of_code bottom) "-" (/.of_code top)) (.and (n.>= bottom char') (n.<= top char')))] (wrap char))) @@ -204,7 +204,7 @@ [(exception: #export ( {options Text} {character Char}) (exception.report ["Options" (/.format options)] - ["Character" (/.format (/.from_code character))]))] + ["Character" (/.format (/.of_code character))]))] [character_should_be] [character_should_not_be] @@ -217,7 +217,7 @@ (function (_ [offset tape]) (case (/.nth offset tape) (#.Some output) - (let [output' (/.from_code output)] + (let [output' (/.of_code output)] (if ( (/.contains? output' options)) (#try.Success [[("lux i64 +" 1 offset) tape] output']) (exception.throw [options output]))) @@ -236,7 +236,7 @@ (function (_ [offset tape]) (case (/.nth offset tape) (#.Some output) - (let [output' (/.from_code output)] + (let [output' (/.of_code output)] (if ( (/.contains? output' options)) (#try.Success [[("lux i64 +" 1 offset) tape] {#basis offset @@ -252,7 +252,7 @@ (exception: #export (character_does_not_satisfy_predicate {character Char}) (exception.report - ["Character" (/.format (/.from_code character))])) + ["Character" (/.format (/.of_code character))])) (def: #export (satisfies p) {#.doc "Only lex characters that satisfy a predicate."} @@ -261,7 +261,7 @@ (case (/.nth offset tape) (#.Some output) (if (p output) - (#try.Success [[("lux i64 +" 1 offset) tape] (/.from_code output)]) + (#try.Success [[("lux i64 +" 1 offset) tape] (/.of_code output)]) (exception.throw ..character_does_not_satisfy_predicate [output])) _ diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux index 1e2c037d5..73a4a9e4e 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -153,20 +153,20 @@ (All [a] (-> (Parser a) (Parser a))) (do //.monad [headT ..any] - (let [members ( (type.un_name headT))] + (let [members ( (type.anonymous headT))] (if (n.> 1 (list.size members)) (local members poly) (//.fail (exception.construct headT))))))] - [variant type.flatten_variant #.Sum ..not_variant] - [tuple type.flatten_tuple #.Product ..not_tuple] + [variant type.flat_variant #.Sum ..not_variant] + [tuple type.flat_tuple #.Product ..not_tuple] ) (def: polymorphic' (Parser [Nat Type]) (do //.monad [headT any - #let [[num_arg bodyT] (type.flatten_univ_q (type.un_name headT))]] + #let [[num_arg bodyT] (type.flat_univ_q (type.anonymous headT))]] (if (n.= 0 num_arg) (//.fail (exception.construct ..not_polymorphic headT)) (wrap [num_arg bodyT])))) @@ -212,17 +212,17 @@ (All [i o] (-> (Parser i) (Parser o) (Parser [i o]))) (do //.monad [headT any - #let [[inputsT outputT] (type.flatten_function (type.un_name headT))]] + #let [[inputsT outputT] (type.flat_function (type.anonymous headT))]] (if (n.> 0 (list.size inputsT)) (//.and (local inputsT in_poly) (local (list outputT) out_poly)) (//.fail (exception.construct ..not_function headT))))) -(def: #export (apply poly) +(def: #export (applied poly) (All [a] (-> (Parser a) (Parser a))) (do //.monad [headT any - #let [[funcT paramsT] (type.flatten_application (type.un_name headT))]] + #let [[funcT paramsT] (type.flat_application (type.anonymous headT))]] (if (n.= 0 (list.size paramsT)) (//.fail (exception.construct ..not_application headT)) (..local (#.Cons funcT paramsT) poly)))) @@ -310,7 +310,7 @@ (All [a] (-> (Parser a) (Parser [Code a]))) (do {! //.monad} [headT any] - (case (type.un_name headT) + (case (type.anonymous headT) (^ (#.Apply (|nothing|) (#.UnivQ _ headT'))) (do ! [[recT _ output] (|> poly @@ -327,10 +327,10 @@ (do //.monad [env ..env headT any] - (case (type.un_name headT) + (case (type.anonymous headT) (^multi (^ (#.Apply (|nothing|) (#.Parameter funcT_idx))) (n.= 0 (adjusted_idx env funcT_idx)) - [(dictionary.get 0 env) (#.Some [self_type self_call])]) + {(dictionary.get 0 env) (#.Some [self_type self_call])}) (wrap self_call) _ @@ -340,7 +340,7 @@ (Parser Code) (do {! //.monad} [env ..env - [funcT argsT] (..apply (//.and any (//.many any))) + [funcT argsT] (..applied (//.and any (//.many any))) _ (local (list funcT) (..parameter! 0)) allC (let [allT (list& funcT argsT)] (|> allT diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux index 86f9cb7a1..f004f109e 100644 --- a/stdlib/source/library/lux/control/remember.lux +++ b/stdlib/source/library/lux/control/remember.lux @@ -35,7 +35,7 @@ (def: deadline (Parser Date) ($_ <>.either - (<>\map (|>> instant.from_millis instant.date) + (<>\map (|>> instant.of_millis instant.date) .int) (do <>.monad [raw .text] diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux index 013553b04..77adf79f0 100644 --- a/stdlib/source/library/lux/control/try.lux +++ b/stdlib/source/library/lux/control/try.lux @@ -40,8 +40,7 @@ (#Failure msg)) (#Failure msg) - (#Failure msg)) - )) + (#Failure msg)))) (implementation: #export monad (Monad Try) @@ -77,7 +76,7 @@ (#Success Mea) Mea)))) -(def: #export (lift monad) +(def: #export (lifted monad) (All [M a] (-> (Monad M) (-> (M a) (M (Try a))))) (\ monad map (\ ..monad wrap))) @@ -96,15 +95,7 @@ false ))) -(def: #export (succeed value) - (All [a] (-> a (Try a))) - (#Success value)) - -(def: #export (fail message) - (-> Text Try) - (#Failure message)) - -(def: #export (assume try) +(def: #export (assumed try) (All [a] (-> (Try a) a)) (case try (#Success value) @@ -113,7 +104,7 @@ (#Failure message) (error! message))) -(def: #export (to_maybe try) +(def: #export (maybe try) (All [a] (-> (Try a) (Maybe a))) (case try (#Success value) @@ -122,7 +113,7 @@ (#Failure message) #.None)) -(def: #export (from_maybe maybe) +(def: #export (of_maybe maybe) (All [a] (-> (Maybe a) (Try a))) (case maybe (#.Some value) @@ -130,7 +121,7 @@ #.None (#Failure (`` (("lux in-module" (~~ (static .prelude_module)) .name\encode) - (name_of ..from_maybe)))))) + (name_of ..of_maybe)))))) (macro: #export (default tokens compiler) {#.doc (doc "Allows you to provide a default value that will be used" diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index 66a3abb6e..ac34275aa 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -267,7 +267,7 @@ (new arr_size) (list.indices arr_size)))) -(def: #export (from_list xs) +(def: #export (of_list xs) (All [a] (-> (List a) (Array a))) (product.right (list\fold (function (_ x [idx arr]) [(inc idx) (write! idx x arr)]) diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index 6768d2155..5c740b072 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -627,7 +627,7 @@ (All [k v] (-> (Dictionary k v) (List [k v]))) (|>> product.right ..entries')) -(def: #export (from_list Hash kvs) +(def: #export (of_list Hash kvs) (All [k v] (-> (Hash k) (List [k v]) (Dictionary k v))) (list\fold (function (_ [k v] dict) (..put k v dict)) diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux index 5c8b82ebd..15d7f8077 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -158,7 +158,7 @@ #Red (case (get@ #left self) (^multi (#.Some left) - [(get@ #color left) #Red]) + {(get@ #color left) #Red}) (red (get@ #key self) (get@ #value self) (#.Some (blacken left)) @@ -170,7 +170,7 @@ _ (case (get@ #right self) (^multi (#.Some right) - [(get@ #color right) #Red]) + {(get@ #color right) #Red}) (red (get@ #key right) (get@ #value right) (#.Some (black (get@ #key self) @@ -200,7 +200,7 @@ #Red (case (get@ #right self) (^multi (#.Some right) - [(get@ #color right) #Red]) + {(get@ #color right) #Red}) (red (get@ #key self) (get@ #value self) (#.Some (black (get@ #key parent) @@ -212,7 +212,7 @@ _ (case (get@ #left self) (^multi (#.Some left) - [(get@ #color left) #Red]) + {(get@ #color left) #Red}) (red (get@ #key left) (get@ #value left) (#.Some (black (get@ #key parent) @@ -284,18 +284,18 @@ (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?left (^multi (#.Some left) - [(get@ #color left) #Red] - [(get@ #left left) (#.Some left>>left)] - [(get@ #color left>>left) #Red]) + {(get@ #color left) #Red} + {(get@ #left left) (#.Some left>>left)} + {(get@ #color left>>left) #Red}) (red (get@ #key left) (get@ #value left) (#.Some (blacken left>>left)) (#.Some (black key value (get@ #right left) ?right))) (^multi (#.Some left) - [(get@ #color left) #Red] - [(get@ #right left) (#.Some left>>right)] - [(get@ #color left>>right) #Red]) + {(get@ #color left) #Red} + {(get@ #right left) (#.Some left>>right)} + {(get@ #color left>>right) #Red}) (red (get@ #key left>>right) (get@ #value left>>right) (#.Some (black (get@ #key left) @@ -313,18 +313,18 @@ (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?right (^multi (#.Some right) - [(get@ #color right) #Red] - [(get@ #right right) (#.Some right>>right)] - [(get@ #color right>>right) #Red]) + {(get@ #color right) #Red} + {(get@ #right right) (#.Some right>>right)} + {(get@ #color right>>right) #Red}) (red (get@ #key right) (get@ #value right) (#.Some (black key value ?left (get@ #left right))) (#.Some (blacken right>>right))) (^multi (#.Some right) - [(get@ #color right) #Red] - [(get@ #left right) (#.Some right>>left)] - [(get@ #color right>>left) #Red]) + {(get@ #color right) #Red} + {(get@ #left right) (#.Some right>>left)} + {(get@ #color right>>left) #Red}) (red (get@ #key right>>left) (get@ #value right>>left) (#.Some (black key value ?left (get@ #left right>>left))) @@ -340,19 +340,19 @@ (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?left (^multi (#.Some left) - [(get@ #color left) #Red]) + {(get@ #color left) #Red}) (red key value (#.Some (blacken left)) ?right) _ (case ?right (^multi (#.Some right) - [(get@ #color right) #Black]) + {(get@ #color right) #Black}) (right_balance key value ?left (#.Some (redden right))) (^multi (#.Some right) - [(get@ #color right) #Red] - [(get@ #left right) (#.Some right>>left)] - [(get@ #color right>>left) #Black]) + {(get@ #color right) #Red} + {(get@ #left right) (#.Some right>>left)} + {(get@ #color right>>left) #Black}) (red (get@ #key right>>left) (get@ #value right>>left) (#.Some (black key value ?left (get@ #left right>>left))) @@ -369,19 +369,19 @@ (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?right (^multi (#.Some right) - [(get@ #color right) #Red]) + {(get@ #color right) #Red}) (red key value ?left (#.Some (blacken right))) _ (case ?left (^multi (#.Some left) - [(get@ #color left) #Black]) + {(get@ #color left) #Black}) (left_balance key value (#.Some (redden left)) ?right) (^multi (#.Some left) - [(get@ #color left) #Red] - [(get@ #right left) (#.Some left>>right)] - [(get@ #color left>>right) #Black]) + {(get@ #color left) #Red} + {(get@ #right left) (#.Some left>>right)} + {(get@ #color left>>right) #Black}) (red (get@ #key left>>right) (get@ #value left>>right) (#.Some (left_balance (get@ #key left) @@ -500,7 +500,7 @@ (if go_left? (case (get@ #left root) (^multi (#.Some left) - [(get@ #color left) #Black]) + {(get@ #color left) #Black}) [(#.Some (balance_left_remove root_key root_val side_outcome (get@ #right root))) #0] @@ -509,7 +509,7 @@ #0]) (case (get@ #right root) (^multi (#.Some right) - [(get@ #color right) #Black]) + {(get@ #color right) #Black}) [(#.Some (balance_right_remove root_key root_val (get@ #left root) side_outcome)) #0] @@ -538,7 +538,7 @@ #.None dict)) -(def: #export (from_list Order list) +(def: #export (of_list Order list) (All [k v] (-> (Order k) (List [k v]) (Dictionary k v))) (list\fold (function (_ [key value] dict) (put key value dict)) diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index 166b4c87b..7ef0d0e31 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -50,7 +50,7 @@ #.Nil xs)) -(def: #export (filter keep? xs) +(def: #export (only keep? xs) (All [a] (-> (Predicate a) (List a) (List a))) (case xs @@ -59,8 +59,8 @@ (#.Cons x xs') (if (keep? x) - (#.Cons x (filter keep? xs')) - (filter keep? xs')))) + (#.Cons x (only keep? xs')) + (only keep? xs')))) (def: #export (partition satisfies? list) {#.doc "Divide the list into all elements that satisfy a predicate, and all elements that do not."} diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux index cb4d9106f..e107fd98d 100644 --- a/stdlib/source/library/lux/data/collection/queue.lux +++ b/stdlib/source/library/lux/data/collection/queue.lux @@ -20,7 +20,7 @@ {#front (list) #rear (list)}) -(def: #export (from_list entries) +(def: #export (of_list entries) (All [a] (-> (List a) (Queue a))) {#front entries #rear (list)}) diff --git a/stdlib/source/library/lux/data/collection/queue/priority.lux b/stdlib/source/library/lux/data/collection/queue/priority.lux index d044a5023..0b25c11fe 100644 --- a/stdlib/source/library/lux/data/collection/queue/priority.lux +++ b/stdlib/source/library/lux/data/collection/queue/priority.lux @@ -42,8 +42,8 @@ (All [a] (-> (Queue a) (Maybe a))) (do maybe.monad [tree (:representation queue)] - (tree.search (n.= (tree.tag tree)) - tree))) + (tree.one (n.= (tree.tag tree)) + tree))) (def: #export (size queue) (All [a] (-> (Queue a) Nat)) diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux index 0bb304c35..69be85a21 100644 --- a/stdlib/source/library/lux/data/collection/row.lux +++ b/stdlib/source/library/lux/data/collection/row.lux @@ -344,7 +344,7 @@ (list\compose (to_list' (#Hierarchy (get@ #root row))) (to_list' (#Base (get@ #tail row))))) -(def: #export from_list +(def: #export of_list (All [a] (-> (List a) (Row a))) (list\fold ..add ..empty)) @@ -359,7 +359,7 @@ (syntax: #export (row {elems (p.some s.any)}) {#.doc (doc "Row literals." (row +10 +20 +30 +40))} - (wrap (list (` (..from_list (list (~+ elems))))))) + (wrap (list (` (..of_list (list (~+ elems))))))) (implementation: (node_equivalence Equivalence) (All [a] (-> (Equivalence a) (Equivalence (Node a)))) diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index a7fa5cb75..10bbfa9d0 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -103,19 +103,20 @@ (let [[next x] (step init)] (//.pending [x (unfold step next)]))) -(def: #export (filter predicate sequence) +(def: #export (only predicate sequence) (All [a] (-> (-> a Bit) (Sequence a) (Sequence a))) (let [[head tail] (//.run sequence)] (if (predicate head) - (//.pending [head (filter predicate tail)]) - (filter predicate tail)))) + (//.pending [head (only predicate tail)]) + (only predicate tail)))) (def: #export (partition left? xs) {#.doc (doc "Split a sequence in two based on a predicate." "The left side contains all entries for which the predicate is #1." "The right side contains all entries for which the predicate is #0.")} (All [a] (-> (-> a Bit) (Sequence a) [(Sequence a) (Sequence a)])) - [(filter left? xs) (filter (bit.complement left?) xs)]) + [(..only left? xs) + (..only (bit.complement left?) xs)]) (implementation: #export functor (Functor Sequence) diff --git a/stdlib/source/library/lux/data/collection/set.lux b/stdlib/source/library/lux/data/collection/set.lux index 0ae6cee25..27049802d 100644 --- a/stdlib/source/library/lux/data/collection/set.lux +++ b/stdlib/source/library/lux/data/collection/set.lux @@ -88,7 +88,7 @@ (All [a] (-> (Set a) Bit)) (|>> ..size (n.= 0))) -(def: #export (from_list hash elements) +(def: #export (of_list hash elements) (All [a] (-> (Hash a) (List a) (Set a))) (list\fold ..add (..new hash) elements)) diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux index efd266c18..c078c4df1 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -108,7 +108,7 @@ (let [(^@ set [hash _]) (:representation set)] (|> set dictionary.keys - (//.from_list hash)))) + (//.of_list hash)))) (implementation: #export equivalence (All [a] (Equivalence (Set a))) @@ -144,14 +144,14 @@ (All [a] (-> (Set a) Bit)) (|>> ..size (n.= 0))) -(def: #export (from_list hash subject) +(def: #export (of_list hash subject) (All [a] (-> (Hash a) (List a) (Set a))) (list\fold (..add 1) (..new hash) subject)) -(def: #export (from_set subject) +(def: #export (of_set subject) (All [a] (-> (//.Set a) (Set a))) - (..from_list (//.member_hash subject) - (//.to_list subject))) + (..of_list (//.member_hash subject) + (//.to_list subject))) (def: #export super? (All [a] (-> (Set a) (Set a) Bit)) diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux index b61bfb546..e53e3398e 100644 --- a/stdlib/source/library/lux/data/collection/set/ordered.lux +++ b/stdlib/source/library/lux/data/collection/set/ordered.lux @@ -46,7 +46,7 @@ (All [a] (-> (Set a) (List a))) (|>> :representation /.keys)) - (def: #export (from_list &order list) + (def: #export (of_list &order list) (All [a] (-> (Order a) (List a) (Set a))) (list\fold add (..new &order) list)) @@ -57,14 +57,14 @@ (def: #export (intersection left right) (All [a] (-> (Set a) (Set a) (Set a))) (|> (..to_list right) - (list.filter (..member? left)) - (..from_list (get@ #/.&order (:representation right))))) + (list.only (..member? left)) + (..of_list (get@ #/.&order (:representation right))))) (def: #export (difference param subject) (All [a] (-> (Set a) (Set a) (Set a))) (|> (..to_list subject) - (list.filter (|>> (..member? param) not)) - (..from_list (get@ #/.&order (:representation subject))))) + (list.only (|>> (..member? param) not)) + (..of_list (get@ #/.&order (:representation subject))))) (implementation: #export equivalence (All [a] (Equivalence (Set a))) diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux index a3b1be634..1e986da40 100644 --- a/stdlib/source/library/lux/data/collection/tree/finger.lux +++ b/stdlib/source/library/lux/data/collection/tree/finger.lux @@ -79,7 +79,7 @@ (list\compose (values left) (values right)))) - (def: #export (search predicate tree) + (def: #export (one predicate tree) (All [@ t v] (-> (Predicate t) (Tree @ t v) (Maybe v))) (let [[monoid tag root] (:representation tree)] (if (predicate tag) @@ -98,9 +98,9 @@ #.None))) ) -(def: #export (found? predicate tree) +(def: #export (exists? predicate tree) (All [@ t v] (-> (Predicate t) (Tree @ t v) Bit)) - (case (..search predicate tree) + (case (..one predicate tree) (#.Some _) true diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux index 72847c91d..5e6f20eb6 100644 --- a/stdlib/source/library/lux/data/color.lux +++ b/stdlib/source/library/lux/data/color.lux @@ -51,7 +51,7 @@ (abstract: #export Color RGB - (def: #export (from_rgb [red green blue]) + (def: #export (of_rgb [red green blue]) (-> RGB Color) (:abstraction {#red (n.% ..rgb red) #green (n.% ..rgb green) @@ -84,14 +84,14 @@ b)))) (def: #export black - (..from_rgb {#red 0 - #green 0 - #blue 0})) + (..of_rgb {#red 0 + #green 0 + #blue 0})) (def: #export white - (..from_rgb {#red ..top - #green ..top - #blue ..top})) + (..of_rgb {#red ..top + #green ..top + #blue ..top})) (implementation: #export addition (Monoid Color) @@ -183,23 +183,23 @@ ## else p))) -(def: #export (from_hsl [hue saturation luminance]) +(def: #export (of_hsl [hue saturation luminance]) (-> HSL Color) (if (f.= +0.0 saturation) ## Achromatic (let [intensity (..up luminance)] - (from_rgb {#red intensity - #green intensity - #blue intensity})) + (of_rgb {#red intensity + #green intensity + #blue intensity})) ## Chromatic (let [q (if (f.< +0.5 luminance) (|> saturation (f.+ +1.0) (f.* luminance)) (|> luminance (f.+ saturation) (f.- (f.* saturation luminance)))) p (|> luminance (f.* +2.0) (f.- q)) third (|> +1.0 (f./ +3.0))] - (from_rgb {#red (..up (|> hue (f.+ third) (hue_to_rgb p q))) - #green (..up (|> hue (hue_to_rgb p q))) - #blue (..up (|> hue (f.- third) (hue_to_rgb p q)))})))) + (of_rgb {#red (..up (|> hue (f.+ third) (hue_to_rgb p q))) + #green (..up (|> hue (hue_to_rgb p q))) + #blue (..up (|> hue (f.- third) (hue_to_rgb p q)))})))) (def: #export (to_hsb color) (-> Color HSB) @@ -233,7 +233,7 @@ saturation brightness])))) -(def: #export (from_hsb [hue saturation brightness]) +(def: #export (of_hsb [hue saturation brightness]) (-> HSB Color) (let [hue (|> hue (f.* +6.0)) i (math.floor hue) @@ -246,9 +246,9 @@ red (case mod 0 v 1 q 2 p 3 p 4 t 5 v _ (undefined)) green (case mod 0 t 1 v 2 v 3 q 4 p 5 p _ (undefined)) blue (case mod 0 p 1 p 2 t 3 v 4 v 5 q _ (undefined))] - (from_rgb {#red (..up red) - #green (..up green) - #blue (..up blue)}))) + (of_rgb {#red (..up red) + #green (..up green) + #blue (..up blue)}))) (def: #export (to_cmyk color) (-> Color CMYK) @@ -268,21 +268,21 @@ #yellow yellow #key key})) -(def: #export (from_cmyk [cyan magenta yellow key]) +(def: #export (of_cmyk [cyan magenta yellow key]) (-> CMYK Color) (if (f.= +1.0 key) - (from_rgb {#red 0 - #green 0 - #blue 0}) + (of_rgb {#red 0 + #green 0 + #blue 0}) (let [red (|> (|> +1.0 (f.- cyan)) (f.* (|> +1.0 (f.- key)))) green (|> (|> +1.0 (f.- magenta)) (f.* (|> +1.0 (f.- key)))) blue (|> (|> +1.0 (f.- yellow)) (f.* (|> +1.0 (f.- key))))] - (from_rgb {#red (..up red) - #green (..up green) - #blue (..up blue)})))) + (of_rgb {#red (..up red) + #green (..up green) + #blue (..up blue)})))) (def: (normalize ratio) (-> Frac Frac) @@ -307,9 +307,9 @@ .nat))) [redS greenS blueS] (to_rgb start) [redE greenE blueE] (to_rgb end)] - (from_rgb {#red (interpolate' redE redS) - #green (interpolate' greenE greenS) - #blue (interpolate' blueE blueS)}))) + (of_rgb {#red (interpolate' redE redS) + #green (interpolate' greenE greenS) + #blue (interpolate' blueE blueS)}))) (template [ ] [(def: #export ( ratio color) @@ -324,11 +324,11 @@ [(def: #export ( ratio color) (-> Frac Color Color) (let [[hue saturation luminance] (to_hsl color)] - (from_hsl [hue - (|> saturation - (f.* (|> +1.0 ( (..normalize ratio)))) - (f.min +1.0)) - luminance])))] + (of_hsl [hue + (|> saturation + (f.* (|> +1.0 ( (..normalize ratio)))) + (f.min +1.0)) + luminance])))] [saturate f.+] [de_saturate f.-] @@ -337,21 +337,21 @@ (def: #export (gray_scale color) (-> Color Color) (let [[_ _ luminance] (to_hsl color)] - (from_hsl [+0.0 - +0.0 - luminance]))) + (of_hsl [+0.0 + +0.0 + luminance]))) (template [ <1> <2>] [(def: #export ( color) (-> Color [Color Color Color]) (let [[hue saturation luminance] (to_hsl color)] [color - (from_hsl [(|> hue (f.+ <1>) ..normalize) - saturation - luminance]) - (from_hsl [(|> hue (f.+ <2>) ..normalize) - saturation - luminance])]))] + (of_hsl [(|> hue (f.+ <1>) ..normalize) + saturation + luminance]) + (of_hsl [(|> hue (f.+ <2>) ..normalize) + saturation + luminance])]))] [triad (|> +1.0 (f./ +3.0)) (|> +2.0 (f./ +3.0))] [clash (|> +1.0 (f./ +4.0)) (|> +3.0 (f./ +4.0))] @@ -363,15 +363,15 @@ (-> Color [Color Color Color Color]) (let [[hue saturation luminance] (to_hsb color)] [color - (from_hsb [(|> hue (f.+ <1>) ..normalize) - saturation - luminance]) - (from_hsb [(|> hue (f.+ <2>) ..normalize) - saturation - luminance]) - (from_hsb [(|> hue (f.+ <3>) ..normalize) - saturation - luminance])]))] + (of_hsb [(|> hue (f.+ <1>) ..normalize) + saturation + luminance]) + (of_hsb [(|> hue (f.+ <2>) ..normalize) + saturation + luminance]) + (of_hsb [(|> hue (f.+ <3>) ..normalize) + saturation + luminance])]))] [square (|> +1.0 (f./ +4.0)) (|> +2.0 (f./ +4.0)) (|> +3.0 (f./ +4.0))] [tetradic (|> +2.0 (f./ +12.0)) (|> +6.0 (f./ +12.0)) (|> +8.0 (f./ +12.0))] @@ -388,9 +388,9 @@ (let [[hue saturation brightness] (to_hsb color) spread (..normalize spread)] (list\map (function (_ idx) - (from_hsb [(|> idx inc .int int.frac (f.* spread) (f.+ hue) ..normalize) - saturation - brightness])) + (of_hsb [(|> idx inc .int int.frac (f.* spread) (f.+ hue) ..normalize) + saturation + brightness])) (list.indices variations)))) (def: #export (monochromatic spread variations color) @@ -403,7 +403,7 @@ (f.+ brightness) ..normalize [hue saturation] - from_hsb))))) + of_hsb))))) (type: #export Alpha Rev) diff --git a/stdlib/source/library/lux/data/color/named.lux b/stdlib/source/library/lux/data/color/named.lux index a9a9ab4ab..8eb01d331 100644 --- a/stdlib/source/library/lux/data/color/named.lux +++ b/stdlib/source/library/lux/data/color/named.lux @@ -8,9 +8,9 @@ (template [ ] [(def: #export Color - (//.from_rgb {#//.red (hex ) - #//.green (hex ) - #//.blue (hex )}))] + (//.of_rgb {#//.red (hex ) + #//.green (hex ) + #//.blue (hex )}))] ["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 7103f7d9d..c7bd7da94 100644 --- a/stdlib/source/library/lux/data/format/binary.lux +++ b/stdlib/source/library/lux/data/format/binary.lux @@ -1,7 +1,6 @@ (.module: [library [lux (#- and or nat int rev list type) - [type (#+ :share)] [abstract [monoid (#+ Monoid)] [monad (#+ Monad do)] @@ -73,7 +72,7 @@ [(n.+ offset) (|> binary ( offset value) - try.assume)])]))] + try.assumed)])]))] [bits/8 /.size/8 binary.write/8] [bits/16 /.size/16 binary.write/16] @@ -92,7 +91,7 @@ (function (_ [offset binary]) (|> binary (binary.write/8 offset ) - try.assume + try.assumed [(.inc offset)] caseT))])]) ([0 #.Left left] @@ -135,7 +134,7 @@ [size (function (_ [offset binary]) [(n.+ size offset) - (try.assume + (try.assumed (binary.copy (n.min size (binary.size value)) 0 value @@ -152,7 +151,7 @@ [size' (function (_ [offset binary]) [(n.+ size' offset) - (try.assume + (try.assumed (do try.monad [_ ( offset size binary)] (binary.copy size 0 value (n.+ offset) binary)))])]))))] @@ -185,7 +184,7 @@ original_count) value (if (n.= original_count capped_count) value - (|> value row.to_list (list.take capped_count) row.from_list)) + (|> value row.to_list (list.take capped_count) row.of_list)) (^open "specification\.") ..monoid [size mutation] (|> value (row\map valueW) @@ -195,7 +194,7 @@ specification\identity))] [(n.+ size) (function (_ [offset binary]) - (try.assume + (try.assumed (do try.monad [_ ( offset capped_count binary)] (wrap (mutation [(n.+ offset) binary])))))])))] @@ -240,7 +239,7 @@ (function (_ [offset binary]) (|> binary (binary.write/8 offset ) - try.assume + try.assumed [(.inc offset)] caseT))])]) ([0 #.Primitive (..and ..text (..list recur))] @@ -275,7 +274,7 @@ (function (_ [offset binary]) (|> binary (binary.write/8 offset ) - try.assume + try.assumed [(.inc offset)] caseT))])]) ([0 #.Bit ..bit] diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux index 273ab75b8..132aea2e2 100644 --- a/stdlib/source/library/lux/data/format/css/property.lux +++ b/stdlib/source/library/lux/data/format/css/property.lux @@ -68,15 +68,15 @@ (Property ) (:abstraction ))] - (~~ (template.splice +)))) - - (with-expansions [ (template.splice +)] - (template [] - [(`` (def: #export (~~ (text-identifier )) - (Property ) - (:abstraction )))] - - ))] + (~~ (template.spliced +)))) + + (with-expansions [ (template.spliced +)] + (template [] + [(`` (def: #export (~~ (text-identifier )) + (Property ) + (:abstraction )))] + + ))] [All [] diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux index 2a0210f7a..36f9b7796 100644 --- a/stdlib/source/library/lux/data/format/css/selector.lux +++ b/stdlib/source/library/lux/data/format/css/selector.lux @@ -65,7 +65,7 @@ (:representation right))))] - (~~ (template.splice +))))] + (~~ (template.spliced +))))] [Can-Chain (Generic Any) Can-Chain [["" and]]] @@ -107,7 +107,7 @@ (Selector Can-Chain) (:abstraction ))] - (~~ (template.splice +))))] + (~~ (template.spliced +))))] [Can-Chain [[active ":active"] diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux index f85272a04..5c6e575ed 100644 --- a/stdlib/source/library/lux/data/format/css/value.lux +++ b/stdlib/source/library/lux/data/format/css/value.lux @@ -28,8 +28,8 @@ [// [selector (#+ Label)]]) -(syntax: (text-identifier {identifier s.text}) - (wrap (list (code.local-identifier identifier)))) +(syntax: (text_identifier {identifier s.text}) + (wrap (list (code.local_identifier (text.replace_all "-" "_" identifier))))) (template: (enumeration: + +) (abstract: #export @@ -42,10 +42,10 @@ (`` (template [ ] [(def: #export (:abstraction ))] - (~~ (template.splice +)) + (~~ (template.spliced +)) )) - (template.splice +))) + (template.spliced +))) (template: (multi: ) (def: #export ( pre post) @@ -84,11 +84,11 @@ (Value ) (:abstraction ))] - (~~ (template.splice +)))) + (~~ (template.spliced +)))) - (with-expansions [ (template.splice +)] + (with_expansions [ (template.spliced +)] (template [] - [(`` (def: #export (~~ (text-identifier )) + [(`` (def: #export (~~ (..text_identifier )) (Value ) (:abstraction )))] @@ -117,11 +117,11 @@ ["thick"]]] [Slice - [[full-slice "fill"]] + [[full_slice "fill"]] []] [Alignment - [[auto-alignment "auto"]] + [[auto_alignment "auto"]] [["stretch"] ["center"] ["flex-start"] @@ -134,24 +134,24 @@ [] []] - [Animation-Direction - [[normal-direction "normal"]] + [Animation_Direction + [[normal_direction "normal"]] [["reverse"] ["alternate"] ["alternate-reverse"]]] - [Animation-Fill - [[fill-forwards "forwards"] - [fill-backwards "backwards"] - [fill-both "both"]] + [Animation_Fill + [[fill_forwards "forwards"] + [fill_backwards "backwards"] + [fill_both "both"]] []] - [Column-Fill + [Column_Fill [] [["balance"] ["auto"]]] - [Column-Span + [Column_Span [] [["all"]]] @@ -180,17 +180,17 @@ [Visibility [[invisible "hidden"] - [collapse-visibility "collapse"]] + [collapse_visibility "collapse"]] [["visible"]]] [Attachment - [[scroll-attachment "scroll"] - [fixed-attachment "fixed"] - [local-attachment "local"]] + [[scroll_attachment "scroll"] + [fixed_attachment "fixed"] + [local_attachment "local"]] []] [Blend - [[normal-blend "normal"]] + [[normal_blend "normal"]] [["multiply"] ["screen"] ["overlay"] @@ -212,11 +212,11 @@ ["content-box"]]] [Image - [[no-image "none"]] + [[no_image "none"]] []] [Repeat - [[stretch-repeat "stretch"]] + [[stretch_repeat "stretch"]] [["repeat"] ["repeat-x"] ["repeat-y"] @@ -225,19 +225,19 @@ ["round"]]] [Location - [[left-top "left top"] - [left-center "left center"] - [left-bottom "left bottom"] - [right-top "right top"] - [right-center "right center"] - [right-bottom "right bottom"] - [center-top "center top"] - [center-center "center center"] - [center-bottom "center bottom"]] + [[left_top "left top"] + [left_center "left center"] + [left_bottom "left bottom"] + [right_top "right top"] + [right_center "right center"] + [right_bottom "right bottom"] + [center_top "center top"] + [center_center "center center"] + [center_bottom "center bottom"]] []] [Fit - [[no-fit "none"]] + [[no_fit "none"]] [["fill"] ["cover"] ["contain"] @@ -260,7 +260,7 @@ [["separate"] ["collapse"]]] - [Box-Decoration-Break + [Box_Decoration_Break [] [["slice"] ["clone"]]] @@ -271,14 +271,14 @@ ["bottom"]]] [Float - [[float-left "left"] - [float-right "right"]] + [[float_left "left"] + [float_right "right"]] []] [Clear - [[clear-left "left"] - [clear-right "right"] - [clear-both "both"]] + [[clear_left "left"] + [clear_right "right"] + [clear_both "both"]] []] [Counter @@ -293,8 +293,8 @@ ["no-close-quote"]]] [Cursor - [[horizontal-text "text"] - [no-cursor "none"]] + [[horizontal_text "text"] + [no_cursor "none"]] [["alias"] ["all-scroll"] ["cell"] @@ -337,14 +337,14 @@ [] []] - [Text-Direction - [[left-to-right "ltr"] - [right-to-left "rtl"]] + [Text_Direction + [[left_to_right "ltr"] + [right_to_left "rtl"]] []] [Display - [[grid-display "grid"] - [no-display "none"]] + [[grid_display "grid"] + [no_display "none"]] [["inline"] ["block"] ["contents"] @@ -374,38 +374,38 @@ [] []] - [Flex-Direction + [Flex_Direction [] [["row"] ["row-reverse"] ["column"] ["column-reverse"]]] - [Flex-Wrap - [[no-wrap "nowrap"]] + [Flex_Wrap + [[no_wrap "nowrap"]] [["wrap"] - ["wrap-reverse"]]] + ["wrap_reverse"]]] - [Font-Kerning - [[auto-kerning "auto"] - [normal-kerning "normal"] - [no-kerning "none"]] + [Font_Kerning + [[auto_kerning "auto"] + [normal_kerning "normal"] + [no_kerning "none"]] []] - [Font-Size - [[medium-size "medium"] - [xx-small-size "xx-small"] - [x-small-size "x-small"] - [small-size "small"] - [large-size "large"] - [x-large-size "x-large"] - [xx-large-size "xx-large"] - [smaller-size "smaller"] - [larger-size "larger"]] + [Font_Size + [[medium_size "medium"] + [xx_small_size "xx-small"] + [x_small_size "x-small"] + [small_size "small"] + [large_size "large"] + [x_large_size "x-large"] + [xx_large_size "xx-large"] + [smaller_size "smaller"] + [larger_size "larger"]] []] - [Font-Stretch - [[normal-stretch "normal"]] + [Font_Stretch + [[normal_stretch "normal"]] [["condensed"] ["ultra-condensed"] ["extra-condensed"] @@ -415,64 +415,64 @@ ["extra-expanded"] ["ultra-expanded"]]] - [Font-Style - [[normal-style "normal"]] + [Font_Style + [[normal_style "normal"]] [["italic"] ["oblique"]]] - [Font-Weight - [[normal-weight "normal"] - [weight-100 "100"] - [weight-200 "200"] - [weight-300 "300"] - [weight-400 "400"] - [weight-500 "500"] - [weight-600 "600"] - [weight-700 "700"] - [weight-800 "800"] - [weight-900 "900"]] + [Font_Weight + [[normal_weight "normal"] + [weight_100 "100"] + [weight_200 "200"] + [weight_300 "300"] + [weight_400 "400"] + [weight_500 "500"] + [weight_600 "600"] + [weight_700 "700"] + [weight_800 "800"] + [weight_900 "900"]] [["bold"]]] - [Font-Variant - [[normal-font "normal"]] + [Font_Variant + [[normal_font "normal"]] [["small-caps"]]] [Grid [] []] - [Grid-Content - [[auto-content "auto"]] + [Grid_Content + [[auto_content "auto"]] [["max-content"] ["min-content"]]] - [Grid-Flow - [[row-flow "row"] - [column-flow "column"] - [dense-flow "dense"] - [row-dense-flow "row dense"] - [column-dense-flow "column dense"]] + [Grid_Flow + [[row_flow "row"] + [column_flow "column"] + [dense_flow "dense"] + [row_dense_flow "row dense"] + [column_dense_flow "column dense"]] []] - [Grid-Span - [[auto-span "auto"]] + [Grid_Span + [[auto_span "auto"]] []] - [Grid-Template + [Grid_Template [] []] - [Hanging-Punctuation - [[no-hanging-punctuation "none"]] + [Hanging_Punctuation + [[no_hanging_punctuation "none"]] [["first"] ["last"] ["allow-end"] ["force-end"]]] [Hyphens - [[no-hyphens "none"] - [manual-hyphens "manual"] - [auto-hyphens "auto"]] + [[no_hyphens "none"] + [manual_hyphens "manual"] + [auto_hyphens "auto"]] []] [Orientation @@ -495,55 +495,55 @@ []] [Update - [[no-update "none"] - [slow-update "slow"] - [fast-update "fast"]] + [[no_update "none"] + [slow_update "slow"] + [fast_update "fast"]] []] - [Block-Overflow - [[no-block-overflow "none"] - [scroll-block-overflow "scroll"] - [optional-paged-block-overflow "optional-paged"] - [paged-block-overflow "paged"]] + [Block_Overflow + [[no_block_overflow "none"] + [scroll_block_overflow "scroll"] + [optional_paged_block_overflow "optional-paged"] + [paged_block_overflow "paged"]] []] - [Inline-Overflow - [[no-inline-overflow "none"] - [scroll-inline-overflow "scroll"]] + [Inline_Overflow + [[no_inline_overflow "none"] + [scroll_inline_overflow "scroll"]] []] - [Display-Mode + [Display_Mode [] [["fullscreen"] ["standalone"] ["minimal-ui"] ["browser"]]] - [Color-Gamut + [Color_Gamut [] [["srgb"] ["p3"] ["rec2020"]]] - [Inverted-Colors - [[no-inverted-colors "none"] - [inverted-colors "inverted"]] + [Inverted_Colors + [[no_inverted_colors "none"] + [inverted_colors "inverted"]] []] [Pointer - [[no-pointer "none"] - [coarse-pointer "coarse"] - [fine-pointer "fine"]] + [[no_pointer "none"] + [coarse_pointer "coarse"] + [fine_pointer "fine"]] []] [Hover - [[no-hover "none"]] + [[no_hover "none"]] [["hover"]]] [Light - [[dim-light "dim"] - [normal-light "normal"] - [washed-light "washed"]] + [[dim_light "dim"] + [normal_light "normal"] + [washed_light "washed"]] []] [Ratio @@ -551,33 +551,33 @@ []] [Scripting - [[no-scripting "none"] - [initial-scripting-only "initial-only"] - [scripting-enabled "enabled"]] + [[no_scripting "none"] + [initial_scripting_only "initial-only"] + [scripting_enabled "enabled"]] []] [Motion - [[no-motion-preference "no-preference"] - [reduced-motion "reduce"]] + [[no_motion_preference "no-preference"] + [reduced_motion "reduce"]] []] - [Color-Scheme - [[no-color-scheme-preference "no-preference"] - [light-color-scheme "light"] - [dark-color-scheme "dark"]] + [Color_Scheme + [[no_color_scheme_preference "no-preference"] + [light_color_scheme "light"] + [dark_color_scheme "dark"]] []] [Isolation - [[auto-isolation "auto"]] + [[auto_isolation "auto"]] [["isolate"]]] - [List-Style-Position + [List_Style_Position [] [["inside"] ["outside"]]] - [List-Style-Type - [[no-list-style "none"]] + [List_Style_Type + [[no_list_style "none"]] [["disc"] ["armenian"] ["circle"] @@ -605,23 +605,23 @@ []] [Overflow - [[visible-overflow "visible"] - [hidden-overflow "hidden"] - [scroll-overflow "scroll"] - [auto-overflow "auto"]] + [[visible_overflow "visible"] + [hidden_overflow "hidden"] + [scroll_overflow "scroll"] + [auto_overflow "auto"]] []] - [Page-Break - [[auto-page-break "auto"] - [always-page-break "always"] - [avoid-page-break "avoid"] - [left-page-break "left"] - [right-page-break "right"]] + [Page_Break + [[auto_page_break "auto"] + [always_page_break "always"] + [avoid_page_break "avoid"] + [left_page_break "left"] + [right_page_break "right"]] []] - [Pointer-Events - [[auto-pointer-events "auto"] - [no-pointer-events "none"]] + [Pointer_Events + [[auto_pointer_events "auto"] + [no_pointer_events "none"]] []] [Position @@ -633,156 +633,156 @@ ["sticky"]]] [Quotes - [[no-quotes "none"]] + [[no_quotes "none"]] []] [Resize - [[resize-none "none"] - [resize-both "both"] - [resize-horizontal "horizontal"] - [resize-vertical "vertical"]] + [[resize_none "none"] + [resize_both "both"] + [resize_horizontal "horizontal"] + [resize_vertical "vertical"]] []] - [Scroll-Behavior - [[auto-scroll-behavior "auto"] - [smooth-scroll-behavior "smooth"]] + [Scroll_Behavior + [[auto_scroll_behavior "auto"] + [smooth_scroll_behavior "smooth"]] []] - [Table-Layout - [[auto-table-layout "auto"] - [fixed-table-layout "fixed"]] + [Table_Layout + [[auto_table_layout "auto"] + [fixed_table_layout "fixed"]] []] - [Text-Align - [[left-text-align "left"] - [right-text-align "right"] - [center-text-align "center"] - [justify-text-align "justify"]] + [Text_Align + [[left_text_align "left"] + [right_text_align "right"] + [center_text_align "center"] + [justify_text_align "justify"]] []] - [Text-Align-Last - [[auto-text-align-last "auto"] - [left-text-align-last "left"] - [right-text-align-last "right"] - [center-text-align-last "center"] - [justify-text-align-last "justify"] - [start-text-align-last "start"] - [end-text-align-last "end"]] + [Text_Align_Last + [[auto_text_align_last "auto"] + [left_text_align_last "left"] + [right_text_align_last "right"] + [center_text_align_last "center"] + [justify_text_align_last "justify"] + [start_text_align_last "start"] + [end_text_align_last "end"]] []] - [Text-Decoration-Line - [[no-text-decoration-line "none"] - [underline-text-decoration-line "underline"] - [overline-text-decoration-line "overline"] - [line-through-text-decoration-line "line-through"]] + [Text_Decoration_Line + [[no_text_decoration_line "none"] + [underline_text_decoration_line "underline"] + [overline_text_decoration_line "overline"] + [line_through_text_decoration_line "line-through"]] []] - [Text-Decoration-Style - [[solid-text-decoration-style "solid"] - [double-text-decoration-style "double"] - [dotted-text-decoration-style "dotted"] - [dashed-text-decoration-style "dashed"] - [wavy-text-decoration-style "wavy"]] + [Text_Decoration_Style + [[solid_text_decoration_style "solid"] + [double_text_decoration_style "double"] + [dotted_text_decoration_style "dotted"] + [dashed_text_decoration_style "dashed"] + [wavy_text_decoration_style "wavy"]] []] - [Text-Justification - [[auto-text-justification "auto"] - [inter-word-text-justification "inter-word"] - [inter-character-text-justification "inter-character"] - [no-text-justification "none"]] + [Text_Justification + [[auto_text_justification "auto"] + [inter_word_text_justification "inter-word"] + [inter_character_text_justification "inter-character"] + [no_text_justification "none"]] []] - [Text-Overflow - [[clip-text-overflow "clip"] - [ellipsis-text-overflow "ellipsis"]] + [Text_Overflow + [[clip_text_overflow "clip"] + [ellipsis_text_overflow "ellipsis"]] []] - [Text-Transform - [[no-text-transform "none"]] + [Text_Transform + [[no_text_transform "none"]] [["capitalize"] ["uppercase"] ["lowercase"]]] [Transform - [[no-transform "none"]] + [[no_transform "none"]] []] - [Transform-Origin + [Transform_Origin [] []] - [Transform-Style + [Transform_Style [] [["flat"] - ["preserve-3d"]]] + ["preserve_3d"]]] [Transition - [[transition-none "none"] - [transition-all "all"]] + [[transition_none "none"] + [transition_all "all"]] []] [Bidi - [[bidi-normal "normal"] - [bidi-embed "embed"] - [bidi-isolate "isolate"] - [bidi-isolate-override "isolate-override"] - [bidi-plaintext "plaintext"]] + [[bidi_normal "normal"] + [bidi_embed "embed"] + [bidi_isolate "isolate"] + [bidi_isolate_override "isolate-override"] + [bidi_plaintext "plaintext"]] [["bidi-override"]]] - [User-Select - [[user-select-auto "auto"] - [user-select-none "none"] - [user-select-text "text"] - [user-select-all "all"]] + [User_Select + [[user_select_auto "auto"] + [user_select_none "none"] + [user_select_text "text"] + [user_select_all "all"]] []] - [Vertical-Align - [[vertical-align-baseline "baseline"] - [vertical-align-sub "sub"] - [vertical-align-super "super"] - [vertical-align-top "top"] - [vertical-align-text-top "text-top"] - [vertical-align-middle "middle"] - [vertical-align-bottom "bottom"] - [vertical-align-text-bottom "text-bottom"]] + [Vertical_Align + [[vertical_align_baseline "baseline"] + [vertical_align_sub "sub"] + [vertical_align_super "super"] + [vertical_align_top "top"] + [vertical_align_text_top "text-top"] + [vertical_align_middle "middle"] + [vertical_align_bottom "bottom"] + [vertical_align_text_bottom "text-bottom"]] []] - [White-Space - [[normal-white-space "normal"] - [no-wrap-white-space "nowrap"] - [pre-white-space "pre"] - [pre-line-white-space "pre-line"] - [pre-wrap-white-space "pre-wrap"]] + [White_Space + [[normal_white_space "normal"] + [no_wrap_white_space "nowrap"] + [pre_white_space "pre"] + [pre_line_white_space "pre-line"] + [pre_wrap_white_space "pre-wrap"]] []] - [Word-Break - [[normal-word-break "normal"]] + [Word_Break + [[normal_word_break "normal"]] [["break-all"] ["keep-all"] ["break-word"]]] - [Word-Wrap - [[normal-word-wrap "normal"] - [break-word-word-wrap "break-word"]] + [Word_Wrap + [[normal_word_wrap "normal"] + [break_word_word_wrap "break-word"]] []] - [Writing-Mode - [[top-to-bottom-writing-mode "horizontal-tb"] - [left-to-right-writing-mode "vertical-rl"] - [right-to-left-writing-mode "vertical-lr"]] + [Writing_Mode + [[top_to_bottom_writing_mode "horizontal-tb"] + [left_to_right_writing_mode "vertical-rl"] + [right_to_left_writing_mode "vertical-lr"]] []] - [Z-Index + [Z_Index [] []] ) - (def: value-separator ",") + (def: value_separator ",") (def: (apply name inputs) (-> Text (List Text) Value) (|> inputs - (text.join-with ..value-separator) + (text.join_with ..value_separator) (text.enclose ["(" ")"]) (format name) :abstraction)) @@ -797,7 +797,7 @@ (-> Nat Step (Value Timing)) (..apply "steps" (list (%.nat intervals) (..step step)))) - (def: #export (cubic-bezier p0 p1 p2 p3) + (def: #export (cubic_bezier p0 p1 p2 p3) (-> Frac Frac Frac Frac (Value Timing)) (|> (list p0 p1 p2 p3) (list\map %number) @@ -810,8 +810,8 @@ [iteration Iteration] [count Count] - [slice-number/1 Slice] - [span-line Grid-Span] + [slice_number/1 Slice] + [span_line Grid_Span] ) (def: #export animation @@ -820,7 +820,7 @@ (def: #export (rgb color) (-> color.Color (Value Color)) - (let [[red green blue] (color.to-rgb color)] + (let [[red green blue] (color.to_rgb color)] (..apply "rgb" (list (%.nat red) (%.nat green) (%.nat blue))))) @@ -828,7 +828,7 @@ (def: #export (rgba pigment) (-> color.Pigment (Value Color)) (let [(^slots [#color.color #color.alpha]) pigment - [red green blue] (color.to-rgb color)] + [red green blue] (color.to_rgb color)] (..apply "rgba" (list (%.nat red) (%.nat green) (%.nat blue) @@ -875,18 +875,18 @@ [seconds "s"] - [milli-seconds "ms"] + [milli_seconds "ms"] ) (def: #export thickness (-> (Value Length) (Value Thickness)) (|>> :transmutation)) - (def: slice-separator " ") + (def: slice_separator " ") - (def: #export (slice-number/2 horizontal vertical) + (def: #export (slice_number/2 horizontal vertical) (-> Nat Nat (Value Slice)) - (:abstraction (format (%.nat horizontal) ..slice-separator + (:abstraction (format (%.nat horizontal) ..slice_separator (%.nat vertical)))) (abstract: #export Stop @@ -896,17 +896,17 @@ (-> (Value Color) Stop) (|>> (:representation Value) (:abstraction Stop))) - (def: stop-separator " ") + (def: stop_separator " ") - (def: #export (single-stop length color) + (def: #export (single_stop length color) (-> (Value Length) (Value Color) Stop) - (:abstraction (format (:representation Value color) ..stop-separator + (:abstraction (format (:representation Value color) ..stop_separator (:representation Value length)))) - (def: #export (double-stop start end color) + (def: #export (double_stop start end color) (-> (Value Length) (Value Length) (Value Color) Stop) - (:abstraction (format (:representation Value color) ..stop-separator - (:representation Value start) ..stop-separator + (:abstraction (format (:representation Value color) ..stop_separator + (:representation Value start) ..stop_separator (:representation Value end)))) (abstract: #export Hint @@ -916,14 +916,14 @@ (-> (Value Length) Hint) (|>> (:representation Value) (:abstraction Hint))) - (def: (with-hint [hint stop]) + (def: (with_hint [hint stop]) (-> [(Maybe Hint) Stop] Text) (case hint #.None (:representation Stop stop) (#.Some hint) - (format (:representation Hint hint) ..value-separator (:representation Stop stop)))))) + (format (:representation Hint hint) ..value_separator (:representation Stop stop)))))) (type: #export (List/1 a) [a (List a)]) @@ -939,19 +939,19 @@ (-> Rev Angle) (:abstraction (format (%.rev value) "turn"))) - (def: degree-limit Nat 360) + (def: degree_limit Nat 360) (def: #export (degree value) (-> Nat Angle) - (:abstraction (format (%.nat (n.% ..degree-limit value)) "deg"))) + (:abstraction (format (%.nat (n.% ..degree_limit value)) "deg"))) (template [ ] [(def: #export Angle (..degree ))] - [000 to-top] - [090 to-right] - [180 to-bottom] - [270 to-left] + [000 to_top] + [090 to_right] + [180 to_bottom] + [270 to_left] ) (template [ ] @@ -959,11 +959,11 @@ (-> Angle Stop (List/1 [(Maybe Hint) Stop]) (Value Image)) (let [[now after] next] (..apply (list& (:representation Angle angle) - (with-hint now) - (list\map with-hint after)))))] + (with_hint now) + (list\map with_hint after)))))] - [linear-gradient "linear-gradient"] - [repeating-linear-gradient "repeating-linear-gradient"] + [linear_gradient "linear-gradient"] + [repeating_linear_gradient "repeating-linear-gradient"] ) ) @@ -974,19 +974,19 @@ (-> Percentage Text) (|>> :representation)) - (def: percentage-limit Nat (.inc 100)) + (def: percentage_limit Nat (.inc 100)) (def: #export (%% value) (-> Nat Percentage) - (:abstraction (format (%.nat (n.% percentage-limit value)) "%"))) + (:abstraction (format (%.nat (n.% percentage_limit value)) "%"))) - (def: #export slice-percent/1 + (def: #export slice_percent/1 (-> Percentage (Value Slice)) (|>> :representation (:abstraction Value))) - (def: #export (slice-percent/2 horizontal vertical) + (def: #export (slice_percent/2 horizontal vertical) (-> Percentage Percentage (Value Slice)) - (:abstraction Value (format (:representation horizontal) ..slice-separator + (:abstraction Value (format (:representation horizontal) ..slice_separator (:representation vertical)))) (template [
 +]
@@ -995,12 +995,12 @@
                 (->  (Value Filter))
                 (|>> 
 (list) (..apply )))]
 
-             (~~ (template.splice +))))]
+             (~~ (template.spliced +))))]
 
       [Nat (<| (:representation Value) ..px n.frac)
        [[blur "blur"]]]
       [Nat (<| ..angle ..degree)
-       [[hue-rotate "hue-rotate"]]]
+       [[hue_rotate "hue-rotate"]]]
       [Percentage (:representation Percentage)
        [[brightness "brightness"]
         [contrast "contrast"]
@@ -1012,33 +1012,33 @@
       )
     )
 
-  (def: #export svg-filter
+  (def: #export svg_filter
     (-> URL (Value Filter))
     (|>> (list) (..apply "url")))
 
-  (def: default-shadow-length (px +0.0))
+  (def: default_shadow_length (px +0.0))
 
-  (def: #export (drop-shadow horizontal vertical blur spread color)
+  (def: #export (drop_shadow horizontal vertical blur spread color)
     (-> (Value Length) (Value Length)
         (Maybe (Value Length)) (Maybe (Value Length))
         (Value Color)
         (Value Filter))
     (|> (list (:representation horizontal)
               (:representation vertical)
-              (|> blur (maybe.default ..default-shadow-length) :representation)
-              (|> spread (maybe.default ..default-shadow-length) :representation)
+              (|> blur (maybe.default ..default_shadow_length) :representation)
+              (|> spread (maybe.default ..default_shadow_length) :representation)
               (:representation color))
-        (text.join-with " ")
+        (text.join_with " ")
         (list)
         (..apply "drop-shadow")))
 
-  (def: length-separator " ")
+  (def: length_separator " ")
 
   (template [ ]
     [(def: #export ( horizontal vertical)
        (-> (Value Length) (Value Length) (Value ))
        (:abstraction (format (:representation horizontal)
-                             ..length-separator
+                             ..length_separator
                              (:representation vertical))))]
 
     [location Location]
@@ -1057,16 +1057,16 @@
 
   (enumeration: Shape Text
     shape
-    [[ellipse-shape "ellipse"]
-     [circle-shape "circle"]]
+    [[ellipse_shape "ellipse"]
+     [circle_shape "circle"]]
     [])
 
   (enumeration: Extent Text
     extent
-    [[closest-side "closest-side"]
-     [closest-corner "closest-corner"]
-     [farthest-side "farthest-side"]
-     [farthest-corner "farthest-corner"]]
+    [[closest_side "closest-side"]
+     [closest_corner "closest-corner"]
+     [farthest_side "farthest-side"]
+     [farthest_corner "farthest-corner"]]
     [])
 
   (template [ ]
@@ -1074,21 +1074,21 @@
        (-> Shape (Maybe Extent) (Value Location)
            Stop (List/1 [(Maybe Hint) Stop])
            (Value Image))
-       (let [after-extent (format "at " (:representation location))
-             with-extent (case extent
+       (let [after_extent (format "at " (:representation location))
+             with_extent (case extent
                            (#.Some extent)
-                           (format (..extent extent) " " after-extent)
+                           (format (..extent extent) " " after_extent)
                            
                            #.None
-                           after-extent)
-             where (format (..shape shape) " " with-extent)
+                           after_extent)
+             where (format (..shape shape) " " with_extent)
              [now after] next]
          (..apply  (list& (..shape shape)
-                                    (with-hint now)
-                                    (list\map with-hint after)))))]
+                                    (with_hint now)
+                                    (list\map with_hint after)))))]
     
-    [radial-gradient "radial-gradient"]
-    [repeating-radial-gradient "repeating-radial-gradient"]
+    [radial_gradient "radial-gradient"]
+    [repeating_radial_gradient "repeating-radial-gradient"]
     )
 
   (def: #export (shadow horizontal vertical blur spread color inset?)
@@ -1096,16 +1096,16 @@
         (Maybe (Value Length)) (Maybe (Value Length))
         (Value Color) Bit
         (Value Shadow))
-    (let [with-inset (if inset?
+    (let [with_inset (if inset?
                        (list "inset")
                        (list))]
       (|> (list& (:representation horizontal)
                  (:representation vertical)
-                 (|> blur (maybe.default ..default-shadow-length) :representation)
-                 (|> spread (maybe.default ..default-shadow-length) :representation)
+                 (|> blur (maybe.default ..default_shadow_length) :representation)
+                 (|> spread (maybe.default ..default_shadow_length) :representation)
                  (:representation color)
-                 with-inset)
-          (text.join-with " ")
+                 with_inset)
+          (text.join_with " ")
           :abstraction)))
 
   (type: #export Rectangle
@@ -1125,7 +1125,7 @@
     (-> Label (Value Counter))
     (|>> :abstraction))
 
-  (def: #export current-count
+  (def: #export current_count
     (-> (Value Counter) (Value Content))
     (|>> :representation (list) (..apply "counter")))
 
@@ -1142,9 +1142,9 @@
     (|>> (list) (..apply "url")))
 
   (enumeration: Font Text
-    font-name
+    font_name
     [[serif "serif"]
-     [sans-serif "sans-serif"]
+     [sans_serif "sans-serif"]
      [cursive "cursive"]
      [fantasy "fantasy"]
      [monospace "monospace"]]
@@ -1152,20 +1152,20 @@
        (-> Text Font)
        (|>> %.text :abstraction))
 
-     (def: #export (font-family options)
+     (def: #export (font_family options)
        (-> (List Font) (Value Font))
        (case options
          (#.Cons _)
          (|> options
-             (list\map ..font-name)
-             (text.join-with ",")
+             (list\map ..font_name)
+             (text.join_with ",")
              (:abstraction Value))
          
          #.Nil
          ..initial))])
 
-  (def: #export font-size
-    (-> (Value Length) (Value Font-Size))
+  (def: #export font_size
+    (-> (Value Length) (Value Font_Size))
     (|>> :transmutation))
 
   (def: #export number
@@ -1176,31 +1176,31 @@
     (-> Label (Value Grid))
     (|>> :abstraction))
 
-  (def: #export fit-content
-    (-> (Value Length) (Value Grid-Content))
+  (def: #export fit_content
+    (-> (Value Length) (Value Grid_Content))
     (|>> :representation (list) (..apply "fit-content")))
 
-  (def: #export (min-max min max)
-    (-> (Value Grid-Content) (Value Grid-Content) (Value Grid-Content))
+  (def: #export (min_max min max)
+    (-> (Value Grid_Content) (Value Grid_Content) (Value Grid_Content))
     (..apply "minmax" (list (:representation min)
                             (:representation max))))
 
-  (def: #export grid-span
-    (-> Nat (Value Grid-Span))
+  (def: #export grid_span
+    (-> Nat (Value Grid_Span))
     (|>> %.nat (format "span ") :abstraction))
 
-  (def: grid-column-separator " ")
-  (def: grid-row-separator " ")
+  (def: grid_column_separator " ")
+  (def: grid_row_separator " ")
 
-  (def: #export grid-template
-    (-> (List (List (Maybe (Value Grid)))) (Value Grid-Template))
+  (def: #export grid_template
+    (-> (List (List (Maybe (Value Grid)))) (Value Grid_Template))
     (let [empty (: (Value Grid)
                    (:abstraction "."))]
       (|>> (list\map (|>> (list\map (|>> (maybe.default empty)
                                          :representation))
-                          (text.join-with ..grid-column-separator)
+                          (text.join_with ..grid_column_separator)
                           (text.enclose ["'" "'"])))
-           (text.join-with ..grid-row-separator)
+           (text.join_with ..grid_row_separator)
            :abstraction)))
 
   (def: #export (resolution dpi)
@@ -1212,32 +1212,32 @@
     (:abstraction (format (%.nat numerator) "/" (%.nat denominator))))
 
   (enumeration: Quote Text
-    quote-text
-    [[double-quote "\0022"]
-     [single-quote "\0027"]
-     [single-left-angle-quote "\2039"]
-     [single-right-angle-quote "\203A"]
-     [double-left-angle-quote "\00AB"]
-     [double-right-angle-quote "\00BB"]
-     [single-left-quote "\2018"]
-     [single-right-quote "\2019"]
-     [double-left-quote "\201C"]
-     [double-right-quote "\201D"]
-     [low-double-quote "\201E"]]
+    quote_text
+    [[double_quote "\0022"]
+     [single_quote "\0027"]
+     [single_left_angle_quote "\2039"]
+     [single_right_angle_quote "\203A"]
+     [double_left_angle_quote "\00AB"]
+     [double_right_angle_quote "\00BB"]
+     [single_left_quote "\2018"]
+     [single_right_quote "\2019"]
+     [double_left_quote "\201C"]
+     [double_right_quote "\201D"]
+     [low_double_quote "\201E"]]
     [(def: #export quote
        (-> Text Quote)
        (|>> :abstraction))])
 
-  (def: quote-separator " ")
+  (def: quote_separator " ")
 
   (def: #export (quotes [left0 right0] [left1 right1])
     (-> [Quote Quote] [Quote Quote] (Value Quotes))
     (|> (list left0 right0 left1 right1)
-        (list\map (|>> ..quote-text %.text))
-        (text.join-with ..quote-separator)
+        (list\map (|>> ..quote_text %.text))
+        (text.join_with ..quote_separator)
         :abstraction))
 
-  (def: #export (matrix-2d [a b] [c d] [tx ty])
+  (def: #export (matrix_2d [a b] [c d] [tx ty])
     (-> [Frac Frac]
         [Frac Frac]
         [Frac Frac]
@@ -1246,7 +1246,7 @@
         (list\map %number)
         (..apply "matrix")))
 
-  (def: #export (matrix-3d [a0 b0 c0 d0] [a1 b1 c1 d1] [a2 b2 c2 d2] [a3 b3 c3 d3])
+  (def: #export (matrix_3d [a0 b0 c0 d0] [a1 b1 c1 d1] [a2 b2 c2 d2] [a3 b3 c3 d3])
     (-> [Frac Frac Frac Frac]
         [Frac Frac Frac Frac]
         [Frac Frac Frac Frac]
@@ -1256,74 +1256,74 @@
         (list\map %number)
         (..apply "matrix3d")))
 
-  (template [   ]
-    [(`` (def: #export ( [(~~ (template.splice ))])
-           (-> [(~~ (template.splice ))] (Value Transform))
-           (|> (list (~~ (template.splice )))
+  (template [   ]
+    [(`` (def: #export ( [(~~ (template.spliced ))])
+           (-> [(~~ (template.spliced ))] (Value Transform))
+           (|> (list (~~ (template.spliced )))
                (list\map %number)
                (..apply ))))]
 
-    [translate-2d "translate" [Frac Frac] [x y]]
-    [translate-3d "translate3d" [Frac Frac Frac] [x y z]]
-    [translate-x "translateX" [Frac] [value]]
-    [translate-y "translateY" [Frac] [value]]
-    [translate-z "translateZ" [Frac] [value]]
+    [translate_2d "translate" [Frac Frac] [x y]]
+    [translate_3d "translate3d" [Frac Frac Frac] [x y z]]
+    [translate_x "translateX" [Frac] [value]]
+    [translate_y "translateY" [Frac] [value]]
+    [translate_z "translateZ" [Frac] [value]]
 
-    [scale-2d "scale" [Frac Frac] [x y]]
-    [scale-3d "scale3d" [Frac Frac Frac] [x y z]]
-    [scale-x "scaleX" [Frac] [value]]
-    [scale-y "scaleY" [Frac] [value]]
-    [scale-z "scaleZ" [Frac] [value]]
+    [scale_2d "scale" [Frac Frac] [x y]]
+    [scale_3d "scale3d" [Frac Frac Frac] [x y z]]
+    [scale_x "scaleX" [Frac] [value]]
+    [scale_y "scaleY" [Frac] [value]]
+    [scale_z "scaleZ" [Frac] [value]]
 
     [perspective "perspective" [Frac] [value]]
     )
 
-  (template [   ]
-    [(`` (def: #export ( [(~~ (template.splice ))])
-           (-> [(~~ (template.splice ))] (Value Transform))
-           (|> (list (~~ (template.splice )))
+  (template [   ]
+    [(`` (def: #export ( [(~~ (template.spliced ))])
+           (-> [(~~ (template.spliced ))] (Value Transform))
+           (|> (list (~~ (template.spliced )))
                (list\map ..angle)
                (..apply ))))]
 
-    [rotate-2d "rotate" [Angle] [angle]]
-    [rotate-x "rotateX" [Angle] [angle]]
-    [rotate-y "rotateY" [Angle] [angle]]
-    [rotate-z "rotateZ" [Angle] [angle]]
+    [rotate_2d "rotate" [Angle] [angle]]
+    [rotate_x "rotateX" [Angle] [angle]]
+    [rotate_y "rotateY" [Angle] [angle]]
+    [rotate_z "rotateZ" [Angle] [angle]]
 
-    [skew "skew" [Angle Angle] [x-angle y-angle]]
-    [skew-x "skewX" [Angle] [angle]]
-    [skew-y "skewY" [Angle] [angle]]
+    [skew "skew" [Angle Angle] [x_angle y_angle]]
+    [skew_x "skewX" [Angle] [angle]]
+    [skew_y "skewY" [Angle] [angle]]
     )
 
-  (def: #export (rotate-3d [x y z angle])
+  (def: #export (rotate_3d [x y z angle])
     (-> [Frac Frac Frac Angle] (Value Transform))
     (..apply "rotate3d"
              (list (%number x) (%number y) (%number z) (..angle angle))))
 
-  (def: origin-separator " ")
+  (def: origin_separator " ")
 
-  (def: #export (origin-2d x y)
-    (-> (Value Length) (Value Length) (Value Transform-Origin))
-    (:abstraction (format (:representation x) ..origin-separator
+  (def: #export (origin_2d x y)
+    (-> (Value Length) (Value Length) (Value Transform_Origin))
+    (:abstraction (format (:representation x) ..origin_separator
                           (:representation y))))
 
-  (def: #export (origin-3d x y z)
-    (-> (Value Length) (Value Length) (Value Length) (Value Transform-Origin))
-    (:abstraction (format (:representation x) ..origin-separator
-                          (:representation y) ..origin-separator
+  (def: #export (origin_3d x y z)
+    (-> (Value Length) (Value Length) (Value Length) (Value Transform_Origin))
+    (:abstraction (format (:representation x) ..origin_separator
+                          (:representation y) ..origin_separator
                           (:representation z))))
 
-  (def: #export vertical-align
-    (-> (Value Length) (Value Vertical-Align))
+  (def: #export vertical_align
+    (-> (Value Length) (Value Vertical_Align))
     (|>> :transmutation))
 
-  (def: #export (z-index index)
-    (-> Int (Value Z-Index))
+  (def: #export (z_index index)
+    (-> Int (Value Z_Index))
     (:abstraction (if (i.< +0 index)
                     (%.int index)
                     (%.nat (.nat index)))))
 
-  (multi: multi-image Image ",")
-  (multi: multi-shadow Shadow ",")
-  (multi: multi-content Content " ")
+  (multi: multi_image Image ",")
+  (multi: multi_shadow Shadow ",")
+  (multi: multi_content Content " ")
   )
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 6a8e0b24f..7cbf607ce 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -105,7 +105,7 @@
            [(abstract: #export  Any)
             (type: #export  (HTML ( )))]
 
-           (~~ (template.splice +))))]
+           (~~ (template.spliced +))))]
 
     [Element Element'
      [[Content Content']
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index 142a15610..638048599 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -63,7 +63,7 @@
 
 (def: #export object
   (-> (List [String JSON]) JSON)
-  (|>> (dictionary.from_list text.hash) #..Object))
+  (|>> (dictionary.of_list text.hash) #..Object))
 
 (syntax: #export (json token)
   {#.doc (doc "A simple way to produce JSON literals."
@@ -101,7 +101,7 @@
                                _
                                (meta.fail "Wrong syntax for JSON object.")))
                            pairs)]
-        (wrap (list (` (: JSON (#..Object ((~! dictionary.from_list)
+        (wrap (list (` (: JSON (#..Object ((~! dictionary.of_list)
                                            (~! text.hash)
                                            (list (~+ pairs')))))))))
       
@@ -290,18 +290,18 @@
 ############################################################
 ############################################################
 
-(def: parse_space
+(def: space_parser
   (Parser Text)
   (.some .space))
 
-(def: parse_separator
+(def: separator_parser
   (Parser [Text Any Text])
   ($_ <>.and
-      ..parse_space
+      ..space_parser
       (.this ..separator)
-      ..parse_space))
+      ..space_parser))
 
-(def: parse_null
+(def: null_parser
   (Parser Null)
   (do <>.monad
     [_ (.this "null")]
@@ -314,17 +314,17 @@
        [_ (.this )]
        (wrap )))]
 
-  [parse_true  "true"  #1]
-  [parse_false "false" #0]
+  [true_parser  "true"  #1]
+  [false_parser "false" #0]
   )
 
-(def: parse_boolean
+(def: boolean_parser
   (Parser Boolean)
   ($_ <>.either
-      ..parse_true
-      ..parse_false))
+      ..true_parser
+      ..false_parser))
 
-(def: parse_number
+(def: number_parser
   (Parser Number)
   (do {! <>.monad}
     [signed? (<>.parses? (.this "-"))
@@ -346,7 +346,7 @@
       (#try.Success value)
       (wrap value))))
 
-(def: parse_escaped
+(def: escaped_parser
   (Parser Text)
   ($_ <>.either
       (<>.after (.this "\t")
@@ -364,7 +364,7 @@
       (<>.after (.this "\\")
                 (<>\wrap "\"))))
 
-(def: parse_string
+(def: string_parser
   (Parser String)
   (<| (.enclosed [text.double_quote text.double_quote])
       (loop [_ []])
@@ -373,50 +373,50 @@
          stop .peek])
       (if (text\= "\" stop)
         (do !
-          [escaped parse_escaped
+          [escaped escaped_parser
            next_chars (recur [])]
           (wrap ($_ text\compose chars escaped next_chars)))
         (wrap chars))))
 
-(def: (parse_kv parse_json)
+(def: (kv_parser json_parser)
   (-> (Parser JSON) (Parser [String JSON]))
   (do <>.monad
-    [key ..parse_string
-     _ ..parse_space
+    [key ..string_parser
+     _ ..space_parser
      _ (.this ..entry_separator)
-     _ ..parse_space
-     value parse_json]
+     _ ..space_parser
+     value json_parser]
     (wrap [key value])))
 
 (template [     ]
-  [(def: ( parse_json)
+  [(def: ( json_parser)
      (-> (Parser JSON) (Parser ))
      (do <>.monad
        [_ (.this )
-        _ parse_space
-        elems (<>.separated_by ..parse_separator )
-        _ parse_space
+        _ space_parser
+        elems (<>.separated_by ..separator_parser )
+        _ space_parser
         _ (.this )]
        (wrap ( elems))))]
 
-  [parse_array  Array  ..open_array ..close_array parse_json  row.from_list]
-  [parse_object Object ..open_object ..close_object (parse_kv parse_json) (dictionary.from_list text.hash)]
+  [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)]
   )
 
-(def: parse_json
+(def: json_parser
   (Parser JSON)
   (<>.rec
-   (function (_ parse_json)
+   (function (_ json_parser)
      ($_ <>.or
-         parse_null
-         parse_boolean
-         parse_number
-         parse_string
-         (parse_array parse_json)
-         (parse_object parse_json)))))
+         null_parser
+         boolean_parser
+         number_parser
+         string_parser
+         (array_parser json_parser)
+         (object_parser json_parser)))))
 
 (implementation: #export codec
   (Codec Text JSON)
   
   (def: encode ..format)
-  (def: decode (.run parse_json)))
+  (def: decode (.run json_parser)))
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux
index f95b29334..b4ae34e8a 100644
--- a/stdlib/source/library/lux/data/format/tar.lux
+++ b/stdlib/source/library/lux/data/format/tar.lux
@@ -286,7 +286,7 @@
 
      (def: #export 
        
-       (try.assume ( "")))
+       (try.assumed ( "")))
      )]
 
   [Name Text      ..name_size name_is_too_long name from_name name_writer name_parser anonymous]
@@ -446,7 +446,7 @@
     (Writer Mode)
     (|>> :representation
          ..small
-         try.assume
+         try.assumed
          ..small_writer))
 
   (exception: #export (invalid_mode {value Nat})
@@ -569,7 +569,7 @@
 
 (def: no_device
   Device
-  (try.assume (..small 0)))
+  (try.assumed (..small 0)))
 
 (type: #export Tar
   (Row Entry))
@@ -809,7 +809,7 @@
                (get@ #modification_time)
                ..from_big
                .int
-               duration.from_millis
+               duration.of_millis
                (duration.up (|> duration.second duration.to_millis .nat))
                instant.absolute)
            (get@ #mode header)
@@ -867,5 +867,5 @@
 (def: #export parser
   (Parser Tar)
   (|> (<>.some entry_parser)
-      (\ <>.monad map row.from_list)
+      (\ <>.monad map row.of_list)
       (<>.before ..end_of_archive_parser)))
diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux
index 56d394490..867b24cb6 100644
--- a/stdlib/source/library/lux/data/format/xml.lux
+++ b/stdlib/source/library/lux/data/format/xml.lux
@@ -61,7 +61,7 @@
 
                 (#.Some _)
                 (<>.codec int.decimal (.many .hexadecimal)))]
-        (wrap (|> code .nat text.from_code)))
+        (wrap (|> code .nat text.of_code)))
       (<>.before (.this ";"))
       (<>.after (.this "&#"))))
 
@@ -113,7 +113,7 @@
 
 (def: attrs^
   (Parser Attrs)
-  (<| (\ <>.monad map (dictionary.from_list name.hash))
+  (<| (\ <>.monad map (dictionary.of_list name.hash))
       <>.some
       (<>.and (..spaced^ attr_name^))
       (<>.after (.this "="))
@@ -161,7 +161,7 @@
 
 (def: null^
   (Parser Any)
-  (.this (text.from_code 0)))
+  (.this (text.of_code 0)))
 
 (def: xml^
   (Parser XML)
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index 6acc3233c..7dfebd734 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -23,12 +23,12 @@
 
 ## TODO: Instead of ints, chars should be produced fron nats.
 ## (The JVM specifies chars as 16-bit unsigned integers)
-(def: #export from_code
+(def: #export of_code
   (-> Char Text)
   (|>> .int "lux i64 char"))
 
 (template [  ]
-  [(def: #export  (from_code ))
+  [(def: #export  (..of_code ))
    (def: #export  )]
 
   [00 \0  null]
diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux
index 2e9883c78..1002859cc 100644
--- a/stdlib/source/library/lux/data/text/escape.lux
+++ b/stdlib/source/library/lux/data/text/escape.lux
@@ -149,7 +149,7 @@
   (exception.report
    ["In" (%.text text)]
    ["At" (%.nat offset)]
-   ["Name" (%.text (//.from_code sigil))]))
+   ["Name" (%.text (//.of_code sigil))]))
 
 (exception: #export (invalid_unicode_escape {text Text} {offset Nat})
   (exception.report
@@ -183,7 +183,7 @@
     (let [limit' (|> limit (n.- offset) (n.- ..unicode_escape_offset))]
       (#try.Success [(format previous
                              ("lux text clip" 0 offset current)
-                             (//.from_code char))
+                             (//.of_code char))
                      ("lux text clip" (n.+ ..unicode_escape_offset offset) limit' current)
                      limit']))
     
diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux
index a80503d36..c1a1478b6 100644
--- a/stdlib/source/library/lux/data/text/format.lux
+++ b/stdlib/source/library/lux/data/text/format.lux
@@ -89,7 +89,7 @@
             (Format )
             (\  encode))]
 
-         (~~ (template.splice ,))))]
+         (~~ (template.spliced ,))))]
 
   [Nat
    [[nat/2 nat.binary]
diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux
index 38f4155ab..506dca6ab 100644
--- a/stdlib/source/library/lux/data/text/regex.lux
+++ b/stdlib/source/library/lux/data/text/regex.lux
@@ -136,7 +136,7 @@
 (def: control^
   (Parser Text)
   (<>.either (.range (hex "0") (hex "1F"))
-             (.one_of (//.from_code (hex "7F")))))
+             (.one_of (//.of_code (hex "7F")))))
 
 (def: punct^
   (Parser Text)
@@ -150,7 +150,7 @@
 (def: print^
   (Parser Text)
   (<>.either graph^
-             (.one_of (//.from_code (hex "20")))))
+             (.one_of (//.of_code (hex "20")))))
 
 (def: re_system_class^
   (Parser Code)
@@ -489,7 +489,7 @@
                 do_something_else))}
   (with_gensyms [g!temp]
     (wrap (list& (` (^multi (~ g!temp)
-                            [((~! .run) (..regex (~ (code.text pattern))) (~ g!temp))
-                             (#try.Success (~ (maybe.default g!temp bindings)))]))
+                            {((~! .run) (..regex (~ (code.text pattern))) (~ g!temp))
+                             (#try.Success (~ (maybe.default g!temp bindings)))}))
                  body
                  branches))))
diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux
index 2c48aed41..1f2d411f9 100644
--- a/stdlib/source/library/lux/data/text/unicode/set.lux
+++ b/stdlib/source/library/lux/data/text/unicode/set.lux
@@ -223,8 +223,8 @@
     (Equivalence Set)
 
     (def: (= reference subject)
-      (set\= (set.from_list //block.hash (tree.tags (:representation reference)))
-             (set.from_list //block.hash (tree.tags (:representation subject))))))
+      (set\= (set.of_list //block.hash (tree.tags (:representation reference)))
+             (set.of_list //block.hash (tree.tags (:representation subject))))))
   )
 
 (template [ ]
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux
index b73b92035..93506c541 100644
--- a/stdlib/source/library/lux/debug.lux
+++ b/stdlib/source/library/lux/debug.lux
@@ -121,7 +121,7 @@
 
 (for {@.lua (def: (tuple_array tuple)
               (-> (array.Array Any) (array.Array Any))
-              (array.from_list
+              (array.of_list
                (loop [idx 0]
                  (let [member ("lua array read" idx tuple)]
                    (if ("lua object nil?" member)
@@ -146,7 +146,7 @@
                             (`` (<| (~~ (template [ ]
                                           [(case (ffi.check  object)
                                              (#.Some value)
-                                             (`` (|> value (~~ (template.splice ))))
+                                             (`` (|> value (~~ (template.spliced ))))
                                              #.None)]
 
                                           [java/lang/Boolean [(:as .Bit) %.bit]]
@@ -159,12 +159,12 @@
                                       (let [value (:as (array.Array java/lang/Object) value)]
                                         (case (array.read 0 value)
                                           (^multi (#.Some tag)
-                                                  [(ffi.check java/lang/Integer tag)
-                                                   (#.Some tag)]
-                                                  [[(array.read 1 value)
+                                                  {(ffi.check java/lang/Integer tag)
+                                                   (#.Some tag)}
+                                                  {[(array.read 1 value)
                                                     (array.read 2 value)]
                                                    [last?
-                                                    (#.Some choice)]])
+                                                    (#.Some choice)]})
                                           (let [last? (case last?
                                                         (#.Some _) #1
                                                         #.None #0)]
@@ -184,7 +184,7 @@
           (case (ffi.type_of value)
             (^template [ ]
               [
-               (`` (|> value (~~ (template.splice ))))])
+               (`` (|> value (~~ (template.spliced ))))])
             (["boolean" [(:as .Bit) %.bit]]
              ["number" [(:as .Frac) %.frac]]
              ["string" [(:as .Text) %.text]]
@@ -219,7 +219,7 @@
           (case (..str (..type value))
             (^template [  ]
               [(^or  )
-               (`` (|> value (~~ (template.splice ))))])
+               (`` (|> value (~~ (template.spliced ))))])
             (["" "" [(:as .Bit) %.bit]]
              ["" "" [(:as .Int) %.int]]
              ["" "" [(:as .Frac) %.frac]]
@@ -251,7 +251,7 @@
           (case (..type value)
             (^template [ ]
               [
-               (`` (|> value (~~ (template.splice ))))])
+               (`` (|> value (~~ (template.spliced ))))])
             (["boolean" [(:as .Bit) %.bit]]
              ["string" [(:as .Text) %.text]]
              ["nil" [(new> "nil" [])]])
@@ -324,7 +324,7 @@
           (case (..gettype value)
             (^template [ ]
               [
-               (`` (|> value (~~ (template.splice ))))])
+               (`` (|> value (~~ (template.spliced ))))])
             (["boolean" [(:as .Bit) %.bit]]
              ["integer" [(:as .Int) %.int]]
              ["double" [(:as .Frac) %.frac]]
@@ -350,7 +350,7 @@
           @.scheme
           (`` (cond (~~ (template [ ]
                           [( value)
-                           (`` (|> value (~~ (template.splice ))))]
+                           (`` (|> value (~~ (template.spliced ))))]
 
                           [..boolean? [(:as .Bit) %.bit]]
                           [..integer? [(:as .Int) %.int]]
@@ -430,12 +430,12 @@
                 [XML %.xml]))
 
           (do <>.monad
-            [[_ elemT] (.apply (<>.and (.exactly List) .any))
+            [[_ elemT] (.applied (<>.and (.exactly List) .any))
              elemR (.local (list elemT) representation)]
             (wrap (|>> (:as (List Any)) (%.list elemR))))
 
           (do <>.monad
-            [[_ elemT] (.apply (<>.and (.exactly Maybe) .any))
+            [[_ elemT] (.applied (<>.and (.exactly Maybe) .any))
              elemR (.local (list elemT) representation)]
             (wrap (|>> (:as (Maybe Any))
                        (%.maybe elemR)))))))
@@ -496,8 +496,8 @@
          (..tuple_representation representation)
 
          (do <>.monad
-           [[funcT inputsT+] (.apply (<>.and .any (<>.many .any)))]
-           (case (type.apply inputsT+ funcT)
+           [[funcT inputsT+] (.applied (<>.and .any (<>.many .any)))]
+           (case (type.applied inputsT+ funcT)
              (#.Some outputT)
              (.local (list outputT) representation)
 
@@ -568,7 +568,7 @@
                            ## The list is reversed to make sure that, when building the dictionary,
                            ## later bindings overshadow earlier ones if they have the same name.
                            list.reverse
-                           (dictionary.from_list text.hash))]
+                           (dictionary.of_list text.hash))]
      targets (: (Meta (List Target))
                 (case targets
                   #.Nil
diff --git a/stdlib/source/library/lux/ffi.js.lux b/stdlib/source/library/lux/ffi.js.lux
index 8d092aa02..852ed2b11 100644
--- a/stdlib/source/library/lux/ffi.js.lux
+++ b/stdlib/source/library/lux/ffi.js.lux
@@ -382,6 +382,6 @@
 (template: #export (closure  )
   (.:as ..Function
         (`` ("js function"
-             (~~ (template.count ))
+             (~~ (template.amount ))
              (.function (_ [])
                )))))
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index c05a2afe2..6b45f2fbe 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -108,7 +108,7 @@
             [type.float   box.float]
             [type.double  box.double]
             [type.char    box.char])
-      (dictionary.from_list type.hash)))
+      (dictionary.of_list type.hash)))
 
 (template [ 
 ]
   [(def: ( unboxed boxed raw)
@@ -1489,10 +1489,10 @@
                                        [unboxed raw (list)]
                                        
                                        #AutoPrM
-                                       (with_expansions [' (template.splice )
+                                       (with_expansions [' (template.spliced )
                                                           (template [  
 ]
                                                                         [(\ type.equivalence =  unboxed)
-                                                                         (with_expansions [' (template.splice )]
+                                                                         (with_expansions [' (template.spliced )]
                                                                            [
                                                                             (` (.|> (~ raw) (~+ 
)))
                                                                             (list ')])]
@@ -1911,7 +1911,7 @@
                                    params)))))
 
         (#.Apply A F)
-        (case (lux_type.apply (list A) F)
+        (case (lux_type.applied (list A) F)
           #.None
           
 
diff --git a/stdlib/source/library/lux/ffi.lua.lux b/stdlib/source/library/lux/ffi.lua.lux
index bb224c575..1eb32b3bf 100644
--- a/stdlib/source/library/lux/ffi.lua.lux
+++ b/stdlib/source/library/lux/ffi.lua.lux
@@ -305,6 +305,6 @@
 (template: #export (closure  )
   (.:as ..Function
         (`` ("lua function"
-             (~~ (template.count ))
+             (~~ (template.amount ))
              (.function (_ [])
                )))))
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 832d3907f..5b4d49084 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -275,11 +275,11 @@
       Code)
   (case [name+params mode in_array?]
     (^multi [[prim #.Nil] #ManualPrM #0]
-            [(manual_primitive_to_type prim) (#.Some output)])
+            {(manual_primitive_to_type prim) (#.Some output)})
     output
 
     (^multi [[prim #.Nil] #AutoPrM #0]
-            [(auto_primitive_to_type prim) (#.Some output)])
+            {(auto_primitive_to_type prim) (#.Some output)})
     output
     
     [[name params] _ _]
@@ -1497,7 +1497,7 @@
   (let [[full_name class_tvars] class
         full_name (sanitize full_name)
         all_params (|> (member_type_vars class_tvars member)
-                       (list.filter free_type_param?)
+                       (list.only free_type_param?)
                        (list\map type_param_to_type_arg))]
     (case member
       (#EnumDecl enum_members)
@@ -1509,7 +1509,7 @@
 
                               _
                               (let [=class_tvars (|> class_tvars
-                                                     (list.filter free_type_param?)
+                                                     (list.only free_type_param?)
                                                      (list\map type_param_to_type_arg))]
                                 (` (All [(~+ =class_tvars)] (primitive (~ (code.text full_name)) [(~+ =class_tvars)]))))))
                getter_interop (: (-> Text Code)
@@ -1575,7 +1575,7 @@
                        base_gtype)
                tvar_asts (: (List Code)
                             (|> class_tvars
-                                (list.filter free_type_param?)
+                                (list.only free_type_param?)
                                 (list\map type_param_to_type_arg)))
                getter_name (code.identifier ["" (..import_name import_format method_prefix import_field_name)])
                setter_name (code.identifier ["" (..import_name import_format method_prefix (format import_field_name "!"))])]
@@ -1749,7 +1749,7 @@
       (\ meta.monad wrap name)
 
       (#.Apply A F)
-      (case (type.apply (list A) F)
+      (case (type.applied (list A) F)
         #.None
         (meta.fail (format "Cannot apply type: " (type.format F) " to " (type.format A)))
 
diff --git a/stdlib/source/library/lux/ffi.py.lux b/stdlib/source/library/lux/ffi.py.lux
index 737cfefd8..36196c8dc 100644
--- a/stdlib/source/library/lux/ffi.py.lux
+++ b/stdlib/source/library/lux/ffi.py.lux
@@ -310,6 +310,6 @@
 (template: #export (lambda  )
   (.:as ..Function
         (`` ("python function"
-             (~~ (template.count ))
+             (~~ (template.amount ))
              (.function (_ [])
                )))))
diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux
index 554606609..cceaf1777 100644
--- a/stdlib/source/library/lux/locale/language.lux
+++ b/stdlib/source/library/lux/locale/language.lux
@@ -26,7 +26,7 @@
     )
 
   (template []
-    [(with_expansions [' (template.splice )]
+    [(with_expansions [' (template.spliced )]
        (template [   +]
          [(def: #export 
             Language
@@ -37,7 +37,7 @@
                    Language
                    )]
 
-                (~~ (template.splice +))))]
+                (~~ (template.spliced +))))]
 
          '
          ))]
diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux
index be60b6734..f824005b3 100644
--- a/stdlib/source/library/lux/locale/territory.lux
+++ b/stdlib/source/library/lux/locale/territory.lux
@@ -41,7 +41,7 @@
      (`` (template []
            [(def: #export  Territory 
)] - (~~ (template.splice +))))] + (~~ (template.spliced +))))] ["AF" "AFG" 004 "Afghanistan" afghanistan []] ["AX" "ALA" 248 "Åland Islands" aland_islands []] diff --git a/stdlib/source/library/lux/macro/poly.lux b/stdlib/source/library/lux/macro/poly.lux index 5ce420e7a..b40f29a8c 100644 --- a/stdlib/source/library/lux/macro/poly.lux +++ b/stdlib/source/library/lux/macro/poly.lux @@ -6,9 +6,9 @@ [abstract ["." monad (#+ do)]] [control - ["p" parser + ["<>" parser ["<.>" type (#+ Env)] - ["s" code]]] + ["<.>" code]]] [data ["." product] ["." maybe] @@ -25,15 +25,15 @@ ["n" nat]]]]]) (syntax: #export (poly: {export |export|.parser} - {name s.local_identifier} + {name .local_identifier} body) (with_gensyms [g!_ g!type g!output] (let [g!name (code.identifier ["" name])] - (wrap (.list (` ((~! syntax:) (~+ (|export|.format export)) ((~ g!name) {(~ g!type) (~! s.identifier)}) + (wrap (.list (` ((~! syntax:) (~+ (|export|.format export)) ((~ g!name) {(~ g!type) (~! .identifier)}) ((~! do) (~! meta.monad) [(~ g!type) ((~! meta.find_type_def) (~ g!type))] (case (: (.Either .Text .Code) - ((~! .run) ((~! p.rec) + ((~! .run) ((~! <>.rec) (function ((~ g!_) (~ g!name)) (~ body))) (~ g!type))) @@ -54,9 +54,9 @@ #.None)) (syntax: #export (derived: {export |export|.parser} - {?name (p.maybe s.local_identifier)} - {[poly_func poly_args] (s.form (p.and s.identifier (p.many s.identifier)))} - {?custom_impl (p.maybe s.any)}) + {?name (<>.maybe .local_identifier)} + {[poly_func poly_args] (.form (<>.and .identifier (<>.many .identifier)))} + {?custom_impl (<>.maybe .any)}) (do {! meta.monad} [poly_args (monad.map ! meta.normalize poly_args) name (case ?name @@ -64,12 +64,12 @@ (wrap name) (^multi #.None - [(derivation_name (product.right poly_func) (list\map product.right poly_args)) - (#.Some derived_name)]) + {(derivation_name (product.right poly_func) (list\map product.right poly_args)) + (#.Some derived_name)}) (wrap derived_name) _ - (p.fail "derived: was given no explicit name, and cannot generate one from given information.")) + (<>.fail "derived: was given no explicit name, and cannot generate one from given information.")) #let [impl (case ?custom_impl (#.Some custom_impl) custom_impl @@ -114,8 +114,8 @@ (^template [ ] [( left right) (` ( (~+ (list\map (to_code env) ( type)))))]) - ([| #.Sum type.flatten_variant] - [& #.Product type.flatten_tuple]) + ([| #.Sum type.flat_variant] + [& #.Product type.flat_tuple]) (#.Named name sub_type) (code.identifier name) diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux index c489703fc..36edd6a1e 100644 --- a/stdlib/source/library/lux/macro/template.lux +++ b/stdlib/source/library/lux/macro/template.lux @@ -26,10 +26,10 @@ ["." code] ["." local]]) -(syntax: #export (splice {parts (.tuple (<>.some .any))}) +(syntax: #export (spliced {parts (.tuple (<>.some .any))}) (wrap parts)) -(syntax: #export (count {parts (.tuple (<>.some .any))}) +(syntax: #export (amount {parts (.tuple (<>.some .any))}) (wrap (list (code.nat (list.size parts))))) (syntax: #export (with_locals {locals (.tuple (<>.some .local_identifier))} @@ -100,7 +100,7 @@ (type: Environment (Dictionary Text Code)) -(def: (apply env template) +(def: (applied env template) (-> Environment Code Code) (case template [_ (#.Identifier "" name)] @@ -113,15 +113,15 @@ (^template [] [[meta ( elems)] - [meta ( (list\map (apply env) elems))]]) + [meta ( (list\map (applied env) elems))]]) ([#.Tuple] [#.Form]) [meta (#.Record members)] [meta (#.Record (list\map (: (-> [Code Code] [Code Code]) (function (_ [key value]) - [(apply env key) - (apply env value)])) + [(applied env key) + (applied env value)])) members))] _ @@ -141,14 +141,14 @@ (-> Local Macro) ("lux macro" (function (_ inputs compiler) - (.let [parameters_count (list.size parameters) - inputs_count (list.size inputs)] - (if (nat.= parameters_count inputs_count) + (.let [parameters_amount (list.size parameters) + inputs_amount (list.size inputs)] + (if (nat.= parameters_amount inputs_amount) (.let [environment (: Environment (|> (list.zip/2 parameters inputs) - (dictionary.from_list text.hash)))] - (#.Right [compiler (list\map (..apply environment) template)])) - (exception.throw ..irregular_arguments [parameters_count inputs_count])))))) + (dictionary.of_list text.hash)))] + (#.Right [compiler (list\map (..applied environment) template)])) + (exception.throw ..irregular_arguments [parameters_amount inputs_amount])))))) (def: local (Parser Local) diff --git a/stdlib/source/library/lux/math/logic/fuzzy.lux b/stdlib/source/library/lux/math/logic/fuzzy.lux index c1815f3db..c00f63c43 100644 --- a/stdlib/source/library/lux/math/logic/fuzzy.lux +++ b/stdlib/source/library/lux/math/logic/fuzzy.lux @@ -57,7 +57,7 @@ (All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) (..intersection (..complement sub) base)) -(def: #export (from_predicate predicate) +(def: #export (of_predicate predicate) (All [a] (-> (Predicate a) (Fuzzy a))) (function (_ elem) (if (predicate elem) @@ -69,9 +69,9 @@ (function (_ elem) (/.> treshold (set elem)))) -(def: #export from_set +(def: #export of_set (All [a] (-> (Set a) (Fuzzy a))) - (|>> set.member? ..from_predicate)) + (|>> set.member? ..of_predicate)) (def: (ascending from to) (-> Rev Rev (Fuzzy Rev)) diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux index fa654a408..b607b6e6a 100644 --- a/stdlib/source/library/lux/math/modulus.lux +++ b/stdlib/source/library/lux/math/modulus.lux @@ -53,4 +53,4 @@ (meta.lift (do try.monad [_ (..modulus divisor)] - (wrap (list (` ((~! try.assume) (..modulus (~ (code.int divisor)))))))))) + (wrap (list (` ((~! try.assumed) (..modulus (~ (code.int divisor)))))))))) diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux index 506fde750..dd03f37b3 100644 --- a/stdlib/source/library/lux/math/number.lux +++ b/stdlib/source/library/lux/math/number.lux @@ -13,7 +13,7 @@ ["#." rev] ["#." frac]]) -(macro: (encoding_doc tokens state) +(macro: (documentation tokens state) (case tokens (^ (list [location (#.Text encoding)] example_1 example_2)) (let [encoding ($_ "lux text concat" @@ -27,7 +27,7 @@ (~ example_2))))])) _ - (#try.Failure "Wrong syntax for 'encoding_doc'."))) + (#try.Failure "Wrong syntax for 'documentation'."))) (def: separator ",") @@ -41,7 +41,7 @@ _ #0)) -(def: clean_separators +(def: without_separators (-> Text Text) (text.replace_all ..separator "")) @@ -52,21 +52,21 @@ (#.Cons [meta (#.Text repr')] #.Nil) (if (..separator_prefixed? repr') (#try.Failure ) - (let [repr (..clean_separators repr')] + (let [repr (..without_separators repr')] (case (\ decode repr) (#try.Success value) (#try.Success [state (list [meta (#.Nat value)])]) (^multi (#try.Failure _) - [(\ decode repr) (#try.Success value)]) + {(\ decode repr) (#try.Success value)}) (#try.Success [state (list [meta (#.Int value)])]) (^multi (#try.Failure _) - [(\ decode repr) (#try.Success value)]) + {(\ decode repr) (#try.Success value)}) (#try.Success [state (list [meta (#.Rev value)])]) (^multi (#try.Failure _) - [(\ decode repr) (#try.Success value)]) + {(\ decode repr) (#try.Success value)}) (#try.Success [state (list [meta (#.Frac value)])]) _ @@ -77,11 +77,11 @@ [bin /nat.binary /int.binary /rev.binary /frac.binary "Invalid binary syntax." - (encoding_doc "binary" (bin "11001001") (bin "11,00,10,01"))] + (..documentation "binary" (bin "11001001") (bin "11,00,10,01"))] [oct /nat.octal /int.octal /rev.octal /frac.octal "Invalid octal syntax." - (encoding_doc "octal" (oct "615243") (oct "615,243"))] + (..documentation "octal" (oct "615243") (oct "615,243"))] [hex /nat.hex /int.hex /rev.hex /frac.hex "Invalid hexadecimal syntax." - (encoding_doc "hexadecimal" (hex "deadBEEF") (hex "dead,BEEF"))] + (..documentation "hexadecimal" (hex "deadBEEF") (hex "dead,BEEF"))] ) diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index f6f01192e..1b0e1e52a 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -230,7 +230,11 @@ (def: sign_offset (//nat.+ ..exponent_size ..exponent_offset)) (template [ ] - [(def: (|> (\ //nat.hex decode) try.assume ))] + [(def: + (|> + (\ //nat.hex decode) + try.assumed + ))] [.i64 "FFF8000000000000" not_a_number_bits] [.i64 "7FF0000000000000" positive_infinity_bits] @@ -306,7 +310,7 @@ [sign 1 ..sign_offset] ) -(def: #export (from_bits input) +(def: #export (of_bits input) (-> I64 Frac) (case [(: Nat (..exponent input)) (: Nat (..mantissa input)) @@ -411,7 +415,7 @@ 0 whole _ ("lux text concat" whole (\ encode decimal)))) #let [sign (if negative? 1 0)]] - (wrap (..from_bits + (wrap (..of_bits ($_ //i64.or (//i64.left_shift ..sign_offset (.i64 sign)) (//i64.left_shift ..mantissa_size (.i64 (//int.+ (.int ..double_bias) exponent))) diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux index 357b36557..f11eee2f4 100644 --- a/stdlib/source/library/lux/math/number/i64.lux +++ b/stdlib/source/library/lux/math/number/i64.lux @@ -163,7 +163,7 @@ (repetitions size "1") (repetitions size "0"))) - high (try.assume (\ n.binary decode pattern)) + high (try.assumed (\ n.binary decode pattern)) low (..rotate_right size high)] (function (_ value) (..or (..right_shift size (..and high value)) diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux index 8b555e21d..3c3cf9448 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -78,14 +78,14 @@ (let [[state' fa] (ffa state)] (fa state'))))) -(def: #export (filter pred gen) +(def: #export (only pred gen) {#.doc "Retries the generator until the output satisfies a predicate."} (All [a] (-> (-> a Bit) (Random a) (Random a))) (do ..monad [sample gen] (if (pred sample) (wrap sample) - (filter pred gen)))) + (only pred gen)))) (def: #export (one check random) (All [a b] @@ -138,7 +138,7 @@ (def: #export frac (Random Frac) - (\ ..monad map (|>> .i64 f.from_bits) ..nat)) + (\ ..monad map (|>> .i64 f.of_bits) ..nat)) (def: #export safe_frac (Random Frac) @@ -158,7 +158,7 @@ (|>> (n.% size) (n.+ start)))] (|> ..nat (\ ..monad map in_range) - (..filter (unicode.member? set))))) + (..only (unicode.member? set))))) (def: #export (text char_gen size) (-> (Random Char) Nat (Random Text)) @@ -167,7 +167,7 @@ (do ..monad [x char_gen xs (text char_gen (dec size))] - (wrap (text\compose (text.from_code x) xs))))) + (wrap (text\compose (text.of_code x) xs))))) (template [ ] [(def: #export @@ -263,8 +263,8 @@ [values (list size value_gen)] (wrap (|> values ))))] - [array Array array.from_list] - [queue Queue queue.from_list] + [array Array array.of_list] + [queue Queue queue.of_list] [stack Stack (list\fold stack.push stack.empty)] ) @@ -299,7 +299,7 @@ (def: #export instant (Random Instant) - (\ ..monad map instant.from_millis ..int)) + (\ ..monad map instant.of_millis ..int)) (def: #export date (Random Date) @@ -311,7 +311,7 @@ (def: #export duration (Random Duration) - (\ ..monad map duration.from_millis ..int)) + (\ ..monad map duration.of_millis ..int)) (def: #export month (Random Month) diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index b86100325..5415b7c9e 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -514,9 +514,9 @@ [=module (..find_module module) this_module_name ..current_module_name] (wrap (|> (get@ #.types =module) - (list.filter (function (_ [type_name [tag_list exported? type]]) - (or exported? - (text\= this_module_name module)))) + (list.only (function (_ [type_name [tag_list exported? type]]) + (or exported? + (text\= this_module_name module)))) (list\map (function (_ [type_name [tag_list exported? type]]) [tag_list type])))))) @@ -535,7 +535,7 @@ [name type]))) scopes)])))) -(def: #export (un_alias def_name) +(def: #export (de_aliased def_name) {#.doc "Given an aliased definition's name, returns the original definition being referenced."} (-> Name (Meta Name)) (do ..monad diff --git a/stdlib/source/library/lux/meta/annotation.lux b/stdlib/source/library/lux/meta/annotation.lux index 1b7ee480b..14f55f106 100644 --- a/stdlib/source/library/lux/meta/annotation.lux +++ b/stdlib/source/library/lux/meta/annotation.lux @@ -73,7 +73,7 @@ [signature? #.sig?] ) -(def: (parse_text input) +(def: (text_parser input) (-> Code (Maybe Text)) (case input [_ (#.Text actual_value)] @@ -88,7 +88,7 @@ (maybe.default (list) (do {! maybe.monad} [args (..tuple (name_of ) ann)] - (monad.map ! ..parse_text args))))] + (monad.map ! ..text_parser args))))] [function_arguments #.func-args] [type_arguments #.type-args] diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux index 2ec6746c2..2ebcb6a8e 100644 --- a/stdlib/source/library/lux/target/common_lisp.lux +++ b/stdlib/source/library/lux/target/common_lisp.lux @@ -199,16 +199,16 @@ body))) (template [ + + +] - [(`` (def: #export ( [(~~ (template.splice +))] function) - (-> [(~~ (template.splice +))] (Expression Any) (Computation Any)) - (..call/* function (list (~~ (template.splice +)))))) + [(`` (def: #export ( [(~~ (template.spliced +))] function) + (-> [(~~ (template.spliced +))] (Expression Any) (Computation Any)) + (..call/* function (list (~~ (template.spliced +)))))) (`` (template [ ] [(def: #export ( args) - (-> [(~~ (template.splice +))] (Computation Any)) + (-> [(~~ (template.spliced +))] (Computation Any)) ( args (..var )))] - (~~ (template.splice +))))] + (~~ (template.spliced +))))] [call/0 [] [] [[get-universal-time/0 "get-universal-time"] @@ -263,10 +263,10 @@ (template [ + +] [(`` (template [ ] [(def: #export ( args) - (-> [(~~ (template.splice +))] (Access Any)) + (-> [(~~ (template.spliced +))] (Access Any)) (:transmutation ( args (..var ))))] - (~~ (template.splice +))))] + (~~ (template.spliced +))))] [call/1 [(Expression Any)] [[car/1 "car"] diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux index d7b42280c..26c2e7b41 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -35,7 +35,7 @@ (template [ +] [(with_expansions [ (template.identifier [ "'"])] (abstract: ( brand) Any) - (`` (type: #export (|> Any (~~ (template.splice +))))))] + (`` (type: #export (|> Any (~~ (template.spliced +))))))] [Expression [Code]] [Computation [Expression' Code]] @@ -46,7 +46,7 @@ (template [ +] [(with_expansions [ (template.identifier [ "'"])] (abstract: #export Any) - (`` (type: #export (|> (~~ (template.splice +))))))] + (`` (type: #export (|> (~~ (template.spliced +))))))] [Var [Location' Computation' Expression' Code]] [Access [Location' Computation' Expression' Code]] @@ -429,14 +429,14 @@ (template [ + + +] [(`` (def: #export ( function) - (-> Expression (~~ (template.splice +)) Computation) - (.function (_ (~~ (template.splice +))) - (..apply/* function (list (~~ (template.splice +))))))) + (-> Expression (~~ (template.spliced +)) Computation) + (.function (_ (~~ (template.spliced +))) + (..apply/* function (list (~~ (template.spliced +))))))) (`` (template [ ] [(def: #export ( (..var )))] - (~~ (template.splice +))))] + (~~ (template.spliced +))))] [apply/1 [_0] [Expression] [[not_a_number? "isNaN"]]] diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux index 9869a6f8b..d7d3cd36c 100644 --- a/stdlib/source/library/lux/target/jvm/attribute.lux +++ b/stdlib/source/library/lux/target/jvm/attribute.lux @@ -87,7 +87,7 @@ (def: (constant' @name index) (-> (Index UTF8) (Constant Any) Attribute) (#Constant {#name @name - #length (|> /constant.length //unsigned.u4 try.assume) + #length (|> /constant.length //unsigned.u4 try.assumed) #info index})) (def: #export (constant index) @@ -104,7 +104,7 @@ #length (|> specification (/code.length ..length) //unsigned.u4 - try.assume) + try.assumed) #info specification})) (def: #export (code specification) diff --git a/stdlib/source/library/lux/target/jvm/attribute/code.lux b/stdlib/source/library/lux/target/jvm/attribute/code.lux index 80cc7a6ad..2f80d96d2 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code.lux @@ -1,7 +1,6 @@ (.module: [library [lux (#- Code) - [type (#+ :share)] [abstract [equivalence (#+ Equivalence)]] [data diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index 82b2d30db..0d94ae9f1 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -198,7 +198,7 @@ []]])))) (template [ ] - [(def: U2 (|> //unsigned.u2 try.assume))] + [(def: U2 (|> //unsigned.u2 try.assumed))] [$0 0] [$1 1] @@ -210,7 +210,7 @@ ) (template [ ] - [(def: Registry (|> //unsigned.u2 try.assume /registry.registry))] + [(def: Registry (|> //unsigned.u2 try.assumed /registry.registry))] [@_ 0] [@0 1] @@ -589,7 +589,7 @@ (template [ ] [(def: #export ( local) (-> Nat (Bytecode Any)) - (with_expansions [' (template.splice )] + (with_expansions [' (template.spliced )] (`` (case local (~~ (template [ ] [ (..bytecode $0 [])] @@ -629,7 +629,7 @@ (template [ ] [(def: #export ( local) (-> Nat (Bytecode Any)) - (with_expansions [' (template.splice )] + (with_expansions [' (template.spliced )] (`` (case local (~~ (template [ ] [ (..bytecode $0 [])] @@ -977,8 +977,8 @@ (list\map ..type_size) (list\fold n.+ (if 0 1)) //unsigned.u1 - try.assume) - production (|> output ..type_size //unsigned.u1 try.assume)]] + try.assumed) + production (|> output ..type_size //unsigned.u1 try.assumed)]] (..bytecode (//unsigned.lift/2 consumption) (//unsigned.lift/2 production) @_ diff --git a/stdlib/source/library/lux/target/jvm/bytecode/address.lux b/stdlib/source/library/lux/target/jvm/bytecode/address.lux index 8d51a8597..8a42afb41 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/address.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/address.lux @@ -32,7 +32,7 @@ (def: #export start Address - (|> 0 ///unsigned.u2 try.assume :abstraction)) + (|> 0 ///unsigned.u2 try.assumed :abstraction)) (def: #export (move distance) (-> U2 (-> Address (Try Address))) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux index 090fc64fe..3773b4333 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux @@ -76,10 +76,10 @@ (template [ ] [(def: #export (-> Register Registry) - (let [extra (|> /////unsigned.u2 try.assume)] + (let [extra (|> /////unsigned.u2 try.assumed)] (|>> /////unsigned.lift/2 (/////unsigned.+/2 extra) - try.assume + try.assumed :abstraction)))] [for ..normal] diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index 65e36875f..d4f4ba688 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -59,7 +59,7 @@ (type: Opcode Nat) (template [ ] - [(def: Size (|> ///unsigned.u2 try.assume))] + [(def: Size (|> ///unsigned.u2 try.assumed))] [opcode_size 1] [register_size 1] @@ -74,7 +74,7 @@ (function (_ [offset binary]) [(n.+ (///unsigned.value ..opcode_size) offset) - (try.assume + (try.assumed (binary.write/8 offset opcode binary))])) (def: nullary @@ -89,7 +89,8 @@ [(def: Size (|> ..opcode_size - (///unsigned.+/2 ) try.assume))] + (///unsigned.+/2 ) + try.assumed))] [size/1 ..register_size] [size/2 ..index_size] @@ -102,7 +103,7 @@ (-> Opcode Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ) offset) - (try.assume + (try.assumed (do try.monad [_ (binary.write/8 offset opcode binary)] ( (n.+ (///unsigned.value ..opcode_size) offset) @@ -128,7 +129,7 @@ (-> Opcode Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ) offset) - (try.assume + (try.assumed (do try.monad [_ (binary.write/8 offset opcode binary)] ( (n.+ (///unsigned.value ..opcode_size) offset) @@ -149,14 +150,14 @@ (def: size/11 Size (|> ..opcode_size - (///unsigned.+/2 ..register_size) try.assume - (///unsigned.+/2 ..byte_size) try.assume)) + (///unsigned.+/2 ..register_size) try.assumed + (///unsigned.+/2 ..byte_size) try.assumed)) (def: (binary/11' opcode input0 input1) (-> Opcode U1 U1 Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..size/11) offset) - (try.assume + (try.assumed (do try.monad [_ (binary.write/8 offset opcode binary) _ (binary.write/8 (n.+ (///unsigned.value ..opcode_size) offset) @@ -176,14 +177,14 @@ (def: size/21 Size (|> ..opcode_size - (///unsigned.+/2 ..index_size) try.assume - (///unsigned.+/2 ..byte_size) try.assume)) + (///unsigned.+/2 ..index_size) try.assumed + (///unsigned.+/2 ..byte_size) try.assumed)) (def: (binary/21' opcode input0 input1) (-> Opcode U2 U1 Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..size/21) offset) - (try.assume + (try.assumed (do try.monad [_ (binary.write/8 offset opcode binary) _ (binary.write/16 (n.+ (///unsigned.value ..opcode_size) offset) @@ -203,15 +204,15 @@ (def: size/211 Size (|> ..opcode_size - (///unsigned.+/2 ..index_size) try.assume - (///unsigned.+/2 ..byte_size) try.assume - (///unsigned.+/2 ..byte_size) try.assume)) + (///unsigned.+/2 ..index_size) try.assumed + (///unsigned.+/2 ..byte_size) try.assumed + (///unsigned.+/2 ..byte_size) try.assumed)) (def: (trinary/211' opcode input0 input1 input2) (-> Opcode U2 U1 U1 Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..size/211) offset) - (try.assume + (try.assumed (do try.monad [_ (binary.write/8 offset opcode binary) _ (binary.write/16 (n.+ (///unsigned.value ..opcode_size) offset) @@ -239,7 +240,7 @@ (|>> :representation)) (template [ ] - [(def: #export (|> ///unsigned.u1 try.assume :abstraction))] + [(def: #export (|> ///unsigned.u1 try.assumed :abstraction))] [04 t_boolean] [05 t_char] @@ -479,9 +480,9 @@ ["B4" getfield/1] ["B4" getfield/2] ["B5" putfield/1] ["B5" putfield/2])] (template [ ] - [(with_expansions [' (template.splice )] + [(with_expansions [' (template.spliced )] (template [ ] - [(with_expansions [' (template.splice ) + [(with_expansions [' (template.spliced ) (template [ ] [] @@ -495,7 +496,7 @@ (let [[estimator '] ] [estimator (function (_ []) - (`` (' (hex ) (~~ (template.splice )))))])))] + (`` (' (hex ) (~~ (template.spliced )))))])))] ' ))] @@ -570,7 +571,7 @@ [["C5" multianewarray [[index (Index Class)] [count U1]] [(///index.value index) count]]]] [..trinary/211 - [["B9" invokeinterface [[index (Index (Reference Method))] [count U1] [output_count U1]] [(///index.value index) count (try.assume (///unsigned.u1 0))]]]] + [["B9" invokeinterface [[index (Index (Reference Method))] [count U1] [output_count U1]] [(///index.value index) count (try.assumed (///unsigned.u1 0))]]]] )) (def: (switch_padding offset) @@ -595,14 +596,14 @@ (n.* (///unsigned.value ..big_jump_size) (inc amount_of_afterwards))) ///unsigned.u2 - try.assume)))] + try.assumed)))] [estimator (function (_ minimum default [at_minimum afterwards]) (let [amount_of_afterwards (list.size afterwards) estimator (estimator amount_of_afterwards)] (function (_ [size mutation]) (let [padding (switch_padding size) - tableswitch_size (try.assume + tableswitch_size (try.assumed (do {! try.monad} [size (///unsigned.u2 size)] (\ ! map (|>> estimator ///unsigned.value) @@ -610,7 +611,7 @@ tableswitch_mutation (: Mutation (function (_ [offset binary]) [(n.+ tableswitch_size offset) - (try.assume + (try.assumed (do {! try.monad} [amount_of_afterwards (|> amount_of_afterwards .int ///signed.s4) maximum (///signed.+/4 minimum amount_of_afterwards) @@ -659,14 +660,14 @@ (///unsigned.value ..integer_size) (n.* amount_of_cases case_size)) ///unsigned.u2 - try.assume)))] + try.assumed)))] [estimator (function (_ default cases) (let [amount_of_cases (list.size cases) estimator (estimator amount_of_cases)] (function (_ [size mutation]) (let [padding (switch_padding size) - lookupswitch_size (try.assume + lookupswitch_size (try.assumed (do {! try.monad} [size (///unsigned.u2 size)] (\ ! map (|>> estimator ///unsigned.value) @@ -674,7 +675,7 @@ lookupswitch_mutation (: Mutation (function (_ [offset binary]) [(n.+ lookupswitch_size offset) - (try.assume + (try.assumed (do {! try.monad} [_ (binary.write/8 offset (hex "AB") binary) #let [offset (n.+ (///unsigned.value ..opcode_size) offset)] diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux index 7f6705de8..165f9a33f 100644 --- a/stdlib/source/library/lux/target/jvm/class.lux +++ b/stdlib/source/library/lux/target/jvm/class.lux @@ -106,8 +106,8 @@ #this @this #super @super #interfaces @interfaces - #fields (row.from_list =fields) - #methods (row.from_list =methods) + #fields (row.of_list =fields) + #methods (row.of_list =methods) #attributes attributes}))) (def: #export (writer class) diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index 663dc472f..7f2a7aa26 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -115,8 +115,8 @@ [(def: (Writer ) (`` (|>> :representation - (~~ (template.splice )) - (~~ (template.splice )))))] + (~~ (template.spliced )) + (~~ (template.spliced )))))] [integer_writer Integer [] [binaryF.bits/32]] [float_writer Float [java/lang/Float::floatToRawIntBits ffi.int_to_long (:as I64)] [i32.i32 binaryF.bits/32]] diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux index e7fa465d8..b4697768a 100644 --- a/stdlib/source/library/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux @@ -154,5 +154,5 @@ (def: #export empty Pool - [(|> 1 //unsigned.u2 try.assume //index.index) + [(|> 1 //unsigned.u2 try.assumed //index.index) row.empty]) diff --git a/stdlib/source/library/lux/target/jvm/constant/tag.lux b/stdlib/source/library/lux/target/jvm/constant/tag.lux index 414de077b..0eba9788e 100644 --- a/stdlib/source/library/lux/target/jvm/constant/tag.lux +++ b/stdlib/source/library/lux/target/jvm/constant/tag.lux @@ -26,7 +26,7 @@ (template [ ] [(def: #export Tag - (|> ///unsigned.u1 try.assume :abstraction))] + (|> ///unsigned.u1 try.assumed :abstraction))] [01 utf8] [03 integer] diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux index 49beb0a66..5cc5e9310 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -80,19 +80,19 @@ (def: #export (define class_name bytecode loader) (-> Text Binary java/lang/ClassLoader (Try java/lang/Object)) - (let [signature (array.from_list (list (:as java/lang/Object - class_name) - (:as java/lang/Object - bytecode) - (:as java/lang/Object - (|> 0 - (:as (primitive "java.lang.Long")) - ffi.long_to_int)) - (:as java/lang/Object - (|> bytecode - binary.size - (:as (primitive "java.lang.Long")) - ffi.long_to_int))))] + (let [signature (array.of_list (list (:as java/lang/Object + class_name) + (:as java/lang/Object + bytecode) + (:as java/lang/Object + (|> 0 + (:as (primitive "java.lang.Long")) + ffi.long_to_int)) + (:as java/lang/Object + (|> bytecode + binary.size + (:as (primitive "java.lang.Long")) + ffi.long_to_int))))] (java/lang/reflect/Method::invoke loader signature java/lang/ClassLoader::defineClass))) (def: #export (new_library _) diff --git a/stdlib/source/library/lux/target/jvm/magic.lux b/stdlib/source/library/lux/target/jvm/magic.lux index 70859362b..fee2c425a 100644 --- a/stdlib/source/library/lux/target/jvm/magic.lux +++ b/stdlib/source/library/lux/target/jvm/magic.lux @@ -14,7 +14,7 @@ (def: #export code Magic - (|> (hex "CAFEBABE") //unsigned.u4 try.assume)) + (|> (hex "CAFEBABE") //unsigned.u4 try.assumed)) (def: #export writer //unsigned.writer/4) diff --git a/stdlib/source/library/lux/target/jvm/method.lux b/stdlib/source/library/lux/target/jvm/method.lux index e832b1667..3dcc4d7a2 100644 --- a/stdlib/source/library/lux/target/jvm/method.lux +++ b/stdlib/source/library/lux/target/jvm/method.lux @@ -55,7 +55,7 @@ @descriptor (//constant/pool.descriptor (//type.descriptor type)) attributes (|> attributes (monad.seq !) - (\ ! map row.from_list)) + (\ ! map row.of_list)) attributes (case code (#.Some code) (do ! diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux index 109486231..80db613de 100644 --- a/stdlib/source/library/lux/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/target/jvm/modifier.lux @@ -41,7 +41,7 @@ (template: (!wrap value) (|> value //unsigned.u2 - try.assume + try.assumed :abstraction)) (template: (!unwrap value) diff --git a/stdlib/source/library/lux/target/jvm/type/alias.lux b/stdlib/source/library/lux/target/jvm/type/alias.lux index 594a75562..315dff281 100644 --- a/stdlib/source/library/lux/target/jvm/type/alias.lux +++ b/stdlib/source/library/lux/target/jvm/type/alias.lux @@ -128,4 +128,4 @@ return (..return aliasing) exceptions (<>.some (..exception aliasing))] (wrap (//.method [type_variables inputs return exceptions])))) - try.assume)) + try.assumed)) diff --git a/stdlib/source/library/lux/target/jvm/type/category.lux b/stdlib/source/library/lux/target/jvm/type/category.lux index f6c17a280..7f492290d 100644 --- a/stdlib/source/library/lux/target/jvm/type/category.lux +++ b/stdlib/source/library/lux/target/jvm/type/category.lux @@ -25,7 +25,7 @@ [(with_expansions [ (template.identifier [ "'"])] (abstract: #export Any) (type: #export - (`` (<| Return' Value' (~~ (template.splice )) ))))] + (`` (<| Return' Value' (~~ (template.spliced )) ))))] [[] Primitive] [[Object' Parameter'] Var] diff --git a/stdlib/source/library/lux/target/jvm/type/parser.lux b/stdlib/source/library/lux/target/jvm/type/parser.lux index eac2f5fcb..5c8f218b9 100644 --- a/stdlib/source/library/lux/target/jvm/type/parser.lux +++ b/stdlib/source/library/lux/target/jvm/type/parser.lux @@ -91,14 +91,14 @@ (|>> //.signature //signature.signature (.run ..var') - try.to_maybe)) + try.maybe)) (def: #export name (-> (Type Var) Text) (|>> //.signature //signature.signature (.run ..var') - try.assume)) + try.assumed)) (template [ ] [(def: @@ -155,7 +155,7 @@ (|>> //.signature //signature.signature (.run (<>.after (.this ) ..class)) - try.to_maybe))] + try.maybe))] [lower? //signature.lower_prefix //.lower] [upper? //signature.upper_prefix //.upper] @@ -166,7 +166,7 @@ (|>> //.signature //signature.signature (.run (..class'' ..parameter)) - try.assume)) + try.assumed)) (def: #export value (Parser (Type Value)) @@ -224,7 +224,7 @@ (|>> //.signature //signature.signature (.run parser) - try.assume))) + try.assumed))) (template [ ] [(def: #export @@ -232,7 +232,7 @@ (|>> //.signature //signature.signature (.run ) - try.to_maybe))] + try.maybe))] [array? (Type Value) (do <>.monad @@ -262,4 +262,4 @@ (|>> //.signature //signature.signature (.run ..declaration') - try.assume)) + try.assumed)) diff --git a/stdlib/source/library/lux/target/jvm/version.lux b/stdlib/source/library/lux/target/jvm/version.lux index 0aaf297de..d22ca84e2 100644 --- a/stdlib/source/library/lux/target/jvm/version.lux +++ b/stdlib/source/library/lux/target/jvm/version.lux @@ -13,12 +13,12 @@ (def: #export default_minor Minor - (|> 0 //unsigned.u2 try.assume)) + (|> 0 //unsigned.u2 try.assumed)) (template [ ] [(def: #export Major - (|> //unsigned.u2 try.assume))] + (|> //unsigned.u2 try.assumed))] [45 v1_1] [46 v1_2] diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux index 7e0202481..11f2c285e 100644 --- a/stdlib/source/library/lux/target/lua.lux +++ b/stdlib/source/library/lux/target/lua.lux @@ -61,7 +61,7 @@ (template [ +] [(with_expansions [ (template.identifier [ "'"])] (abstract: ( brand) Any) - (`` (type: #export (|> Any (~~ (template.splice +))))))] + (`` (type: #export (|> Any (~~ (template.spliced +))))))] [Expression [Code]] [Computation [Expression' Code]] @@ -72,7 +72,7 @@ (template [ +] [(with_expansions [ (template.identifier [ "'"])] (abstract: #export Any) - (`` (type: #export (|> (~~ (template.splice +))))))] + (`` (type: #export (|> (~~ (template.spliced +))))))] [Literal [Computation' Expression' Code]] [Var [Location' Computation' Expression' Code]] @@ -383,7 +383,7 @@ [(with_expansions [ (template.identifier ["apply/" ]) (arity_inputs ) (arity_types ) - (template.splice +)] + (template.spliced +)] (def: #export ( function ) (-> Expression Computation) (..apply/* (.list ) function)) diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux index 6a3e01fbb..5008eae43 100644 --- a/stdlib/source/library/lux/target/php.lux +++ b/stdlib/source/library/lux/target/php.lux @@ -69,7 +69,7 @@ (template [ +] [(with_expansions [ (template.identifier [ "'"])] (abstract: ( brand) Any) - (`` (type: #export (|> Any (~~ (template.splice +))))))] + (`` (type: #export (|> Any (~~ (template.spliced +))))))] [Expression [Code]] [Computation [Expression' Code]] @@ -80,7 +80,7 @@ (template [ +] [(with_expansions [ (template.identifier [ "'"])] (abstract: #export Any) - (`` (type: #export (|> (~~ (template.splice +))))))] + (`` (type: #export (|> (~~ (template.spliced +))))))] [Literal [Computation' Expression' Code]] [Var [Location' Computation' Expression' Code]] @@ -239,7 +239,7 @@ [(with_expansions [ (template.identifier ["apply/" ]) (arity_inputs ) (arity_types ) - (template.splice +)] + (template.spliced +)] (def: #export ( function []) (-> Expression [] Computation) (..apply/* (.list ) function)) diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index 49c3d8612..0cf6d2c27 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -469,7 +469,7 @@ [(with_expansions [ (template.identifier ["apply/" ]) (arity_inputs ) (arity_types ) - (template.splice +)] + (template.spliced +)] (def: #export ( function ) (-> (Expression Any) (Computation Any)) (..apply/* function (.list ))) diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux index fee2e206b..06f516e75 100644 --- a/stdlib/source/library/lux/target/r.lux +++ b/stdlib/source/library/lux/target/r.lux @@ -30,7 +30,7 @@ (template [ +] [(with_expansions [ (template.identifier [ "'"])] (abstract: #export ( kind) Any) - (`` (type: #export (|> Any (~~ (template.splice +))))))] + (`` (type: #export (|> Any (~~ (template.spliced +))))))] [Expression [Code]] ) @@ -38,7 +38,7 @@ (template [ +] [(with_expansions [ (template.identifier [ "'"])] (abstract: #export ( kind) Any) - (`` (type: #export ( ) (|> (~~ (template.splice +))))))] + (`` (type: #export ( ) (|> (~~ (template.spliced +))))))] [Var [Expression' Code]] ) @@ -217,7 +217,7 @@ [(with_expansions [ (template.identifier ["apply/" ]) (arity_inputs ) (arity_types ) - (template.splice +)] + (template.spliced +)] (def: #export ( function []) (-> Expression [] Expression) (..apply (.list ) function)) diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index 3eb4f07b9..a7dd6907f 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -61,7 +61,7 @@ (template [ +] [(with_expansions [ (template.identifier [ "'"])] (abstract: ( brand) Any) - (`` (type: #export (|> Any (~~ (template.splice +))))))] + (`` (type: #export (|> Any (~~ (template.spliced +))))))] [Expression [Code]] [Computation [Expression' Code]] @@ -74,7 +74,7 @@ (template [ +] [(with_expansions [ (template.identifier [ "'"])] (abstract: #export Any) - (`` (type: #export (|> (~~ (template.splice +))))))] + (`` (type: #export (|> (~~ (template.spliced +))))))] [Literal [Computation' Expression' Code]] [Access [Location' Computation' Expression' Code]] @@ -445,7 +445,7 @@ [(with_expansions [ (template.identifier ["apply/" ]) (arity_inputs ) (arity_types ) - (template.splice +)] + (template.spliced +)] (def: #export ( function ) (-> Expression Computation) (..apply/* (.list ) function)) diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux index 8e1308e04..43b94d459 100644 --- a/stdlib/source/library/lux/target/scheme.lux +++ b/stdlib/source/library/lux/target/scheme.lux @@ -43,14 +43,14 @@ (template [ +] [(abstract: #export ( brand) Any) - (`` (type: #export (|> Any (~~ (template.splice +)))))] + (`` (type: #export (|> Any (~~ (template.spliced +)))))] [Expression Expression' [Code]] ) (template [ +] [(abstract: #export Any) - (`` (type: #export (|> (~~ (template.splice +)))))] + (`` (type: #export (|> (~~ (template.spliced +)))))] [Var Var' [Expression' Code]] [Computation Computation' [Expression' Code]] @@ -192,14 +192,14 @@ (template [ + + +] [(`` (def: #export ( procedure) - (-> Expression (~~ (template.splice +)) Computation) - (function (_ (~~ (template.splice +))) - (..apply/* (list (~~ (template.splice +))) procedure)))) + (-> Expression (~~ (template.spliced +)) Computation) + (function (_ (~~ (template.spliced +))) + (..apply/* (list (~~ (template.spliced +))) procedure)))) (`` (template [ ] [(def: #export ( (..var )))] - (~~ (template.splice +))))] + (~~ (template.spliced +))))] [apply/1 [_0] [Expression] [[exact/1 "exact"] diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux index 6e28624ce..e14505e13 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -261,7 +261,7 @@ (let [message (|> coverage (list\map %.name) (text.join_with " & ")) - coverage (set.from_list name.hash coverage)] + coverage (set.of_list name.hash coverage)] (|> (..assert message condition) (promise\map (function (_ [tally documentation]) [(update@ #actual_coverage (set.union coverage) tally) @@ -277,7 +277,7 @@ (let [context (|> coverage (list\map %.name) (text.join_with " & ")) - coverage (set.from_list name.hash coverage)] + coverage (set.of_list name.hash coverage)] (random\map (promise\map (function (_ [tally documentation]) [(update@ #actual_coverage (set.union coverage) tally) documentation])) @@ -295,7 +295,7 @@ (def: coverage_separator Text - (text.from_code 31)) + (text.of_code 31)) (def: encode_coverage (-> (List Text) Text) @@ -308,7 +308,7 @@ (def: (decode_coverage module encoding) (-> Text Text (Set Name)) (loop [remaining encoding - output (set.from_list name.hash (list))] + output (set.of_list name.hash (list))] (case (text.split_with ..coverage_separator remaining) (#.Some [head tail]) (recur tail (set.add [module head] output)) diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux index 5c043f696..cf1f340c0 100644 --- a/stdlib/source/library/lux/time.lux +++ b/stdlib/source/library/lux/time.lux @@ -45,11 +45,11 @@ (def: separator ":") -(def: parse_section +(def: section_parser (Parser Nat) (<>.codec n.decimal (.exactly 2 .decimal))) -(def: parse_millis +(def: millis_parser (Parser Nat) (<>.either (|> (.at_most 3 .decimal) (<>.codec n.decimal) @@ -71,9 +71,9 @@ (wrap value) (<>.lift (exception.throw [value])))))] - [..hours parse_hour invalid_hour ..parse_section] - [..minutes parse_minute invalid_minute ..parse_section] - [..seconds parse_second invalid_second ..parse_section] + [..hours hour_parser invalid_hour ..section_parser] + [..minutes minute_parser invalid_minute ..section_parser] + [..seconds second_parser invalid_second ..section_parser] ) (abstract: #export Time @@ -86,7 +86,7 @@ Time (:abstraction 0)) - (def: #export (from_millis milli_seconds) + (def: #export (of_millis milli_seconds) (-> Nat (Try Time)) (if (n.< ..limit milli_seconds) (#try.Success (:abstraction milli_seconds)) @@ -134,12 +134,12 @@ second (to_millis duration.second) millis (to_millis duration.milli_second)] (do {! <>.monad} - [utc_hour ..parse_hour + [utc_hour ..hour_parser _ (.this ..separator) - utc_minute ..parse_minute + utc_minute ..minute_parser _ (.this ..separator) - utc_second ..parse_second - utc_millis ..parse_millis] + utc_second ..second_parser + utc_millis ..millis_parser] (wrap (:abstraction ($_ n.+ (n.* utc_hour hour) @@ -176,7 +176,7 @@ (def: #export (clock time) (-> Time Clock) - (let [time (|> time ..to_millis .int duration.from_millis) + (let [time (|> time ..to_millis .int duration.of_millis) [hours time] [(duration.query duration.hour time) (duration.frame duration.hour time)] [minutes time] [(duration.query duration.minute time) (duration.frame duration.minute time)] [seconds millis] [(duration.query duration.second time) (duration.frame duration.second time)]] @@ -194,10 +194,10 @@ (duration.up (get@ #hour clock) duration.hour) (duration.up (get@ #minute clock) duration.minute) (duration.up (get@ #second clock) duration.second) - (duration.from_millis (.int (get@ #milli_second clock)))) + (duration.of_millis (.int (get@ #milli_second clock)))) duration.to_millis .nat - ..from_millis)) + ..of_millis)) (def: (encode time) (-> Time Text) diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux index e8de6d99e..c2ad8d025 100644 --- a/stdlib/source/library/lux/time/date.lux +++ b/stdlib/source/library/lux/time/date.lux @@ -84,9 +84,10 @@ (def: #export epoch Date - (try.assume (..date //year.epoch - #//month.January - ..minimum_day))) + (try.assumed + (..date //year.epoch + #//month.January + ..minimum_day))) (template [ ] [(def: #export @@ -137,11 +138,11 @@ (get@ #day sample))))))))) ) -(def: parse_section +(def: section_parser (Parser Nat) (<>.codec n.decimal (.exactly 2 .decimal))) -(def: parse_millis +(def: millis_parser (Parser Nat) (<>.either (|> (.at_most 3 .decimal) (<>.codec n.decimal) @@ -158,13 +159,13 @@ (def: (Parser Nat) (do <>.monad - [value ..parse_section] + [value ..section_parser] (if (and (n.>= value) (n.<= value)) (wrap value) (<>.lift (exception.throw [value])))))] - [1 12 parse_month invalid_month] + [1 12 month_parser invalid_month] ) (def: #export parser @@ -172,10 +173,10 @@ (do <>.monad [utc_year //year.parser _ (.this ..separator) - utc_month ..parse_month + utc_month ..month_parser _ (.this ..separator) #let [month (maybe.assume (dictionary.get utc_month ..month_by_number))] - utc_day ..parse_section] + utc_day ..section_parser] (<>.lift (..date utc_year month utc_day)))) (def: (encode value) @@ -305,7 +306,7 @@ (i.- (.int ..days_since_epoch))))) ## http://howardhinnant.github.io/date_algorithms.html -(def: #export (from_days days) +(def: #export (of_days days) (-> Int Date) (let [days (i.+ (.int ..days_since_epoch) days) era (|> (if (i.< +0 days) @@ -333,9 +334,10 @@ (inc year) year)] ## Coercing, because the year is already in internal form. - (try.assume (..date (:as Year year) - (maybe.assume (dictionary.get month ..month_by_number)) - day)))) + (try.assumed + (..date (:as Year year) + (maybe.assume (dictionary.get month ..month_by_number)) + day)))) (implementation: #export enum (Enum Date) @@ -343,7 +345,7 @@ (def: &order ..order) (def: succ - (|>> ..to_days inc ..from_days)) + (|>> ..to_days inc ..of_days)) (def: pred - (|>> ..to_days dec ..from_days))) + (|>> ..to_days dec ..of_days))) diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux index 1de5dab4f..bcc65a0d3 100644 --- a/stdlib/source/library/lux/time/duration.lux +++ b/stdlib/source/library/lux/time/duration.lux @@ -28,7 +28,7 @@ {#.doc "Durations have a resolution of milli-seconds."} - (def: #export from_millis + (def: #export of_millis (-> Int Duration) (|>> :abstraction)) @@ -87,10 +87,10 @@ ) (def: #export empty - (..from_millis +0)) + (..of_millis +0)) (def: #export milli_second - (..from_millis +1)) + (..of_millis +1)) (template [ ] [(def: #export diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux index ecefe3491..a73a603ba 100644 --- a/stdlib/source/library/lux/time/instant.lux +++ b/stdlib/source/library/lux/time/instant.lux @@ -37,7 +37,7 @@ {#.doc "Instant is defined as milliseconds since the epoch."} - (def: #export from_millis + (def: #export of_millis (-> Int Instant) (|>> :abstraction)) @@ -47,7 +47,7 @@ (def: #export (span from to) (-> Instant Instant Duration) - (duration.from_millis (i.- (:representation from) (:representation to)))) + (duration.of_millis (i.- (:representation from) (:representation to)))) (def: #export (shift duration instant) (-> Duration Instant Instant) @@ -55,7 +55,7 @@ (def: #export (relative instant) (-> Instant Duration) - (|> instant :representation duration.from_millis)) + (|> instant :representation duration.of_millis)) (def: #export (absolute offset) (-> Duration Instant) @@ -89,7 +89,7 @@ (def: #export epoch {#.doc "The instant corresponding to 1970-01-01T00:00:00Z"} Instant - (..from_millis +0)) + (..of_millis +0)) (def: millis_per_day (duration.query duration.milli_second duration.day)) @@ -104,8 +104,8 @@ +0 [days millis] _ [(dec days) (i.+ ..millis_per_day millis)])) (i./% ..millis_per_day offset))] - [(date.from_days days) - (duration.from_millis day_time)])) + [(date.of_days days) + (duration.of_millis day_time)])) (template [ ] [(def: Text )] @@ -116,10 +116,13 @@ (def: (clock_time duration) (-> Duration Time) - (let [time (if (\ duration.order < duration.empty duration) - (duration.merge duration.day duration) - duration)] - (|> time duration.to_millis .nat //.from_millis try.assume))) + (|> (if (\ duration.order < duration.empty duration) + (duration.merge duration.day duration) + duration) + duration.to_millis + .nat + //.of_millis + try.assumed)) (def: (encode instant) (-> Instant Text) @@ -154,44 +157,44 @@ (def: #export now (IO Instant) - (io (..from_millis (for {@.old ("jvm invokestatic:java.lang.System:currentTimeMillis:") - @.jvm (|> ("jvm member invoke static" [] "java.lang.System" "currentTimeMillis" []) - ("jvm object cast") - (: (primitive "java.lang.Long")) - (:as Int)) - @.js (let [date ("js object new" ("js constant" "Date") [])] - (|> ("js object do" "getTime" date []) - (:as Frac) - "lux f64 i64")) - @.python (let [time ("python import" "time")] - (|> ("python object do" "time" time) - (:as Frac) - (f.* +1,000.0) - "lux f64 i64")) - @.lua (|> ("lua constant" "os.time") - "lua apply" - (:as Int) - (i.* +1,000)) - @.ruby (let [% ("ruby constant" "Time") - % ("ruby object do" "now" %)] - (|> ("ruby object do" "to_f" %) + (io (..of_millis (for {@.old ("jvm invokestatic:java.lang.System:currentTimeMillis:") + @.jvm (|> ("jvm member invoke static" [] "java.lang.System" "currentTimeMillis" []) + ("jvm object cast") + (: (primitive "java.lang.Long")) + (:as Int)) + @.js (let [date ("js object new" ("js constant" "Date") [])] + (|> ("js object do" "getTime" date []) + (:as Frac) + "lux f64 i64")) + @.python (let [time ("python import" "time")] + (|> ("python object do" "time" time) (:as Frac) (f.* +1,000.0) "lux f64 i64")) - @.php (|> ("php constant" "time") - "php apply" - (:as Int) - (i.* +1,000)) - @.scheme (|> ("scheme constant" "current-second") - (:as Int) - (i.* +1,000) - ("scheme apply" ("scheme constant" "exact")) - ("scheme apply" ("scheme constant" "truncate"))) - @.common_lisp (|> ("common_lisp constant" "get-universal-time") - "common_lisp apply" - (:as Int) - (i.* +1,000)) - })))) + @.lua (|> ("lua constant" "os.time") + "lua apply" + (:as Int) + (i.* +1,000)) + @.ruby (let [% ("ruby constant" "Time") + % ("ruby object do" "now" %)] + (|> ("ruby object do" "to_f" %) + (:as Frac) + (f.* +1,000.0) + "lux f64 i64")) + @.php (|> ("php constant" "time") + "php apply" + (:as Int) + (i.* +1,000)) + @.scheme (|> ("scheme constant" "current-second") + (:as Int) + (i.* +1,000) + ("scheme apply" ("scheme constant" "exact")) + ("scheme apply" ("scheme constant" "truncate"))) + @.common_lisp (|> ("common_lisp constant" "get-universal-time") + "common_lisp apply" + (:as Int) + (i.* +1,000)) + })))) (template [ ] [(def: #export ( instant) @@ -227,9 +230,9 @@ +6 #day.Saturday _ (undefined)))) -(def: #export (from_date_time date time) +(def: #export (of_date_time date time) (-> Date Time Instant) (|> (date.to_days date) (i.* (duration.to_millis duration.day)) (i.+ (.int (//.to_millis time))) - ..from_millis)) + ..of_millis)) diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux index 3d49eb706..7fcbb94eb 100644 --- a/stdlib/source/library/lux/tool/compiler/default/init.lux +++ b/stdlib/source/library/lux/tool/compiler/default/init.lux @@ -225,7 +225,7 @@ (def: module_aliases (-> .Module Aliases) - (|>> (get@ #.module_aliases) (dictionary.from_list text.hash))) + (|>> (get@ #.module_aliases) (dictionary.of_list text.hash))) (def: #export (compiler expander prelude write_directive) (All [anchor expression directive] @@ -252,7 +252,7 @@ #let [descriptor {#descriptor.hash hash #descriptor.name module #descriptor.file (get@ #///.file input) - #descriptor.references (set.from_list text.hash dependencies) + #descriptor.references (set.of_list text.hash dependencies) #descriptor.state #.Compiled #descriptor.registry final_registry}]] (wrap [state diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index 3d3f4cde0..2e5fb6fed 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -1,7 +1,7 @@ (.module: [library [lux (#- Module) - [type (#+ :share)] + [type (#+ :sharing)] ["." debug] ["@" target] [abstract @@ -176,22 +176,22 @@ .Lux (Try ))) - (|> (:share [] - - state - - (///directive.Operation Any) - (do ///phase.monad - [_ (///directive.lift_analysis - (///analysis.install analysis_state)) - _ (///directive.lift_analysis - (extension.with extender analysers)) - _ (///directive.lift_synthesis - (extension.with extender synthesizers)) - _ (///directive.lift_generation - (extension.with extender (:assume generators))) - _ (extension.with extender (:assume directives))] - (wrap []))) + (|> (:sharing [] + + state + + (///directive.Operation Any) + (do ///phase.monad + [_ (///directive.lift_analysis + (///analysis.install analysis_state)) + _ (///directive.lift_analysis + (extension.with extender analysers)) + _ (///directive.lift_synthesis + (extension.with extender synthesizers)) + _ (///directive.lift_generation + (extension.with extender (:assume generators))) + _ (extension.with extender (:assume directives))] + (wrap []))) (///phase.run' state) (\ try.monad map product.left))) @@ -389,74 +389,74 @@ (-> (-> ))) (let [current (stm.var initial) - pending (:share [] - - initial - - (Var (Dictionary Module )) - (:assume (stm.var (dictionary.new text.hash)))) + pending (:sharing [] + + initial + + (Var (Dictionary Module )) + (:assume (stm.var (dictionary.new text.hash)))) dependence (: (Var Dependence) (stm.var ..independence))] (function (_ compile) (function (import! importer module) (do {! promise.monad} - [[return signal] (:share [] - - initial - - (Promise [ (Maybe [ - archive.ID - ])]) - (:assume - (stm.commit - (do {! stm.monad} - [dependence (if (text\= archive.runtime_module importer) - (stm.read dependence) - (do ! - [[_ dependence] (stm.update (..depend importer module) dependence)] - (wrap dependence)))] - (case (..verify_dependencies importer module dependence) - (#try.Failure error) - (wrap [(promise.resolved (#try.Failure error)) - #.None]) - - (#try.Success _) - (do ! - [[archive state] (stm.read current)] - (if (archive.archived? archive module) - (wrap [(promise\wrap (#try.Success [archive state])) - #.None]) - (do ! - [@pending (stm.read pending)] - (case (dictionary.get module @pending) - (#.Some [return signal]) - (wrap [return - #.None]) - - #.None - (case (if (archive.reserved? archive module) - (do try.monad - [module_id (archive.id module archive)] - (wrap [module_id archive])) - (archive.reserve module archive)) - (#try.Success [module_id archive]) - (do ! - [_ (stm.write [archive state] current) - #let [[return signal] (:share [] - - initial - - - (promise.promise []))] - _ (stm.update (dictionary.put module [return signal]) pending)] - (wrap [return - (#.Some [[archive state] - module_id - signal])])) + [[return signal] (:sharing [] + + initial + + (Promise [ (Maybe [ + archive.ID + ])]) + (:assume + (stm.commit + (do {! stm.monad} + [dependence (if (text\= archive.runtime_module importer) + (stm.read dependence) + (do ! + [[_ dependence] (stm.update (..depend importer module) dependence)] + (wrap dependence)))] + (case (..verify_dependencies importer module dependence) + (#try.Failure error) + (wrap [(promise.resolved (#try.Failure error)) + #.None]) + + (#try.Success _) + (do ! + [[archive state] (stm.read current)] + (if (archive.archived? archive module) + (wrap [(promise\wrap (#try.Success [archive state])) + #.None]) + (do ! + [@pending (stm.read pending)] + (case (dictionary.get module @pending) + (#.Some [return signal]) + (wrap [return + #.None]) - (#try.Failure error) - (wrap [(promise\wrap (#try.Failure error)) - #.None]))))))))))) + #.None + (case (if (archive.reserved? archive module) + (do try.monad + [module_id (archive.id module archive)] + (wrap [module_id archive])) + (archive.reserve module archive)) + (#try.Success [module_id archive]) + (do ! + [_ (stm.write [archive state] current) + #let [[return signal] (:sharing [] + + initial + + + (promise.promise []))] + _ (stm.update (dictionary.put module [return signal]) pending)] + (wrap [return + (#.Some [[archive state] + module_id + signal])])) + + (#try.Failure error) + (wrap [(promise\wrap (#try.Failure error)) + #.None]))))))))))) _ (case signal #.None (wrap []) @@ -492,7 +492,7 @@ (archive.archived archive)) #let [additions (|> modules (list\map product.left) - (set.from_list text.hash))]] + (set.of_list text.hash))]] (wrap (update@ [#extension.state #///directive.analysis #///directive.state @@ -501,10 +501,10 @@ (|> analysis_state (:as .Lux) (update@ #.modules (function (_ current) - (list\compose (list.filter (|>> product.left - (set.member? additions) - not) - current) + (list\compose (list.only (|>> product.left + (set.member? additions) + not) + current) modules))) :assume)) state)))) @@ -514,20 +514,20 @@ (-> Module )) (|> (///directive.set_current_module module) (///phase.run' state) - try.assume + try.assumed product.left)) (def: #export (compile import static expander platform compilation context) (All [] (-> Import Static Expander Compilation )) (let [[compilation_sources compilation_host_dependencies compilation_libraries compilation_target compilation_module] compilation - base_compiler (:share [] - - context - - (///.Compiler .Module Any) - (:assume - ((//init.compiler expander syntax.prelude (get@ #write platform)) $.key (list)))) + base_compiler (:sharing [] + + context + + (///.Compiler .Module Any) + (:assume + ((//init.compiler expander syntax.prelude (get@ #write platform)) $.key (list)))) compiler (..parallel context (function (_ importer import! module_id [archive state] module) @@ -545,14 +545,14 @@ (list))] (let [new_dependencies (get@ #///.dependencies compilation) all_dependencies (list\compose new_dependencies all_dependencies) - continue! (:share [] - - platform - - (-> (///.Compilation .Module Any) (List Module) - (Action [Archive ])) - (:assume - recur))] + continue! (:sharing [] + + platform + + (-> (///.Compilation .Module Any) (List Module) + (Action [Archive ])) + (:assume + recur))] (do ! [[archive state] (case new_dependencies #.Nil @@ -566,14 +566,14 @@ #let [archive (|> archive,document+ (list\map product.left) (list\fold archive.merge archive))]] - (wrap [archive (try.assume + (wrap [archive (try.assumed (..updated_state archive state))])))] (case ((get@ #///.process compilation) ## TODO: The "///directive.set_current_module" below shouldn't be necessary. Remove it ASAP. ## TODO: The context shouldn't need to be re-set either. (|> (///directive.set_current_module module) (///phase.run' state) - try.assume + try.assumed product.left) archive) (#try.Success [state more|done]) @@ -584,7 +584,7 @@ (#.Right [descriptor document output]) (do ! [#let [_ (debug.log! (..module_compilation_log module state)) - descriptor (set@ #descriptor.references (set.from_list text.hash all_dependencies) descriptor)] + descriptor (set@ #descriptor.references (set.of_list text.hash all_dependencies) descriptor)] _ (..cache_module static platform module_id [descriptor document output])] (case (archive.add module [descriptor document output] archive) (#try.Success archive) 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 d447b8d1d..327488817 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 @@ -129,7 +129,7 @@ (#.Product _) (|> caseT - type.flatten_tuple + type.flat_tuple (list\map (re_quantify envs)) type.tuple (\ ///.monad wrap)) @@ -193,7 +193,7 @@ [inputT' (simplify_case inputT)] (.case inputT' (#.Product _) - (let [subs (type.flatten_tuple inputT') + (let [subs (type.flat_tuple inputT') num_subs (maybe.default (list.size subs) num_tags) num_sub_patterns (list.size sub_patterns) @@ -251,7 +251,7 @@ [inputT' (simplify_case inputT)] (.case inputT' (#.Sum _) - (let [flat_sum (type.flatten_variant inputT') + (let [flat_sum (type.flat_variant inputT') size_sum (list.size flat_sum) num_cases (maybe.default size_sum num_tags) idx (/.tag lefts right?)] 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 df92858ec..bc4fad3d3 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 @@ -169,11 +169,11 @@ (ex.report ["Coverage so-far" (%coverage so_far)] ["Coverage addition" (%coverage addition)])) -(def: (flatten_alt coverage) +(def: (flat_alt coverage) (-> Coverage (List Coverage)) (case coverage (#Alt left right) - (list& left (flatten_alt right)) + (list& left (flat_alt right)) _ (list coverage))) @@ -197,8 +197,8 @@ (= rightR rightS)) [(#Alt _) (#Alt _)] - (let [flatR (flatten_alt reference) - flatS (flatten_alt sample)] + (let [flatR (flat_alt reference) + flatS (flat_alt sample)] (and (n.= (list.size flatR) (list.size flatS)) (list.every? (function (_ [coverageR coverageS]) (= coverageR coverageS)) @@ -346,7 +346,7 @@ (#try.Failure error) (try.fail error)) ))))] - [successA possibilitiesSF] (fuse_once addition (flatten_alt so_far))] + [successA possibilitiesSF] (fuse_once addition (flat_alt so_far))] (loop [successA successA possibilitiesSF possibilitiesSF] (case successA diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux index 9ad503709..ace669fbe 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux @@ -228,7 +228,7 @@ (#.Product _) (///\wrap (|> inferT - (type.function (type.flatten_tuple inferT)) + (type.function (type.flat_tuple inferT)) (substitute_bound target originalT))) _ @@ -258,7 +258,7 @@ [#.ExQ]) (#.Sum _) - (let [cases (type.flatten_variant currentT) + (let [cases (type.flat_variant currentT) actual_size (list.size cases) boundary (dec expected_size)] (cond (or (n.= expected_size actual_size) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux index 0f8106a7d..c49e936ec 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -101,7 +101,7 @@ (/.with_stack ..cannot_analyse_variant [expectedT' tag valueC] (case expectedT (#.Sum _) - (let [flat (type.flatten_variant expectedT)] + (let [flat (type.flat_variant expectedT)] (case (list.nth tag flat) (#.Some variant_type) (do ! @@ -170,7 +170,7 @@ (do {! ///.monad} [expectedT (///extension.lift meta.expected_type) membersA+ (: (Operation (List Analysis)) - (loop [membersT+ (type.flatten_tuple expectedT) + (loop [membersT+ (type.flat_tuple expectedT) membersC+ members] (case [membersT+ membersC+] [(#.Cons memberT #.Nil) _] @@ -315,7 +315,7 @@ (wrap []) (/.throw ..record_size_mismatch [size_ts size_record recordT record])) #let [tuple_range (list.indices size_ts) - tag->idx (dictionary.from_list name.hash (list.zip/2 tag_set tuple_range))] + tag->idx (dictionary.of_list name.hash (list.zip/2 tag_set tuple_range))] idx->val (monad.fold ! (function (_ [key val] idx->val) (do ! 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 e5af044c3..f47ca7aea 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 @@ -343,7 +343,7 @@ [(reflection.reflection reflection.float) [box.float jvm.float]] [(reflection.reflection reflection.double) [box.double jvm.double]] [(reflection.reflection reflection.char) [box.char jvm.char]]) - (dictionary.from_list text.hash))) + (dictionary.of_list text.hash))) (def: (jvm_type luxT) (-> .Type (Operation (Type Value))) @@ -950,7 +950,7 @@ (inheritance_candidate_parents class_loader currentT to_class toT fromC) (class_candidate_parents class_loader current_name currentT to_name to_class)))] (case (|> candidate_parents - (list.filter product.right) + (list.only product.right) (list\map product.left)) (#.Cons [next_name nextT] _) (recur [next_name nextT]) @@ -1170,7 +1170,7 @@ list.reverse) num_owner_tvars (list.size owner_tvars) owner_tvarsT (|> lux_tvars (list.take num_owner_tvars) (list\map product.right)) - mapping (dictionary.from_list text.hash lux_tvars)] + mapping (dictionary.of_list text.hash lux_tvars)] [owner_tvarsT mapping])) (def: (method_signature method_style method) @@ -1280,7 +1280,7 @@ (-> (List (Type Var)) (List (Type Var)) Aliasing) (|> (list.zip/2 (list\map jvm_parser.name actual) (list\map jvm_parser.name expected)) - (dictionary.from_list text.hash))) + (dictionary.of_list text.hash))) (def: (method_candidate class_loader actual_class_tvars class_name actual_method_tvars method_name method_style inputsJT) (-> java/lang/ClassLoader (List (Type Var)) External (List (Type Var)) Text Method_Style (List (Type Value)) (Operation Method_Signature)) @@ -1290,7 +1290,7 @@ candidates (|> class java/lang/Class::getDeclaredMethods array.to_list - (list.filter (|>> java/lang/reflect/Method::getName (text\= method_name))) + (list.only (|>> java/lang/reflect/Method::getName (text\= method_name))) (monad.map ! (: (-> java/lang/reflect/Method (Operation Evaluation)) (function (_ method) (do ! @@ -1542,13 +1542,13 @@ (list (/////analysis.text argument) (value_analysis argumentJT)))) -(template [ ] +(template [ ] [(def: (-> (java/lang/Class java/lang/Object) (Try (List [Text (Type Method)]))) (|>> java/lang/Class::getDeclaredMethods array.to_list - + (monad.map try.monad (function (_ method) (do {! try.monad} @@ -1568,7 +1568,7 @@ (wrap [(java/lang/reflect/Method::getName method) (jvm.method [type_variables inputs return exceptions])]))))))] - [abstract_methods (list.filter (|>> java/lang/reflect/Method::getModifiers java/lang/reflect/Modifier::isAbstract))] + [abstract_methods (list.only (|>> java/lang/reflect/Method::getModifiers java/lang/reflect/Modifier::isAbstract))] [methods (<|)] ) @@ -1913,7 +1913,7 @@ (do {! phase.monad} [parent_parameters (|> parent_parameters (monad.map maybe.monad jvm_parser.var?) - try.from_maybe + try.of_maybe phase.lift)] (|> super_parameters (monad.map ! (..reflection_type mapping)) @@ -2038,15 +2038,15 @@ (-> (List [Text (Type Method)]) (List [Text (Type Method)]) (List [Text (Type Method)])) - (list.filter (function (_ [sub_name subJT]) - (|> super_set - (list.filter (function (_ [super_name superJT]) - (and (text\= super_name sub_name) - (jvm\= superJT subJT)))) - list.size - (n.= 1) - not)) - sub_set)) + (list.only (function (_ [sub_name subJT]) + (|> super_set + (list.only (function (_ [super_name superJT]) + (and (text\= super_name sub_name) + (jvm\= superJT subJT)))) + list.size + (n.= 1) + not)) + sub_set)) (exception: #export (class_parameter_mismatch {expected (List Text)} {actual (List (Type Parameter))}) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/bundle.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/bundle.lux index 3fb0c967e..95b04daa2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/bundle.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/bundle.lux @@ -26,4 +26,4 @@ (-> Text (-> (Bundle s i o) (Bundle s i o)))) (|>> dictionary.entries (list\map (function (_ [key val]) [(format prefix " " key) val])) - (dictionary.from_list text.hash))) + (dictionary.of_list text.hash))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux index 8678c6269..d11c6cb49 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux @@ -191,7 +191,7 @@ (^template [ ] [[_ ( value)] (do pool.monad - [constant (`` (|> value (~~ (template.splice )))) + [constant (`` (|> value (~~ (template.spliced )))) attribute (attribute.constant constant)] (field.field ..constant::modifier name (row.row attribute)))]) ([#.Bit type.boolean [(case> #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux index 8fd5d2416..b67f9287b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux @@ -22,7 +22,7 @@ [math [number ["n" nat]]] - ["." type (#+ :share) + ["." type (#+ :sharing) ["." check]]]] ["." /// (#+ Extender) ["#." bundle] @@ -328,12 +328,12 @@ valueC) _ (<| (///.install extender (:as Text name)) - (:share [anchor expression directive] - (Handler anchor expression directive) - handler - - - (:assume handlerV))) + (:sharing [anchor expression directive] + (Handler anchor expression directive) + handler + + + (:assume handlerV))) _ (/////directive.lift_generation (/////generation.log! (format " " (%.text (:as Text name)))))] (wrap /////directive.no_requirements)) 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 a74c72d38..9cc6c1dbc 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 @@ -156,7 +156,7 @@ (/.install "%" (binary (product.uncurry _.%))) (/.install "=" (binary (product.uncurry _.=))) (/.install "<" (binary (product.uncurry _.<))) - (/.install "i64" (unary //runtime.i64//from_number)) + (/.install "i64" (unary //runtime.i64//of_number)) (/.install "encode" (unary (_.do "toString" (list)))) (/.install "decode" (unary f64//decode))))) @@ -168,7 +168,7 @@ (/.install "<" (binary (product.uncurry _.<))) (/.install "concat" (binary text//concat)) (/.install "index" (trinary text//index)) - (/.install "size" (unary (|>> (_.the "length") //runtime.i64//from_number))) + (/.install "size" (unary (|>> (_.the "length") //runtime.i64//of_number))) (/.install "char" (binary (product.uncurry //runtime.text//char))) (/.install "clip" (trinary text//clip)) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux index edc4e2321..67966efe8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux @@ -36,7 +36,7 @@ (def: array::length (Unary Expression) - (|>> (_.the "length") //runtime.i64//from_number)) + (|>> (_.the "length") //runtime.i64//of_number)) (def: (array::read [indexG arrayG]) (Binary Expression) 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 da55a6c32..d71b9dbcc 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 @@ -116,7 +116,7 @@ [branchG (phase archive branch) @branch ///runtime.forge-label] (wrap [(list\map (function (_ char) - [(try.assume (signed.s4 (.int char))) @branch]) + [(try.assumed (signed.s4 (.int char))) @branch]) chars) ($_ _.compose (_.set-label @branch) 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 2d31a6b71..aa07cbe9f 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 @@ -85,7 +85,7 @@ (list\map (|>> product.right synthesis.path/then //case.dependencies)) (list& (//case.dependencies (synthesis.path/then else))) list.concat - (set.from_list _.hash) + (set.of_list _.hash) set.to_list) @expression (_.constant (reference.artifact [context_module context_artifact])) directive (_.define_function @expression (list& (_.parameter @input) (list\map _.reference foreigns)) 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 65783662a..bfd952cc9 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 @@ -391,7 +391,7 @@ (runtime: i64//-one (i64//negate i64//one)) -(runtime: (i64//from_number value) +(runtime: (i64//of_number value) (_.return (<| (_.? (_.not_a_number? value) i64//zero) (_.? (_.<= (_.negate i64//2^63) value) @@ -399,7 +399,7 @@ (_.? (|> value (_.+ (_.i32 +1)) (_.>= i64//2^63)) i64//max) (_.? (|> value (_.< (_.i32 +0))) - (|> value _.negate i64//from_number i64//negate)) + (|> value _.negate i64//of_number i64//negate)) (..i64 (|> value (_./ i64//2^32) _.to_i32) (|> value (_.% i64//2^32) _.to_i32))))) @@ -590,7 +590,7 @@ (_.define remainder subject) (_.while (i64//<= remainder parameter) (with_vars [approximate approximate_result approximate_remainder log2 delta] - (let [approximate_result' (i64//from_number approximate) + (let [approximate_result' (i64//of_number approximate) approx_remainder (i64//* parameter approximate_result)] ($_ _.then (_.define approximate (|> (i64//to_number remainder) @@ -647,7 +647,7 @@ @i64//+ @i64//negate @i64//to_number - @i64//from_number + @i64//of_number @i64//- @i64//* @i64//< @@ -662,7 +662,7 @@ (_.define idx (|> text (_.do "indexOf" (list part (i64//to_number start))))) (_.return (_.? (_.= (_.i32 -1) idx) ..none - (..some (i64//from_number idx))))))) + (..some (i64//of_number idx))))))) (runtime: (text//clip offset length text) (_.return (|> text (_.do "substring" (list (_.the ..i64_low_field offset) @@ -675,7 +675,7 @@ (_.define result (|> text (_.do "charCodeAt" (list (_.the ..i64_low_field idx))))) (_.if (_.not_a_number? result) (_.throw (_.string "[Lux Error] Cannot get char from text.")) - (_.return (i64//from_number result)))))) + (_.return (i64//of_number result)))))) (def: runtime//text Statement diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux index 5497cc094..a3e4fc738 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux @@ -18,7 +18,7 @@ (def: #export initial (Bytecode Any) - (|> +0 signed.s1 try.assume _.bipush)) + (|> +0 signed.s1 try.assumed _.bipush)) (def: this _.aload_0) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux index e42804d63..da80cbfdd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux @@ -153,5 +153,5 @@ (monad.seq _.monad))]] ($_ _.compose ///partial/count.value - (_.tableswitch (try.assume (signed.s4 +0)) @default [@labelsH @labelsT]) + (_.tableswitch (try.assumed (signed.s4 +0)) @default [@labelsH @labelsT]) cases))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux index 3785f9a40..ef5717521 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux @@ -56,7 +56,7 @@ type.void (list)])) -(def: no-partials (|> 0 unsigned.u1 try.assume _.bipush)) +(def: no-partials (|> 0 unsigned.u1 try.assumed _.bipush)) (def: #export (super environment-size arity) (-> Nat Arity (Bytecode Any)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux index 0441f3b00..67a384781 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux @@ -133,7 +133,7 @@ _.return)))] [..class (<| (format.run class.writer) - try.assume + try.assumed (class.class version.v6_0 ..program::modifier (name.internal ..class) 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 28d9b81cd..86a980c95 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 @@ -516,7 +516,7 @@ class.public class.final)) bytecode (<| (format.run class.writer) - try.assume + try.assumed (class.class jvm/version.v6_0 modifier (name.internal class) @@ -584,7 +584,7 @@ //function/count.type (row.row))) bytecode (<| (format.run class.writer) - try.assume + try.assumed (class.class jvm/version.v6_0 modifier (name.internal class) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux index 18b65c352..6004e31a8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux @@ -90,8 +90,8 @@ [directive instantiation] (: [Statement Expression] (case (|> (synthesis.path/then bodyS) //case.dependencies - (set.from_list _.hash) - (set.difference (set.from_list _.hash locals)) + (set.of_list _.hash) + (set.difference (set.of_list _.hash locals)) set.to_list) #.Nil [(_.function @loop locals diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux index 9dc7e9e78..8b99967a2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux @@ -82,11 +82,11 @@ list.enumeration (list\map (|>> product.left (n.+ start) //case.register _.parameter))) @loop (_.constant (///reference.artifact [loop_module loop_artifact])) - loop_variables (set.from_list _.hash (list\map product.right locals)) + loop_variables (set.of_list _.hash (list\map product.right locals)) referenced_variables (: (-> Synthesis (Set Var)) (|>> synthesis.path/then //case.dependencies - (set.from_list _.hash))) + (set.of_list _.hash))) [directive instantiation] (: [Statement Expression] (case (|> (list\map referenced_variables initsS+) (list\fold set.union (referenced_variables bodyS)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux index 4ec21d754..96c1d1ce1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux @@ -88,8 +88,8 @@ [directive instantiation] (: [(Statement Any) (Expression Any)] (case (|> (synthesis.path/then bodyS) //case.dependencies - (set.from_list _.hash) - (set.difference (set.from_list _.hash locals)) + (set.of_list _.hash) + (set.difference (set.of_list _.hash locals)) set.to_list) #.Nil [actual_loop 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 4682a593d..40ef044f6 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 @@ -303,7 +303,7 @@ ..i64_high (_.< (_.int +0)))))))) -(runtime: (i64::from_float input) +(runtime: (i64::of_float input) (_.cond (list [(_.apply (list input) (_.var "is.nan")) i64::zero] [(|> input (_.<= (_.negate f2^63))) @@ -311,7 +311,7 @@ [(|> input (_.+ (_.float +1.0)) (_.>= f2^63)) i64::max] [(|> input (_.< (_.float +0.0))) - (|> input _.negate i64::from_float i64::negate)]) + (|> input _.negate i64::of_float i64::negate)]) (i64::new (|> input (_./ f2^32)) (|> input (_.%% f2^32))))) @@ -483,7 +483,7 @@ (_.or (|> remainder (i64::= param)))) (let [calc_rough_estimate (_.apply (list (|> (i64::to_float remainder) (_./ (i64::to_float param)))) (_.var "floor")) - calc_approximate_result (i64::from_float approximate) + calc_approximate_result (i64::of_float approximate) calc_approximate_remainder (|> approximate_result (i64::* param)) delta (_.if (|> (_.float +48.0) (_.<= log2)) (_.float +1.0) @@ -551,7 +551,7 @@ (runtime: (io::current_time! _) (|> current_time_float (_.* (_.float +1,000.0)) - i64::from_float)) + i64::of_float)) (def: runtime::io Expression @@ -676,7 +676,7 @@ @f2^63 @i64::new - @i64::from_float + @i64::of_float @i64::and @i64::or @@ -758,7 +758,7 @@ (_.nth (_.int +1)))) (_.if (|> idx (_.= (_.int -1))) ..none - (..some (i64::from_float (|> idx (_.+ startF)))))) + (..some (i64::of_float (|> idx (_.+ startF)))))) ..none)))) (runtime: (text::clip text from to) @@ -780,7 +780,7 @@ (_.if (|> idx (within? (_.length text))) ($_ _.then (_.set! idx (inc idx)) - (..some (i64::from_float (char_at idx text)))) + (..some (i64::of_float (char_at idx text)))) ..none)) (def: runtime::text diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux index 02938eb7a..e0f9ea89e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -414,7 +414,7 @@ (update@ #bindings (set.union (|> initsS+ list.enumeration (list\map (|>> product.left (n.+ start))) - (set.from_list n.hash)))) + (set.of_list n.hash)))) (for_synthesis iterationS) (get@ #dependencies))) (list\fold for_synthesis synthesis_storage initsS+)) 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 07e7a54b9..9e292c485 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 @@ -297,18 +297,18 @@ (do try.monad [#let [baseline (|> redundancy dictionary.keys - (set.from_list n.hash))] + (set.of_list n.hash))] [redundancy pre] (recur [redundancy pre]) #let [bindings (|> redundancy dictionary.keys - (set.from_list n.hash) + (set.of_list n.hash) (set.difference baseline))] [redundancy post] (recur [redundancy post]) #let [redundants (|> redundancy dictionary.entries - (list.filter (function (_ [register redundant?]) - (and (set.member? bindings register) - redundant?))) + (list.only (function (_ [register redundant?]) + (and (set.member? bindings register) + redundant?))) (list\map product.left))]] (wrap [(list\fold dictionary.remove redundancy (set.to_list bindings)) (|> redundants 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 de266d0ad..e5329f36a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -236,11 +236,11 @@ ## Form and tuple syntax is mostly the same, differing only in the ## delimiters involved. ## They may have an arbitrary number of arbitrary Code nodes as elements. - [parse_form ..close_form #.Form] - [parse_tuple ..close_tuple #.Tuple] + [form_parser ..close_form #.Form] + [tuple_parser ..close_tuple #.Tuple] ) -(inline: (parse_record parse where offset source_code) +(inline: (record_parser parse where offset source_code) (-> (Parser Code) Location Offset Text (Either [Source Text] [Source Code])) (loop [source (: Source [(!forward 1 where) offset source_code]) @@ -265,7 +265,7 @@ (#.Left [[where offset source_code] (exception.construct ..text_cannot_contain_new_lines content)]))) -(def: (parse_text where offset source_code) +(def: (text_parser where offset source_code) (-> Location Offset Text (Either [Source Text] [Source Code])) (case ("lux text index" offset (static ..text_delimiter) source_code) (#.Some g!end) @@ -279,7 +279,7 @@ (#.Text g!content)]])) _ - (!failure ..parse_text where offset source_code))) + (!failure ..text_parser where offset source_code))) (with_expansions [ (as_is "0" "1" "2" "3" "4" "5" "6" "7" "8" "9") (template [] @@ -307,7 +307,7 @@ [[ ] @then - (~~ (template.splice @else_options))] + (~~ (template.spliced @else_options))] ## else @else))) @@ -349,14 +349,14 @@ (with_expansions [ (as_is (!number_output source_code start end int.decimal #.Int)) (as_is (!number_output source_code start end frac.decimal #.Frac)) - (!failure ..parse_frac where offset source_code) + (!failure ..frac_parser where offset source_code) (static ..frac_separator) (template [] [(~~ (static ))] [..positive_sign] [..negative_sign])] - (inline: (parse_frac source_code//size start where offset source_code) + (inline: (frac_parser source_code//size start where offset source_code) (-> Nat Nat Location Offset Text (Either [Source Text] [Source Code])) (loop [end offset @@ -381,7 +381,7 @@ )))) - (inline: (parse_signed source_code//size start where offset source_code) + (inline: (signed_parser source_code//size start where offset source_code) (-> Nat Nat Location Offset Text (Either [Source Text] [Source Code])) (loop [end offset] @@ -390,7 +390,7 @@ (recur (!inc end)) [[] - (parse_frac source_code//size start where (!inc end) source_code)] + (frac_parser source_code//size start where (!inc end) source_code)] )))) ) @@ -406,22 +406,22 @@ [] (!number_output source_code start g!end )))))] - [parse_nat n.decimal #.Nat] - [parse_rev rev.decimal #.Rev] + [nat_parser n.decimal #.Nat] + [rev_parser rev.decimal #.Rev] ) -(template: (!parse_signed source_code//size offset where source_code @aliases @end) +(template: (!signed_parser source_code//size offset where source_code @aliases @end) (<| (let [g!offset/1 (!inc offset)]) (!with_char+ source_code//size source_code g!offset/1 g!char/1 @end) (!if_digit? g!char/1 - (parse_signed source_code//size offset where (!inc/2 offset) source_code) - (!parse_full_name offset [where (!inc offset) source_code] where @aliases #.Identifier)))) + (signed_parser source_code//size offset where (!inc/2 offset) source_code) + (!full_name_parser offset [where (!inc offset) source_code] where @aliases #.Identifier)))) (with_expansions [ (#.Right [[(update@ #.column (|>> (!n/+ (!n/- start end))) where) end source_code] (!clip start end source_code)])] - (inline: (parse_name_part start where offset source_code) + (inline: (name_part_parser start where offset source_code) (-> Nat Location Offset Text (Either [Source Text] [Source Text])) (let [source_code//size ("lux text size" source_code)] @@ -431,13 +431,13 @@ (recur (!inc end)) )))))) -(template: (!parse_half_name @offset @char @module) +(template: (!half_name_parser @offset @char @module) (!if_name_char?|head @char - (!letE [source' name] (..parse_name_part @offset where (!inc @offset) source_code) + (!letE [source' name] (..name_part_parser @offset where (!inc @offset) source_code) (#.Right [source' [@module name]])) - (!failure ..!parse_half_name where @offset source_code))) + (!failure ..!half_name_parser where @offset source_code))) -(`` (def: (parse_short_name source_code//size current_module [where offset/0 source_code]) +(`` (def: (short_name_parser source_code//size current_module [where offset/0 source_code]) (-> Nat Text (Parser Name)) (<| (!with_char+ source_code//size source_code offset/0 char/0 (!end_of_file where offset/0 source_code current_module)) @@ -445,34 +445,34 @@ (<| (let [offset/1 (!inc offset/0)]) (!with_char+ source_code//size source_code offset/1 char/1 (!end_of_file where offset/1 source_code current_module)) - (!parse_half_name offset/1 char/1 current_module)) - (!parse_half_name offset/0 char/0 (static ..prelude)))))) + (!half_name_parser offset/1 char/1 current_module)) + (!half_name_parser offset/0 char/0 (static ..prelude)))))) -(template: (!parse_short_name source_code//size @current_module @source @where @tag) - (!letE [source' name] (..parse_short_name source_code//size @current_module @source) +(template: (!short_name_parser source_code//size @current_module @source @where @tag) + (!letE [source' name] (..short_name_parser source_code//size @current_module @source) (#.Right [source' [@where (@tag name)]]))) (with_expansions [ (as_is (#.Right [source' ["" simple]]))] - (`` (def: (parse_full_name aliases start source) + (`` (def: (full_name_parser aliases start source) (-> Aliases Offset (Parser Name)) (<| (!letE [source' simple] (let [[where offset source_code] source] - (..parse_name_part start where offset source_code))) + (..name_part_parser start where offset source_code))) (let [[where' offset' source_code'] source']) (!with_char source_code' offset' char/separator ) (if (!n/= (char (~~ (static ..name_separator))) char/separator) (<| (let [offset'' (!inc offset')]) - (!letE [source'' complex] (..parse_name_part offset'' (!forward 1 where') offset'' source_code')) + (!letE [source'' complex] (..name_part_parser offset'' (!forward 1 where') offset'' source_code')) (if ("lux text =" "" complex) (let [[where offset source_code] source] - (!failure ..parse_full_name where offset source_code)) + (!failure ..full_name_parser where offset source_code)) (#.Right [source'' [(|> aliases (dictionary.get simple) (maybe.default simple)) complex]]))) ))))) -(template: (!parse_full_name @offset @source @where @aliases @tag) - (!letE [source' full_name] (..parse_full_name @aliases @offset @source) +(template: (!full_name_parser @offset @source @where @aliases @tag) + (!letE [source' full_name] (..full_name_parser @aliases @offset @source) (#.Right [source' [@where (@tag full_name)]]))) ## TODO: Grammar macro for specifying syntax. @@ -511,9 +511,9 @@ [(~~ (static ))] (!close )] - [..open_form ..close_form parse_form] - [..open_tuple ..close_tuple parse_tuple] - [..open_record ..close_record parse_record] + [..open_form ..close_form form_parser] + [..open_tuple ..close_tuple tuple_parser] + [..open_record ..close_record record_parser] )] (`` ("lux syntax char case!" char/0 [[(~~ (static text.space)) @@ -528,7 +528,7 @@ ## Text [(~~ (static ..text_delimiter))] - (parse_text where (!inc offset/0) source_code) + (text_parser where (!inc offset/0) source_code) ## Special code [(~~ (static ..sigil))] @@ -537,7 +537,7 @@ (!end_of_file where offset/1 source_code current_module)) ("lux syntax char case!" char/1 [[(~~ (static ..name_separator))] - (!parse_short_name source_code//size current_module where #.Tag) + (!short_name_parser source_code//size current_module where #.Tag) ## Single_line comment [(~~ (static ..sigil))] @@ -558,7 +558,7 @@ ## else (!if_name_char?|head char/1 ## Tag - (!parse_full_name offset/1 where aliases #.Tag) + (!full_name_parser offset/1 where aliases #.Tag) (!failure ..parse where offset/0 source_code)))) ## Coincidentally (= ..name_separator ..frac_separator) @@ -569,20 +569,20 @@ (!with_char+ source_code//size source_code offset/1 char/1 (!end_of_file where offset/1 source_code current_module)) (!if_digit? char/1 - (parse_rev source_code//size offset/0 where (!inc offset/1) source_code) - (!parse_short_name source_code//size current_module [where offset/1 source_code] where #.Identifier))) + (rev_parser source_code//size offset/0 where (!inc offset/1) source_code) + (!short_name_parser source_code//size current_module [where offset/1 source_code] where #.Identifier))) [(~~ (static ..positive_sign)) (~~ (static ..negative_sign))] - (!parse_signed source_code//size offset/0 where source_code aliases - (!end_of_file where offset/0 source_code current_module))] + (!signed_parser source_code//size offset/0 where source_code aliases + (!end_of_file where offset/0 source_code current_module))] ## else (!if_digit? char/0 ## Natural number - (parse_nat source_code//size offset/0 where (!inc offset/0) source_code) + (nat_parser source_code//size offset/0 where (!inc offset/0) source_code) ## Identifier - (!parse_full_name offset/0 [] where aliases #.Identifier)) + (!full_name_parser offset/0 [] where aliases #.Identifier)) ))) ))) )) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux index 39beec921..4442bd5f3 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux @@ -251,7 +251,7 @@ (n.= (list.size reservations) (|> reservations (list\map product.left) - (set.from_list text.hash) + (set.of_list text.hash) set.size))) (def: (correct_ids? reservations) @@ -259,7 +259,7 @@ (n.= (list.size reservations) (|> reservations (list\map product.right) - (set.from_list n.hash) + (set.of_list n.hash) set.size))) (def: (correct_reservations? reservations) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux index 39edd668e..3e2e86663 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux @@ -13,7 +13,7 @@ ["." dictionary (#+ Dictionary)]] [format ["." binary (#+ Writer)]]] - [type (#+ :share) + [type (#+ :sharing) abstract]]] [// ["." signature (#+ Signature)] @@ -35,12 +35,12 @@ (if (\ signature.equivalence = (key.signature key) document//signature) - (#try.Success (:share [e] - (Key e) - key - - e - (:assume document//content))) + (#try.Success (:sharing [e] + (Key e) + key + + e + (:assume document//content))) (exception.throw ..invalid_signature [(key.signature key) document//signature])))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux index b41b272f5..cb52004f4 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -183,12 +183,12 @@ (\ fs directory_files) (\ ! map (|>> (list\map (function (_ file) [(file.name fs file) file])) - (list.filter (|>> product.left (text\= ..module_descriptor_file) not)) + (list.only (|>> product.left (text\= ..module_descriptor_file) not)) (monad.map ! (function (_ [name path]) (|> path (\ fs read) (\ ! map (|>> [name]))))) - (\ ! map (dictionary.from_list text.hash)))) + (\ ! map (dictionary.of_list text.hash)))) (\ ! join)))) (type: Definitions (Dictionary Text Any)) @@ -225,7 +225,7 @@ (case input (#.Cons [[artifact_id artifact_category] input']) (case (do ! - [data (try.from_maybe (dictionary.get (format (%.nat artifact_id) extension) actual)) + [data (try.of_maybe (dictionary.get (format (%.nat artifact_id) extension) actual)) #let [context [module_id artifact_id] directive (\ host ingest context data)]] (case artifact_category @@ -329,7 +329,7 @@ (#.Definition [exported? type annotations _]) (|> definitions (dictionary.get def_name) - try.from_maybe + try.of_maybe (\ ! map (|>> [exported? type annotations] #.Definition [def_name]))))) @@ -378,7 +378,7 @@ (if valid_cache? #.None (#.Some [module_name module_id])))) - (dictionary.from_list text.hash))) + (dictionary.of_list text.hash))) (def: (full_purge caches load_order) (-> (List [Bit [Module [archive.ID [Descriptor (Document .Module)]]]]) @@ -434,7 +434,7 @@ dictionary.entries (monad.map ! (..purge! fs static))) loaded_caches (|> load_order - (list.filter (|>> product.left (dictionary.key? purge) not)) + (list.only (|>> product.left (dictionary.key? purge) not)) (monad.map ! (function (_ [module_name [module_id [descriptor document _]]]) (do ! [[descriptor,document,output bundles] (..load_definitions fs static module_id host_environment descriptor document)] 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 7794d3f5e..60c50db11 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -1,7 +1,6 @@ (.module: [library [lux (#- Module Definition) - [type (#+ :share)] ["." ffi (#+ import: do_to)] [abstract ["." monad (#+ Monad do)]] diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux index 514de6852..e69755445 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux @@ -1,7 +1,7 @@ (.module: [library [lux (#- Module) - [type (#+ :share)] + [type (#+ :sharing)] [abstract ["." monad (#+ Monad do)]] [control @@ -64,11 +64,11 @@ (\ encoding.utf8 decode) (\ try.monad map (|>> :assume - (:share [directive] - directive - so_far - - directive) + (:sharing [directive] + directive + so_far + + directive) (..then so_far))))) (: _.Expression (_.manual ""))))) @@ -124,9 +124,9 @@ #let [mapping (|> order (list\map (function (_ [module [module_id [descriptor document output]]]) [module module_id])) - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (: (Dictionary Module archive.ID)))] entries (monad.map ! (..write_module now mapping) order)] (wrap (|> entries - row.from_list + row.of_list (binary.run tar.writer)))))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux index 404b3d800..080765231 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux @@ -1,7 +1,7 @@ (.module: [library [lux #* - [type (#+ :share)] + [type (#+ :sharing)] [abstract ["." monad (#+ Monad do)]] [control @@ -46,11 +46,11 @@ (\ utf8.codec decode) (\ try.monad map (|>> :assume - (:share [directive] - directive - so_far - - directive) + (:sharing [directive] + directive + so_far + + directive) (sequence so_far))))) so_far))) diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux index d69098f92..f7e3ddf03 100644 --- a/stdlib/source/library/lux/tool/compiler/phase.lux +++ b/stdlib/source/library/lux/tool/compiler/phase.lux @@ -70,7 +70,7 @@ (def: #export fail (-> Text Operation) - (|>> try.fail (state.lift try.monad))) + (|>> #try.Failure (state.lift try.monad))) (def: #export (throw exception parameters) (All [e] (-> (Exception e) e Operation)) diff --git a/stdlib/source/library/lux/tool/interpreter.lux b/stdlib/source/library/lux/tool/interpreter.lux index df48eb420..8008dea25 100644 --- a/stdlib/source/library/lux/tool/interpreter.lux +++ b/stdlib/source/library/lux/tool/interpreter.lux @@ -8,7 +8,7 @@ [data ["." text ("#\." equivalence) ["%" format (#+ format)]]] - [type (#+ :share) + [type (#+ :sharing) ["." check]] [compiler ["." phase @@ -84,65 +84,65 @@ (wrap state))) (with-expansions [ (as-is (Operation anchor expression directive [Type Any]))] - - (def: (interpret-directive code) - (All [anchor expression directive] - (-> Code )) - (do phase.monad - [_ (total.phase code) - _ init.refresh] - (wrap [Any []]))) - - (def: (interpret-expression code) - (All [anchor expression directive] - (-> Code )) - (do {! phase.monad} - [state (extension.lift phase.get-state) - #let [analyse (get@ [#directive.analysis #directive.phase] state) - synthesize (get@ [#directive.synthesis #directive.phase] state) - generate (get@ [#directive.generation #directive.phase] state)] - [_ codeT codeA] (directive.lift-analysis - (analysis.with-scope - (type.with-fresh-env - (do ! - [[codeT codeA] (type.with-inference - (analyse code)) - codeT (type.with-env - (check.clean codeT))] - (wrap [codeT codeA]))))) - codeS (directive.lift-synthesis - (synthesize codeA))] - (directive.lift-generation - (generation.with-buffer - (do ! - [codeH (generate codeS) - count generation.next - codeV (generation.evaluate! (format "interpretation_" (%.nat count)) codeH)] - (wrap [codeT codeV])))))) - - (def: (interpret configuration code) - (All [anchor expression directive] - (-> Configuration Code )) - (function (_ state) - (case (<| (phase.run' state) - (:share [anchor expression directive] - {(State+ anchor expression directive) - state} - { - (interpret-directive code)})) - (#try.Success [state' output]) - (#try.Success [state' output]) - - (#try.Failure error) - (if (ex.match? total.not-a-directive error) - (<| (phase.run' state) - (:share [anchor expression directive] - {(State+ anchor expression directive) - state} - { - (interpret-expression code)})) - (#try.Failure error))))) - ) + + (def: (interpret-directive code) + (All [anchor expression directive] + (-> Code )) + (do phase.monad + [_ (total.phase code) + _ init.refresh] + (wrap [Any []]))) + + (def: (interpret-expression code) + (All [anchor expression directive] + (-> Code )) + (do {! phase.monad} + [state (extension.lift phase.get-state) + #let [analyse (get@ [#directive.analysis #directive.phase] state) + synthesize (get@ [#directive.synthesis #directive.phase] state) + generate (get@ [#directive.generation #directive.phase] state)] + [_ codeT codeA] (directive.lift-analysis + (analysis.with-scope + (type.with-fresh-env + (do ! + [[codeT codeA] (type.with-inference + (analyse code)) + codeT (type.with-env + (check.clean codeT))] + (wrap [codeT codeA]))))) + codeS (directive.lift-synthesis + (synthesize codeA))] + (directive.lift-generation + (generation.with-buffer + (do ! + [codeH (generate codeS) + count generation.next + codeV (generation.evaluate! (format "interpretation_" (%.nat count)) codeH)] + (wrap [codeT codeV])))))) + + (def: (interpret configuration code) + (All [anchor expression directive] + (-> Configuration Code )) + (function (_ state) + (case (<| (phase.run' state) + (:sharing [anchor expression directive] + {(State+ anchor expression directive) + state} + { + (interpret-directive code)})) + (#try.Success [state' output]) + (#try.Success [state' output]) + + (#try.Failure error) + (if (ex.match? total.not-a-directive error) + (<| (phase.run' state) + (:sharing [anchor expression directive] + {(State+ anchor expression directive) + state} + { + (interpret-expression code)})) + (#try.Failure error))))) + ) (def: (execute configuration code) (All [anchor expression directive] @@ -163,29 +163,29 @@ #source Source}) (with-expansions [ (as-is (Context anchor expression directive))] - (def: (read-eval-print context) - (All [anchor expression directive] - (-> (Try [ Text]))) - (do try.monad - [#let [[_where _offset _code] (get@ #source context)] - [source' input] (syntax.parse ..module syntax.no-aliases (text.size _code) (get@ #source context)) - [state' representation] (let [## TODO: Simplify ASAP - state (:share [anchor expression directive] - { - context} - {(State+ anchor expression directive) - (get@ #state context)})] - (<| (phase.run' state) - ## TODO: Simplify ASAP - (:share [anchor expression directive] - { - context} - {(Operation anchor expression directive Text) - (execute (get@ #configuration context) input)})))] - (wrap [(|> context - (set@ #state state') - (set@ #source source')) - representation])))) + (def: (read-eval-print context) + (All [anchor expression directive] + (-> (Try [ Text]))) + (do try.monad + [#let [[_where _offset _code] (get@ #source context)] + [source' input] (syntax.parse ..module syntax.no-aliases (text.size _code) (get@ #source context)) + [state' representation] (let [## TODO: Simplify ASAP + state (:sharing [anchor expression directive] + { + context} + {(State+ anchor expression directive) + (get@ #state context)})] + (<| (phase.run' state) + ## TODO: Simplify ASAP + (:sharing [anchor expression directive] + { + context} + {(Operation anchor expression directive Text) + (execute (get@ #configuration context) input)})))] + (wrap [(|> context + (set@ #state state') + (set@ #source source')) + representation])))) (def: #export (run Monad Console platform configuration generation-bundle) (All [! anchor expression directive] diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux index 751645cc4..60ef3a4a2 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -39,25 +39,25 @@ _ [num_args type])))] - [flatten_univ_q #.UnivQ] - [flatten_ex_q #.ExQ] + [flat_univ_q #.UnivQ] + [flat_ex_q #.ExQ] ) -(def: #export (flatten_function type) +(def: #export (flat_function type) (-> Type [(List Type) Type]) (case type (#.Function in out') - (let [[ins out] (flatten_function out')] + (let [[ins out] (flat_function out')] [(list& in ins) out]) _ [(list) type])) -(def: #export (flatten_application type) +(def: #export (flat_application type) (-> Type [Type (List Type)]) (case type (#.Apply arg func') - (let [[func args] (flatten_application func')] + (let [[func args] (flat_application func')] [func (list\compose args (list arg))]) _ @@ -73,8 +73,8 @@ _ (list type)))] - [flatten_variant #.Sum] - [flatten_tuple #.Product] + [flat_variant #.Sum] + [flat_tuple #.Product] ) (def: #export (format type) @@ -98,11 +98,11 @@ (list.interpose " ") (list\fold text\compose "")) )]) - ([#.Sum "(| " ")" flatten_variant] - [#.Product "[" "]" flatten_tuple]) + ([#.Sum "(| " ")" flat_variant] + [#.Product "[" "]" flat_tuple]) (#.Function input output) - (let [[ins out] (flatten_function type)] + (let [[ins out] (flat_function type)] ($_ text\compose "(-> " (|> ins (list\map format) @@ -121,7 +121,7 @@ ($_ text\compose "⟨e:" (n\encode id) "⟩") (#.Apply param fun) - (let [[type_func type_args] (flatten_application type)] + (let [[type_func type_args] (flat_application type)] ($_ text\compose "(" (format type_func) " " (|> type_args (list\map format) list.reverse (list.interpose " ") (list\fold text\compose "")) ")")) (^template [ ] @@ -134,15 +134,16 @@ ($_ text\compose module "." name) )) -(def: (beta_reduce env type) +## https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction +(def: (reduced env type) (-> (List Type) Type Type) (case type (#.Primitive name params) - (#.Primitive name (list\map (beta_reduce env) params)) + (#.Primitive name (list\map (reduced env) params)) (^template [] [( left right) - ( (beta_reduce env left) (beta_reduce env right))]) + ( (reduced env left) (reduced env right))]) ([#.Sum] [#.Product] [#.Function] [#.Apply]) @@ -153,7 +154,7 @@ ( env def) _ - ( (list\map (beta_reduce env) old_env) def))]) + ( (list\map (reduced env) old_env) def))]) ([#.UnivQ] [#.ExQ]) @@ -219,7 +220,7 @@ #0 )))) -(def: #export (apply params func) +(def: #export (applied params func) (-> (List Type) Type (Maybe Type)) (case params #.Nil @@ -230,15 +231,15 @@ (^template [] [( env body) (|> body - (beta_reduce (list& func param env)) - (apply params'))]) + (reduced (list& func param env)) + (applied params'))]) ([#.UnivQ] [#.ExQ]) (#.Apply A F) - (apply (list& A params) F) + (applied (list& A params) F) (#.Named name unnamed) - (apply params unnamed) + (applied params unnamed) _ #.None))) @@ -271,20 +272,20 @@ ([#.UnivQ] [#.ExQ]) )) -(def: #export (un_alias type) +(def: #export (de_aliased type) (-> Type Type) (case type (#.Named _ (#.Named name type')) - (un_alias (#.Named name type')) + (de_aliased (#.Named name type')) _ type)) -(def: #export (un_name type) +(def: #export (anonymous type) (-> Type Type) (case type (#.Named name type') - (un_name type') + (anonymous type') _ type)) @@ -342,10 +343,9 @@ (quantified? _type) (#.Apply A F) - (maybe.default #0 - (do maybe.monad - [applied (apply (list A) F)] - (wrap (quantified? applied)))) + (|> (..applied (list A) F) + (\ maybe.monad map quantified?) + (maybe.default #0)) (^or (#.UnivQ _) (#.ExQ _)) #1 @@ -362,12 +362,12 @@ (list) (#.Primitive array.type_name)))) -(def: #export (flatten_array type) +(def: #export (flat_array type) (-> Type [Nat Type]) (case type (^multi (^ (#.Primitive name (list element_type))) (text\= array.type_name name)) - (let [[depth element_type] (flatten_array element_type)] + (let [[depth element_type] (flat_array element_type)] [(inc depth) element_type]) _ @@ -375,7 +375,7 @@ (def: #export array? (-> Type Bit) - (|>> ..flatten_array + (|>> ..flat_array product.left (n.> 0))) @@ -439,9 +439,9 @@ (<>.and .any .any)) ## TODO: Make sure the generated code always gets optimized away. -(syntax: #export (:share {type_vars ..type_parameters} - {exemplar ..typed} - {computation ..typed}) +(syntax: #export (:sharing {type_vars ..type_parameters} + {exemplar ..typed} + {computation ..typed}) (macro.with_gensyms [g!_] (let [shareC (` (: (All [(~+ (list\map code.local_identifier type_vars))] (-> (~ (get@ #type exemplar)) @@ -453,7 +453,7 @@ (syntax: #export (:by_example {type_vars ..type_parameters} {exemplar ..typed} {extraction .any}) - (wrap (list (` (:of ((~! :share) + (wrap (list (` (:of ((~! :sharing) [(~+ (list\map code.local_identifier type_vars))] (~ (get@ #type exemplar)) diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index a8b447338..24335b7bb 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/type/check.lux @@ -285,7 +285,7 @@ (apply_type! funcT'' argT)) _ - (case (//.apply (list argT) funcT) + (case (//.applied (list argT) funcT) (#.Some output) (check\wrap output) diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux index a308b99a8..fb2598ab8 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/type/implicit.lux @@ -3,7 +3,7 @@ [lux #* [abstract ["." monad (#+ Monad do)] - ["eq" equivalence]] + ["." equivalence]] [control ["." try] ["p" parser @@ -65,7 +65,7 @@ (find_member_type idx sig_type') (#.Apply arg func) - (case (type.apply (list arg) func) + (case (type.applied (list arg) func) #.None (check.fail (format "Cannot apply type " (%.type func) " to type " (%.type arg))) @@ -95,8 +95,8 @@ imp_mods (meta.imported_modules this_module_name) tag_lists (monad.map ! meta.tag_lists imp_mods) #let [tag_lists (|> tag_lists list\join (list\map product.left) list\join) - candidates (list.filter (|>> product.right (text\= simple_name)) - tag_lists)]] + candidates (list.only (|>> product.right (text\= simple_name)) + tag_lists)]] (case candidates #.Nil (meta.fail (format "Unknown tag: " (%.name member))) @@ -168,7 +168,7 @@ (#.UnivQ _) (do check.monad [[id var] check.var] - (apply_function_type (maybe.assume (type.apply (list var) func)) + (apply_function_type (maybe.assume (type.applied (list var) func)) arg)) (#.Function input output) @@ -185,7 +185,7 @@ (#.UnivQ _) (do check.monad [[id var] check.var - [ids final_output] (concrete_type (maybe.assume (type.apply (list var) type)))] + [ids final_output] (concrete_type (maybe.assume (type.applied (list var) type)))] (wrap [(#.Cons id ids) final_output])) @@ -217,7 +217,7 @@ (case (check.run context (do {! check.monad} [[tvars alt_type] (concrete_type alt_type) - #let [[deps alt_type] (type.flatten_function alt_type)] + #let [[deps alt_type] (type.flat_function alt_type)] _ (check.check dep alt_type) context' check.context =deps (monad.map ! (provision compiler context') deps)] @@ -266,7 +266,7 @@ (case (check.run context (do {! check.monad} [[tvars alt_type] (concrete_type alt_type) - #let [[deps alt_type] (type.flatten_function alt_type)] + #let [[deps alt_type] (type.flat_function alt_type)] _ (check.check alt_type sig_type) member_type (find_member_type member_idx alt_type) _ (check_apply member_type input_types output_type) @@ -333,7 +333,7 @@ (\ number.equivalence = x y) (\\ = x y) "Can optionally add the prefix of the module where the signature was defined." - (\\ eq.= x y) + (\\ equivalence.= x y) "(List Nat) equivalence" (\\ = (list.indices 10) diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux index a3e49104d..950a884ae 100644 --- a/stdlib/source/library/lux/type/refinement.lux +++ b/stdlib/source/library/lux/type/refinement.lux @@ -49,7 +49,7 @@ #.None)))) ) -(def: #export (filter refiner values) +(def: #export (only refiner values) (All [t %] (-> (Refiner t %) (List t) (List (Refined t %)))) (case values #.Nil @@ -58,10 +58,10 @@ (#.Cons head tail) (case (refiner head) (#.Some refined) - (#.Cons refined (filter refiner tail)) + (#.Cons refined (only refiner tail)) #.None - (filter refiner tail)))) + (only refiner tail)))) (def: #export (partition refiner values) (All [t %] (-> (Refiner t %) (List t) [(List (Refined t %)) (List t)])) diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index d59faa1c1..ac2912f16 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -229,7 +229,7 @@ (#.Some children) (|> children array.to_list - (monad.filter ! (|>> )) + (monad.only ! (|>> )) (\ ! map (monad.map ! (|>> java/io/File::getAbsolutePath))) (\ ! join)) @@ -248,7 +248,7 @@ (def: last_modified (|>> java/io/File::new (java/io/File::lastModified) - (\ (try.with io.monad) map (|>> duration.from_millis instant.absolute)))) + (\ (try.with io.monad) map (|>> duration.of_millis instant.absolute)))) (def: can_execute? (|>> java/io/File::new @@ -453,7 +453,7 @@ (\ ! map (|>> ( []) [sub]) (with_promise write! (Try Stats) (Fs::stat [sub (..value_callback write!)] node_fs))))) - (\ ! map (|>> (list.filter product.right) + (\ ! map (|>> (list.only product.right) (list\map product.left))))))] [directory_files Stats::isFile] @@ -477,7 +477,7 @@ (wrap (|> stats Stats::mtimeMs f.int - duration.from_millis + duration.of_millis instant.absolute)))) (def: (can_execute? path) @@ -598,7 +598,7 @@ (list\map (|>> (format path ..python_separator))) (monad.map ! (function (_ sub) (\ ! map (|>> [sub]) ( [sub])))) - (\ ! map (|>> (list.filter product.right) + (\ ! map (|>> (list.only product.right) (list\map product.left))))) (\ ! join))))] @@ -614,7 +614,7 @@ (|>> os/path::getmtime (\ (try.with io.monad) map (|>> f.int (i.* +1,000) - duration.from_millis + duration.of_millis instant.absolute)))) (def: (can_execute? path) @@ -746,14 +746,14 @@ [(def: (let [! (try.with io.monad)] (|>> RubyFile::stat - (\ ! map (`` (|>> (~~ (template.splice ))))))))] + (\ ! map (`` (|>> (~~ (template.spliced ))))))))] [file_size [RubyStat::size .nat]] [last_modified [(RubyStat::mtime []) (RubyTime::to_f []) (f.* +1,000.0) f.int - duration.from_millis + duration.of_millis instant.absolute]] [can_execute? [(RubyStat::executable? [])]] )) @@ -872,10 +872,10 @@ ## [value ( [path])] ## (if (bit\= false (:as Bit value)) ## (\ io.monad wrap (exception.throw ..cannot_find_file [path])) - ## (wrap (`` (|> value (~~ (template.splice ))))))))] + ## (wrap (`` (|> value (~~ (template.spliced ))))))))] ## [size ..filesize [.nat]] - ## [last_modified ..filemtime [(i.* +1,000) duration.from_millis instant.absolute]] + ## [last_modified ..filemtime [(i.* +1,000) duration.of_millis instant.absolute]] ## )) ## (def: (can_execute? _) @@ -915,7 +915,7 @@ ## [children (..scandir [path])] ## (loop [input (|> children ## array.to_list - ## (list.filter (function (_ child) + ## (list.only (function (_ child) ## (not (or (text\= "." child) ## (text\= ".." child)))))) ## output (: (List ( IO)) diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index df655ed9c..721e9b059 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -150,16 +150,16 @@ (do {! (try.with promise.monad)} [current_files (..poll_files fs directory) #let [creations (if (..creation? concern) - (list.filter (|>> product.left (dictionary.key? file_tracker) not) - current_files) + (list.only (|>> product.left (dictionary.key? file_tracker) not) + current_files) (list)) available (|> current_files (list\map product.left) - (set.from_list text.hash)) + (set.of_list text.hash)) deletions (if (..deletion? concern) (|> (dictionary.entries file_tracker) (list\map product.left) - (list.filter (|>> (set.member? available) not))) + (list.only (|>> (set.member? available) not))) (list)) modifications (list.all (function (_ [path current_modification]) (do maybe.monad @@ -233,7 +233,7 @@ _ (do promise.monad [_ (stm.commit (stm.write (|> changes (list\map product.left) - (dictionary.from_list text.hash)) + (dictionary.of_list text.hash)) tracker))] (wrap (#try.Success []))) #let [[creations modifications deletions] @@ -247,8 +247,8 @@ (wrap ($_ list\compose (list\map (|>> product.left [..creation]) creations) (|> modifications - (list.filter (function (_ [path previous_modification current_modification]) - (not (instant\= previous_modification current_modification)))) + (list.only (function (_ [path previous_modification current_modification]) + (not (instant\= previous_modification current_modification)))) (list\map (|>> product.left [..modification]))) (list\map (|>> [..deletion]) deletions) ))))) diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index 5a7a93e31..95dbde0dc 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -224,4 +224,4 @@ (def: #export headers (-> (List [Text Text]) //.Headers) - (dictionary.from_list text.hash)) + (dictionary.of_list text.hash)) diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux index 4a6911798..80ce2bbf5 100644 --- a/stdlib/source/library/lux/world/net/http/request.lux +++ b/stdlib/source/library/lux/world/net/http/request.lux @@ -31,7 +31,7 @@ (def: (merge inputs) (-> (List Binary) Binary) - (let [[_ output] (try.assume + (let [[_ output] (try.assumed (monad.fold try.monad (function (_ input [offset output]) (let [amount (binary.size input)] diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux index 8c8a0ac05..1607e14c3 100644 --- a/stdlib/source/library/lux/world/program.lux +++ b/stdlib/source/library/lux/world/program.lux @@ -66,7 +66,7 @@ (#try.Failure _) #.None))) - (dictionary.from_list text.hash))))) + (dictionary.of_list text.hash))))) (`` (implementation: #export (async program) (-> (Program IO) (Program Promise)) @@ -334,7 +334,7 @@ ## array.to_list ## (list\map (function (_ variable) ## [variable ("php array read" (:as Nat variable) environment)])) - ## (dictionary.from_list text.hash)))) + ## (dictionary.of_list text.hash)))) ## @.scheme (do io.monad ## [input (..get-environment-variables [])] ## (loop [input input diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux index ddfacbc5e..00cba51fe 100644 --- a/stdlib/source/library/lux/world/shell.lux +++ b/stdlib/source/library/lux/world/shell.lux @@ -112,8 +112,8 @@ (def: sanitize_common_command (-> Replacer (Sanitizer Command)) - (let [x0A (text.from_code (hex "0A")) - xFF (text.from_code (hex "FF"))] + (let [x0A (text.of_code (hex "0A")) + xFF (text.of_code (hex "FF"))] (function (_ replacer) (|>> (..replace x0A replacer) (..replace xFF replacer) diff --git a/stdlib/source/poly/lux/abstract/equivalence.lux b/stdlib/source/poly/lux/abstract/equivalence.lux index 080e64af0..15795ffcf 100644 --- a/stdlib/source/poly/lux/abstract/equivalence.lux +++ b/stdlib/source/poly/lux/abstract/equivalence.lux @@ -4,9 +4,8 @@ [abstract [monad (#+ Monad do)]] [control - ["p" parser - ["<.>" type] - ["s" code (#+ Parser)]]] + ["<>" parser + ["<.>" type]]] [data ["." product] ["." bit] @@ -43,14 +42,14 @@ ["." /]]) (poly: #export equivalence - (`` (do {! p.monad} + (`` (do {! <>.monad} [#let [g!_ (code.local_identifier "_____________")] *env* .env inputT .peek #let [@Equivalence (: (-> Type Code) (function (_ type) (` ((~! /.Equivalence) (~ (poly.to_code *env* type))))))]] - ($_ p.either + ($_ <>.either ## Basic types (~~ (template [ ] [(do ! @@ -68,8 +67,8 @@ ## Composite types (~~ (template [ ] [(do ! - [[_ argC] (.apply (p.and (.exactly ) - equivalence))] + [[_ argC] (.applied (<>.and (.exactly ) + equivalence))] (wrap (` (: (~ (@Equivalence inputT)) ( (~ argC))))))] @@ -82,10 +81,10 @@ [tree.Tree (~! tree.equivalence)] )) (do ! - [[_ _ valC] (.apply ($_ p.and - (.exactly dictionary.Dictionary) - .any - equivalence))] + [[_ _ valC] (.applied ($_ <>.and + (.exactly dictionary.Dictionary) + .any + equivalence))] (wrap (` (: (~ (@Equivalence inputT)) ((~! dictionary.equivalence) (~ valC)))))) ## Models @@ -102,13 +101,13 @@ [month.Month month.equivalence] )) (do ! - [_ (.apply (p.and (.exactly unit.Qty) - .any))] + [_ (.applied (<>.and (.exactly unit.Qty) + .any))] (wrap (` (: (~ (@Equivalence inputT)) unit.equivalence)))) ## Variants (do ! - [members (.variant (p.many equivalence)) + [members (.variant (<>.many equivalence)) #let [last (dec (list.size members)) g!_ (code.local_identifier "_____________") g!left (code.local_identifier "_____________left") @@ -129,7 +128,7 @@ #0)))))) ## Tuples (do ! - [g!eqs (.tuple (p.many equivalence)) + [g!eqs (.tuple (<>.many equivalence)) #let [g!_ (code.local_identifier "_____________") indices (list.indices (list.size g!eqs)) g!lefts (list\map (|>> nat\encode (text\compose "left") code.local_identifier) indices) @@ -149,7 +148,7 @@ .recursive_self ## Type applications (do ! - [[funcC argsC] (.apply (p.and equivalence (p.many equivalence)))] + [[funcC argsC] (.applied (<>.and equivalence (<>.many equivalence)))] (wrap (` ((~ funcC) (~+ argsC))))) ## Parameters .parameter @@ -164,6 +163,6 @@ .recursive_call ## If all else fails... (|> .any - (\ ! map (|>> %.type (format "Cannot create Equivalence for: ") p.fail)) + (\ ! map (|>> %.type (format "Cannot create Equivalence for: ") <>.fail)) (\ ! join)) )))) diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux index d7409df9f..5c63c58e1 100644 --- a/stdlib/source/poly/lux/data/format/json.lux +++ b/stdlib/source/poly/lux/data/format/json.lux @@ -135,36 +135,36 @@