aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2021-08-23 02:30:53 -0400
committerEduardo Julian2021-08-23 02:30:53 -0400
commitec1f31b5a1492d5e0ab260397291d4449483bbd9 (patch)
treec730b4ca89af366779b0ad0f46fae705b5c2bcbc
parent1ea83ecadccc5adee1bdb35bd11527c3982c015e (diff)
The Python compiler can now be compiled by the new JVM compiler.
-rw-r--r--documentation/book/the_lux_programming_language/appendix_b.md88
-rw-r--r--documentation/bookmark/architecture.md4
-rw-r--r--documentation/bookmark/database/query.md4
-rw-r--r--documentation/bookmark/security/authentication.md4
-rw-r--r--documentation/bookmark/unicode.md4
-rw-r--r--licentia/source/program/licentia.lux6
-rw-r--r--lux-cl/source/program.lux4
-rw-r--r--lux-js/source/program.lux6
-rw-r--r--lux-jvm/source/luxc/lang/directive/jvm.lux38
-rw-r--r--lux-jvm/source/luxc/lang/synthesis/variable.lux22
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/case.lux52
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux10
-rw-r--r--lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux78
-rw-r--r--lux-jvm/test/test/luxc/lang/synthesis/loop.lux2
-rw-r--r--lux-lua/source/program.lux8
-rw-r--r--lux-php/source/program.lux4
-rw-r--r--lux-python/source/program.lux6
-rw-r--r--lux-r/source/luxc/lang/synthesis/variable.lux22
-rw-r--r--lux-r/source/program.lux4
-rw-r--r--lux-ruby/source/program.lux4
-rw-r--r--lux-scheme/source/program.lux4
-rw-r--r--stdlib/source/documentation/lux.lux16
-rw-r--r--stdlib/source/documentation/lux/abstract.lux4
-rw-r--r--stdlib/source/documentation/lux/abstract/mix.lux (renamed from stdlib/source/documentation/lux/abstract/fold.lux)8
-rw-r--r--stdlib/source/documentation/lux/abstract/monad.lux8
-rw-r--r--stdlib/source/documentation/lux/control/concurrency/frp.lux10
-rw-r--r--stdlib/source/documentation/lux/control/pipe.lux4
-rw-r--r--stdlib/source/documentation/lux/data/collection/array.lux2
-rw-r--r--stdlib/source/documentation/lux/data/collection/list.lux8
-rw-r--r--stdlib/source/documentation/lux/data/collection/row.lux2
-rw-r--r--stdlib/source/documentation/lux/data/color.lux25
-rw-r--r--stdlib/source/documentation/lux/data/color/named.lux8
-rw-r--r--stdlib/source/documentation/lux/data/product.lux2
-rw-r--r--stdlib/source/documentation/lux/data/text/encoding/utf8.lux5
-rw-r--r--stdlib/source/documentation/lux/data/text/unicode/block.lux6
-rw-r--r--stdlib/source/documentation/lux/macro/template.lux2
-rw-r--r--stdlib/source/documentation/lux/math.lux73
-rw-r--r--stdlib/source/documentation/lux/math/infix.lux2
-rw-r--r--stdlib/source/documentation/lux/math/logic.lux14
-rw-r--r--stdlib/source/documentation/lux/math/modular.lux53
-rw-r--r--stdlib/source/documentation/lux/math/modulus.lux39
-rw-r--r--stdlib/source/documentation/lux/math/number.lux52
-rw-r--r--stdlib/source/documentation/lux/math/number/complex.lux64
-rw-r--r--stdlib/source/documentation/lux/math/number/frac.lux127
-rw-r--r--stdlib/source/documentation/lux/math/number/i16.lux25
-rw-r--r--stdlib/source/documentation/lux/math/number/i32.lux25
-rw-r--r--stdlib/source/documentation/lux/math/number/i64.lux123
-rw-r--r--stdlib/source/documentation/lux/math/number/i8.lux25
-rw-r--r--stdlib/source/documentation/lux/math/number/int.lux127
-rw-r--r--stdlib/source/documentation/lux/math/number/nat.lux82
-rw-r--r--stdlib/source/documentation/lux/math/number/ratio.lux45
-rw-r--r--stdlib/source/documentation/lux/math/number/rev.lux115
-rw-r--r--stdlib/source/documentation/lux/math/random.lux139
-rw-r--r--stdlib/source/documentation/lux/meta.lux196
-rw-r--r--stdlib/source/documentation/lux/meta/annotation.lux56
-rw-r--r--stdlib/source/documentation/lux/meta/location.lux30
-rw-r--r--stdlib/source/documentation/lux/static.lux70
-rw-r--r--stdlib/source/documentation/lux/target.lux32
-rw-r--r--stdlib/source/library/lux.lux628
-rw-r--r--stdlib/source/library/lux/abstract/apply.lux20
-rw-r--r--stdlib/source/library/lux/abstract/codec.lux16
-rw-r--r--stdlib/source/library/lux/abstract/comonad.lux28
-rw-r--r--stdlib/source/library/lux/abstract/fold.lux16
-rw-r--r--stdlib/source/library/lux/abstract/mix.lux16
-rw-r--r--stdlib/source/library/lux/abstract/monad.lux44
-rw-r--r--stdlib/source/library/lux/abstract/monad/free.lux9
-rw-r--r--stdlib/source/library/lux/abstract/monad/indexed.lux30
-rw-r--r--stdlib/source/library/lux/abstract/monoid.lux4
-rw-r--r--stdlib/source/library/lux/control/concatenative.lux30
-rw-r--r--stdlib/source/library/lux/control/concurrency/actor.lux2
-rw-r--r--stdlib/source/library/lux/control/concurrency/async.lux2
-rw-r--r--stdlib/source/library/lux/control/concurrency/frp.lux12
-rw-r--r--stdlib/source/library/lux/control/concurrency/stm.lux2
-rw-r--r--stdlib/source/library/lux/control/continuation.lux2
-rw-r--r--stdlib/source/library/lux/control/exception.lux28
-rw-r--r--stdlib/source/library/lux/control/io.lux2
-rw-r--r--stdlib/source/library/lux/control/lazy.lux2
-rw-r--r--stdlib/source/library/lux/control/maybe.lux2
-rw-r--r--stdlib/source/library/lux/control/parser.lux4
-rw-r--r--stdlib/source/library/lux/control/parser/binary.lux2
-rw-r--r--stdlib/source/library/lux/control/parser/json.lux10
-rw-r--r--stdlib/source/library/lux/control/parser/synthesis.lux4
-rw-r--r--stdlib/source/library/lux/control/parser/text.lux34
-rw-r--r--stdlib/source/library/lux/control/parser/tree.lux33
-rw-r--r--stdlib/source/library/lux/control/parser/type.lux6
-rw-r--r--stdlib/source/library/lux/control/parser/xml.lux2
-rw-r--r--stdlib/source/library/lux/control/pipe.lux3
-rw-r--r--stdlib/source/library/lux/control/reader.lux2
-rw-r--r--stdlib/source/library/lux/control/region.lux6
-rw-r--r--stdlib/source/library/lux/control/remember.lux9
-rw-r--r--stdlib/source/library/lux/control/security/policy.lux2
-rw-r--r--stdlib/source/library/lux/control/state.lux4
-rw-r--r--stdlib/source/library/lux/control/thread.lux2
-rw-r--r--stdlib/source/library/lux/control/try.lux4
-rw-r--r--stdlib/source/library/lux/control/writer.lux4
-rw-r--r--stdlib/source/library/lux/data/bit.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/array.lux132
-rw-r--r--stdlib/source/library/lux/data/collection/bits.lux10
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary.lux158
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/ordered.lux14
-rw-r--r--stdlib/source/library/lux/data/collection/list.lux79
-rw-r--r--stdlib/source/library/lux/data/collection/row.lux62
-rw-r--r--stdlib/source/library/lux/data/collection/set.lux8
-rw-r--r--stdlib/source/library/lux/data/collection/set/multi.lux40
-rw-r--r--stdlib/source/library/lux/data/collection/set/ordered.lux6
-rw-r--r--stdlib/source/library/lux/data/collection/tree.lux18
-rw-r--r--stdlib/source/library/lux/data/collection/tree/zipper.lux2
-rw-r--r--stdlib/source/library/lux/data/color.lux13
-rw-r--r--stdlib/source/library/lux/data/color/named.lux1
-rw-r--r--stdlib/source/library/lux/data/format/binary.lux4
-rw-r--r--stdlib/source/library/lux/data/format/css.lux4
-rw-r--r--stdlib/source/library/lux/data/format/html.lux10
-rw-r--r--stdlib/source/library/lux/data/format/json.lux42
-rw-r--r--stdlib/source/library/lux/data/format/tar.lux54
-rw-r--r--stdlib/source/library/lux/data/format/xml.lux8
-rw-r--r--stdlib/source/library/lux/data/identity.lux3
-rw-r--r--stdlib/source/library/lux/data/name.lux4
-rw-r--r--stdlib/source/library/lux/data/product.lux1
-rw-r--r--stdlib/source/library/lux/data/text.lux4
-rw-r--r--stdlib/source/library/lux/data/text/buffer.lux16
-rw-r--r--stdlib/source/library/lux/data/text/encoding.lux1
-rw-r--r--stdlib/source/library/lux/data/text/encoding/utf8.lux17
-rw-r--r--stdlib/source/library/lux/data/text/escape.lux4
-rw-r--r--stdlib/source/library/lux/data/text/format.lux34
-rw-r--r--stdlib/source/library/lux/data/text/regex.lux78
-rw-r--r--stdlib/source/library/lux/data/text/unicode/set.lux12
-rw-r--r--stdlib/source/library/lux/documentation.lux38
-rw-r--r--stdlib/source/library/lux/ffi.js.lux2
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux17
-rw-r--r--stdlib/source/library/lux/ffi.lua.lux12
-rw-r--r--stdlib/source/library/lux/ffi.old.lux18
-rw-r--r--stdlib/source/library/lux/ffi.php.lux2
-rw-r--r--stdlib/source/library/lux/ffi.py.lux12
-rw-r--r--stdlib/source/library/lux/ffi.rb.lux2
-rw-r--r--stdlib/source/library/lux/ffi.scm.lux2
-rw-r--r--stdlib/source/library/lux/macro.lux6
-rw-r--r--stdlib/source/library/lux/macro/code.lux35
-rw-r--r--stdlib/source/library/lux/macro/template.lux15
-rw-r--r--stdlib/source/library/lux/math.lux69
-rw-r--r--stdlib/source/library/lux/math/infix.lux22
-rw-r--r--stdlib/source/library/lux/math/modular.lux18
-rw-r--r--stdlib/source/library/lux/math/modulus.lux8
-rw-r--r--stdlib/source/library/lux/math/number.lux39
-rw-r--r--stdlib/source/library/lux/math/number/complex.lux7
-rw-r--r--stdlib/source/library/lux/math/number/frac.lux112
-rw-r--r--stdlib/source/library/lux/math/number/i16.lux3
-rw-r--r--stdlib/source/library/lux/math/number/i32.lux3
-rw-r--r--stdlib/source/library/lux/math/number/i64.lux43
-rw-r--r--stdlib/source/library/lux/math/number/i8.lux3
-rw-r--r--stdlib/source/library/lux/math/number/int.lux47
-rw-r--r--stdlib/source/library/lux/math/number/nat.lux34
-rw-r--r--stdlib/source/library/lux/math/number/ratio.lux16
-rw-r--r--stdlib/source/library/lux/math/number/rev.lux43
-rw-r--r--stdlib/source/library/lux/math/random.lux21
-rw-r--r--stdlib/source/library/lux/meta.lux56
-rw-r--r--stdlib/source/library/lux/meta/annotation.lux1
-rw-r--r--stdlib/source/library/lux/meta/location.lux12
-rw-r--r--stdlib/source/library/lux/target.lux2
-rw-r--r--stdlib/source/library/lux/target/common_lisp.lux2
-rw-r--r--stdlib/source/library/lux/target/js.lux10
-rw-r--r--stdlib/source/library/lux/target/jvm/attribute/code.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/class.lux12
-rw-r--r--stdlib/source/library/lux/target/jvm/constant/pool.lux10
-rw-r--r--stdlib/source/library/lux/target/jvm/reflection.lux8
-rw-r--r--stdlib/source/library/lux/target/lua.lux12
-rw-r--r--stdlib/source/library/lux/target/php.lux12
-rw-r--r--stdlib/source/library/lux/target/python.lux10
-rw-r--r--stdlib/source/library/lux/target/r.lux10
-rw-r--r--stdlib/source/library/lux/target/ruby.lux10
-rw-r--r--stdlib/source/library/lux/target/scheme.lux2
-rw-r--r--stdlib/source/library/lux/test.lux24
-rw-r--r--stdlib/source/library/lux/time.lux24
-rw-r--r--stdlib/source/library/lux/time/date.lux34
-rw-r--r--stdlib/source/library/lux/time/day.lux10
-rw-r--r--stdlib/source/library/lux/time/duration.lux18
-rw-r--r--stdlib/source/library/lux/time/instant.lux8
-rw-r--r--stdlib/source/library/lux/time/month.lux10
-rw-r--r--stdlib/source/library/lux/time/year.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux42
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux52
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux24
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux82
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux20
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux20
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux108
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux20
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux45
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux56
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux34
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux16
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive.lux28
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux36
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux24
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/archive.lux62
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/context.lux40
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux32
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/script.lux30
-rw-r--r--stdlib/source/library/lux/type.lux36
-rw-r--r--stdlib/source/library/lux/type/abstract.lux6
-rw-r--r--stdlib/source/library/lux/type/check.lux20
-rw-r--r--stdlib/source/library/lux/type/implicit.lux38
-rw-r--r--stdlib/source/library/lux/type/poly.lux2
-rw-r--r--stdlib/source/library/lux/type/resource.lux18
-rw-r--r--stdlib/source/library/lux/world/file/watch.lux92
-rw-r--r--stdlib/source/library/lux/world/net/http/request.lux26
-rw-r--r--stdlib/source/library/lux/world/net/http/response.lux8
-rw-r--r--stdlib/source/library/lux/world/shell.lux32
-rw-r--r--stdlib/source/poly/lux/abstract/equivalence.lux4
-rw-r--r--stdlib/source/poly/lux/data/format/json.lux139
-rw-r--r--stdlib/source/program/aedifex/command/build.lux32
-rw-r--r--stdlib/source/program/aedifex/command/deploy.lux4
-rw-r--r--stdlib/source/program/aedifex/command/deps.lux4
-rw-r--r--stdlib/source/program/aedifex/command/install.lux4
-rw-r--r--stdlib/source/program/aedifex/command/pom.lux4
-rw-r--r--stdlib/source/program/aedifex/dependency/deployment.lux4
-rw-r--r--stdlib/source/program/aedifex/dependency/resolution.lux8
-rw-r--r--stdlib/source/program/aedifex/hash.lux16
-rw-r--r--stdlib/source/program/aedifex/input.lux2
-rw-r--r--stdlib/source/program/aedifex/metadata/artifact.lux8
-rw-r--r--stdlib/source/program/aedifex/metadata/snapshot.lux8
-rw-r--r--stdlib/source/program/aedifex/package.lux2
-rw-r--r--stdlib/source/program/aedifex/pom.lux6
-rw-r--r--stdlib/source/program/aedifex/project.lux10
-rw-r--r--stdlib/source/program/aedifex/repository/identity.lux2
-rw-r--r--stdlib/source/program/compositor/import.lux36
-rw-r--r--stdlib/source/program/scriptum.lux20
-rw-r--r--stdlib/source/specification/compositor/generation/case.lux10
-rw-r--r--stdlib/source/specification/lux/abstract/apply.lux25
-rw-r--r--stdlib/source/specification/lux/abstract/codec.lux2
-rw-r--r--stdlib/source/specification/lux/abstract/mix.lux (renamed from stdlib/source/specification/lux/abstract/fold.lux)6
-rw-r--r--stdlib/source/specification/lux/world/file.lux6
-rw-r--r--stdlib/source/test/aedifex/command/auto.lux2
-rw-r--r--stdlib/source/test/aedifex/command/deploy.lux10
-rw-r--r--stdlib/source/test/aedifex/command/deps.lux4
-rw-r--r--stdlib/source/test/aedifex/command/pom.lux4
-rw-r--r--stdlib/source/test/aedifex/dependency/deployment.lux10
-rw-r--r--stdlib/source/test/aedifex/dependency/resolution.lux42
-rw-r--r--stdlib/source/test/aedifex/hash.lux4
-rw-r--r--stdlib/source/test/aedifex/input.lux2
-rw-r--r--stdlib/source/test/aedifex/package.lux4
-rw-r--r--stdlib/source/test/aedifex/repository/local.lux2
-rw-r--r--stdlib/source/test/aedifex/repository/remote.lux6
-rw-r--r--stdlib/source/test/lux/abstract.lux4
-rw-r--r--stdlib/source/test/lux/abstract/apply.lux6
-rw-r--r--stdlib/source/test/lux/abstract/codec.lux6
-rw-r--r--stdlib/source/test/lux/abstract/enum.lux14
-rw-r--r--stdlib/source/test/lux/abstract/mix.lux (renamed from stdlib/source/test/lux/abstract/fold.lux)6
-rw-r--r--stdlib/source/test/lux/abstract/monad.lux16
-rw-r--r--stdlib/source/test/lux/abstract/monoid.lux4
-rw-r--r--stdlib/source/test/lux/control/concurrency/frp.lux26
-rw-r--r--stdlib/source/test/lux/control/function/memo.lux4
-rw-r--r--stdlib/source/test/lux/control/function/mixin.lux4
-rw-r--r--stdlib/source/test/lux/control/parser/binary.lux16
-rw-r--r--stdlib/source/test/lux/control/parser/cli.lux6
-rw-r--r--stdlib/source/test/lux/control/parser/text.lux28
-rw-r--r--stdlib/source/test/lux/data/binary.lux4
-rw-r--r--stdlib/source/test/lux/data/collection/array.lux6
-rw-r--r--stdlib/source/test/lux/data/collection/list.lux18
-rw-r--r--stdlib/source/test/lux/data/collection/queue/priority.lux12
-rw-r--r--stdlib/source/test/lux/data/collection/row.lux8
-rw-r--r--stdlib/source/test/lux/data/collection/set/multi.lux12
-rw-r--r--stdlib/source/test/lux/data/collection/tree.lux10
-rw-r--r--stdlib/source/test/lux/data/collection/tree/finger.lux10
-rw-r--r--stdlib/source/test/lux/data/format/json.lux2
-rw-r--r--stdlib/source/test/lux/data/format/tar.lux6
-rw-r--r--stdlib/source/test/lux/data/name.lux2
-rw-r--r--stdlib/source/test/lux/data/text/encoding.lux10
-rw-r--r--stdlib/source/test/lux/data/text/escape.lux4
-rw-r--r--stdlib/source/test/lux/data/text/format.lux4
-rw-r--r--stdlib/source/test/lux/locale/language.lux34
-rw-r--r--stdlib/source/test/lux/locale/territory.lux38
-rw-r--r--stdlib/source/test/lux/math/modular.lux4
-rw-r--r--stdlib/source/test/lux/math/number.lux6
-rw-r--r--stdlib/source/test/lux/math/number/i64.lux2
-rw-r--r--stdlib/source/test/lux/time.lux8
-rw-r--r--stdlib/source/test/lux/time/date.lux2
-rw-r--r--stdlib/source/test/lux/time/day.lux2
-rw-r--r--stdlib/source/test/lux/time/instant.lux8
-rw-r--r--stdlib/source/test/lux/time/month.lux8
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux46
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux38
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux14
-rw-r--r--stdlib/source/test/lux/type/check.lux12
-rw-r--r--stdlib/source/test/lux/world/net/http/client.lux8
331 files changed, 4359 insertions, 2945 deletions
diff --git a/documentation/book/the_lux_programming_language/appendix_b.md b/documentation/book/the_lux_programming_language/appendix_b.md
new file mode 100644
index 000000000..90ba1341a
--- /dev/null
+++ b/documentation/book/the_lux_programming_language/appendix_b.md
@@ -0,0 +1,88 @@
+# Appendix B: Math in Lux
+
+Math in Lux is a bit different from what you might be used to in other languages.
+
+For starters, Lux is a _lisp_, which means that it uses prefix syntax for everything.
+
+That means, familiar operations such as `3 + 5` or `8 = 8` get written as `(+ 3 5)` and `(= 8 8)`.
+
+There's also the issue of different operators for different types.
+
+Whereas other programming languages often overload the math operators `+`, `-`, `>`, etc. for all numeric (and some non-numeric) types, Lux actual offers different versions for different types (defined in the respective modules for those types).
+
+The differences may look trivial, but since the numeric types are treated differently in Lux, you must be aware of which function-set you're using when working with your data.
+
+However, this is not the biggest difference in Lux's math operators in comparison to other languages.
+The difference that takes the crown is the ordering of the arguments.
+
+What do I mean?
+
+In most languages you'd write `4 - 7`.
+In other lisps you'd write `(- 4 7)`.
+But in Lux, you'd write `(- 7 4)`.
+
+_What is going on!? This is so bizarre!_
+
+Calm down.
+Everything is going to be fine.
+
+What's going on is that in functional programming, there is this convention of putting the most significant argument to a function as the last one.
+In the case of math functions, this would be the argument on which you're operating. I call it the _"subject"_ of the function.
+
+In the case of the subtraction operation, it would be the 4, since you're subtracting 7 from it.
+
+In most lisps, the order of the arguments is such that the subject is the first argument; but not so in Lux.
+
+Now, you may be wondering: _what could possibly be the benefit of making this bizarre change?_
+
+Piping. Piping convinced me to make this change.
+
+You see; this might look very impractical to those accustomed to the old way, but when you're writing complex calculations with many levels of nesting, being able to pipe your operations helps a lot, and this style of doing math lends itself perfectly for it.
+
+Consider this:
+
+```
+(|> x (/ scale) (pow 3.0) (- shift))
+```
+
+If I was using the traditional way of doing math, I wouldn't be able to pipe it, and it would look like this:
+
+```
+(- (pow (/ x scale)
+ 3.0)
+ shift)
+```
+
+ `pow` is the _power_ function, located in `library/lux/math`.
+
+You can complain all you want about me breaking with tradition, but that just looks ugly.
+
+So, I'm just going to say it: I broke with tradition because tradition wasn't helping, and I'm not one to just comply because I'm supposed to.
+
+However, I'm not without a heart; and I know that a lot of people would prefer to have a more... traditional way of doing math.
+
+So, for you guys, I've introduced a special macro in the `library/lux/math/infix` module.
+
+It's called `infix`, and it allows you to do infix math, with nested expressions.
+
+Here's an example:
+
+```
+(infix [[3.0 pow 2.0] + [5.0 * 8.0]])
+```
+
+So, that corresponds to `3^2 + 5*8`.
+
+Note that `infix` doesn't enforce any grouping rules, since you can actually use it with arbitrary functions that you import or define (even with partially applied functions).
+
+The rule is simple, the argument to the right of the operator will be taken first, and then the argument to the left.
+
+So `[3.0 pow 2.0]` becomes `(pow 2.0 3.0)`, and `[5.0 * 8.0]` becomes `(* 8.0 5.0)`.
+Thus, the infix syntax is transformed into Lux's prefix variation.
+
+---
+
+I know that Lux's way of doing math is a bit... foreign; but I made that change to ensure math fit the rest of the language perfectly.
+
+Hopefully you'll come to see that getting used to the new way is a piece of cake and has its advantages as soon as you write complex calculations.
+
diff --git a/documentation/bookmark/architecture.md b/documentation/bookmark/architecture.md
new file mode 100644
index 000000000..66449caf8
--- /dev/null
+++ b/documentation/bookmark/architecture.md
@@ -0,0 +1,4 @@
+# Reference
+
+1. [Awesome Software Architecture](https://mehdihadeli.github.io/awesome-software-architecture/)
+
diff --git a/documentation/bookmark/database/query.md b/documentation/bookmark/database/query.md
new file mode 100644
index 000000000..68b002da7
--- /dev/null
+++ b/documentation/bookmark/database/query.md
@@ -0,0 +1,4 @@
+# Reference
+
+1. [Using Tree Structures with Pagination to build Folder Navigation](https://medium.com/frame-io-engineering/hierarchy-and-pagination-traversing-the-folder-tree-1ba641ec2ce7)
+
diff --git a/documentation/bookmark/security/authentication.md b/documentation/bookmark/security/authentication.md
new file mode 100644
index 000000000..09f954592
--- /dev/null
+++ b/documentation/bookmark/security/authentication.md
@@ -0,0 +1,4 @@
+# Reference
+
+1. [WebAuthn.io](https://webauthn.io/)
+
diff --git a/documentation/bookmark/unicode.md b/documentation/bookmark/unicode.md
new file mode 100644
index 000000000..706b3791d
--- /dev/null
+++ b/documentation/bookmark/unicode.md
@@ -0,0 +1,4 @@
+# Reference
+
+1. [How Unicode helps to ruin your software](https://blog.typeable.io/posts/2021-08-17-unicode.html)
+
diff --git a/licentia/source/program/licentia.lux b/licentia/source/program/licentia.lux
index 50fb066e9..14f29237f 100644
--- a/licentia/source/program/licentia.lux
+++ b/licentia/source/program/licentia.lux
@@ -67,14 +67,14 @@
(do (try.with io.monad)
[blob (\ file.default read input)
document (io\wrap (do {! try.monad}
- [raw_json (\ utf8.codec decode blob)
+ [raw_json (\ utf8.codec decoded blob)
json (|> raw_json
java/lang/String::trim
- (\ json.codec decode))]
+ (\ json.codec decoded))]
(|> json
(<json>.result /input.license)
(\ ! map /output.license))))]
- (\ file.default write (\ utf8.codec encode document) output)))]
+ (\ file.default write (\ utf8.codec encoded document) output)))]
(wrap (debug.log! (case ?done
(#try.Success _)
(success_message output)
diff --git a/lux-cl/source/program.lux b/lux-cl/source/program.lux
index 36ce1f0cd..3122dc31e 100644
--- a/lux-cl/source/program.lux
+++ b/lux-cl/source/program.lux
@@ -322,7 +322,7 @@
(wrap [global value definition]))))
(def: (ingest context content)
- (|> content (\ encoding.utf8 decode) try.trusted (:as (_.Expression Any))))
+ (|> content (\ encoding.utf8 decoded) try.trusted (:as (_.Expression Any))))
(def: (re_learn context content)
(run! content))
@@ -341,7 +341,7 @@
#platform.host host
#platform.phase common_lisp.generate
#platform.runtime runtime.generate
- #platform.write (|>> _.code (\ encoding.utf8 encode))})))
+ #platform.write (|>> _.code (\ encoding.utf8 encoded))})))
(def: get_ecl_cli_inputs
(let [@idx (_.var "i")]
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux
index 2bc4f4a49..3dbdf35ec 100644
--- a/lux-js/source/program.lux
+++ b/lux-js/source/program.lux
@@ -487,7 +487,7 @@
(def: define! (..define! interpreter))
(def: (ingest context content)
- (|> content (\ utf8.codec decode) try.trusted (:as _.Statement)))
+ (|> content (\ utf8.codec decoded) try.trusted (:as _.Statement)))
(def: (re_learn context custom content)
(..execute! interpreter content))
@@ -546,7 +546,7 @@
(def: define! ..define!)
(def: (ingest context content)
- (|> content (\ utf8.codec decode) try.trusted (:as _.Statement)))
+ (|> content (\ utf8.codec decoded) try.trusted (:as _.Statement)))
(def: (re_learn context custom content)
(..execute! content))
@@ -581,7 +581,7 @@
#platform.phase js.generate
#platform.runtime runtime.generate
#platform.phase_wrapper ..phase_wrapper
- #platform.write (|>> _.code (\ utf8.codec encode))})))
+ #platform.write (|>> _.code (\ utf8.codec encoded))})))
(def: (program context program)
(Program _.Expression _.Statement)
diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux
index a7314b0dc..2c6577ae1 100644
--- a/lux-jvm/source/luxc/lang/directive/jvm.lux
+++ b/lux-jvm/source/luxc/lang/directive/jvm.lux
@@ -18,9 +18,9 @@
["%" format (#+ format)]]
[collection
[array (#+ Array)]
- ["." list ("#\." fold functor monoid)]
+ ["." list ("#\." mix functor monoid)]
["." dictionary (#+ Dictionary)]
- ["." row (#+ Row) ("#\." functor fold)]]]
+ ["." row (#+ Row) ("#\." functor mix)]]]
[math
[number
["." nat]]]
@@ -442,18 +442,18 @@
(#/.TABLESWITCH min max default labels)
(let [[mapping default] (..relabel [mapping default])
- [mapping labels] (list\fold (function (_ input [mapping output])
- (let [[mapping input] (..relabel [mapping input])]
- [mapping (list& input output)]))
- [mapping (list)] labels)]
+ [mapping labels] (list\mix (function (_ input [mapping output])
+ (let [[mapping input] (..relabel [mapping input])]
+ [mapping (list& input output)]))
+ [mapping (list)] labels)]
[mapping (#/.TABLESWITCH min max default (list.reversed labels))])
(#/.LOOKUPSWITCH default keys+labels)
(let [[mapping default] (..relabel [mapping default])
- [mapping keys+labels] (list\fold (function (_ [expected input] [mapping output])
- (let [[mapping input] (..relabel [mapping input])]
- [mapping (list& [expected input] output)]))
- [mapping (list)] keys+labels)]
+ [mapping keys+labels] (list\mix (function (_ [expected input] [mapping output])
+ (let [[mapping input] (..relabel [mapping input])]
+ [mapping (list& [expected input] output)]))
+ [mapping (list)] keys+labels)]
[mapping (#/.LOOKUPSWITCH default (list.reversed keys+labels))])
))
@@ -515,11 +515,11 @@
(def: (relabel_bytecode [mapping bytecode])
(Re_labeler (/.Bytecode Inst))
- (row\fold (function (_ input [mapping output])
- (let [[mapping input'] (..relabel_instruction [mapping input])]
- [mapping (row.suffix input' output)]))
- [mapping (row.row)]
- bytecode))
+ (row\mix (function (_ input [mapping output])
+ (let [[mapping input'] (..relabel_instruction [mapping input])]
+ [mapping (row.suffix input' output)]))
+ [mapping (row.row)]
+ bytecode))
(def: fresh
Mapping
@@ -1033,7 +1033,7 @@
[_scope bodyA] (|> arguments'
(#.Item [self selfT])
list.reversed
- (list\fold scopeA.with_local (analyse archive bodyC))
+ (list\mix scopeA.with_local (analyse archive bodyC))
(typeA.with_type returnT)
analysis.with_scope)]
(in [privacy strict_floating_point? annotations method_tvars exceptions
@@ -1063,7 +1063,7 @@
[_scope bodyA] (|> arguments'
(#.Item [self selfT])
list.reversed
- (list\fold scopeA.with_local (analyse archive bodyC))
+ (list\mix scopeA.with_local (analyse archive bodyC))
(typeA.with_type returnT)
analysis.with_scope)]
(in [[super_name super_tvars] method_name strict_floating_point? annotations
@@ -1091,7 +1091,7 @@
[_scope bodyA] (|> arguments'
(#.Item [self selfT])
list.reversed
- (list\fold scopeA.with_local (analyse archive bodyC))
+ (list\mix scopeA.with_local (analyse archive bodyC))
(typeA.with_type returnT)
analysis.with_scope)]
(in [name privacy final? strict_floating_point? annotations method_tvars
@@ -1116,7 +1116,7 @@
returnT (//A.boxed_reflection_return mapping returnJ)
[_scope bodyA] (|> arguments'
list.reversed
- (list\fold scopeA.with_local (analyse archive bodyC))
+ (list\mix scopeA.with_local (analyse archive bodyC))
(typeA.with_type returnT)
analysis.with_scope)]
(in [name privacy strict_floating_point? annotations method_tvars
diff --git a/lux-jvm/source/luxc/lang/synthesis/variable.lux b/lux-jvm/source/luxc/lang/synthesis/variable.lux
index 4721187f8..f4e68d25b 100644
--- a/lux-jvm/source/luxc/lang/synthesis/variable.lux
+++ b/lux-jvm/source/luxc/lang/synthesis/variable.lux
@@ -2,7 +2,7 @@
lux
(lux (data [library
[number]]
- (coll [list "list/" Fold<List> Monoid<List>]
+ (coll [list "list/" Mix<List> Monoid<List>]
["s" set])))
(luxc (lang ["la" analysis]
["ls" synthesis]
@@ -47,7 +47,7 @@
(def: (unused-vars current-arity bound exprS)
(-> ls.Arity (List Variable) ls.Synthesis (List Variable))
(let [tracker (loop [exprS exprS
- tracker (list/fold s.has init-tracker bound)]
+ tracker (list/mix s.has init-tracker bound)]
(case exprS
(#ls.Variable var)
(if (non-arg? current-arity var)
@@ -58,14 +58,14 @@
(recur memberS tracker)
(#ls.Tuple membersS)
- (list/fold recur tracker membersS)
+ (list/mix recur tracker membersS)
(#ls.Call funcS argsS)
- (list/fold recur (recur funcS tracker) argsS)
+ (list/mix recur (recur funcS tracker) argsS)
(^or (#ls.Recur argsS)
(#ls.Procedure name argsS))
- (list/fold recur tracker argsS)
+ (list/mix recur tracker argsS)
(#ls.Let offset inputS outputS)
(|> tracker (recur inputS) (recur outputS))
@@ -74,16 +74,16 @@
(|> tracker (recur testS) (recur thenS) (recur elseS))
(#ls.Loop offset initsS bodyS)
- (recur bodyS (list/fold recur tracker initsS))
+ (recur bodyS (list/mix recur tracker initsS))
(#ls.Case inputS outputPS)
- (let [tracker' (list/fold s.has
- (recur inputS tracker)
- (bound-vars outputPS))]
- (list/fold recur tracker' (path-bodies outputPS)))
+ (let [tracker' (list/mix s.has
+ (recur inputS tracker)
+ (bound-vars outputPS))]
+ (list/mix recur tracker' (path-bodies outputPS)))
(#ls.Function arity env bodyS)
- (list/fold s.lacks tracker env)
+ (list/mix s.lacks tracker env)
_
tracker
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
index 3a6291036..eb1f37f0b 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
@@ -8,7 +8,7 @@
["ex" exception (#+ exception:)]]
[data
[collection
- ["." list ("#@." fold)]]]
+ ["." list ("#@." mix)]]]
[math
[number
["n" nat]]]
@@ -132,21 +132,21 @@
[(<tag> cons)
(do {@ phase.monad}
[forkG (: (Operation Inst)
- (monad.fold @ (function (_ [test thenP] elseG)
- (do @
- [thenG (path' stack_depth @else @end phase archive thenP)]
- (in (<| _.with_label (function (_ @else))
- (|>> <dup>
- (<test> test)
- <comparison>
- (<if> @else)
- <pop>
- thenG
- (_.label @else)
- elseG)))))
- (|>> <pop>
- (_.GOTO @else))
- (#.Item cons)))]
+ (monad.mix @ (function (_ [test thenP] elseG)
+ (do @
+ [thenG (path' stack_depth @else @end phase archive thenP)]
+ (in (<| _.with_label (function (_ @else))
+ (|>> <dup>
+ (<test> test)
+ <comparison>
+ (<if> @else)
+ <pop>
+ thenG
+ (_.label @else)
+ elseG)))))
+ (|>> <pop>
+ (_.GOTO @else))
+ (#.Item cons)))]
(in (|>> peekI
<unwrap>
forkG)))])
@@ -266,16 +266,16 @@
(Generator [(List synthesis.Member) Synthesis])
(do phase.monad
[recordG (phase archive recordS)]
- (in (list@fold (function (_ step so_far)
- (.let [next (.case step
- (#.Left lefts)
- (..left_projection lefts)
-
- (#.Right lefts)
- (..right_projection lefts))]
- (|>> so_far next)))
- recordG
- (list.reversed path)))))
+ (in (list@mix (function (_ step so_far)
+ (.let [next (.case step
+ (#.Left lefts)
+ (..left_projection lefts)
+
+ (#.Right lefts)
+ (..right_projection lefts))]
+ (|>> so_far next)))
+ recordG
+ (list.reversed path)))))
(def: .public (case phase archive [valueS path])
(Generator [Synthesis Path])
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
index 31538a0bd..e2855e999 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
@@ -16,7 +16,7 @@
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list ("#\." monad fold)]
+ ["." list ("#\." monad mix)]
["." dictionary (#+ Dictionary)]
["." set]]]
[macro
@@ -1031,10 +1031,10 @@
(-> Nat (List (Type Value)) Inst)
(|> types
list.enumeration
- (list\fold (function (_ [lux_register type] [jvm_register before])
- (let [[jvm_register' after] (prepare_argument (n.+ offset lux_register) type jvm_register)]
- [jvm_register' (|>> before after)]))
- (: [Register Inst] [offset (|>>)]))
+ (list\mix (function (_ [lux_register type] [jvm_register before])
+ (let [[jvm_register' after] (prepare_argument (n.+ offset lux_register) type jvm_register)]
+ [jvm_register' (|>> before after)]))
+ (: [Register Inst] [offset (|>>)]))
product.right))
(def: .public (returnI returnT)
diff --git a/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
index 77f5b34bc..f3af659fa 100644
--- a/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
+++ b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
@@ -11,7 +11,7 @@
format]
[collection
["." array]
- [list ("list/" Fold<List>)]
+ [list ("list/" Mix<List>)]
["dict" dictionary]]]
[math
["r" random "r/" Monad<Random>]]
@@ -38,8 +38,8 @@
[... runtime-bytecode @runtime.translate
]
(default.with-scope
- (typeA.with-type output-type
- (_primitive.analyse (` ((~ (code.text procedure)) (~+ params)))))))
+ (typeA.with-type output-type
+ (_primitive.analyse (` ((~ (code.text procedure)) (~+ params)))))))
(analysis.with-current-module "")
(macro.result (initL.compiler []))
(case> (#e.Success _)
@@ -59,8 +59,8 @@
[... runtime-bytecode @runtime.translate
]
(default.with-scope
- (typeA.with-type output-type
- (_primitive.analyse syntax))))
+ (typeA.with-type output-type
+ (_primitive.analyse syntax))))
(analysis.with-current-module "")
(macro.result (initL.compiler []))
(case> (#e.Success _)
@@ -87,9 +87,9 @@
["jvm convert float-to-int" "java.lang.Float" hostAE.Integer]
["jvm convert float-to-long" "java.lang.Float" hostAE.Long]
)]
- ($_ seq
- <conversions>
- )))
+ ($_ seq
+ <conversions>
+ )))
(context: "Conversions [int]."
(with-expansions [<conversions> (template [<procedure> <from> <to>]
@@ -105,9 +105,9 @@
["jvm convert int-to-long" "java.lang.Integer" hostAE.Long]
["jvm convert int-to-short" "java.lang.Integer" hostAE.Short]
)]
- ($_ seq
- <conversions>
- )))
+ ($_ seq
+ <conversions>
+ )))
(context: "Conversions [long]."
(with-expansions [<conversions> (template [<procedure> <from> <to>]
@@ -122,9 +122,9 @@
["jvm convert long-to-short" "java.lang.Long" hostAE.Short]
["jvm convert long-to-byte" "java.lang.Long" hostAE.Byte]
)]
- ($_ seq
- <conversions>
- )))
+ ($_ seq
+ <conversions>
+ )))
(context: "Conversions [char + byte + short]."
(with-expansions [<conversions> (template [<procedure> <from> <to>]
@@ -140,9 +140,9 @@
["jvm convert byte-to-long" "java.lang.Byte" hostAE.Long]
["jvm convert short-to-long" "java.lang.Short" hostAE.Long]
)]
- ($_ seq
- <conversions>
- )))
+ ($_ seq
+ <conversions>
+ )))
(template [<domain> <boxed> <type>]
[(context: (format "Arithmetic " "[" <domain> "].")
@@ -159,9 +159,9 @@
[(format "jvm " <domain> " /") <boxed> <boxed> <type>]
[(format "jvm " <domain> " %") <boxed> <boxed> <type>]
)]
- ($_ seq
- <instructions>
- )))
+ ($_ seq
+ <instructions>
+ )))
(context: (format "Order " "[" <domain> "].")
(with-expansions [<instructions> (template [<procedure> <subject> <param> <output>]
@@ -174,9 +174,9 @@
[(format "jvm " <domain> " =") <boxed> <boxed> hostAE.Boolean]
[(format "jvm " <domain> " <") <boxed> <boxed> hostAE.Boolean]
)]
- ($_ seq
- <instructions>
- )))
+ ($_ seq
+ <instructions>
+ )))
(context: (format "Bitwise " "[" <domain> "].")
(with-expansions [<instructions> (template [<procedure> <subject> <param> <output>]
@@ -193,9 +193,9 @@
[(format "jvm " <domain> " shr") <boxed> "java.lang.Integer" <type>]
[(format "jvm " <domain> " ushr") <boxed> "java.lang.Integer" <type>]
)]
- ($_ seq
- <instructions>
- )))]
+ ($_ seq
+ <instructions>
+ )))]
["int" "java.lang.Integer" hostAE.Integer]
@@ -217,9 +217,9 @@
[(format "jvm " <domain> " /") <boxed> <boxed> <type>]
[(format "jvm " <domain> " %") <boxed> <boxed> <type>]
)]
- ($_ seq
- <instructions>
- )))
+ ($_ seq
+ <instructions>
+ )))
(context: (format "Order " "[" <domain> "].")
(with-expansions [<instructions> (template [<procedure> <subject> <param> <output>]
@@ -232,9 +232,9 @@
[(format "jvm " <domain> " =") <boxed> <boxed> hostAE.Boolean]
[(format "jvm " <domain> " <") <boxed> <boxed> hostAE.Boolean]
)]
- ($_ seq
- <instructions>
- )))]
+ ($_ seq
+ <instructions>
+ )))]
["float" "java.lang.Float" hostAE.Float]
@@ -253,9 +253,9 @@
[(format "jvm " <domain> " =") <boxed> <boxed> hostAE.Boolean]
[(format "jvm " <domain> " <") <boxed> <boxed> hostAE.Boolean]
)]
- ($_ seq
- <instructions>
- )))]
+ ($_ seq
+ <instructions>
+ )))]
["char" "java.lang.Character" hostAE.Character]
@@ -287,10 +287,10 @@
("jvm array new" (~ (code.nat size)))))
boxedT (#.Primitive boxed (list))
boxedTC (` (+0 (~ (code.text boxed)) (+0)))
- multi-arrayT (list/fold (function (_ _ innerT)
- (|> innerT (list) (#.Primitive "#Array")))
- boxedT
- (list.n/range +1 level))]]
+ multi-arrayT (list/mix (function (_ _ innerT)
+ (|> innerT (list) (#.Primitive "#Array")))
+ boxedT
+ (list.n/range +1 level))]]
($_ seq
(test "jvm array new"
(success "jvm array new"
diff --git a/lux-jvm/test/test/luxc/lang/synthesis/loop.lux b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
index 7aeafab5f..2b09fb3e7 100644
--- a/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
+++ b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
@@ -4,7 +4,7 @@
(control [monad #+ do])
(data [bit "bit/" Eq<Bit>]
[number]
- (coll [list "list/" Functor<List> Fold<List>]
+ (coll [list "list/" Functor<List>]
(set ["set" unordered]))
text/format)
(macro [code])
diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux
index 41df182c0..4667088cb 100644
--- a/lux-lua/source/program.lux
+++ b/lux-lua/source/program.lux
@@ -572,7 +572,7 @@
(wrap [global value definition]))))
(def: (ingest context content)
- (|> content (\ utf8.codec decode) try.trusted (:as _.Statement)))
+ (|> content (\ utf8.codec decoded) try.trusted (:as _.Statement)))
(def: (re_learn context custom content)
(run! content))
@@ -610,7 +610,7 @@
(wrap [global value definition]))))
(def: (ingest context content)
- (|> content (\ utf8.codec decode) try.trusted (:as _.Statement)))
+ (|> content (\ utf8.codec decoded) try.trusted (:as _.Statement)))
(def: (re_learn context custom content)
(run! content))
@@ -777,7 +777,7 @@
#platform.phase lua.generate
#platform.runtime runtime.generate
#platform.phase_wrapper ..phase_wrapper
- #platform.write (|>> _.code (\ utf8.codec encode))}])))
+ #platform.write (|>> _.code (\ utf8.codec encoded))}])))
@.lua (def: platform
(IO (Platform [Register _.Label] _.Expression _.Statement))
(do io.monad
@@ -787,7 +787,7 @@
#platform.phase lua.generate
#platform.runtime runtime.generate
#platform.phase_wrapper ..phase_wrapper
- #platform.write (|>> _.code (\ utf8.codec encode))})))})
+ #platform.write (|>> _.code (\ utf8.codec encoded))})))})
(def: (program context program)
(Program _.Expression _.Statement)
diff --git a/lux-php/source/program.lux b/lux-php/source/program.lux
index 214960667..2b7ba15de 100644
--- a/lux-php/source/program.lux
+++ b/lux-php/source/program.lux
@@ -490,7 +490,7 @@
(wrap [global value definition]))))
(def: (ingest context content)
- (|> content (\ utf8.codec decode) try.trusted (:as _.Statement)))
+ (|> content (\ utf8.codec decoded) try.trusted (:as _.Statement)))
(def: (re_learn context content)
(run! content))
@@ -508,7 +508,7 @@
#platform.host host
#platform.phase php.generate
#platform.runtime runtime.generate
- #platform.write (|>> _.code (\ utf8.codec encode))})))
+ #platform.write (|>> _.code (\ utf8.codec encoded))})))
(def: (program context program)
(Program _.Expression _.Statement)
diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux
index 1d75f0e98..bf154a7e7 100644
--- a/lux-python/source/program.lux
+++ b/lux-python/source/program.lux
@@ -297,7 +297,7 @@
(def: (ingest context content)
(|> content
- (\ utf8.codec decode)
+ (\ utf8.codec decoded)
try.trusted
(:as (_.Statement Any))))
@@ -340,7 +340,7 @@
(def: define! define!)
(def: (ingest context content)
- (|> content (\ utf8.codec decode) try.trusted (:as (_.Statement Any))))
+ (|> content (\ utf8.codec decoded) try.trusted (:as (_.Statement Any))))
(def: (re_learn context content)
(execute! content))
@@ -476,7 +476,7 @@
#platform.phase python.generate
#platform.runtime runtime.generate
#platform.phase_wrapper ..phase_wrapper
- #platform.write (|>> _.code (\ utf8.codec encode))})))
+ #platform.write (|>> _.code (\ utf8.codec encoded))})))
(def: (program context program)
(Program (_.Expression Any) (_.Statement Any))
diff --git a/lux-r/source/luxc/lang/synthesis/variable.lux b/lux-r/source/luxc/lang/synthesis/variable.lux
index f747a82df..920c99057 100644
--- a/lux-r/source/luxc/lang/synthesis/variable.lux
+++ b/lux-r/source/luxc/lang/synthesis/variable.lux
@@ -1,7 +1,7 @@
(.module:
lux
(lux (data [number]
- (coll [list "list/" Fold<List> Monoid<List>]
+ (coll [list "list/" Mix<List> Monoid<List>]
["s" set])))
(luxc (lang ["la" analysis]
["ls" synthesis]
@@ -46,7 +46,7 @@
(def: (unused-vars current-arity bound exprS)
(-> ls.Arity (List Variable) ls.Synthesis (List Variable))
(let [tracker (loop [exprS exprS
- tracker (list/fold s.has init-tracker bound)]
+ tracker (list/mix s.has init-tracker bound)]
(case exprS
(#ls.Variable var)
(if (non-arg? current-arity var)
@@ -57,14 +57,14 @@
(recur memberS tracker)
(#ls.Tuple membersS)
- (list/fold recur tracker membersS)
+ (list/mix recur tracker membersS)
(#ls.Call funcS argsS)
- (list/fold recur (recur funcS tracker) argsS)
+ (list/mix recur (recur funcS tracker) argsS)
(^or (#ls.Recur argsS)
(#ls.Procedure name argsS))
- (list/fold recur tracker argsS)
+ (list/mix recur tracker argsS)
(#ls.Let offset inputS outputS)
(|> tracker (recur inputS) (recur outputS))
@@ -73,16 +73,16 @@
(|> tracker (recur testS) (recur thenS) (recur elseS))
(#ls.Loop offset initsS bodyS)
- (recur bodyS (list/fold recur tracker initsS))
+ (recur bodyS (list/mix recur tracker initsS))
(#ls.Case inputS outputPS)
- (let [tracker' (list/fold s.has
- (recur inputS tracker)
- (bound-vars outputPS))]
- (list/fold recur tracker' (path-bodies outputPS)))
+ (let [tracker' (list/mix s.has
+ (recur inputS tracker)
+ (bound-vars outputPS))]
+ (list/mix recur tracker' (path-bodies outputPS)))
(#ls.Function arity env bodyS)
- (list/fold s.lacks tracker env)
+ (list/mix s.lacks tracker env)
_
tracker
diff --git a/lux-r/source/program.lux b/lux-r/source/program.lux
index 9f956591c..ec4931eae 100644
--- a/lux-r/source/program.lux
+++ b/lux-r/source/program.lux
@@ -526,7 +526,7 @@
(wrap [global value definition]))))
(def: (ingest context content)
- (|> content (\ utf8.codec decode) try.trusted (:as _.Expression)))
+ (|> content (\ utf8.codec decoded) try.trusted (:as _.Expression)))
(def: (re_learn context content)
(run! content))
@@ -547,7 +547,7 @@
#platform.host host
#platform.phase r.generate
#platform.runtime runtime.generate
- #platform.write (|>> _.code (\ utf8.codec encode))}])))
+ #platform.write (|>> _.code (\ utf8.codec encoded))}])))
(def: (program context program)
(Program _.Expression _.Expression)
diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux
index 374009830..f66262971 100644
--- a/lux-ruby/source/program.lux
+++ b/lux-ruby/source/program.lux
@@ -635,7 +635,7 @@
(def: (ingest context content)
(|> content
- (\ utf8.codec decode)
+ (\ utf8.codec decoded)
try.trusted
(:as _.Statement)))
@@ -808,7 +808,7 @@
#platform.phase ruby.generate
#platform.runtime runtime.generate
#platform.phase_wrapper ..phase_wrapper
- #platform.write (|>> _.code (\ utf8.codec encode))})))
+ #platform.write (|>> _.code (\ utf8.codec encoded))})))
(def: (program context program)
(Program _.Expression _.Statement)
diff --git a/lux-scheme/source/program.lux b/lux-scheme/source/program.lux
index 16d1ebcaa..5ffdcf74b 100644
--- a/lux-scheme/source/program.lux
+++ b/lux-scheme/source/program.lux
@@ -380,7 +380,7 @@
(wrap [global value definition]))))
(def: (ingest context content)
- (|> content (\ encoding.utf8 decode) try.trusted (:as _.Expression)))
+ (|> content (\ encoding.utf8 decoded) try.trusted (:as _.Expression)))
(def: (re_learn context content)
(run! content))
@@ -399,7 +399,7 @@
#platform.host host
#platform.phase scheme.generate
#platform.runtime runtime.generate
- #platform.write (|>> _.code (\ encoding.utf8 encode))})))
+ #platform.write (|>> _.code (\ encoding.utf8 encoded))})))
(def: (program context program)
(Program _.Expression _.Expression)
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux
index 4a964e552..ac01ef0f1 100644
--- a/stdlib/source/documentation/lux.lux
+++ b/stdlib/source/documentation/lux.lux
@@ -17,13 +17,14 @@
["#." ffi]
["#." locale]
["#." macro]
- ... ["#." math]
- ... ["#." meta]
+ ["#." math]
+ ["#." meta]
["#." program]
- ... ["#." target]
+ ["#." static]
+ ["#." target]
... ["#." test]
... ["#." time]
- ... ... ["#." tool] ... TODO: Update & expand tests for this
+ ... ... ["#." tool] ... TODO: Documentation for this
... ["#." type]
... ["#." world]
... ["#." extension]
@@ -44,8 +45,11 @@
/ffi.documentation
/locale.documentation
/macro.documentation
-
- /program.documentation]))
+ /math.documentation
+ /meta.documentation
+ /program.documentation
+ /static.documentation
+ /target.documentation]))
(program: inputs
(io.io (debug.log! ($.documentation ..documentation))))
diff --git a/stdlib/source/documentation/lux/abstract.lux b/stdlib/source/documentation/lux/abstract.lux
index a8c0d3b03..11d002127 100644
--- a/stdlib/source/documentation/lux/abstract.lux
+++ b/stdlib/source/documentation/lux/abstract.lux
@@ -13,7 +13,7 @@
["#." comonad]
["#." enum]
["#." equivalence]
- ["#." fold]
+ ["#." mix]
["#." functor]
["#." hash]
["#." interval]
@@ -30,7 +30,7 @@
/comonad.documentation
/enum.documentation
/equivalence.documentation
- /fold.documentation
+ /mix.documentation
/functor.documentation
/hash.documentation
/interval.documentation
diff --git a/stdlib/source/documentation/lux/abstract/fold.lux b/stdlib/source/documentation/lux/abstract/mix.lux
index 33a12a91c..73b23e628 100644
--- a/stdlib/source/documentation/lux/abstract/fold.lux
+++ b/stdlib/source/documentation/lux/abstract/mix.lux
@@ -8,17 +8,17 @@
[\\library
["." /]])
-(documentation: /.Fold
+(documentation: /.Mix
"Iterate over a structure's values to build a summary value.")
(documentation: /.with_monoid
- "Fold over a foldable structure using the monoid's identity as the initial value."
- [(with_monoid monoid fold value)])
+ "Mix a mixable structure using the monoid's identity as the initial value."
+ [(with_monoid monoid mix value)])
(.def: .public documentation
(.List $.Module)
($.module /._
""
- [..Fold
+ [..Mix
..with_monoid]
[]))
diff --git a/stdlib/source/documentation/lux/abstract/monad.lux b/stdlib/source/documentation/lux/abstract/monad.lux
index 07318bce9..cdf12eedf 100644
--- a/stdlib/source/documentation/lux/abstract/monad.lux
+++ b/stdlib/source/documentation/lux/abstract/monad.lux
@@ -37,9 +37,9 @@
"Filter the values in a list with a monadic function."
[(only monad predicate items)])
-(documentation: /.fold
- "Fold a list with a monadic function."
- [(fold monad function initial_value items)])
+(documentation: /.mix
+ "Mix a list with a monadic function."
+ [(mix monad function initial_value items)])
(.def: .public documentation
(.List $.Module)
@@ -51,5 +51,5 @@
..all
..map
..only
- ..fold]
+ ..mix]
[/free.documentation]))
diff --git a/stdlib/source/documentation/lux/control/concurrency/frp.lux b/stdlib/source/documentation/lux/control/concurrency/frp.lux
index 728e93be5..74ddc31e2 100644
--- a/stdlib/source/documentation/lux/control/concurrency/frp.lux
+++ b/stdlib/source/documentation/lux/control/concurrency/frp.lux
@@ -32,9 +32,9 @@
"A one-element channel containing the output from an async."
[(of_async async)])
-(documentation: /.aggregate
- "Asynchronous fold over channels."
- [(aggregate f init channel)])
+(documentation: /.mix
+ "Asynchronous mix over channels."
+ [(mix f init channel)])
(documentation: /.sequential
"Transforms the given list into a channel with the same elements."
@@ -50,14 +50,14 @@
..Subscriber
..only
..of_async
- ..aggregate
+ ..mix
..sequential
($.default /.channel_is_already_closed)
($.default /.functor)
($.default /.apply)
($.default /.monad)
($.default /.subscribe!)
- ($.default /.aggregates)
+ ($.default /.mixes)
($.default /.poll)
($.default /.periodic)
($.default /.iterations)
diff --git a/stdlib/source/documentation/lux/control/pipe.lux b/stdlib/source/documentation/lux/control/pipe.lux
index f18415290..284a2ec20 100644
--- a/stdlib/source/documentation/lux/control/pipe.lux
+++ b/stdlib/source/documentation/lux/control/pipe.lux
@@ -80,7 +80,7 @@
[(|> +5
(tuple> [(i.* +10)]
[-- (i./ +2)]
- [i\encode]))
+ [i\encoded]))
"=>"
[+50 +2 "+5"]])
@@ -103,7 +103,7 @@
(.def: .public documentation
(.List $.Module)
($.module /._
- ""
+ "Composable extensions to the piping macros (|> and <|) that enhance them with various abilities."
[..new>
..let>
..cond>
diff --git a/stdlib/source/documentation/lux/data/collection/array.lux b/stdlib/source/documentation/lux/data/collection/array.lux
index 3bf22b587..e36cba1a8 100644
--- a/stdlib/source/documentation/lux/data/collection/array.lux
+++ b/stdlib/source/documentation/lux/data/collection/array.lux
@@ -118,7 +118,7 @@
($.default /.equivalence)
($.default /.monoid)
($.default /.functor)
- ($.default /.fold)
+ ($.default /.mix)
($.default /.every?)
($.default /.any?)]
[]))
diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux
index 1050ab7ce..87cf01da1 100644
--- a/stdlib/source/documentation/lux/data/collection/list.lux
+++ b/stdlib/source/documentation/lux/data/collection/list.lux
@@ -15,9 +15,9 @@
[\\library
["." /]])
-(documentation: /.aggregates
+(documentation: /.mixes
""
- [(aggregates f init inputs)])
+ [(mixes f init inputs)])
(documentation: /.reversed
""
@@ -181,7 +181,7 @@
(.List $.Module)
($.module /._
""
- [..aggregates
+ [..mixes
..reversed
..only
..partition
@@ -225,7 +225,7 @@
..lifted
..enumeration
..when
- ($.default /.fold)
+ ($.default /.mix)
($.default /.equivalence)
($.default /.hash)
($.default /.monoid)
diff --git a/stdlib/source/documentation/lux/data/collection/row.lux b/stdlib/source/documentation/lux/data/collection/row.lux
index e72e8974e..a49b12bd4 100644
--- a/stdlib/source/documentation/lux/data/collection/row.lux
+++ b/stdlib/source/documentation/lux/data/collection/row.lux
@@ -75,7 +75,7 @@
($.default /.of_list)
($.default /.empty?)
($.default /.equivalence)
- ($.default /.fold)
+ ($.default /.mix)
($.default /.monoid)
($.default /.functor)
($.default /.apply)
diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux
index 96a44b6ed..2a439f7c3 100644
--- a/stdlib/source/documentation/lux/data/color.lux
+++ b/stdlib/source/documentation/lux/data/color.lux
@@ -77,6 +77,19 @@
(documentation: /.Pigment
"A color with some degree of transparency.")
+(template [<name>]
+ [(`` (documentation: <name>
+ (format "A "
+ (text.replaced "_" "-" (~~ (template.text [<name>])))
+ " color scheme.")))]
+
+ [/.triad]
+ [/.clash]
+ [/.split_complement]
+ [/.square]
+ [/.tetradic]
+ )
+
(.def: .public documentation
(.List $.Module)
($.module /._
@@ -101,6 +114,13 @@
..translucent
..opaque
..Pigment
+
+ ..triad
+ ..clash
+ ..split_complement
+ ..square
+ ..tetradic
+
($.default /.of_rgb)
($.default /.rgb)
($.default /.equivalence)
@@ -116,11 +136,6 @@
($.default /.cmyk)
($.default /.of_cmyk)
($.default /.gray_scale)
- ($.default /.triad)
- ($.default /.clash)
- ($.default /.split_complement)
- ($.default /.square)
- ($.default /.tetradic)
($.default /.Spread)
($.default /.Palette)]
[/named.documentation]))
diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux
index 6f9a080eb..b0a6d88ba 100644
--- a/stdlib/source/documentation/lux/data/color/named.lux
+++ b/stdlib/source/documentation/lux/data/color/named.lux
@@ -14,7 +14,7 @@
["." template]]
[math
[number
- ["." nat ("#\." hex)]]]]]
+ ["." nat ("hex\." hex)]]]]]
[\\library
["." /
["/#" //]]])
@@ -23,9 +23,9 @@
[(documentation: <name>
(let [[red green blue] (//.rgb <name>)
[_ name] (name_of <name>)]
- (format "R:" (nat\encode red)
- " G:" (nat\encode green)
- " B:" (nat\encode blue)
+ (format "R:" (hex\encoded red)
+ " G:" (hex\encoded green)
+ " B:" (hex\encoded blue)
" | " (text.replaced "_" " " name))))]
[/.alice_blue]
diff --git a/stdlib/source/documentation/lux/data/product.lux b/stdlib/source/documentation/lux/data/product.lux
index 78d0d5aaa..f1abaffcd 100644
--- a/stdlib/source/documentation/lux/data/product.lux
+++ b/stdlib/source/documentation/lux/data/product.lux
@@ -39,7 +39,7 @@
(.def: .public documentation
(.List $.Module)
($.module /._
- ""
+ "Functionality for working with tuples (particularly 2-tuples/pairs)."
[..left
..right
..curried
diff --git a/stdlib/source/documentation/lux/data/text/encoding/utf8.lux b/stdlib/source/documentation/lux/data/text/encoding/utf8.lux
index cfe8aee01..dc9a199f3 100644
--- a/stdlib/source/documentation/lux/data/text/encoding/utf8.lux
+++ b/stdlib/source/documentation/lux/data/text/encoding/utf8.lux
@@ -10,9 +10,12 @@
[\\library
["." /]])
+(documentation: /.codec
+ "A codec for binary encoding of text as UTF-8.")
+
(.def: .public documentation
(.List $.Module)
($.module /._
""
- [($.default /.codec)]
+ [..codec]
[]))
diff --git a/stdlib/source/documentation/lux/data/text/unicode/block.lux b/stdlib/source/documentation/lux/data/text/unicode/block.lux
index 703ac9f58..faa9d8833 100644
--- a/stdlib/source/documentation/lux/data/text/unicode/block.lux
+++ b/stdlib/source/documentation/lux/data/text/unicode/block.lux
@@ -9,7 +9,7 @@
["." template]]
[math
[number
- ["." nat ("#\." hex)]]]]]
+ ["." nat ("hex\." hex)]]]]]
[\\library
["." /]])
@@ -27,8 +27,8 @@
(template [<name>]
[(documentation: <name>
(let [[_ name] (name_of <name>)]
- (format (nat\encode (/.start <name>))
- "-" (nat\encode (/.end <name>))
+ (format (hex\encoded (/.start <name>))
+ "-" (hex\encoded (/.end <name>))
" | " (text.replaced "_" " " name))))]
[/.basic_latin]
diff --git a/stdlib/source/documentation/lux/macro/template.lux b/stdlib/source/documentation/lux/macro/template.lux
index 894d68c3d..7b2d0bf2e 100644
--- a/stdlib/source/documentation/lux/macro/template.lux
+++ b/stdlib/source/documentation/lux/macro/template.lux
@@ -65,7 +65,7 @@
(.def: .public documentation
(.List $.Module)
($.module /._
- ""
+ "Utilities commonly used while templating."
[..spliced
..amount
..with_locals
diff --git a/stdlib/source/documentation/lux/math.lux b/stdlib/source/documentation/lux/math.lux
index 7c74692ca..f41afe130 100644
--- a/stdlib/source/documentation/lux/math.lux
+++ b/stdlib/source/documentation/lux/math.lux
@@ -9,20 +9,73 @@
["." list]]]]]
["." / #_
["#." infix]
- ... ["#." modulus]
- ... ["#." modular]
- ... ["#." number]
- ["#." logic]]
+ ["#." modulus]
+ ["#." modular]
+ ["#." number]
+ ["#." logic]
+ ["#." random]]
[\\library
["." /]])
+(documentation: /.e
+ "The base of the natural logarithm.")
+
+(documentation: /.pi
+ "The ratio of a circle's circumference to its diameter.")
+
+(documentation: /.tau
+ "The ratio of a circle's circumference to its radius.")
+
+(documentation: /.pow
+ ""
+ [(pow param subject)])
+
+(documentation: /.atan/2
+ ""
+ [(atan/2 x y)])
+
+(documentation: /.log'
+ ""
+ [(log' base it)])
+
(.def: .public documentation
(.List $.Module)
($.module /._
- ""
- []
+ "Common mathematical constants and functions."
+ [..e
+ ..pi
+ ..tau
+ ..pow
+ ..atan/2
+ ..log'
+ ($.default /.cos)
+ ($.default /.sin)
+ ($.default /.tan)
+ ($.default /.acos)
+ ($.default /.asin)
+ ($.default /.atan)
+ ($.default /.exp)
+ ($.default /.log)
+ ($.default /.ceil)
+ ($.default /.floor)
+ ($.default /.root/2)
+ ($.default /.root/3)
+ ($.default /.round)
+ ($.default /.factorial)
+ ($.default /.hypotenuse)
+ ($.default /.sinh)
+ ($.default /.cosh)
+ ($.default /.tanh)
+ ($.default /.coth)
+ ($.default /.asinh)
+ ($.default /.acosh)
+ ($.default /.atanh)
+ ($.default /.acoth)
+ ($.default /.asech)
+ ($.default /.acsch)]
[/infix.documentation
- ... /modulus.documentation
- ... /modular.documentation
- ... /number.documentation
- /logic.documentation]))
+ /modulus.documentation
+ /modular.documentation
+ /number.documentation
+ /logic.documentation
+ /random.documentation]))
diff --git a/stdlib/source/documentation/lux/math/infix.lux b/stdlib/source/documentation/lux/math/infix.lux
index ccb72f665..add6876f2 100644
--- a/stdlib/source/documentation/lux/math/infix.lux
+++ b/stdlib/source/documentation/lux/math/infix.lux
@@ -27,5 +27,5 @@
(.List $.Module)
($.module /._
""
- []
+ [..infix]
[]))
diff --git a/stdlib/source/documentation/lux/math/logic.lux b/stdlib/source/documentation/lux/math/logic.lux
index 1b455c23e..f5aaddfc3 100644
--- a/stdlib/source/documentation/lux/math/logic.lux
+++ b/stdlib/source/documentation/lux/math/logic.lux
@@ -6,17 +6,13 @@
[text
["%" format (#+ format)]]
[collection
- ["." list]]]]]
+ ["." list ("#\." monoid)]]]]]
["." / #_
["#." continuous]
- ["#." fuzzy]]
- [\\library
- ["." /]])
+ ["#." fuzzy]])
(.def: .public documentation
(.List $.Module)
- ($.module /._
- ""
- []
- [/continuous.documentation
- /fuzzy.documentation]))
+ ($_ list\compose
+ /continuous.documentation
+ /fuzzy.documentation))
diff --git a/stdlib/source/documentation/lux/math/modular.lux b/stdlib/source/documentation/lux/math/modular.lux
new file mode 100644
index 000000000..f0c4c9f33
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/modular.lux
@@ -0,0 +1,53 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Mod
+ "A number under a modulus.")
+
+(documentation: /.modular
+ ""
+ [(modular modulus value)])
+
+(documentation: /.adapter
+ ""
+ [(adapter reference subject)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Mod
+ ..modular
+ ..adapter
+ ($.default /.modulus)
+ ($.default /.value)
+ ($.default /.incorrect_modulus)
+ ($.default /.codec)
+
+ ($.default /.=)
+ ($.default /.<)
+ ($.default /.<=)
+ ($.default /.>)
+ ($.default /.>=)
+
+ ($.default /.equivalence)
+ ($.default /.order)
+
+ ($.default /.+)
+ ($.default /.-)
+ ($.default /.*)
+
+ ($.default /.addition)
+ ($.default /.multiplication)
+ ($.default /.inverse)
+ ($.default /.moduli_are_not_equal)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/modulus.lux b/stdlib/source/documentation/lux/math/modulus.lux
new file mode 100644
index 000000000..c97eaa270
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/modulus.lux
@@ -0,0 +1,39 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Modulus
+ (format "A number used as a modulus in modular arithmetic."
+ \n "It cannot be 0."))
+
+(documentation: /.congruent?
+ ""
+ [(congruent? modulus reference subject)])
+
+(documentation: /.literal
+ ""
+ ["Success!"
+ (literal 123)]
+ ["Failure!"
+ (literal 0)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Modulus
+ ..congruent?
+ ..literal
+ ($.default /.zero_cannot_be_a_modulus)
+ ($.default /.modulus)
+ ($.default /.divisor)
+ ($.default /.=)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number.lux b/stdlib/source/documentation/lux/math/number.lux
new file mode 100644
index 000000000..d4243f21d
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number.lux
@@ -0,0 +1,52 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]]
+ ["." / #_
+ ["#." i8]
+ ["#." i16]
+ ["#." i32]
+ ["#." i64]
+ ["#." nat]
+ ["#." int]
+ ["#." rev]
+ ["#." frac]
+ ["#." ratio]
+ ["#." complex]])
+
+(template [<name> <encoding> <no_commas> <with_commas>]
+ [(documentation: <name>
+ (format "Given syntax for a " <encoding> " number, generates a Nat, an Int, a Rev or a Frac.")
+ [<no_commas>]
+ ["Allows for the presence of commas (,) among the digits."
+ <with_commas>])]
+
+ [/.bin "binary" (bin "11001001") (bin "11,00,10,01")]
+ [/.oct "octal" (oct "615243") (oct "615,243")]
+ [/.hex "hexadecimal" (hex "deadBEEF") (hex "dead,BEEF")]
+ )
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..bin
+ ..oct
+ ..hex]
+ [/i8.documentation
+ /i16.documentation
+ /i32.documentation
+ /i64.documentation
+ /nat.documentation
+ /int.documentation
+ /rev.documentation
+ /frac.documentation
+ /ratio.documentation
+ /complex.documentation]))
diff --git a/stdlib/source/documentation/lux/math/number/complex.lux b/stdlib/source/documentation/lux/math/number/complex.lux
new file mode 100644
index 000000000..0a56b0d85
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/complex.lux
@@ -0,0 +1,64 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Complex
+ "A complex number.")
+
+(documentation: /.complex
+ "Complex literals."
+ [(complex real imaginary)]
+ ["The imaginary part can be omitted if it's +0.0."
+ (complex real)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Complex arithmetic."
+ [..Complex
+ ..complex
+ ($.default /.i)
+ ($.default /.+one)
+ ($.default /.-one)
+ ($.default /.zero)
+ ($.default /.not_a_number?)
+ ($.default /.=)
+ ($.default /.+)
+ ($.default /.-)
+ ($.default /.equivalence)
+ ($.default /.opposite)
+ ($.default /.signum)
+ ($.default /.conjugate)
+ ($.default /.*')
+ ($.default /.*)
+ ($.default /./)
+ ($.default /./')
+ ($.default /.%)
+ ($.default /.cos)
+ ($.default /.cosh)
+ ($.default /.sin)
+ ($.default /.sinh)
+ ($.default /.tan)
+ ($.default /.tanh)
+ ($.default /.abs)
+ ($.default /.exp)
+ ($.default /.log)
+ ($.default /.pow)
+ ($.default /.pow')
+ ($.default /.root/2)
+ ($.default /.reciprocal)
+ ($.default /.acos)
+ ($.default /.asin)
+ ($.default /.atan)
+ ($.default /.argument)
+ ($.default /.roots)
+ ($.default /.approximately?)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/frac.lux b/stdlib/source/documentation/lux/math/number/frac.lux
new file mode 100644
index 000000000..a161327fa
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/frac.lux
@@ -0,0 +1,127 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.=
+ "Frac(tion) equivalence."
+ [(= reference sample)])
+
+(documentation: /.<
+ "Frac(tion) less-than."
+ [(< reference sample)])
+
+(documentation: /.<=
+ "Frac(tion) less-than or equal."
+ [(<= reference sample)])
+
+(documentation: /.>
+ "Frac(tion) greater-than."
+ [(> reference sample)])
+
+(documentation: /.>=
+ "Frac(tion) greater-than or equal."
+ [(>= reference sample)])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> param subject)])]
+
+ [/.+ "Frac(tion) addition."]
+ [/.- "Frac(tion) substraction."]
+ [/.* "Frac(tion) multiplication."]
+ [/./ "Frac(tion) division."]
+ [/.% "Frac(tion) remainder."]
+ )
+
+(documentation: /./%
+ ""
+ [(/% param subject)])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> left right)])]
+
+ [/.min "Frac(tion) minimum."]
+ [/.max "Frac(tion) minimum."]
+ )
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>)]
+
+ [/.not_a_number "Not a number."]
+ [/.positive_infinity "Positive infinity."]
+ [/.negative_infinity "Negative infinity."]
+ )
+
+(documentation: /.not_a_number?
+ "Tests whether a frac is actually not-a-number."
+ [(not_a_number? it)])
+
+(documentation: /.approximately?
+ ""
+ [(approximately? margin_of_error standard value)])
+
+(documentation: /.mod
+ ""
+ [(mod divisor dividend)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..=
+ ..<
+ ..<=
+ ..>
+ ..>=
+ ..+
+ ..-
+ ..*
+ ../
+ ..%
+ ../%
+ ..min
+ ..max
+ ..not_a_number
+ ..positive_infinity
+ ..negative_infinity
+ ..not_a_number?
+ ..approximately?
+ ..mod
+ ($.default /.positive?)
+ ($.default /.negative?)
+ ($.default /.zero?)
+ ($.default /.opposite)
+ ($.default /.abs)
+ ($.default /.signum)
+ ($.default /.nat)
+ ($.default /.int)
+ ($.default /.rev)
+ ($.default /.equivalence)
+ ($.default /.order)
+ ($.default /.smallest)
+ ($.default /.biggest)
+ ($.default /.addition)
+ ($.default /.addition)
+ ($.default /.minimum)
+ ($.default /.maximum)
+ ($.default /.number?)
+ ($.default /.decimal)
+ ($.default /.bits)
+ ($.default /.of_bits)
+ ($.default /.binary)
+ ($.default /.octal)
+ ($.default /.hex)
+ ($.default /.hash)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/i16.lux b/stdlib/source/documentation/lux/math/number/i16.lux
new file mode 100644
index 000000000..a38b3cbff
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/i16.lux
@@ -0,0 +1,25 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.I16
+ "A 16-bit integer.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..I16
+ ($.default /.equivalence)
+ ($.default /.width)
+ ($.default /.i16)
+ ($.default /.i64)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/i32.lux b/stdlib/source/documentation/lux/math/number/i32.lux
new file mode 100644
index 000000000..5f438cc50
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/i32.lux
@@ -0,0 +1,25 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.I32
+ "A 32-bit integer.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..I32
+ ($.default /.equivalence)
+ ($.default /.width)
+ ($.default /.i32)
+ ($.default /.i64)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/i64.lux b/stdlib/source/documentation/lux/math/number/i64.lux
new file mode 100644
index 000000000..9a7d3aead
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/i64.lux
@@ -0,0 +1,123 @@
+(.module:
+ [library
+ [lux (#- or and not)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> parameter subject)])]
+
+ [/.or "Bitwise or."]
+ [/.xor "Bitwise xor."]
+ [/.and "Bitwise and."]
+
+ [/.left_shifted "Bitwise left-shift."]
+ [/.right_shifted "Unsigned/logic bitwise right-shift."]
+ )
+
+(documentation: /.Mask
+ "A pattern of bits that can be imposed on I64 values.")
+
+(documentation: /.bit
+ "A mask with only a specific bit set."
+ [(bit position)])
+
+(documentation: /.sign
+ "A mask for the sign bit of ints.")
+
+(documentation: /.not
+ "Bitwise negation.")
+
+(documentation: /.mask
+ "Mask a block of bits of the specified size."
+ [(mask amount_of_bits)])
+
+(documentation: /.ones
+ "Count the number of 1s in a bit-map."
+ [(ones it)])
+
+(documentation: /.zero
+ "Clear bit at the given index."
+ [(zero index input)])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> index input)])]
+
+ [/.one "Set bit at given index."]
+ [/.flipped "Flip bit at given index."]
+ )
+
+(documentation: /.one?
+ ""
+ [(one? index input)])
+
+(documentation: /.zero?
+ ""
+ [(zero? index input)])
+
+(template [<name>]
+ [(documentation: <name>
+ ""
+ [(<name> distance input)])]
+
+ [/.left_rotated]
+ [/.right_rotated]
+ )
+
+(documentation: /.region
+ "A mask for a block of bits of the given size, starting at the given offset."
+ [(region offset size)])
+
+(documentation: /.Sub
+ "A sub-space of I64 with a reduce amount of bits.")
+
+(documentation: /.sub
+ "Given a width in the interval (0,64), yields an implementation for integers of that width."
+ [(sub width)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..or
+ ..xor
+ ..and
+ ..left_shifted
+ ..right_shifted
+ ..Mask
+ ..bit
+ ..sign
+ ..not
+ ..mask
+ ..ones
+ ..zero
+ ..one
+ ..flipped
+ ..one?
+ ..zero?
+ ..left_rotated
+ ..right_rotated
+ ..region
+ ..Sub
+ ..sub
+ ($.default /.bits_per_byte)
+ ($.default /.bytes_per_i64)
+ ($.default /.width)
+ ($.default /.false)
+ ($.default /.true)
+ ($.default /.equivalence)
+ ($.default /.hash)
+ ($.default /.disjunction)
+ ($.default /.conjunction)
+ ($.default /.reversed)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/i8.lux b/stdlib/source/documentation/lux/math/number/i8.lux
new file mode 100644
index 000000000..e7022c20e
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/i8.lux
@@ -0,0 +1,25 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.I8
+ "A 8-bit integer.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..I8
+ ($.default /.equivalence)
+ ($.default /.width)
+ ($.default /.i8)
+ ($.default /.i64)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/int.lux b/stdlib/source/documentation/lux/math/number/int.lux
new file mode 100644
index 000000000..fc066a37a
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/int.lux
@@ -0,0 +1,127 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.=
+ "Int(eger) equivalence."
+ [(= reference sample)])
+
+(documentation: /.<
+ "Int(eger) less-than."
+ [(< reference sample)])
+
+(documentation: /.<=
+ "Int(eger) less-than or equal."
+ [(<= reference sample)])
+
+(documentation: /.>
+ "Int(eger) greater-than."
+ [(> reference sample)])
+
+(documentation: /.>=
+ "Int(eger) greater-than or equal."
+ [(>= reference sample)])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> left right)])]
+
+ [/.min "Int(eger) minimum."]
+ [/.max "Int(eger) maximum."]
+ )
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> param subject)])]
+
+ [/.+ "Int(eger) addition."]
+ [/.- "Int(eger) substraction."]
+ [/.* "Int(eger) multiplication."]
+ [/./ "Int(eger) division."]
+ [/.% "Int(eger) remainder."]
+ [/./% "Int(eger) [division remainder]."]
+ )
+
+(documentation: /.opposite
+ "A value of equal magnitude and opposite sign.")
+
+(documentation: /.abs
+ "A value of equal magnitude and positive sign.")
+
+(documentation: /.signum
+ "A value (either -1, 0 or +0) which represents the sign.")
+
+(documentation: /.mod
+ (format "Integer modulo."
+ \n "Note: The modulo and the remainder are not the same.")
+ [(mod divisor dividend)])
+
+(documentation: /.gcd
+ "Greatest Common Divisor.")
+
+(documentation: /.extended_gcd
+ "Extended euclidean algorithm.")
+
+(documentation: /.lcm
+ "Least Common Multiple.")
+
+(documentation: /.right_shifted
+ "Signed/arithmetic bitwise right-shift."
+ [(right_shifted parameter subject)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..=
+ ..<
+ ..<=
+ ..>
+ ..>=
+ ..min
+ ..max
+ ..+
+ ..-
+ ..*
+ ../
+ ..%
+ ../%
+ ..opposite
+ ..abs
+ ..signum
+ ..mod
+ ..gcd
+ ..extended_gcd
+ ..lcm
+ ..right_shifted
+ ($.default /.positive?)
+ ($.default /.negative?)
+ ($.default /.zero?)
+ ($.default /.even?)
+ ($.default /.odd?)
+ ($.default /.co_prime?)
+ ($.default /.frac)
+ ($.default /.equivalence)
+ ($.default /.order)
+ ($.default /.enum)
+ ($.default /.interval)
+ ($.default /.addition)
+ ($.default /.multiplication)
+ ($.default /.maximum)
+ ($.default /.minimum)
+ ($.default /.binary)
+ ($.default /.octal)
+ ($.default /.decimal)
+ ($.default /.hex)
+ ($.default /.hash)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/nat.lux b/stdlib/source/documentation/lux/math/number/nat.lux
new file mode 100644
index 000000000..6b0ac7ea9
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/nat.lux
@@ -0,0 +1,82 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(template [<name> <documentation>]
+ [(documentation: <name>
+ <documentation>
+ [(<name> parameter subject)])]
+
+ [/.= "Nat(ural) equivalence."]
+ [/.+ "Nat(ural) addition."]
+ [/.- "Nat(ural) substraction."]
+ [/.< "Nat(ural) less-than."]
+ [/.<= "Nat(ural) less-than or equal."]
+ [/.> "Nat(ural) greater-than."]
+ [/.>= "Nat(ural) greater-than or equal."]
+ [/.* "Nat(ural) multiplication."]
+ [/./ "Nat(ural) division."]
+ [/./% "Nat(ural) [division remainder]."]
+ [/.% "Nat(ural) remainder."]
+ )
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> left right)])]
+
+ [/.min "Nat(ural) minimum."]
+ [/.max "Nat(ural) maximum."]
+ )
+
+(documentation: /.gcd
+ "Greatest Common Divisor.")
+
+(documentation: /.lcm
+ "Least Common Multiple.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..=
+ ..+
+ ..-
+ ..<
+ ..<=
+ ..>
+ ..>=
+ ..*
+ ../
+ ../%
+ ..%
+ ..min
+ ..max
+ ..gcd
+ ..lcm
+ ($.default /.co_prime?)
+ ($.default /.even?)
+ ($.default /.odd?)
+ ($.default /.frac)
+ ($.default /.equivalence)
+ ($.default /.order)
+ ($.default /.enum)
+ ($.default /.interval)
+ ($.default /.addition)
+ ($.default /.multiplication)
+ ($.default /.minimum)
+ ($.default /.maximum)
+ ($.default /.binary)
+ ($.default /.octal)
+ ($.default /.hex)
+ ($.default /.decimal)
+ ($.default /.hash)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/ratio.lux b/stdlib/source/documentation/lux/math/number/ratio.lux
new file mode 100644
index 000000000..7af023084
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/ratio.lux
@@ -0,0 +1,45 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Ratio
+ "An unsigned ratio of numbers.")
+
+(documentation: /.ratio
+ "Rational literals."
+ [(ratio numerator denominator)]
+ ["The denominator can be omitted if it is 1."
+ (ratio numerator)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Rational numbers."
+ [..Ratio
+ ..ratio
+ ($.default /.nat)
+ ($.default /.=)
+ ($.default /.equivalence)
+ ($.default /.<)
+ ($.default /.<=)
+ ($.default /.>)
+ ($.default /.>=)
+ ($.default /.order)
+ ($.default /.+)
+ ($.default /.-)
+ ($.default /.*)
+ ($.default /./)
+ ($.default /.%)
+ ($.default /.reciprocal)
+ ($.default /.codec)
+ ($.default /.addition)
+ ($.default /.multiplication)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/rev.lux b/stdlib/source/documentation/lux/math/number/rev.lux
new file mode 100644
index 000000000..1cfce71bb
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/rev.lux
@@ -0,0 +1,115 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.=
+ "Rev(olution) equivalence."
+ [(= reference sample)])
+
+(documentation: /.<
+ "Rev(olution) less-than."
+ [(< reference sample)])
+
+(documentation: /.<=
+ "Rev(olution) less-than or equal."
+ [(<= reference sample)])
+
+(documentation: /.>
+ "Rev(olution) greater-than."
+ [(> reference sample)])
+
+(documentation: /.>=
+ "Rev(olution) greater-than or equal."
+ [(>= reference sample)])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> left right)])]
+
+ [/.min "Rev(olution) minimum."]
+ [/.max "Rev(olution) maximum."]
+ )
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> param subject)])]
+
+ [/.+ "Rev(olution) addition."]
+ [/.- "Rev(olution) substraction."]
+ [/.* "Rev(olution) multiplication."]
+ [/./ "Rev(olution) division."]
+ [/.% "Rev(olution) remainder."]
+ [/.ratio "Ratio between two rev(olution)s."]
+ )
+
+(template [<name>]
+ [(documentation: <name>
+ ""
+ [(<name> scale subject)])]
+
+ [/.up]
+ [/.down]
+ )
+
+(documentation: /.reciprocal
+ "Rev(olution) reciprocal of a Nat(ural)."
+ [(reciprocal numerator)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..=
+ ..<
+ ..<=
+ ..>
+ ..>=
+ ..min
+ ..max
+ ..+
+ ..-
+ ..*
+ ../
+ ..%
+ ..ratio
+ ..up
+ ..down
+ ..reciprocal
+ ($.default /./1)
+ ($.default /./2)
+ ($.default /./4)
+ ($.default /./8)
+ ($.default /./16)
+ ($.default /./32)
+ ($.default /./64)
+ ($.default /./128)
+ ($.default /./256)
+ ($.default /./512)
+ ($.default /./1024)
+ ($.default /./2048)
+ ($.default /./4096)
+ ($.default /./%)
+ ($.default /.frac)
+ ($.default /.equivalence)
+ ($.default /.hash)
+ ($.default /.order)
+ ($.default /.enum)
+ ($.default /.interval)
+ ($.default /.addition)
+ ($.default /.maximum)
+ ($.default /.minimum)
+ ($.default /.binary)
+ ($.default /.octal)
+ ($.default /.hex)
+ ($.default /.decimal)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/random.lux b/stdlib/source/documentation/lux/math/random.lux
new file mode 100644
index 000000000..8dcfb98dd
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/random.lux
@@ -0,0 +1,139 @@
+(.module:
+ [library
+ [lux (#- or and nat int rev)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.PRNG
+ "An abstract way to represent any PRNG.")
+
+(documentation: /.Random
+ "A producer of random values based on a PRNG.")
+
+(documentation: /.only
+ "Retries the generator until the output satisfies a predicate."
+ [(only pred gen)])
+
+(documentation: /.one
+ ""
+ [(one check random)])
+
+(documentation: /.refined
+ "Retries the generator until the output can be refined."
+ [(refined refiner gen)])
+
+(documentation: /.safe_frac
+ "A number in the interval [0.0,1.0].")
+
+(documentation: /.text
+ ""
+ [(text char_gen size)])
+
+(documentation: /.and
+ "Sequencing combinator."
+ [(and left right)])
+
+(documentation: /.or
+ "Heterogeneous alternative combinator."
+ [(or left right)])
+
+(documentation: /.either
+ "Homogeneous alternative combinator."
+ [(either left right)])
+
+(documentation: /.rec
+ "A combinator for producing recursive random generators."
+ [(rec gen)])
+
+(documentation: /.set
+ ""
+ [(set hash size value_gen)])
+
+(documentation: /.dictionary
+ ""
+ [(dictionary hash size key_gen value_gen)])
+
+(documentation: /.result
+ ""
+ [(result prng calc)])
+
+(documentation: /.prng
+ ""
+ [(prng update return)])
+
+(documentation: /.pcg_32
+ (format "An implementation of the PCG32 algorithm."
+ \n "For more information, please see: http://www.pcg-random.org/"))
+
+(documentation: /.xoroshiro_128+
+ (format "An implementation of the Xoroshiro128+ algorithm."
+ \n "For more information, please see: http://xoroshiro.di.unimi.it/"))
+
+(documentation: /.split_mix_64
+ "An implementation of the SplitMix64 algorithm.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Pseudo-random number generation (PRNG) algorithms."
+ [..PRNG
+ ..Random
+ ..only
+ ..one
+ ..refined
+ ..safe_frac
+ ..text
+ ..and
+ ..or
+ ..either
+ ..rec
+ ..set
+ ..dictionary
+ ..result
+ ..prng
+ ..pcg_32
+ ..xoroshiro_128+
+ ..split_mix_64
+ ($.default /.functor)
+ ($.default /.apply)
+ ($.default /.monad)
+
+ ($.default /.bit)
+ ($.default /.i64)
+ ($.default /.nat)
+ ($.default /.int)
+ ($.default /.rev)
+ ($.default /.frac)
+ ($.default /.char)
+
+ ($.default /.unicode)
+ ($.default /.ascii)
+ ($.default /.ascii/alpha)
+ ($.default /.ascii/alpha_num)
+ ($.default /.ascii/numeric)
+ ($.default /.ascii/upper)
+ ($.default /.ascii/lower)
+
+ ($.default /.ratio)
+ ($.default /.complex)
+
+ ($.default /.maybe)
+ ($.default /.list)
+ ($.default /.row)
+ ($.default /.array)
+ ($.default /.queue)
+ ($.default /.stack)
+
+ ($.default /.instant)
+ ($.default /.date)
+ ($.default /.time)
+ ($.default /.duration)
+ ($.default /.month)
+ ($.default /.day)]
+ []))
diff --git a/stdlib/source/documentation/lux/meta.lux b/stdlib/source/documentation/lux/meta.lux
new file mode 100644
index 000000000..4b6c549bf
--- /dev/null
+++ b/stdlib/source/documentation/lux/meta.lux
@@ -0,0 +1,196 @@
+(.module:
+ [library
+ [lux (#- type)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]]
+ ["." / #_
+ ["#." annotation]
+ ["#." location]])
+
+(documentation: /.result'
+ (format "Evaluates a computation that depends on Lux's compiler state."
+ \n "Also returns a (potentially modified) compiler state.")
+ [(result' lux action)])
+
+(documentation: /.result
+ "Evaluates a computation that depends on Lux's compiler state."
+ [(result lux action)])
+
+(documentation: /.either
+ "Pick whichever computation succeeds."
+ [(either left right)])
+
+(documentation: /.assertion
+ "Fails with the given message if the test is #0."
+ [(assertion message test)])
+
+(documentation: /.failure
+ "Fails with the given error message."
+ [(failure error)])
+
+(documentation: /.module
+ "Looks-up a module with the given name."
+ [(module name)])
+
+(documentation: /.current_module_name
+ "The name of the module currently being compiled, if any.")
+
+(documentation: /.current_module
+ "The module currently being compiled, if any.")
+
+(documentation: /.normal
+ (format "If given a name without a module prefix, gives it the current module's name as prefix."
+ \n "Otherwise, returns the name as-is.")
+ [(normal name)])
+
+(documentation: /.macro
+ "Looks-up a macro known by the given name."
+ [(macro full_name)])
+
+(documentation: /.seed
+ (format "The current value of a number tracked by the compiler."
+ \n "Also increases the value, so it's different next time it is seen."
+ \n "This number can be used for generating data 'randomly' during compilation."))
+
+(documentation: /.module_exists?
+ ""
+ [(module_exists? module)])
+
+(documentation: /.var_type
+ "Looks-up the type of a local variable somewhere in the environment."
+ [(var_type name)])
+
+(documentation: /.definition
+ "Looks-up a definition's whole data in the available modules (including the current one)."
+ [(definition name)])
+
+(documentation: /.export
+ (format "Looks-up a definition in the available modules (including the current one)."
+ \n "The look-up only succeeds if the definition has been exported.")
+ [(export name)])
+
+(documentation: /.definition_type
+ "Looks-up a definition's type in the available modules (including the current one)."
+ [(definition_type name)])
+
+(documentation: /.type
+ "Looks-up the type of either a local variable or a definition."
+ [(type name)])
+
+(documentation: /.type_definition
+ "Finds the value of a type definition (such as Int, Any or Lux)."
+ [(type_definition name)])
+
+(documentation: /.globals
+ "The entire list of globals in a module (including the non-exported/private ones)."
+ [(globals module)])
+
+(documentation: /.definitions
+ "The entire list of definitions in a module (including the non-exported/private ones)."
+ [(definitions module)])
+
+(documentation: /.exports
+ "All the exported definitions in a module."
+ [(exports module_name)])
+
+(documentation: /.modules
+ "All the available modules (including the current one).")
+
+(documentation: /.tags_of
+ "All the tags associated with a type definition."
+ [(tags_of type_name)])
+
+(documentation: /.location
+ "The location of the current expression being analyzed.")
+
+(documentation: /.expected_type
+ "The expected type of the current expression being analyzed.")
+
+(documentation: /.imported_modules
+ "All the modules imported by a specified module."
+ [(imported_modules module_name)])
+
+(documentation: /.imported_by?
+ ""
+ [(imported_by? import module)])
+
+(documentation: /.imported?
+ "Checks if the given module has been imported by the current module."
+ [(imported? import)])
+
+(documentation: /.tag
+ "Given a tag, finds out what is its index, its related tag-list and its associated type."
+ [(tag tag_name)])
+
+(documentation: /.tag_lists
+ "All the tag-lists defined in a module, with their associated types."
+ [(tag_lists module)])
+
+(documentation: /.locals
+ "All the local variables currently in scope, separated in different scopes.")
+
+(documentation: /.de_aliased
+ "Given an aliased definition's name, returns the original definition being referenced."
+ [(de_aliased def_name)])
+
+(documentation: /.compiler_state
+ "Obtains the current state of the compiler.")
+
+(documentation: /.type_context
+ "The current type-checking context.")
+
+(documentation: /.eval
+ ""
+ [(eval type code)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Functions for extracting information from the state of the compiler."
+ [..result'
+ ..result
+ ..either
+ ..assertion
+ ..failure
+ ..module
+ ..current_module_name
+ ..current_module
+ ..normal
+ ..macro
+ ..seed
+ ..module_exists?
+ ..var_type
+ ..definition
+ ..export
+ ..definition_type
+ ..type
+ ..type_definition
+ ..globals
+ ..definitions
+ ..exports
+ ..modules
+ ..tags_of
+ ..location
+ ..expected_type
+ ..imported_modules
+ ..imported_by?
+ ..imported?
+ ..tag
+ ..tag_lists
+ ..locals
+ ..de_aliased
+ ..compiler_state
+ ..type_context
+ ..eval
+ ($.default /.functor)
+ ($.default /.apply)
+ ($.default /.monad)
+ ($.default /.lifted)]
+ [/annotation.documentation
+ /location.documentation]))
diff --git a/stdlib/source/documentation/lux/meta/annotation.lux b/stdlib/source/documentation/lux/meta/annotation.lux
new file mode 100644
index 000000000..42582dad5
--- /dev/null
+++ b/stdlib/source/documentation/lux/meta/annotation.lux
@@ -0,0 +1,56 @@
+(.module:
+ [library
+ [lux (#- nat int rev)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(template [<name>]
+ [(documentation: <name>
+ ""
+ [(<name> tag ann)])]
+
+ [/.value]
+ [/.bit]
+ [/.nat]
+ [/.int]
+ [/.rev]
+ [/.frac]
+ [/.text]
+ [/.identifier]
+ [/.tag]
+ [/.form]
+ [/.tuple]
+ [/.record]
+ )
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Machinary for querying annotations on modules and definitions."
+ [..value
+ ..bit
+ ..nat
+ ..int
+ ..rev
+ ..frac
+ ..text
+ ..identifier
+ ..tag
+ ..form
+ ..tuple
+ ..record
+ ($.default /.Annotation)
+ ($.default /.documentation)
+ ($.default /.flagged?)
+ ($.default /.implementation?)
+ ($.default /.recursive_type?)
+ ($.default /.interface?)
+ ($.default /.function_arguments)
+ ($.default /.type_arguments)]
+ []))
diff --git a/stdlib/source/documentation/lux/meta/location.lux b/stdlib/source/documentation/lux/meta/location.lux
new file mode 100644
index 000000000..6a32244b2
--- /dev/null
+++ b/stdlib/source/documentation/lux/meta/location.lux
@@ -0,0 +1,30 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.here
+ "The Location of the current form."
+ [(here)])
+
+(documentation: /.with
+ ""
+ [(with location error)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..here
+ ..with
+ ($.default /.equivalence)
+ ($.default /.dummy)
+ ($.default /.format)]
+ []))
diff --git a/stdlib/source/documentation/lux/static.lux b/stdlib/source/documentation/lux/static.lux
new file mode 100644
index 000000000..654409252
--- /dev/null
+++ b/stdlib/source/documentation/lux/static.lux
@@ -0,0 +1,70 @@
+(.module:
+ [library
+ [lux (#- nat int rev)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(template [<name> <type>]
+ [(documentation: <name>
+ ""
+ [(<name>
+ (: <type>
+ (value generating expression)))])]
+
+ [/.nat .Nat]
+ [/.int .Int]
+ [/.rev .Rev]
+ [/.frac .Frac]
+ [/.text .Text]
+ )
+
+(documentation: /.literal
+ ""
+ [(/.literal
+ (: (-> ??? Code)
+ format)
+ (: ???
+ (value generating expression)))])
+
+(template [<name> <type>]
+ [(documentation: <name>
+ ""
+ [(: <type>
+ (<name>))])]
+
+ [/.random_nat .Nat]
+ [/.random_int .Int]
+ [/.random_rev .Rev]
+ [/.random_frac .Frac]
+ )
+
+(documentation: /.random
+ ""
+ [(/.random
+ (: (-> ??? Code)
+ format)
+ (: (Random ???)
+ (random data generator)))])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..nat
+ ..int
+ ..rev
+ ..frac
+ ..text
+ ..literal
+ ..random_nat
+ ..random_int
+ ..random_rev
+ ..random_frac
+ ..random]
+ []))
diff --git a/stdlib/source/documentation/lux/target.lux b/stdlib/source/documentation/lux/target.lux
new file mode 100644
index 000000000..9e408ae0f
--- /dev/null
+++ b/stdlib/source/documentation/lux/target.lux
@@ -0,0 +1,32 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Target
+ (format "The name/ID of a platform targetted by a Lux compiler."
+ \n "This information can be used to generate code targetting specific platforms, and to make programs cross-platform."))
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Target
+ ($.default /.old)
+ ($.default /.js)
+ ($.default /.jvm)
+ ($.default /.lua)
+ ($.default /.python)
+ ($.default /.ruby)
+ ($.default /.common_lisp)
+ ($.default /.php)
+ ($.default /.r)
+ ($.default /.scheme)]
+ []))
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 986378ad7..ffe7daf46 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -1143,7 +1143,7 @@
(#Function Nat Code)
(form$ (#Item (tag$ ["library/lux" "Parameter"]) (#Item (nat$ idx) #End))))
-(def:'' .private (list\fold f init xs)
+(def:'' .private (list\mix f init xs)
#End
... (All [a b] (-> (-> b a a) a (List b) a))
(#UnivQ #End (#UnivQ #End (#Function (#Function (#Parameter 1)
@@ -1156,14 +1156,14 @@
init
(#Item x xs')
- (list\fold f (f x init) xs')}
+ (list\mix f (f x init) xs')}
xs))
(def:'' .private (list\size list)
#End
(#UnivQ #End
(#Function ($' List (#Parameter 1)) Nat))
- (list\fold (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list))
+ (list\mix (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list))
(macro:' .public (All tokens)
(#Item [(tag$ ["library/lux" "doc"])
@@ -1184,15 +1184,15 @@
({(#Item [_ (#Tuple args)] (#Item body #End))
(quantified_args_parser args
(function'' [names]
- (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code))
- (function'' [name' body']
- (form$ (#Item (tag$ ["library/lux" "UnivQ"])
- (#Item (tag$ ["library/lux" "End"])
- (#Item (with_replacements (#Item [name' (type_parameter 1)] #End)
- (nested_quantification body'))
- #End))))))
- body
- names)
+ (let'' body' (list\mix ("lux type check" (#Function Text (#Function Code Code))
+ (function'' [name' body']
+ (form$ (#Item (tag$ ["library/lux" "UnivQ"])
+ (#Item (tag$ ["library/lux" "End"])
+ (#Item (with_replacements (#Item [name' (type_parameter 1)] #End)
+ (nested_quantification body'))
+ #End))))))
+ body
+ names)
(in_meta (#Item ({[#1 _]
body'
@@ -1229,15 +1229,15 @@
({(#Item [_ (#Tuple args)] (#Item body #End))
(quantified_args_parser args
(function'' [names]
- (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code))
- (function'' [name' body']
- (form$ (#Item (tag$ ["library/lux" "ExQ"])
- (#Item (tag$ ["library/lux" "End"])
- (#Item (with_replacements (#Item [name' (type_parameter 1)] #End)
- (nested_quantification body'))
- #End))))))
- body
- names)
+ (let'' body' (list\mix ("lux type check" (#Function Text (#Function Code Code))
+ (function'' [name' body']
+ (form$ (#Item (tag$ ["library/lux" "ExQ"])
+ (#Item (tag$ ["library/lux" "End"])
+ (#Item (with_replacements (#Item [name' (type_parameter 1)] #End)
+ (nested_quantification body'))
+ #End))))))
+ body
+ names)
(in_meta (#Item ({[#1 _]
body'
@@ -1258,10 +1258,10 @@
(def:'' .private (list\reversed list)
#End
(All [a] (#Function ($' List a) ($' List a)))
- (list\fold ("lux type check" (All [a] (#Function a (#Function ($' List a) ($' List a))))
- (function'' [head tail] (#Item head tail)))
- #End
- list))
+ (list\mix ("lux type check" (All [a] (#Function a (#Function ($' List a) ($' List a))))
+ (function'' [head tail] (#Item head tail)))
+ #End
+ list))
(macro:' .public (-> tokens)
(#Item [(tag$ ["library/lux" "doc"])
@@ -1272,10 +1272,10 @@
"... This is the type of a function that takes 2 Ints and returns an Int.")))]
#End)
({(#Item output inputs)
- (in_meta (#Item (list\fold ("lux type check" (#Function Code (#Function Code Code))
- (function'' [i o] (form$ (#Item (tag$ ["library/lux" "Function"]) (#Item i (#Item o #End))))))
- output
- inputs)
+ (in_meta (#Item (list\mix ("lux type check" (#Function Code (#Function Code Code))
+ (function'' [i o] (form$ (#Item (tag$ ["library/lux" "Function"]) (#Item i (#Item o #End))))))
+ output
+ inputs)
#End))
_
@@ -1288,12 +1288,12 @@
("lux text concat" "... List-construction macro." __paragraph)
"(list +1 +2 +3)"))]
#End)
- (in_meta (#Item (list\fold (function'' [head tail]
- (form$ (#Item (tag$ ["library/lux" "Item"])
- (#Item (tuple$ (#Item [head (#Item [tail #End])]))
- #End))))
- (tag$ ["library/lux" "End"])
- (list\reversed xs))
+ (in_meta (#Item (list\mix (function'' [head tail]
+ (form$ (#Item (tag$ ["library/lux" "Item"])
+ (#Item (tuple$ (#Item [head (#Item [tail #End])]))
+ #End))))
+ (tag$ ["library/lux" "End"])
+ (list\reversed xs))
#End)))
(macro:' .public (list& xs)
@@ -1305,11 +1305,11 @@
"(list& +1 +2 +3 (list +4 +5 +6))")))]
#End)
({(#Item last init)
- (in_meta (list (list\fold (function'' [head tail]
- (form$ (list (tag$ ["library/lux" "Item"])
- (tuple$ (list head tail)))))
- last
- init)))
+ (in_meta (list (list\mix (function'' [head tail]
+ (form$ (list (tag$ ["library/lux" "Item"])
+ (tuple$ (list head tail)))))
+ last
+ init)))
_
(failure "Wrong syntax for list&")}
@@ -1329,9 +1329,9 @@
(in_meta (list (identifier$ ["library/lux" "Nothing"])))
(#Item last prevs)
- (in_meta (list (list\fold (function'' [left right] (form$ (list (tag$ ["library/lux" "Sum"]) left right)))
- last
- prevs)))}
+ (in_meta (list (list\mix (function'' [left right] (form$ (list (tag$ ["library/lux" "Sum"]) left right)))
+ last
+ prevs)))}
(list\reversed tokens)))
(macro:' .public (Tuple tokens)
@@ -1348,9 +1348,9 @@
(in_meta (list (identifier$ ["library/lux" "Any"])))
(#Item last prevs)
- (in_meta (list (list\fold (function'' [left right] (form$ (list (tag$ ["library/lux" "Product"]) left right)))
- last
- prevs)))}
+ (in_meta (list (list\mix (function'' [left right] (form$ (list (tag$ ["library/lux" "Product"]) left right)))
+ last
+ prevs)))}
(list\reversed tokens)))
(macro:' .private (function' tokens)
@@ -1367,12 +1367,12 @@
(#Item [harg targs])
(in_meta (list (form$ (list (tuple$ (list (local_identifier$ name)
harg))
- (list\fold (function'' [arg body']
- (form$ (list (tuple$ (list (local_identifier$ "")
- arg))
- body')))
- body
- (list\reversed targs))))))}
+ (list\mix (function'' [arg body']
+ (form$ (list (tuple$ (list (local_identifier$ "")
+ arg))
+ body')))
+ body
+ (list\reversed targs))))))}
args)
_
@@ -1437,14 +1437,14 @@
(macro:' .private (let' tokens)
({(#Item [[_ (#Tuple bindings)] (#Item [body #End])])
- (in_meta (list (list\fold ("lux type check" (-> (Tuple Code Code) Code
- Code)
- (function' [binding body]
- ({[label value]
- (form$ (list (record$ (list [label body])) value))}
- binding)))
- body
- (list\reversed (pairs bindings)))))
+ (in_meta (list (list\mix ("lux type check" (-> (Tuple Code Code) Code
+ Code)
+ (function' [binding body]
+ ({[label value]
+ (form$ (list (record$ (list [label body])) value))}
+ binding)))
+ body
+ (list\reversed (pairs bindings)))))
_
(failure "Wrong syntax for let'")}
@@ -1518,7 +1518,7 @@
#End)
({(#Item op tokens')
({(#Item first nexts)
- (in_meta (list (list\fold (function\flipped (right_associativity op)) first nexts)))
+ (in_meta (list (list\mix (function\flipped (right_associativity op)) first nexts)))
_
(failure "Wrong syntax for _$")}
@@ -1540,7 +1540,7 @@
#End)
({(#Item op tokens')
({(#Item last prevs)
- (in_meta (list (list\fold (right_associativity op) last prevs)))
+ (in_meta (list (list\mix (right_associativity op) last prevs)))
_
(failure "Wrong syntax for $_")}
@@ -1554,7 +1554,7 @@
... (: (All [a] (-> a (m a)))
... in)
... (: (All [a b] (-> (-> a (m b)) (m a) (m b)))
-... bind))
+... then))
("lux def type tagged" Monad
(#Named ["library/lux" "Monad"]
(All [m]
@@ -1563,7 +1563,7 @@
($' m a)
($' m b))))))
(record$ (list))
- ["in" "bind"]
+ ["in" "then"]
#0)
(def:''' .private maybe_monad
@@ -1572,7 +1572,7 @@
{#in
(function' [x] (#Some x))
- #bind
+ #then
(function' [f ma]
({#None #None
(#Some a) (f a)}
@@ -1586,7 +1586,7 @@
(function' [state]
(#Right state x)))
- #bind
+ #then
(function' [f ma]
(function' [state]
({(#Left msg)
@@ -1599,29 +1599,29 @@
(macro:' .private (do tokens)
({(#Item monad (#Item [_ (#Tuple bindings)] (#Item body #End)))
(let' [g!in (local_identifier$ "in")
- g!bind (local_identifier$ " bind ")
- body' (list\fold ("lux type check" (-> (Tuple Code Code) Code Code)
- (function' [binding body']
- (let' [[var value] binding]
- ({[_ (#Identifier [module short])]
- ({""
- (form$ (list g!bind
- (form$ (list (tuple$ (list (local_identifier$ "") var)) body'))
- value))
-
- _
- (form$ (list var value body'))}
- module)
-
-
- _
- (form$ (list g!bind
- (form$ (list (tuple$ (list (local_identifier$ "") var)) body'))
- value))}
- var))))
- body
- (list\reversed (pairs bindings)))]
- (in_meta (list (form$ (list (record$ (list [(record$ (list [(tag$ ["library/lux" "in"]) g!in] [(tag$ ["library/lux" "bind"]) g!bind]))
+ g!then (local_identifier$ " then ")
+ body' (list\mix ("lux type check" (-> (Tuple Code Code) Code Code)
+ (function' [binding body']
+ (let' [[var value] binding]
+ ({[_ (#Identifier [module short])]
+ ({""
+ (form$ (list g!then
+ (form$ (list (tuple$ (list (local_identifier$ "") var)) body'))
+ value))
+
+ _
+ (form$ (list var value body'))}
+ module)
+
+
+ _
+ (form$ (list g!then
+ (form$ (list (tuple$ (list (local_identifier$ "") var)) body'))
+ value))}
+ var))))
+ body
+ (list\reversed (pairs bindings)))]
+ (in_meta (list (form$ (list (record$ (list [(record$ (list [(tag$ ["library/lux" "in"]) g!in] [(tag$ ["library/lux" "then"]) g!then]))
body']))
monad)))))
@@ -1638,7 +1638,7 @@
(-> a ($' m b))
($' List a)
($' m ($' List b))))
- (let' [{#in in #bind _} m]
+ (let' [{#in in #then _} m]
({#End
(in #End)
@@ -1649,7 +1649,7 @@
(in (#Item y ys)))}
xs)))
-(def:''' .private (monad\fold m f y xs)
+(def:''' .private (monad\mix m f y xs)
#End
... (All [m a b]
... (-> (Monad m) (-> a b (m b)) b (List a) (m b)))
@@ -1659,14 +1659,14 @@
b
($' List a)
($' m b)))
- (let' [{#in in #bind _} m]
+ (let' [{#in in #then _} m]
({#End
(in y)
(#Item x xs')
(do m
[y' (f x y)]
- (monad\fold m f y' xs'))}
+ (monad\mix m f y' xs'))}
xs)))
(macro:' .public (if tokens)
@@ -1707,7 +1707,7 @@
(-> Text Text Text)
("lux text concat" x y))
-(def:''' .private (name\encode full_name)
+(def:''' .private (name\encoded full_name)
#End
(-> Name Text)
(let' [[module name] full_name]
@@ -1733,11 +1733,11 @@
constant)
#None
- (#Left ($_ text\compose "Unknown definition: " (name\encode full_name)))}
+ (#Left ($_ text\compose "Unknown definition: " (name\encoded full_name)))}
(plist\value name definitions))
#None
- (#Left ($_ text\compose "Unknown module: " module " @ " (name\encode full_name)))}
+ (#Left ($_ text\compose "Unknown module: " module " @ " (name\encoded full_name)))}
(plist\value module modules))))
(def:''' .private (code_list expression)
@@ -1766,21 +1766,21 @@
(in (code_list (form$ (list (tag$ ["library/lux" "Item"])
(tuple$ (list lastO (tag$ ["library/lux" "End"]))))))))}
lastI)]
- (monad\fold meta_monad
- (function' [leftI rightO]
- ({[_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))]
- (let' [g!in-module (form$ (list (text$ "lux in-module")
- (text$ "library/lux")
- (identifier$ ["library/lux" "list\compose"])))]
- (in (form$ (list g!in-module (code_list spliced) rightO))))
-
- _
- (do meta_monad
- [leftO (untemplated leftI)]
- (in (form$ (list (tag$ ["library/lux" "Item"]) (tuple$ (list leftO rightO))))))}
- leftI))
- lastO
- inits))}
+ (monad\mix meta_monad
+ (function' [leftI rightO]
+ ({[_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))]
+ (let' [g!in-module (form$ (list (text$ "lux in-module")
+ (text$ "library/lux")
+ (identifier$ ["library/lux" "list\compose"])))]
+ (in (form$ (list g!in-module (code_list spliced) rightO))))
+
+ _
+ (do meta_monad
+ [leftO (untemplated leftI)]
+ (in (form$ (list (tag$ ["library/lux" "Item"]) (tuple$ (list leftO rightO))))))}
+ leftI))
+ lastO
+ inits))}
(list\reversed elems))
#0
(do meta_monad
@@ -1965,23 +1965,23 @@
(list [(tag$ ["library/lux" "doc"])
(text$ ($_ "lux text concat"
"... Piping macro." __paragraph
- "(|> elems (list\map int\encode) (interposed '' '') (fold text\compose ''''))" __paragraph
+ "(|> elems (list\map int\encoded) (interposed '' '') (mix text\compose ''''))" __paragraph
"... =>" __paragraph
- "(fold text\compose '''' (interposed '' '' (list\map int\encode elems)))"))])
+ "(mix text\compose '''' (interposed '' '' (list\map int\encoded elems)))"))])
({(#Item [init apps])
- (in_meta (list (list\fold ("lux type check" (-> Code Code Code)
- (function' [app acc]
- ({[_ (#Tuple parts)]
- (tuple$ (list\compose parts (list acc)))
+ (in_meta (list (list\mix ("lux type check" (-> Code Code Code)
+ (function' [app acc]
+ ({[_ (#Tuple parts)]
+ (tuple$ (list\compose parts (list acc)))
- [_ (#Form parts)]
- (form$ (list\compose parts (list acc)))
+ [_ (#Form parts)]
+ (form$ (list\compose parts (list acc)))
- _
- (` ((~ app) (~ acc)))}
- app)))
- init
- apps)))
+ _
+ (` ((~ app) (~ acc)))}
+ app)))
+ init
+ apps)))
_
(failure "Wrong syntax for |>")}
@@ -1991,23 +1991,23 @@
(list [(tag$ ["library/lux" "doc"])
(text$ ($_ "lux text concat"
"... Reverse piping macro." __paragraph
- "(<| (fold text\compose '''') (interposed '' '') (list\map int\encode) elems)" __paragraph
+ "(<| (mix text\compose '''') (interposed '' '') (list\map int\encoded) elems)" __paragraph
"... =>" __paragraph
- "(fold text\compose '''' (interposed '' '' (list\map int\encode elems)))"))])
+ "(mix text\compose '''' (interposed '' '' (list\map int\encoded elems)))"))])
({(#Item [init apps])
- (in_meta (list (list\fold ("lux type check" (-> Code Code Code)
- (function' [app acc]
- ({[_ (#Tuple parts)]
- (tuple$ (list\compose parts (list acc)))
+ (in_meta (list (list\mix ("lux type check" (-> Code Code Code)
+ (function' [app acc]
+ ({[_ (#Tuple parts)]
+ (tuple$ (list\compose parts (list acc)))
- [_ (#Form parts)]
- (form$ (list\compose parts (list acc)))
+ [_ (#Form parts)]
+ (form$ (list\compose parts (list acc)))
- _
- (` ((~ app) (~ acc)))}
- app)))
- init
- apps)))
+ _
+ (` ((~ app) (~ acc)))}
+ app)))
+ init
+ apps)))
_
(failure "Wrong syntax for <|")}
@@ -2092,7 +2092,7 @@
#End
(All [a]
(-> (-> a Bit) ($' List a) Bit))
- (list\fold (function' [_2 _1] (if _1 (p _2) #0)) #1 xs))
+ (list\mix (function' [_2 _1] (if _1 (p _2) #0)) #1 xs))
(def:''' .private (high_bits value)
(list)
@@ -2133,7 +2133,7 @@
#End
(All [a]
(-> ($' List ($' List a)) ($' List a)))
- (list\fold list\compose #End (list\reversed xs)))
+ (list\mix list\compose #End (list\reversed xs)))
(macro:' .public (template tokens)
(list [(tag$ ["library/lux" "doc"])
@@ -2199,7 +2199,7 @@
left
right))
-(def:''' .private (bit\encode x)
+(def:''' .private (bit\encoded x)
#End
(-> Bit Text)
(if x "#1" "#0"))
@@ -2214,7 +2214,7 @@
_ ("lux io error" "@digit::format Undefined behavior.")}
digit))
-(def:''' .private (nat\encode value)
+(def:''' .private (nat\encoded value)
#End
(-> Nat Text)
({0
@@ -2238,7 +2238,7 @@
("lux i64 *" -1 value)
value))
-(def:''' .private (int\encode value)
+(def:''' .private (int\encoded value)
#End
(-> Int Text)
(if ("lux i64 =" +0 value)
@@ -2256,7 +2256,7 @@
(|> value ("lux i64 /" +10) int\abs)
(|> value ("lux i64 %" +10) int\abs ("lux type as" Nat) digit::format)))))
-(def:''' .private (frac\encode x)
+(def:''' .private (frac\encoded x)
#End
(-> Frac Text)
("lux f64 encode" x))
@@ -2465,10 +2465,10 @@
expression
[_ (#Form (#Item type_fn args))]
- (list\fold ("lux type check" (-> Code Code Code)
- (function' [arg type_fn] (` (#.Apply (~ arg) (~ type_fn)))))
- (normal_type type_fn)
- (list\map normal_type args))
+ (list\mix ("lux type check" (-> Code Code Code)
+ (function' [arg type_fn] (` (#.Apply (~ arg) (~ type_fn)))))
+ (normal_type type_fn)
+ (list\map normal_type args))
_
type}
@@ -2601,7 +2601,7 @@
#seed ("lux i64 +" 1 seed) #expected expected
#location location #extensions extensions
#scope_type_vars scope_type_vars #eval _eval}
- (local_identifier$ ($_ text\compose "__gensym__" prefix (nat\encode seed))))}
+ (local_identifier$ ($_ text\compose "__gensym__" prefix (nat\encoded seed))))}
state))
(macro:' .public (Rec tokens)
@@ -2631,11 +2631,11 @@
"''YOLO'')"))])
({(#Item value actions)
(let' [dummy (local_identifier$ "")]
- (in_meta (list (list\fold ("lux type check" (-> Code Code Code)
- (function' [pre post] (` ({(~ dummy) (~ post)}
- (~ pre)))))
- value
- actions))))
+ (in_meta (list (list\mix ("lux type check" (-> Code Code Code)
+ (function' [pre post] (` ({(~ dummy) (~ post)}
+ (~ pre)))))
+ value
+ actions))))
_
(failure "Wrong syntax for exec")}
@@ -2681,29 +2681,29 @@
(failure "Wrong syntax for def'")}
parts)))
-(def:' .private (text\encode original)
+(def:' .private (text\encoded original)
(-> Text Text)
($_ text\compose ..double_quote original ..double_quote))
-(def:' .private (code\encode code)
+(def:' .private (code\encoded code)
(-> Code Text)
({[_ (#Bit value)]
- (bit\encode value)
+ (bit\encoded value)
[_ (#Nat value)]
- (nat\encode value)
+ (nat\encoded value)
[_ (#Int value)]
- (int\encode value)
+ (int\encoded value)
[_ (#Rev value)]
- ("lux io error" "@code\encode Undefined behavior.")
+ ("lux io error" "@code\encoded Undefined behavior.")
[_ (#Frac value)]
- (frac\encode value)
+ (frac\encoded value)
[_ (#Text value)]
- (text\encode value)
+ (text\encoded value)
[_ (#Identifier [module name])]
(if (text\= "" module)
@@ -2717,25 +2717,25 @@
[_ (#Form xs)]
($_ text\compose "(" (|> xs
- (list\map code\encode)
+ (list\map code\encoded)
(list\interposed " ")
list\reversed
- (list\fold text\compose "")) ")")
+ (list\mix text\compose "")) ")")
[_ (#Tuple xs)]
($_ text\compose "[" (|> xs
- (list\map code\encode)
+ (list\map code\encoded)
(list\interposed " ")
list\reversed
- (list\fold text\compose "")) "]")
+ (list\mix text\compose "")) "]")
[_ (#Record kvs)]
($_ text\compose "{" (|> kvs
- (list\map (function' [kv] ({[k v] ($_ text\compose (code\encode k) " " (code\encode v))}
+ (list\map (function' [kv] ({[k v] ($_ text\compose (code\encoded k) " " (code\encoded v))}
kv)))
(list\interposed " ")
list\reversed
- (list\fold text\compose "")) "}")}
+ (list\mix text\compose "")) "}")}
code))
(def:' .private (expander branches)
@@ -2765,10 +2765,10 @@
_
(failure ($_ text\compose "'lux.case' expects an even number of tokens: " (|> branches
- (list\map code\encode)
+ (list\map code\encoded)
(list\interposed " ")
list\reversed
- (list\fold text\compose ""))))}
+ (list\mix text\compose ""))))}
branches))
(macro:' .public (case tokens)
@@ -2865,13 +2865,13 @@
(^ (list [_ (#Tuple bindings)] body))
(if (multiple? 2 (list\size bindings))
(|> bindings pairs list\reversed
- (list\fold (: (-> [Code Code] Code Code)
- (function' [lr body']
- (let' [[l r] lr]
- (if (identifier? l)
- (` ({(~ l) (~ body')} (~ r)))
- (` (case (~ r) (~ l) (~ body')))))))
- body)
+ (list\mix (: (-> [Code Code] Code Code)
+ (function' [lr body']
+ (let' [[l r] lr]
+ (if (identifier? l)
+ (` ({(~ l) (~ body')} (~ r)))
+ (` (case (~ r) (~ l) (~ body')))))))
+ body)
list
in_meta)
(failure "let requires an even number of parts"))
@@ -2906,7 +2906,7 @@
(` ([(~ g!name) (~ g!blank)]
(.case (~ g!blank) (~ arg) (~ body'))))))))]
(in_meta (list (nest (..local_identifier$ g!name) head
- (list\fold (nest g!blank) body (list\reversed tail))))))
+ (list\mix (nest g!blank) body (list\reversed tail))))))
#None
(failure "Wrong syntax for function")))
@@ -2971,13 +2971,13 @@
_
(` (#.Item [[(~ location_code) (#.Tag ["library/lux" "func_args"])]
[(~ location_code) (#.Tuple (.list (~+ (list\map (function (_ parameter)
- (` [(~ location_code) (#.Text (~ (text$ (code\encode parameter))))]))
+ (` [(~ location_code) (#.Text (~ (text$ (code\encoded parameter))))]))
parameters))))]]
(~ meta)))))
(def:' .private (with_type_args args)
(-> (List Code) Code)
- (` {#.type_args [(~+ (list\map (function (_ arg) (text$ (code\encode arg)))
+ (` {#.type_args [(~+ (list\map (function (_ arg) (text$ (code\encoded arg)))
args))]}))
(def:' .private (endP tokens)
@@ -3195,7 +3195,7 @@
(-> Code Code Code)
(case addition
[location (#Record pairs)]
- (list\fold with_definition_annotation base pairs)
+ (list\mix with_definition_annotation base pairs)
_
base))
@@ -3295,10 +3295,10 @@
{#.doc <documentation>}
(case (list\reversed tokens)
(^ (list& last init))
- (in_meta (list (list\fold (: (-> Code Code Code)
- (function (_ pre post) (` <form>)))
- last
- init)))
+ (in_meta (list (list\mix (: (-> Code Code Code)
+ (function (_ pre post) (` <form>)))
+ last
+ init)))
_
(failure <message>)))]
@@ -3508,7 +3508,7 @@
(in_meta output)
_
- (failure (text\compose "Unknown tag: " (name\encode [module name]))))))
+ (failure (text\compose "Unknown tag: " (name\encoded [module name]))))))
(def: (record_slots type)
(-> Type (Meta (Maybe [(List Name) (List Type)])))
@@ -3610,10 +3610,10 @@
""
(#Item head tail)
- (list\fold (function (_ right left)
- ($_ text\compose left separator right))
- head
- tail)))
+ (list\mix (function (_ right left)
+ ($_ text\compose left separator right))
+ head
+ tail)))
(def: (remainderP tokens)
(-> (List Code) (Maybe (List Code)))
@@ -4150,7 +4150,7 @@
[current_module current_module_name]
(failure ($_ text\compose
"Wrong syntax for import @ " current_module
- ..\n (code\encode token)))))))
+ ..\n (code\encoded token)))))))
imports)]
(in (list\joined imports'))))
@@ -4181,10 +4181,10 @@
#None
(#Left ($_ text\compose
- "Unknown module: " (text\encode module) ..\n
+ "Unknown module: " (text\encoded module) ..\n
"Current module: " (case current_module
(#Some current_module)
- (text\encode current_module)
+ (text\encoded current_module)
#None
"???") ..\n
@@ -4192,7 +4192,7 @@
(list\map (function (_ [name module])
(text$ name)))
tuple$
- code\encode))))
+ code\encoded))))
))
(def: (only p xs)
@@ -4208,11 +4208,11 @@
(def: (is_member? cases name)
(-> (List Text) Text Bit)
- (let [output (list\fold (function (_ case prev)
- (or prev
- (text\= case name)))
- #0
- cases)]
+ (let [output (list\mix (function (_ case prev)
+ (or prev
+ (text\= case name)))
+ #0
+ cases)]
output))
(def: (on_either f x1 x2)
@@ -4278,12 +4278,12 @@
#scope_type_vars scope_type_vars #eval _eval} state]
(case (plist\value v_module modules)
#None
- (#Left (text\compose "Unknown definition: " (name\encode name)))
+ (#Left (text\compose "Unknown definition: " (name\encoded name)))
(#Some {#definitions definitions #module_hash _ #module_aliases _ #imports _ #tags tags #types types #module_annotations _ #module_state _})
(case (plist\value v_name definitions)
#None
- (#Left (text\compose "Unknown definition: " (name\encode name)))
+ (#Left (text\compose "Unknown definition: " (name\encoded name)))
(#Some definition)
(case definition
@@ -4321,13 +4321,13 @@
(#Right [compiler struct_type])
_
- (#Left ($_ text\compose "Unknown var: " (name\encode full_name)))))
+ (#Left ($_ text\compose "Unknown var: " (name\encoded full_name)))))
(case (definition_type full_name compiler)
(#Some struct_type)
(#Right [compiler struct_type])
_
- (#Left ($_ text\compose "Unknown var: " (name\encode full_name)))))]
+ (#Left ($_ text\compose "Unknown var: " (name\encoded full_name)))))]
(case temp
(#Right [compiler (#Var type_id)])
(let [{#info _ #source _ #current_module _ #modules _
@@ -4360,7 +4360,7 @@
_
(list)))
-(def: (type\encode type)
+(def: (type\encoded type)
(-> Type Text)
(case type
(#Primitive name params)
@@ -4369,41 +4369,41 @@
name
_
- ($_ text\compose "(" name " " (|> params (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose "")) ")"))
+ ($_ text\compose "(" name " " (|> params (list\map type\encoded) (list\interposed " ") list\reversed (list\mix text\compose "")) ")"))
(#Sum _)
- ($_ text\compose "(Or " (|> (flat_variant type) (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose "")) ")")
+ ($_ text\compose "(Or " (|> (flat_variant type) (list\map type\encoded) (list\interposed " ") list\reversed (list\mix text\compose "")) ")")
(#Product _)
- ($_ text\compose "[" (|> (flat_tuple type) (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose "")) "]")
+ ($_ text\compose "[" (|> (flat_tuple type) (list\map type\encoded) (list\interposed " ") list\reversed (list\mix text\compose "")) "]")
(#Function _)
- ($_ text\compose "(-> " (|> (flat_lambda type) (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose "")) ")")
+ ($_ text\compose "(-> " (|> (flat_lambda type) (list\map type\encoded) (list\interposed " ") list\reversed (list\mix text\compose "")) ")")
(#Parameter id)
- (nat\encode id)
+ (nat\encoded id)
(#Var id)
- ($_ text\compose "⌈v:" (nat\encode id) "⌋")
+ ($_ text\compose "⌈v:" (nat\encoded id) "⌋")
(#Ex id)
- ($_ text\compose "⟨e:" (nat\encode id) "⟩")
+ ($_ text\compose "⟨e:" (nat\encoded id) "⟩")
(#UnivQ env body)
- ($_ text\compose "(All " (type\encode body) ")")
+ ($_ text\compose "(All " (type\encoded body) ")")
(#ExQ env body)
- ($_ text\compose "(Ex " (type\encode body) ")")
+ ($_ text\compose "(Ex " (type\encoded body) ")")
(#Apply _)
(let [[func args] (flat_application type)]
($_ text\compose
- "(" (type\encode func) " "
- (|> args (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose ""))
+ "(" (type\encoded func) " "
+ (|> args (list\map type\encoded) (list\interposed " ") list\reversed (list\mix text\compose ""))
")"))
(#Named name _)
- (name\encode name)
+ (name\encoded name)
))
(macro: .public (^open tokens)
@@ -4425,7 +4425,7 @@
struct_evidence (record_slots init_type)]
(case struct_evidence
#None
- (failure (text\compose "Can only 'open' structs: " (type\encode init_type)))
+ (failure (text\compose "Can only 'open' structs: " (type\encoded init_type)))
(#Some tags&members)
(do meta_monad
@@ -4436,20 +4436,20 @@
tags)
pattern (tuple$ (list\map identifier$ locals))]
(do meta_monad
- [enhanced_target (monad\fold meta_monad
- (function (_ [m_local m_type] enhanced_target)
- (do meta_monad
- [m_implementation (record_slots m_type)]
- (case m_implementation
- (#Some m_tags&members)
- (recur m_local
- m_tags&members
- enhanced_target)
-
- #None
- (in enhanced_target))))
- target
- (zipped/2 locals members))]
+ [enhanced_target (monad\mix meta_monad
+ (function (_ [m_local m_type] enhanced_target)
+ (do meta_monad
+ [m_implementation (record_slots m_type)]
+ (case m_implementation
+ (#Some m_tags&members)
+ (recur m_local
+ m_tags&members
+ enhanced_target)
+
+ #None
+ (in enhanced_target))))
+ target
+ (zipped/2 locals members))]
(in (` ({(~ pattern) (~ enhanced_target)} (~ (identifier$ source)))))))))
name tags&members body)]
(in (list full_body)))))
@@ -4469,12 +4469,12 @@
(failure "cond requires an uneven number of arguments.")
(case (list\reversed tokens)
(^ (list& else branches'))
- (in_meta (list (list\fold (: (-> [Code Code] Code Code)
- (function (_ branch else)
- (let [[right left] branch]
- (` (if (~ left) (~ right) (~ else))))))
- else
- (pairs branches'))))
+ (in_meta (list (list\mix (: (-> [Code Code] Code Code)
+ (function (_ branch else)
+ (let [[right left] branch]
+ (` (if (~ left) (~ right) (~ else))))))
+ else
+ (pairs branches'))))
_
(failure "Wrong syntax for cond"))))
@@ -4526,11 +4526,11 @@
(failure "value@ can only use records.")))
(^ (list [_ (#Tuple slots)] record))
- (in_meta (list (list\fold (: (-> Code Code Code)
- (function (_ slot inner)
- (` (..value@ (~ slot) (~ inner)))))
- record
- slots)))
+ (in_meta (list (list\mix (: (-> Code Code Code)
+ (function (_ slot inner)
+ (` (..value@ (~ slot) (~ inner)))))
+ record
+ slots)))
(^ (list selector))
(do meta_monad
@@ -4601,7 +4601,7 @@
(in_meta (list\joined decls')))
_
- (failure (text\compose "Can only 'open:' structs: " (type\encode struct_type)))))
+ (failure (text\compose "Can only 'open:' structs: " (type\encoded struct_type)))))
_
(do meta_monad
@@ -4617,9 +4617,9 @@
(macro: .public (|>> tokens)
{#.doc (text$ ($_ "lux text concat"
"... Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." ..\n
- "(|>> (list\map int\encode) (interposed '' '') (fold text\compose ''''))" ..\n
+ "(|>> (list\map int\encoded) (interposed '' '') (mix text\compose ''''))" ..\n
"... =>" ..\n
- "(function (_ <arg>) (fold text\compose '''' (interposed '' '' (list\map int\encode <arg>))))"))}
+ "(function (_ <arg>) (mix text\compose '''' (interposed '' '' (list\map int\encoded <arg>))))"))}
(do meta_monad
[g!_ (..identifier "_")
g!arg (..identifier "arg")]
@@ -4628,9 +4628,9 @@
(macro: .public (<<| tokens)
{#.doc (text$ ($_ "lux text concat"
"... Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." ..\n
- "(<<| (fold text\compose '''') (interposed '' '') (list\map int\encode))" ..\n
+ "(<<| (mix text\compose '''') (interposed '' '') (list\map int\encoded))" ..\n
"... =>" ..\n
- "(function (_ <arg>) (fold text\compose '''' (interposed '' '' (list\map int\encode <arg>))))"))}
+ "(function (_ <arg>) (mix text\compose '''' (interposed '' '' (list\map int\encoded <arg>))))"))}
(do meta_monad
[g!_ (..identifier "_")
g!arg (..identifier "arg")]
@@ -4659,9 +4659,9 @@
_
(failure ($_ text\compose "Wrong syntax for refer @ " current_module
..\n (|> options
- (list\map code\encode)
+ (list\map code\encoded)
(list\interposed " ")
- (list\fold text\compose "")))))))
+ (list\mix text\compose "")))))))
(def: (referral_definitions module_name [r_defs r_opens])
(-> Text Refer (Meta (List Code)))
@@ -4792,10 +4792,10 @@
(macro: .public (\ tokens)
{#.doc (text$ ($_ "lux text concat"
"... Allows accessing the value of a implementation's member." ..\n
- "(\ codec encode)"
+ "(\ codec encoded)"
__paragraph
"... Also allows using that value as a function." ..\n
- "(\ codec encode +123)"))}
+ "(\ codec encoded +123)"))}
(case tokens
(^ (list struct [_ (#Identifier member)]))
(in_meta (list (` (let [(^open (~ (text$ ..self_reference))) (~ struct)] (~ (identifier$ member))))))
@@ -4862,17 +4862,17 @@
(function (_ _) (..identifier "temp")))
slots)
.let [pairs (zipped/2 slots bindings)
- update_expr (list\fold (: (-> [Code Code] Code Code)
- (function (_ [s b] v)
- (` (..with@ (~ s) (~ v) (~ b)))))
- value
- (list\reversed pairs))
- [_ accesses'] (list\fold (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))])
- (function (_ [new_slot new_binding] [old_record accesses'])
- [(` (value@ (~ new_slot) (~ new_binding)))
- (#Item (list new_binding old_record) accesses')]))
- [record (: (List (List Code)) #End)]
- pairs)
+ update_expr (list\mix (: (-> [Code Code] Code Code)
+ (function (_ [s b] v)
+ (` (..with@ (~ s) (~ v) (~ b)))))
+ value
+ (list\reversed pairs))
+ [_ accesses'] (list\mix (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))])
+ (function (_ [new_slot new_binding] [old_record accesses'])
+ [(` (value@ (~ new_slot) (~ new_binding)))
+ (#Item (list new_binding old_record) accesses')]))
+ [record (: (List (List Code)) #End)]
+ pairs)
accesses (list\joined (list\reversed accesses'))]]
(in (list (` (let [(~+ accesses)]
(~ update_expr)))))))
@@ -5050,14 +5050,14 @@
(^template [<tag>]
[[[_ _ column] (<tag> parts)]
- (list\fold n/min column (list\map baseline_column parts))])
+ (list\mix n/min column (list\map baseline_column parts))])
([#Form]
[#Tuple])
[[_ _ column] (#Record pairs)]
- (list\fold n/min column
- (list\compose (list\map (|>> product\left baseline_column) pairs)
- (list\map (|>> product\right baseline_column) pairs)))
+ (list\mix n/min column
+ (list\compose (list\map (|>> product\left baseline_column) pairs)
+ (list\map (|>> product\right baseline_column) pairs)))
))
(type: Documentation_Fragment
@@ -5083,9 +5083,9 @@
[-- "lux i64 -" "Decrement function."]
)
-(def: tag\encode
+(def: tag\encoded
(-> Name Text)
- (|>> name\encode (text\compose "#")))
+ (|>> name\encoded (text\compose "#")))
(def: (repeated n x)
(All [a] (-> Int a (List a)))
@@ -5120,27 +5120,27 @@
(def: (example_documentation prev_location baseline example)
(-> Location Nat Code [Location Text])
(case example
- (^template [<tag> <encode>]
+ (^template [<tag> <encoded>]
[[new_location (<tag> value)]
- (let [as_text (<encode> value)]
+ (let [as_text (<encoded> value)]
[(updated_location new_location as_text)
(text\compose (location_padding baseline prev_location new_location)
as_text)])])
- ([#Bit bit\encode]
- [#Nat nat\encode]
- [#Int int\encode]
- [#Frac frac\encode]
- [#Text text\encode]
- [#Identifier name\encode]
- [#Tag tag\encode])
+ ([#Bit bit\encoded]
+ [#Nat nat\encoded]
+ [#Int int\encoded]
+ [#Frac frac\encoded]
+ [#Text text\encoded]
+ [#Identifier name\encoded]
+ [#Tag tag\encoded])
(^template [<tag> <open> <close> <prep>]
[[group_location (<tag> parts)]
- (let [[group_location' parts_text] (list\fold (function (_ part [last_location text_accum])
- (let [[part_location part_text] (example_documentation last_location baseline part)]
- [part_location (text\compose text_accum part_text)]))
- [(revised@ #column ++ group_location) ""]
- (<prep> parts))]
+ (let [[group_location' parts_text] (list\mix (function (_ part [last_location text_accum])
+ (let [[part_location part_text] (example_documentation last_location baseline part)]
+ [part_location (text\compose text_accum part_text)]))
+ [(revised@ #column ++ group_location) ""]
+ (<prep> parts))]
[(revised@ #column ++ group_location')
($_ text\compose (location_padding baseline prev_location group_location)
<open>
@@ -5374,7 +5374,7 @@
(test: "Code operations & implementations"
(with_expansions
[<tests> (template [<expr> <text>]
- [(compare <text> (\ Code/encode encode <expr>))]
+ [(compare <text> (\ codec encoded <expr>))]
[(bit #1) "#1"]
[(int +123) "+123"]
@@ -5448,7 +5448,7 @@
["Text" Text text$])
_
- (failure (text\compose "Cannot anti-quote type: " (name\encode name))))))
+ (failure (text\compose "Cannot anti-quote type: " (name\encoded name))))))
(def: (static_literal token)
(-> Code (Meta Code))
@@ -5542,22 +5542,22 @@
(def: (multi_level_case$ g!_ [[init_pattern levels] body])
(-> Code [Multi_Level_Case Code] (List Code))
- (let [inner_pattern_body (list\fold (function (_ [calculation pattern] success)
- (let [bind? (case pattern
- [_ (#.Identifier _)]
- #1
+ (let [inner_pattern_body (list\mix (function (_ [calculation pattern] success)
+ (let [bind? (case pattern
+ [_ (#.Identifier _)]
+ #1
- _
- #0)]
- (` (case (~ calculation)
- (~ pattern)
- (~ success)
-
- (~+ (if bind?
- (list)
- (list g!_ (` #.None))))))))
- (` (#.Some (~ body)))
- (: (List [Code Code]) (list\reversed levels)))]
+ _
+ #0)]
+ (` (case (~ calculation)
+ (~ pattern)
+ (~ success)
+
+ (~+ (if bind?
+ (list)
+ (list g!_ (` #.None))))))))
+ (` (#.Some (~ body)))
+ (: (List [Code Code]) (list\reversed levels)))]
(list init_pattern inner_pattern_body)))
(macro: .public (^multi tokens)
@@ -5617,7 +5617,7 @@
... 'wrong_syntax_error' for easier maintenance of the error_messages.
(def: wrong_syntax_error
(-> Name Text)
- (|>> name\encode
+ (|>> name\encoded
(text\compose "Wrong syntax for ")))
(macro: .public (name_of tokens)
@@ -5649,10 +5649,10 @@
"In the example below, 0 corresponds to the 'a' variable."
(def: .public (of_list list)
(All [a] (-> (List a) (Row a)))
- (list\fold add
- (: (Row (:parameter 0))
- empty)
- list)))}
+ (list\mix add
+ (: (Row (:parameter 0))
+ empty)
+ list)))}
(case tokens
(^ (list [_ (#Nat idx)]))
(do meta_monad
@@ -5662,7 +5662,7 @@
(in (list (` (#Ex (~ (nat$ var_id))))))
#None
- (failure (text\compose "Indexed-type does not exist: " (nat\encode idx)))))
+ (failure (text\compose "Indexed-type does not exist: " (nat\encoded idx)))))
_
(failure (..wrong_syntax_error (name_of ..$)))))
@@ -5681,9 +5681,9 @@
(macro: .public (^@ tokens)
{#.doc (example "Allows you to simultaneously bind and de-structure a value."
(def: (hash (^@ set [Hash<a> _]))
- (list\fold (function (_ elem acc) (+ (\ Hash<a> hash elem) acc))
- 0
- (to_list set))))}
+ (list\mix (function (_ elem acc) (+ (\ Hash<a> hash elem) acc))
+ 0
+ (to_list set))))}
(case tokens
(^ (list& [_meta (#Form (list [_ (#Identifier ["" name])] pattern))] body branches))
(let [g!whole (local_identifier$ name)]
@@ -5742,7 +5742,7 @@
(do meta_monad
[location ..location
.let [[module line column] location
- location ($_ "lux text concat" (text\encode module) "," (nat\encode line) "," (nat\encode column))
+ location ($_ "lux text concat" (text\encoded module) "," (nat\encoded line) "," (nat\encoded column))
message ($_ "lux text concat" "Undefined behavior @ " location)]]
(in (list (` (..panic! (~ (text$ message)))))))
@@ -5897,12 +5897,12 @@
_
(failure ($_ text\compose
- "Invalid target platform (must be a value of type Text): " (name\encode identifier)
- " : " (..code\encode (..type_code type))))))
+ "Invalid target platform (must be a value of type Text): " (name\encoded identifier)
+ " : " (..code\encoded (..type_code type))))))
_
(failure ($_ text\compose
- "Invalid target platform syntax: " (..code\encode choice)
+ "Invalid target platform syntax: " (..code\encoded choice)
..\n "Must be either a text literal or an identifier."))))
(def: (target_pick target options default)
@@ -5962,7 +5962,7 @@
[[ann (<tag> parts)]
(do meta_monad
[=parts (monad\map meta_monad embedded_expansions parts)]
- (in [(list\fold list\compose (list) (list\map left =parts))
+ (in [(list\mix list\compose (list) (list\map left =parts))
[ann (<tag> (list\map right =parts))]]))])
([#Form] [#Tuple])
@@ -5977,7 +5977,7 @@
[val_labels val_labelled] =val]]
(in [(list\compose key_labels val_labels) [key_labelled val_labelled]])))
kvs)]
- (in [(list\fold list\compose (list) (list\map left =kvs))
+ (in [(list\mix list\compose (list) (list\map left =kvs))
[ann (#Record (list\map right =kvs))]]))
_
@@ -6124,7 +6124,7 @@
..pairs
(list\map (function (_ [localT valueT])
(list localT (` (..as_is (~ valueT))))))
- (list\fold list\compose (list))))]
+ (list\mix list\compose (list))))]
(~ bodyT)))))
(..failure ":let requires an even number of parts"))
diff --git a/stdlib/source/library/lux/abstract/apply.lux b/stdlib/source/library/lux/abstract/apply.lux
index 0b80263e8..7ca651988 100644
--- a/stdlib/source/library/lux/abstract/apply.lux
+++ b/stdlib/source/library/lux/abstract/apply.lux
@@ -9,8 +9,8 @@
(: (Functor f)
&functor)
(: (All [a b]
- (-> (f (-> a b)) (f a) (f b)))
- apply))
+ (-> (f a) (f (-> a b)) (f b)))
+ on))
(implementation: .public (composite f_monad f_apply g_apply)
(All [F G]
@@ -22,16 +22,16 @@
(functor.composite (value@ #&functor f_apply)
(value@ #&functor g_apply)))
- (def: (apply fgf fgx)
+ (def: (on fgx fgf)
... TODO: Switch from this version to the one below (in comments) ASAP.
- (let [fgf' (\ f_apply apply
- (\ f_monad in (\ g_apply apply))
- fgf)]
- (\ f_apply apply fgf' fgx))
- ... (let [applyF (\ f_apply apply)
- ... applyG (\ g_apply apply)]
+ (let [fgf' (\ f_apply on
+ fgf
+ (\ f_monad in (function (_ gf gx) (\ g_apply on gx gf))))]
+ (\ f_apply on fgx fgf'))
+ ... (let [applyF (\ f_apply on)
+ ... applyG (\ g_apply on)]
... ($_ applyF
- ... (\ f_monad in applyG)
... fgf
+ ... (\ f_monad in applyG)
... fgx))
))
diff --git a/stdlib/source/library/lux/abstract/codec.lux b/stdlib/source/library/lux/abstract/codec.lux
index 53c95a816..82b4ad194 100644
--- a/stdlib/source/library/lux/abstract/codec.lux
+++ b/stdlib/source/library/lux/abstract/codec.lux
@@ -9,19 +9,19 @@
(interface: .public (Codec m a)
(: (-> a m)
- encode)
+ encoded)
(: (-> m (Try a))
- decode))
+ decoded))
(implementation: .public (composite cb_codec ba_codec)
(All [a b c]
(-> (Codec c b) (Codec b a)
(Codec c a)))
- (def: encode
- (|>> (\ ba_codec encode)
- (\ cb_codec encode)))
+ (def: encoded
+ (|>> (\ ba_codec encoded)
+ (\ cb_codec encoded)))
- (def: (decode cy)
+ (def: (decoded cy)
(do try.monad
- [by (\ cb_codec decode cy)]
- (\ ba_codec decode by))))
+ [by (\ cb_codec decoded cy)]
+ (\ ba_codec decoded by))))
diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux
index 8803eed86..281dc7fc9 100644
--- a/stdlib/source/library/lux/abstract/comonad.lux
+++ b/stdlib/source/library/lux/abstract/comonad.lux
@@ -3,7 +3,7 @@
[lux #*
[data
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
[number
["n" nat]]]
@@ -41,21 +41,21 @@
g!_ (identifier "_")
g!map (identifier "map")
g!split (identifier "split")
- body' (list\fold (: (-> [Code Code] Code Code)
- (function (_ binding body')
- (with_expansions [<default> (` (|> (~ value) (~ g!split) ((~ g!map) (function ((~ g!_) (~ var)) (~ body')))))]
- (let [[var value] binding]
- (case var
- [_ (#.Identifier ["" _])]
- <default>
+ body' (list\mix (: (-> [Code Code] Code Code)
+ (function (_ binding body')
+ (with_expansions [<default> (` (|> (~ value) (~ g!split) ((~ g!map) (function ((~ g!_) (~ var)) (~ body')))))]
+ (let [[var value] binding]
+ (case var
+ [_ (#.Identifier ["" _])]
+ <default>
- [_ (#.Identifier _)]
- (` ((~ var) (~ value) (~ body')))
+ [_ (#.Identifier _)]
+ (` ((~ var) (~ value) (~ body')))
- _
- <default>)))))
- body
- (list.reversed (list.pairs bindings)))]
+ _
+ <default>)))))
+ body
+ (list.reversed (list.pairs bindings)))]
(#.Right [state (list (case ?name
(#.Some name)
(let [name [location.dummy (#.Identifier ["" name])]]
diff --git a/stdlib/source/library/lux/abstract/fold.lux b/stdlib/source/library/lux/abstract/fold.lux
deleted file mode 100644
index ba8a93381..000000000
--- a/stdlib/source/library/lux/abstract/fold.lux
+++ /dev/null
@@ -1,16 +0,0 @@
-(.module:
- [library
- [lux #*]]
- [//
- [monoid (#+ Monoid)]])
-
-(interface: .public (Fold F)
- (: (All [a b]
- (-> (-> b a a) a (F b) a))
- fold))
-
-(def: .public (with_monoid monoid fold value)
- (All [F a]
- (-> (Monoid a) (Fold F) (F a) a))
- (let [(^open "/\.") monoid]
- (fold /\compose /\identity value)))
diff --git a/stdlib/source/library/lux/abstract/mix.lux b/stdlib/source/library/lux/abstract/mix.lux
new file mode 100644
index 000000000..0788f38d0
--- /dev/null
+++ b/stdlib/source/library/lux/abstract/mix.lux
@@ -0,0 +1,16 @@
+(.module:
+ [library
+ [lux #*]]
+ [//
+ [monoid (#+ Monoid)]])
+
+(interface: .public (Mix F)
+ (: (All [a b]
+ (-> (-> b a a) a (F b) a))
+ mix))
+
+(def: .public (with_monoid monoid mix value)
+ (All [F a]
+ (-> (Monoid a) (Mix F) (F a) a))
+ (let [(^open "/\.") monoid]
+ (mix /\compose /\identity value)))
diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux
index 2d81c09e7..85159e505 100644
--- a/stdlib/source/library/lux/abstract/monad.lux
+++ b/stdlib/source/library/lux/abstract/monad.lux
@@ -6,7 +6,7 @@
[//
[functor (#+ Functor)]])
-(def: (list\fold f init xs)
+(def: (list\mix f init xs)
(All [a b]
(-> (-> b a a) a (List b) a))
(case xs
@@ -14,7 +14,7 @@
init
(#.Item x xs')
- (list\fold f (f x init) xs')))
+ (list\mix f (f x init) xs')))
(def: (list\size xs)
(All [a] (-> (List a) Nat))
@@ -30,9 +30,9 @@
(def: (reversed xs)
(All [a]
(-> (List a) (List a)))
- (list\fold (function (_ head tail) (#.Item head tail))
- #.End
- xs))
+ (list\mix (function (_ head tail) (#.Item head tail))
+ #.End
+ xs))
(def: (pairs xs)
(All [a] (-> (List a) (List [a a])))
@@ -72,21 +72,21 @@
g!_ (identifier "_")
g!map (identifier "map")
g!join (identifier "join")
- body' (list\fold (: (-> [Code Code] Code Code)
- (function (_ binding body')
- (with_expansions [<default> (` (|> (~ value) ((~ g!map) (function ((~ g!_) (~ var)) (~ body'))) (~ g!join)))]
- (let [[var value] binding]
- (case var
- [_ (#.Identifier ["" _])]
- <default>
-
- [_ (#.Identifier _)]
- (` ((~ var) (~ value) (~ body')))
-
- _
- <default>)))))
- body
- (reversed (pairs bindings)))]
+ body' (list\mix (: (-> [Code Code] Code Code)
+ (function (_ binding body')
+ (with_expansions [<default> (` (|> (~ value) ((~ g!map) (function ((~ g!_) (~ var)) (~ body'))) (~ g!join)))]
+ (let [[var value] binding]
+ (case var
+ [_ (#.Identifier ["" _])]
+ <default>
+
+ [_ (#.Identifier _)]
+ (` ((~ var) (~ value) (~ body')))
+
+ _
+ <default>)))))
+ body
+ (reversed (pairs bindings)))]
(#.Right [state (list (case ?name
(#.Some name)
(let [name [location.dummy (#.Identifier ["" name])]]
@@ -164,7 +164,7 @@
(recur xs'))))
!\join)))))
-(def: .public (fold monad f init xs)
+(def: .public (mix monad f init xs)
(All [M a b]
(-> (Monad M) (-> b a (M a)) a (List b)
(M a)))
@@ -175,4 +175,4 @@
(#.Item x xs')
(do monad
[init' (f x init)]
- (fold monad f init' xs'))))
+ (mix monad f init' xs'))))
diff --git a/stdlib/source/library/lux/abstract/monad/free.lux b/stdlib/source/library/lux/abstract/monad/free.lux
index 67aa94755..82b405ccc 100644
--- a/stdlib/source/library/lux/abstract/monad/free.lux
+++ b/stdlib/source/library/lux/abstract/monad/free.lux
@@ -24,9 +24,10 @@
(implementation: .public (apply dsl)
(All [F] (-> (Functor F) (Apply (Free F))))
- (def: &functor (..functor dsl))
+ (def: &functor
+ (..functor dsl))
- (def: (apply ef ea)
+ (def: (on ea ef)
(case [ef ea]
[(#Pure f) (#Pure a)]
(#Pure (f a))
@@ -37,9 +38,7 @@
fa))
[(#Effect ff) _]
- (#Effect (\ dsl map
- (function (_ f) (apply f ea))
- ff))
+ (#Effect (\ dsl map (on ea) ff))
)))
(implementation: .public (monad dsl)
diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux
index b43ac87e8..f255f9727 100644
--- a/stdlib/source/library/lux/abstract/monad/indexed.lux
+++ b/stdlib/source/library/lux/abstract/monad/indexed.lux
@@ -6,7 +6,7 @@
["<.>" code (#+ Parser)]]]
[data
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
["." macro
[syntax (#+ syntax:)]
["." code]]]]
@@ -63,20 +63,20 @@
context (<code>.tuple (<>.some context))
expression <code>.any])
(macro.with_identifiers [g!_ g!then]
- (let [body (list\fold (function (_ context next)
- (case context
- (#Macro macro parameter)
- (` ((~ (code.identifier macro))
- (~ parameter)
- (~ next)))
-
- (#Binding [binding value])
- (` ((~ g!then)
- (.function ((~ g!_) (~ binding))
- (~ next))
- (~ value)))))
- expression
- (list.reversed context))]
+ (let [body (list\mix (function (_ context next)
+ (case context
+ (#Macro macro parameter)
+ (` ((~ (code.identifier macro))
+ (~ parameter)
+ (~ next)))
+
+ (#Binding [binding value])
+ (` ((~ g!then)
+ (.function ((~ g!_) (~ binding))
+ (~ next))
+ (~ value)))))
+ expression
+ (list.reversed context))]
(in (list (case ?name
(#.Some name)
(let [name (code.local_identifier name)]
diff --git a/stdlib/source/library/lux/abstract/monoid.lux b/stdlib/source/library/lux/abstract/monoid.lux
index fac4862ae..01dacde2e 100644
--- a/stdlib/source/library/lux/abstract/monoid.lux
+++ b/stdlib/source/library/lux/abstract/monoid.lux
@@ -1,6 +1,6 @@
(.module:
[library
- [lux #*]])
+ [lux (#- and)]])
(interface: .public (Monoid a)
(: a
@@ -8,7 +8,7 @@
(: (-> a a a)
compose))
-(def: .public (composite left right)
+(def: .public (and left right)
(All [l r] (-> (Monoid l) (Monoid r) (Monoid [l r])))
(implementation
(def: identity
diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux
index 93a99ceb2..de474236a 100644
--- a/stdlib/source/library/lux/control/concatenative.lux
+++ b/stdlib/source/library/lux/control/concatenative.lux
@@ -10,7 +10,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold functor)]]]
+ ["." list ("#\." mix functor)]]]
["." macro (#+ with_identifiers)
["." code]
["." template]
@@ -51,12 +51,12 @@
(<>.and (|> bottom^ (<>\map (|>> #.Some)))
(<>\in (list)))))
-(def: (stack_fold tops bottom)
+(def: (stack_mix tops bottom)
(-> (List Code) Code Code)
- (list\fold (function (_ top bottom)
- (` [(~ bottom) (~ top)]))
- bottom
- tops))
+ (list\mix (function (_ top bottom)
+ (` [(~ bottom) (~ top)]))
+ bottom
+ tops))
(def: (singleton expander)
(-> (Meta (List Code)) (Meta Code))
@@ -74,24 +74,24 @@
inputs stack^
outputs stack^])
(let [de_alias (function (_ aliased)
- (list\fold (function (_ [from to] pre)
- (code.replaced (code.local_identifier from) to pre))
- aliased
- aliases))]
+ (list\mix (function (_ [from to] pre)
+ (code.replaced (code.local_identifier from) to pre))
+ aliased
+ aliases))]
(case [(|> inputs (value@ #bottom) (maybe\map (|>> code.nat (~) #.Parameter (`))))
(|> outputs (value@ #bottom) (maybe\map (|>> code.nat (~) #.Parameter (`))))]
[(#.Some bottomI) (#.Some bottomO)]
(monad.do meta.monad
- [inputC (singleton (macro.full_expansion (stack_fold (value@ #top inputs) bottomI)))
- outputC (singleton (macro.full_expansion (stack_fold (value@ #top outputs) bottomO)))]
+ [inputC (singleton (macro.full_expansion (stack_mix (value@ #top inputs) bottomI)))
+ outputC (singleton (macro.full_expansion (stack_mix (value@ #top outputs) bottomO)))]
(in (list (` (-> (~ (de_alias inputC))
(~ (de_alias outputC)))))))
[?bottomI ?bottomO]
(with_identifiers [g!stack]
(monad.do meta.monad
- [inputC (singleton (macro.full_expansion (stack_fold (value@ #top inputs) (maybe.else g!stack ?bottomI))))
- outputC (singleton (macro.full_expansion (stack_fold (value@ #top outputs) (maybe.else g!stack ?bottomO))))]
+ [inputC (singleton (macro.full_expansion (stack_mix (value@ #top inputs) (maybe.else g!stack ?bottomI))))
+ outputC (singleton (macro.full_expansion (stack_mix (value@ #top outputs) (maybe.else g!stack ?bottomO))))]
(in (list (` (All [(~ g!stack)]
(-> (~ (de_alias inputC))
(~ (de_alias outputC))))))))))))
@@ -135,7 +135,7 @@
(-> (-> (~+ g!inputs) (~ g!output))
(=> [(~+ g!inputs)] [(~ g!output)])))
(function ((~ g!) (~ g!func))
- (function ((~ g!) (~ (stack_fold g!inputs g!stack)))
+ (function ((~ g!) (~ (stack_mix g!inputs g!stack)))
[(~ g!stack) ((~ g!func) (~+ g!inputs))])))))))))
(template [<arity>]
diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux
index 20ab00c06..0e248ff9b 100644
--- a/stdlib/source/library/lux/control/concurrency/actor.lux
+++ b/stdlib/source/library/lux/control/concurrency/actor.lux
@@ -18,7 +18,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." monoid monad fold)]]]
+ ["." list ("#\." monoid monad)]]]
["." macro (#+ with_identifiers)
["." code]
[syntax (#+ syntax:)
diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux
index 58fbb4ea6..bdd852ffc 100644
--- a/stdlib/source/library/lux/control/concurrency/async.lux
+++ b/stdlib/source/library/lux/control/concurrency/async.lux
@@ -104,7 +104,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(let [[fb resolve] (..async [])]
(exec
(io.run! (..upon! (function (_ f)
diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux
index cb3645138..1e447ef17 100644
--- a/stdlib/source/library/lux/control/concurrency/frp.lux
+++ b/stdlib/source/library/lux/control/concurrency/frp.lux
@@ -96,13 +96,13 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(do async.monad
[item_f ff
item_a fa]
(case [item_f item_a]
[(#.Some [head_f tail_f]) (#.Some [head_a tail_a])]
- (in (#.Some [(head_f head_a) (apply tail_f tail_a)]))
+ (in (#.Some [(head_f head_a) (on tail_a tail_f)]))
_
(in #.None)))))
@@ -189,7 +189,7 @@
(#.Some [value ..empty]))
async))
-(def: .public (aggregate f init channel)
+(def: .public (mix f init channel)
(All [a b]
(-> (-> b a (Async a)) a (Channel b)
(Async a)))
@@ -202,9 +202,9 @@
(#.Some [head tail])
(do !
[init' (f head init)]
- (aggregate f init' tail)))))
+ (mix f init' tail)))))
-(def: .public (aggregates f init channel)
+(def: .public (mixes f init channel)
(All [a b]
(-> (-> b a (Async a)) a (Channel b)
(Channel a)))
@@ -217,7 +217,7 @@
(#.Some [head tail])
(do !
[init' (f head init)]
- (in (#.Some [init (aggregates f init' tail)]))))))
+ (in (#.Some [init (mixes f init' tail)]))))))
(def: .public (poll milli_seconds action)
(All [a]
diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux
index a41d12aba..5e9759bdb 100644
--- a/stdlib/source/library/lux/control/concurrency/stm.lux
+++ b/stdlib/source/library/lux/control/concurrency/stm.lux
@@ -151,7 +151,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ tx)
(let [[tx' f] (ff tx)
[tx'' a] (fa tx')]
diff --git a/stdlib/source/library/lux/control/continuation.lux b/stdlib/source/library/lux/control/continuation.lux
index 9a65c9d3e..15fdc16d1 100644
--- a/stdlib/source/library/lux/control/continuation.lux
+++ b/stdlib/source/library/lux/control/continuation.lux
@@ -63,7 +63,7 @@
(def: &functor ..functor)
- (def: (apply ff fv)
+ (def: (on fv ff)
(function (_ k)
(|> (k (f v))
(function (_ v)) fv
diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux
index d957188ea..c59767584 100644
--- a/stdlib/source/library/lux/control/exception.lux
+++ b/stdlib/source/library/lux/control/exception.lux
@@ -13,7 +13,7 @@
["." product]
["." text ("#\." monoid)]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
["." code]
[syntax (#+ syntax:)
@@ -108,10 +108,10 @@
(def: (report' entries)
(-> (List [Text Text]) Text)
(let [header_separator ": "
- largest_header_size (list\fold (function (_ [header _] max)
- (n.max (text.size header) max))
- 0
- entries)
+ largest_header_size (list\mix (function (_ [header _] max)
+ (n.max (text.size header) max))
+ 0
+ entries)
on_new_line (|> " "
(list.repeated (n.+ (text.size header_separator)
largest_header_size))
@@ -131,10 +131,10 @@
""
(#.Item head tail)
- (list\fold (function (_ post pre)
- ($_ text\compose pre text.new_line (on_entry post)))
- (on_entry head)
- tail))))
+ (list\mix (function (_ post pre)
+ ($_ text\compose pre text.new_line (on_entry post)))
+ (on_entry head)
+ tail))))
(syntax: .public (report [entries (<>.many (<code>.tuple (<>.and <code>.any <code>.any)))])
(in (list (` ((~! report') (list (~+ (|> entries
@@ -145,11 +145,11 @@
(All [a]
(-> (-> a Text) (List a) Text))
(|> entries
- (list\fold (function (_ entry [index next])
- [(++ index)
- (#.Item [(n\encode index) (format entry)]
- next)])
- [0 #.End])
+ (list\mix (function (_ entry [index next])
+ [(++ index)
+ (#.Item [(n\encoded index) (format entry)]
+ next)])
+ [0 #.End])
product.right
list.reversed
..report'))
diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux
index 125ebfb67..4666dfb8a 100644
--- a/stdlib/source/library/lux/control/io.lux
+++ b/stdlib/source/library/lux/control/io.lux
@@ -52,7 +52,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(!io ((run!' ff) (run!' fa)))))
(implementation: .public monad
diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux
index 46901a3c1..58cf7a526 100644
--- a/stdlib/source/library/lux/control/lazy.lux
+++ b/stdlib/source/library/lux/control/lazy.lux
@@ -61,7 +61,7 @@
(Apply Lazy)
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(lazy ((value ff) (value fa)))))
(implementation: .public monad
diff --git a/stdlib/source/library/lux/control/maybe.lux b/stdlib/source/library/lux/control/maybe.lux
index 7dcf84574..854ef0402 100644
--- a/stdlib/source/library/lux/control/maybe.lux
+++ b/stdlib/source/library/lux/control/maybe.lux
@@ -41,7 +41,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(case [ff fa]
[(#.Some f) (#.Some a)]
(#.Some (f a))
diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux
index 6d3246295..30c728cd2 100644
--- a/stdlib/source/library/lux/control/parser.lux
+++ b/stdlib/source/library/lux/control/parser.lux
@@ -36,7 +36,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ input)
(case (ff input)
(#try.Success [input' f])
@@ -301,7 +301,7 @@
(#try.Failure error)
(#try.Success [input' to_decode])
- (case (\ codec decode to_decode)
+ (case (\ codec decoded to_decode)
(#try.Failure error)
(#try.Failure error)
diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux
index ec251b304..4fd9d15f5 100644
--- a/stdlib/source/library/lux/control/parser/binary.lux
+++ b/stdlib/source/library/lux/control/parser/binary.lux
@@ -173,7 +173,7 @@
(Parser Text)
(do //.monad
[utf8 <binary>]
- (//.lifted (\ utf8.codec decode utf8)))))]
+ (//.lifted (\ utf8.codec decoded utf8)))))]
[08 utf8/8 ..binary/8]
[16 utf8/16 ..binary/16]
diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux
index cc954fc1b..1348b92b4 100644
--- a/stdlib/source/library/lux/control/parser/json.lux
+++ b/stdlib/source/library/lux/control/parser/json.lux
@@ -82,9 +82,8 @@
["Reference" (/.format reference)]
["Sample" (/.format sample)]))
-(template [<test> <check> <type> <equivalence> <tag> <desc>]
+(template [<test> <check> <type> <equivalence> <tag>]
[(def: .public (<test> test)
- {#.doc (code.text ($_ text\compose "Asks whether a JSON value is a " <desc> "."))}
(-> <type> (Parser Bit))
(do //.monad
[head ..any]
@@ -96,7 +95,6 @@
(//.failure (exception.error ..unexpected_value [head])))))
(def: .public (<check> test)
- {#.doc (code.text ($_ text\compose "Ensures a JSON value is a " <desc> "."))}
(-> <type> (Parser Any))
(do //.monad
[head ..any]
@@ -109,9 +107,9 @@
_
(//.failure (exception.error ..unexpected_value [head])))))]
- [boolean? boolean! /.Boolean bit.equivalence #/.Boolean "boolean"]
- [number? number! /.Number frac.equivalence #/.Number "number"]
- [string? string! /.String text.equivalence #/.String "string"]
+ [boolean? boolean! /.Boolean bit.equivalence #/.Boolean]
+ [number? number! /.Number frac.equivalence #/.Number]
+ [string? string! /.String text.equivalence #/.String]
)
(def: .public (nullable parser)
diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux
index b336a0d58..df28b3df1 100644
--- a/stdlib/source/library/lux/control/parser/synthesis.lux
+++ b/stdlib/source/library/lux/control/parser/synthesis.lux
@@ -11,8 +11,6 @@
["." name]
["." text
["%" format (#+ format)]]]
- [macro
- ["." template]]
[math
[number
["n" nat]
@@ -89,7 +87,6 @@
(template [<query> <assertion> <tag> <type> <eq>]
[(`` (def: .public <query>
- {#.doc (example (~~ (template.text ["Queries for a " <query> " synthesis node."])))}
(Parser <type>)
(.function (_ input)
(case input
@@ -100,7 +97,6 @@
(exception.except ..cannot_parse input)))))
(`` (def: .public (<assertion> expected)
- {#.doc (example (~~ (template.text ["Checks for a specific " <query> " synthesis node."])))}
(-> <type> (Parser Any))
(.function (_ input)
(case input
diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux
index a9f69d81e..0e9724a15 100644
--- a/stdlib/source/library/lux/control/parser/text.lux
+++ b/stdlib/source/library/lux/control/parser/text.lux
@@ -11,7 +11,7 @@
["/" text (#+ Char) ("#\." monoid)]
["." product]
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[macro
["." code]
["." template]]
@@ -40,13 +40,13 @@
(exception: .public (unconsumed_input {offset Offset} {tape Text})
(exception.report
- ["Offset" (n\encode offset)]
- ["Input size" (n\encode (/.size tape))]
+ ["Offset" (n\encoded offset)]
+ ["Input size" (n\encoded (/.size tape))]
["Remaining input" (remaining' offset tape)]))
(exception: .public (expected_to_fail {offset Offset} {tape Text})
(exception.report
- ["Offset" (n\encode offset)]
+ ["Offset" (n\encoded offset)]
["Input" (remaining' offset tape)]))
(exception: .public cannot_parse)
@@ -73,12 +73,12 @@
(do //.monad
[offset ..offset
slices parser]
- (in (list\fold (function (_ [slice::basis slice::distance]
- [total::basis total::distance])
- [total::basis ("lux i64 +" slice::distance total::distance)])
- {#basis offset
- #distance 0}
- slices))))
+ (in (list\mix (function (_ [slice::basis slice::distance]
+ [total::basis total::distance])
+ [total::basis ("lux i64 +" slice::distance total::distance)])
+ {#basis offset
+ #distance 0}
+ slices))))
(def: .public any
(Parser Text)
@@ -202,9 +202,8 @@
[character_should_not_be]
)
-(template [<name> <modifier> <exception> <description_modifier>]
+(template [<name> <modifier> <exception>]
[(def: .public (<name> options)
- {#.doc (code.text ($_ /\compose "Yields characters that are" <description_modifier> " part of a piece of text."))}
(-> Text (Parser Text))
(function (_ [offset tape])
(case (/.char offset tape)
@@ -217,13 +216,12 @@
_
(exception.except ..cannot_parse []))))]
- [one_of |> ..character_should_be ""]
- [none_of .not ..character_should_not_be " not"]
+ [one_of |> ..character_should_be]
+ [none_of .not ..character_should_not_be]
)
-(template [<name> <modifier> <exception> <description_modifier>]
+(template [<name> <modifier> <exception>]
[(def: .public (<name> options)
- {#.doc (code.text ($_ /\compose "Yields characters (as a slice) that are" <description_modifier> " part of a piece of text."))}
(-> Text (Parser Slice))
(function (_ [offset tape])
(case (/.char offset tape)
@@ -238,8 +236,8 @@
_
(exception.except ..cannot_slice []))))]
- [one_of! |> ..character_should_be ""]
- [none_of! .not ..character_should_not_be " not"]
+ [one_of! |> ..character_should_be]
+ [none_of! .not ..character_should_not_be]
)
(exception: .public (character_does_not_satisfy_predicate {character Char})
diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux
index 1f7a54a1a..0208134a3 100644
--- a/stdlib/source/library/lux/control/parser/tree.lux
+++ b/stdlib/source/library/lux/control/parser/tree.lux
@@ -32,9 +32,8 @@
(exception: .public cannot_move_further)
-(template [<name> <direction> <doc>]
+(template [<name> <direction>]
[(def: .public <name>
- {#.doc (example <doc>)}
(All [t] (Parser t []))
(function (_ zipper)
(case (<direction> zipper)
@@ -44,28 +43,18 @@
(#.Some next)
(#try.Success [next []]))))]
- [down zipper.down
- "Move down."]
- [up zipper.up
- "Move up."]
+ [down zipper.down]
+ [up zipper.up]
- [right zipper.right
- "Move to the right."]
- [rightmost zipper.rightmost
- "Move to the rightmost node."]
+ [right zipper.right]
+ [rightmost zipper.rightmost]
- [left zipper.left
- "Move to the left."]
- [leftmost zipper.leftmost
- "Move to the leftmost node."]
+ [left zipper.left]
+ [leftmost zipper.leftmost]
- [next zipper.next
- "Move to the next node."]
- [end zipper.end
- "Move to the last node."]
+ [next zipper.next]
+ [end zipper.end]
- [previous zipper.previous
- "Move to the previous node."]
- [start zipper.start
- "Move to the root node."]
+ [previous zipper.previous]
+ [start zipper.start]
)
diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux
index 029d130fd..0b726282a 100644
--- a/stdlib/source/library/lux/control/parser/type.lux
+++ b/stdlib/source/library/lux/control/parser/type.lux
@@ -14,8 +14,7 @@
["." list ("#\." functor)]
["." dictionary (#+ Dictionary)]]]
[macro
- ["." code]
- ["." template]]
+ ["." code]]
[math
[number
["n" nat ("#\." decimal)]]]
@@ -133,7 +132,7 @@
(def: (label idx)
(-> Nat Code)
- (code.local_identifier ($_ text\compose "label" text.tab (n\encode idx))))
+ (code.local_identifier ($_ text\compose "label" text.tab (n\encoded idx))))
(def: .public (with_extension type poly)
(All [a] (-> Type (Parser a) (Parser [Code a])))
@@ -151,7 +150,6 @@
(template [<name> <flattener> <tag> <exception>]
[(`` (def: .public (<name> poly)
- {#.doc (example (~~ (template.text ["Parses the contents of a " <name> " type."])))}
(All [a] (-> (Parser a) (Parser a)))
(do //.monad
[headT ..any]
diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux
index 2b0332544..2e982ad45 100644
--- a/stdlib/source/library/lux/control/parser/xml.lux
+++ b/stdlib/source/library/lux/control/parser/xml.lux
@@ -35,7 +35,7 @@
(exception: .public (unconsumed_inputs {inputs (List XML)})
(exception.report
- ["Inputs" (exception.listing (\ /.codec encode) inputs)]))
+ ["Inputs" (exception.listing (\ /.codec encoded) inputs)]))
(def: (result' parser attrs documents)
(All [a] (-> (Parser a) Attrs (List XML) (Try a)))
diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux
index b194d6749..8fda36325 100644
--- a/stdlib/source/library/lux/control/pipe.lux
+++ b/stdlib/source/library/lux/control/pipe.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Composable extensions to the piping macros (|> and <|) that enhance them with various abilities."}
[library
[lux #*
[abstract
@@ -11,7 +10,7 @@
[data
["." identity]
[collection
- ["." list ("#\." fold monad)]]]
+ ["." list ("#\." monad)]]]
[macro (#+ with_identifiers)
[syntax (#+ syntax:)]
["." code]]
diff --git a/stdlib/source/library/lux/control/reader.lux b/stdlib/source/library/lux/control/reader.lux
index e1ffffd7b..7d6462858 100644
--- a/stdlib/source/library/lux/control/reader.lux
+++ b/stdlib/source/library/lux/control/reader.lux
@@ -33,7 +33,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ env)
((ff env) (fa env)))))
diff --git a/stdlib/source/library/lux/control/region.lux b/stdlib/source/library/lux/control/region.lux
index 9d9f579c0..1ca544ca6 100644
--- a/stdlib/source/library/lux/control/region.lux
+++ b/stdlib/source/library/lux/control/region.lux
@@ -11,7 +11,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold)]]]]]
+ ["." list ("#\." mix)]]]]]
[//
["." exception (#+ Exception exception:)]])
@@ -59,7 +59,7 @@
[[cleaners output] (computation [[] (list)])]
(|> cleaners
(monad.map ! (function (_ cleaner) (cleaner [])))
- (\ ! map (list\fold clean output)))))
+ (\ ! map (list\mix clean output)))))
(def: .public (acquire! monad cleaner value)
(All [! a] (-> (Monad !) (-> a (! (Try Any))) a
@@ -95,7 +95,7 @@
(def: &functor
(..functor (value@ #monad.&functor super)))
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ [region cleaners])
(do super
[[cleaners ef] (ff [region cleaners])
diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux
index 9c6e7a97e..eaba75049 100644
--- a/stdlib/source/library/lux/control/remember.lux
+++ b/stdlib/source/library/lux/control/remember.lux
@@ -40,7 +40,7 @@
<c>.int)
(do <>.monad
[raw <c>.text]
- (case (\ date.codec decode raw)
+ (case (\ date.codec decoded raw)
(#try.Success date)
(in date)
@@ -65,13 +65,6 @@
[(`` (syntax: .public (<name> [deadline ..deadline
message <c>.text
focus (<>.maybe <c>.any)])
- {#.doc (example (~~ (template.text ["A " <message> " message with an expiration date."]))
- "Can have an optional piece of code to focus on."
- (<name> "2022-04-01"
- "Do this, that and the other.")
- (<name> "2022-04-01"
- "Improve the performace."
- (some (complicated (computation 123)))))}
(in (list (` (..remember (~ (code.text (%.date deadline)))
(~ (code.text (format <message> " " message)))
(~+ (case focus
diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux
index 9e33fa86b..497e250ff 100644
--- a/stdlib/source/library/lux/control/security/policy.lux
+++ b/stdlib/source/library/lux/control/security/policy.lux
@@ -66,7 +66,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(:abstraction ((:representation ff) (:representation fa)))))
(implementation: .public monad
diff --git a/stdlib/source/library/lux/control/state.lux b/stdlib/source/library/lux/control/state.lux
index 109491fee..586cb652c 100644
--- a/stdlib/source/library/lux/control/state.lux
+++ b/stdlib/source/library/lux/control/state.lux
@@ -52,7 +52,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ state)
(let [[state' f] (ff state)
[state'' a] (fa state')]
@@ -101,7 +101,7 @@
(def: &functor (with//functor (\ monad &functor)))
- (def: (apply sFf sFa)
+ (def: (on sFa sFf)
(function (_ state)
(do monad
[[state f] (sFf state)
diff --git a/stdlib/source/library/lux/control/thread.lux b/stdlib/source/library/lux/control/thread.lux
index b70813ec9..8366b2efc 100644
--- a/stdlib/source/library/lux/control/thread.lux
+++ b/stdlib/source/library/lux/control/thread.lux
@@ -81,7 +81,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ !)
((ff !) (fa !)))))
diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux
index 05d7d69ea..2a1fce570 100644
--- a/stdlib/source/library/lux/control/try.lux
+++ b/stdlib/source/library/lux/control/try.lux
@@ -29,7 +29,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(case ff
(#Success f)
(case fa
@@ -123,7 +123,7 @@
(#Success value)
#.None
- (#Failure (`` (("lux in-module" (~~ (static .prelude_module)) .name\encode)
+ (#Failure (`` (("lux in-module" (~~ (static .prelude_module)) .name\encoded)
(name_of ..of_maybe))))))
(macro: .public (else tokens compiler)
diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux
index 194822f60..d42e57780 100644
--- a/stdlib/source/library/lux/control/writer.lux
+++ b/stdlib/source/library/lux/control/writer.lux
@@ -3,7 +3,7 @@
[lux #*
["@" target]
[abstract
- monoid
+ [monoid (#+ Monoid)]
[apply (#+ Apply)]
["." functor (#+ Functor)]
["." monad (#+ Monad do)]]]])
@@ -30,7 +30,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(let [[log1 f] ff
[log2 a] fa]
[(\ monoid compose log1 log2) (f a)])))
diff --git a/stdlib/source/library/lux/data/bit.lux b/stdlib/source/library/lux/data/bit.lux
index 6d7b7c9c3..38f7b5f8d 100644
--- a/stdlib/source/library/lux/data/bit.lux
+++ b/stdlib/source/library/lux/data/bit.lux
@@ -49,12 +49,12 @@
(implementation: .public codec
(Codec Text Bit)
- (def: (encode x)
+ (def: (encoded x)
(if x
"#1"
"#0"))
- (def: (decode input)
+ (def: (decoded input)
(case input
"#1" (#.Right #1)
"#0" (#.Right #0)
diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux
index c7fe53e3f..4ec5d1612 100644
--- a/stdlib/source/library/lux/data/collection/array.lux
+++ b/stdlib/source/library/lux/data/collection/array.lux
@@ -6,14 +6,14 @@
[monoid (#+ Monoid)]
[functor (#+ Functor)]
[equivalence (#+ Equivalence)]
- [fold (#+ Fold)]
+ [mix (#+ Mix)]
[predicate (#+ Predicate)]]
[control
["." maybe]]
[data
["." product]
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
[number
["n" nat]]]]])
@@ -178,27 +178,27 @@
(Array a)))
(if (n.= 0 length)
dest_array
- (list\fold (function (_ offset target)
- (case (read! (n.+ offset src_start) src_array)
- #.None
- target
-
- (#.Some value)
- (write! (n.+ offset dest_start) value target)))
- dest_array
- (list.indices length))))
+ (list\mix (function (_ offset target)
+ (case (read! (n.+ offset src_start) src_array)
+ #.None
+ target
+
+ (#.Some value)
+ (write! (n.+ offset dest_start) value target)))
+ dest_array
+ (list.indices length))))
(def: .public (occupancy array)
(All [a] (-> (Array a) Nat))
- (list\fold (function (_ idx count)
- (case (read! idx array)
- #.None
- count
-
- (#.Some _)
- (++ count)))
- 0
- (list.indices (size array))))
+ (list\mix (function (_ idx count)
+ (case (read! idx array)
+ #.None
+ count
+
+ (#.Some _)
+ (++ count)))
+ 0
+ (list.indices (size array))))
(def: .public (vacancy array)
(All [a] (-> (Array a) Nat))
@@ -207,17 +207,17 @@
(def: .public (filter! p xs)
(All [a]
(-> (Predicate a) (Array a) (Array a)))
- (list\fold (function (_ idx xs')
- (case (read! idx xs)
- #.None
- xs'
-
- (#.Some x)
- (if (p x)
- xs'
- (delete! idx xs'))))
- xs
- (list.indices (size xs))))
+ (list\mix (function (_ idx xs')
+ (case (read! idx xs)
+ #.None
+ xs'
+
+ (#.Some x)
+ (if (p x)
+ xs'
+ (delete! idx xs'))))
+ xs
+ (list.indices (size xs))))
(def: .public (example p xs)
(All [a]
@@ -254,22 +254,22 @@
(def: .public (clone xs)
(All [a] (-> (Array a) (Array a)))
(let [arr_size (size xs)]
- (list\fold (function (_ idx ys)
- (case (read! idx xs)
- #.None
- ys
+ (list\mix (function (_ idx ys)
+ (case (read! idx xs)
+ #.None
+ ys
- (#.Some x)
- (write! idx x ys)))
- (empty arr_size)
- (list.indices arr_size))))
+ (#.Some x)
+ (write! idx x ys)))
+ (empty arr_size)
+ (list.indices arr_size))))
(def: .public (of_list xs)
(All [a] (-> (List a) (Array a)))
- (product.right (list\fold (function (_ x [idx arr])
- [(++ idx) (write! idx x arr)])
- [0 (empty (list.size xs))]
- xs)))
+ (product.right (list\mix (function (_ x [idx arr])
+ [(++ idx) (write! idx x arr)])
+ [0 (empty (list.size xs))]
+ xs)))
(def: underflow
Nat
@@ -312,19 +312,19 @@
(let [sxs (size xs)
sxy (size ys)]
(and (n.= sxy sxs)
- (list\fold (function (_ idx prev)
- (and prev
- (case [(read! idx xs) (read! idx ys)]
- [#.None #.None]
- true
+ (list\mix (function (_ idx prev)
+ (and prev
+ (case [(read! idx xs) (read! idx ys)]
+ [#.None #.None]
+ true
- [(#.Some x) (#.Some y)]
- (,\= x y)
+ [(#.Some x) (#.Some y)]
+ (,\= x y)
- _
- false)))
- true
- (list.indices sxs))))))
+ _
+ false)))
+ true
+ (list.indices sxs))))))
(implementation: .public monoid
(All [a] (Monoid (Array a)))
@@ -345,21 +345,21 @@
(let [arr_size (size ma)]
(if (n.= 0 arr_size)
(empty arr_size)
- (list\fold (function (_ idx mb)
- (case (read! idx ma)
- #.None
- mb
-
- (#.Some x)
- (write! idx (f x) mb)))
- (empty arr_size)
- (list.indices arr_size))
+ (list\mix (function (_ idx mb)
+ (case (read! idx ma)
+ #.None
+ mb
+
+ (#.Some x)
+ (write! idx (f x) mb)))
+ (empty arr_size)
+ (list.indices arr_size))
))))
-(implementation: .public fold
- (Fold Array)
+(implementation: .public mix
+ (Mix Array)
- (def: (fold f init xs)
+ (def: (mix f init xs)
(let [arr_size (size xs)]
(loop [so_far init
idx 0]
diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux
index 6c375247c..34e45b10f 100644
--- a/stdlib/source/library/lux/data/collection/bits.lux
+++ b/stdlib/source/library/lux/data/collection/bits.lux
@@ -8,7 +8,7 @@
["." maybe]]
[data
[collection
- ["." array (#+ Array) ("#\." fold)]]]
+ ["." array (#+ Array) ("#\." mix)]]]
[math
[number
["n" nat]
@@ -33,10 +33,10 @@
(def: .public (size bits)
(-> Bits Nat)
- (array\fold (function (_ chunk total)
- (|> chunk i64.ones (n.+ total)))
- 0
- bits))
+ (array\mix (function (_ chunk total)
+ (|> chunk i64.ones (n.+ total)))
+ 0
+ bits))
(def: .public (capacity bits)
(-> Bits Nat)
diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux
index faab0f7b2..afc1cd356 100644
--- a/stdlib/source/library/lux/data/collection/dictionary.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary.lux
@@ -12,8 +12,8 @@
[data
["." product]
[collection
- ["." list ("#\." fold functor monoid)]
- ["." array (#+ Array) ("#\." functor fold)]]]
+ ["." list ("#\." mix functor monoid)]
+ ["." array (#+ Array) ("#\." functor mix)]]]
[math
["." number
["n" nat]
@@ -234,19 +234,19 @@
... nodes to save space.
(def: (demotion except_idx [h_size h_array])
(All [k v] (-> Index (Hierarchy k v) [Bit_Map (Base k v)]))
- (product.right (list\fold (function (_ idx [insertion_idx node])
- (let [[bitmap base] node]
- (case (array.read! idx h_array)
- #.None [insertion_idx node]
- (#.Some sub_node) (if (n.= except_idx idx)
- [insertion_idx node]
- [(++ insertion_idx)
- [(with_bit_position (to_bit_position idx) bitmap)
- (array.write! insertion_idx (#.Left sub_node) base)]])
- )))
- [0 [clean_bitmap
- (array.empty (-- h_size))]]
- (list.indices (array.size h_array)))))
+ (product.right (list\mix (function (_ idx [insertion_idx node])
+ (let [[bitmap base] node]
+ (case (array.read! idx h_array)
+ #.None [insertion_idx node]
+ (#.Some sub_node) (if (n.= except_idx idx)
+ [insertion_idx node]
+ [(++ insertion_idx)
+ [(with_bit_position (to_bit_position idx) bitmap)
+ (array.write! insertion_idx (#.Left sub_node) base)]])
+ )))
+ [0 [clean_bitmap
+ (array.empty (-- h_size))]]
+ (list.indices (array.size h_array)))))
... When #Base nodes grow too large, they're promoted to #Hierarchy to
... add some depth to the tree and help keep its balance.
@@ -260,25 +260,25 @@
(Hash k) Level
Bit_Map (Base k v)
(Array (Node k v))))
- (product.right (list\fold (function (_ hierarchy_idx (^@ default [base_idx h_array]))
- (if (with_bit_position? (to_bit_position hierarchy_idx)
- bitmap)
- [(++ base_idx)
- (case (array.read! base_idx base)
- (#.Some (#.Left sub_node))
- (array.write! hierarchy_idx sub_node h_array)
-
- (#.Some (#.Right [key' val']))
- (array.write! hierarchy_idx
- (node\has (level_up level) (\ key_hash hash key') key' val' key_hash empty_node)
- h_array)
-
- #.None
- (undefined))]
- default))
- [0
- (array.empty hierarchy_nodes_size)]
- hierarchy_indices)))
+ (product.right (list\mix (function (_ hierarchy_idx (^@ default [base_idx h_array]))
+ (if (with_bit_position? (to_bit_position hierarchy_idx)
+ bitmap)
+ [(++ base_idx)
+ (case (array.read! base_idx base)
+ (#.Some (#.Left sub_node))
+ (array.write! hierarchy_idx sub_node h_array)
+
+ (#.Some (#.Right [key' val']))
+ (array.write! hierarchy_idx
+ (node\has (level_up level) (\ key_hash hash key') key' val' key_hash empty_node)
+ h_array)
+
+ #.None
+ (undefined))]
+ default))
+ [0
+ (array.empty hierarchy_nodes_size)]
+ hierarchy_indices)))
... All empty nodes look the same (a #Base node with clean bitmap is
... used).
@@ -518,14 +518,14 @@
(All [k v] (-> (Node k v) Nat))
(case node
(#Hierarchy _size hierarchy)
- (array\fold n.+ 0 (array\map size' hierarchy))
+ (array\mix n.+ 0 (array\map size' hierarchy))
(#Base _ base)
- (array\fold n.+ 0 (array\map (function (_ sub_node')
- (case sub_node'
- (#.Left sub_node) (size' sub_node)
- (#.Right _) 1))
- base))
+ (array\mix n.+ 0 (array\map (function (_ sub_node')
+ (case sub_node'
+ (#.Left sub_node) (size' sub_node)
+ (#.Right _) 1))
+ base))
(#Collisions hash colls)
(array.size colls)
@@ -535,25 +535,25 @@
(All [k v] (-> (Node k v) (List [k v])))
(case node
(#Hierarchy _size hierarchy)
- (array\fold (function (_ sub_node tail) (list\compose (entries' sub_node) tail))
- #.End
- hierarchy)
+ (array\mix (function (_ sub_node tail) (list\compose (entries' sub_node) tail))
+ #.End
+ hierarchy)
(#Base bitmap base)
- (array\fold (function (_ branch tail)
- (case branch
- (#.Left sub_node)
- (list\compose (entries' sub_node) tail)
-
- (#.Right [key' val'])
- (#.Item [key' val'] tail)))
- #.End
- base)
+ (array\mix (function (_ branch tail)
+ (case branch
+ (#.Left sub_node)
+ (list\compose (entries' sub_node) tail)
+
+ (#.Right [key' val'])
+ (#.Item [key' val'] tail)))
+ #.End
+ base)
(#Collisions hash colls)
- (array\fold (function (_ [key' val'] tail) (#.Item [key' val'] tail))
- #.End
- colls)))
+ (array\mix (function (_ [key' val'] tail) (#.Item [key' val'] tail))
+ #.End
+ colls)))
(type: .public (Dictionary k v)
{#hash (Hash k)
@@ -627,18 +627,18 @@
(def: .public (of_list key_hash kvs)
(All [k v] (-> (Hash k) (List [k v]) (Dictionary k v)))
- (list\fold (function (_ [k v] dict)
- (..has k v dict))
- (empty key_hash)
- kvs))
+ (list\mix (function (_ [k v] dict)
+ (..has k v dict))
+ (empty key_hash)
+ kvs))
(template [<side> <name>]
[(def: .public <name>
(All [k v] (-> (Dictionary k v) (List <side>)))
(|>> ..entries
- (list\fold (function (_ [k v] bundle)
- (#.Item <side> bundle))
- #.End)))]
+ (list\mix (function (_ [k v] bundle)
+ (#.Item <side> bundle))
+ #.End)))]
[k keys]
[v values]
@@ -646,21 +646,21 @@
(def: .public (merged dict2 dict1)
(All [k v] (-> (Dictionary k v) (Dictionary k v) (Dictionary k v)))
- (list\fold (function (_ [key val] dict) (has key val dict))
- dict1
- (entries dict2)))
+ (list\mix (function (_ [key val] dict) (has key val dict))
+ dict1
+ (entries dict2)))
(def: .public (merged_with f dict2 dict1)
(All [k v] (-> (-> v v v) (Dictionary k v) (Dictionary k v) (Dictionary k v)))
- (list\fold (function (_ [key val2] dict)
- (case (value key dict)
- #.None
- (has key val2 dict)
+ (list\mix (function (_ [key val2] dict)
+ (case (value key dict)
+ #.None
+ (has key val2 dict)
- (#.Some val1)
- (has key (f val2 val1) dict)))
- dict1
- (entries dict2)))
+ (#.Some val1)
+ (has key (f val2 val1) dict)))
+ dict1
+ (entries dict2)))
(def: .public (re_bound from_key to_key dict)
(All [k v] (-> k k (Dictionary k v) (Dictionary k v)))
@@ -676,12 +676,12 @@
(def: .public (sub keys dict)
(All [k v] (-> (List k) (Dictionary k v) (Dictionary k v)))
(let [[key_hash _] dict]
- (list\fold (function (_ key new_dict)
- (case (value key dict)
- #.None new_dict
- (#.Some val) (has key val new_dict)))
- (empty key_hash)
- keys)))
+ (list\mix (function (_ key new_dict)
+ (case (value key dict)
+ #.None new_dict
+ (#.Some val) (has key val new_dict)))
+ (empty key_hash)
+ keys)))
(implementation: .public (equivalence (^open ",\."))
(All [k v] (-> (Equivalence v) (Equivalence (Dictionary k v))))
diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
index f19843db9..49d4068d5 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
@@ -10,10 +10,7 @@
[data
["p" product]
[collection
- ["." list ("#\." monoid fold)]]]
- [macro
- ["." code]
- ["." template]]
+ ["." list ("#\." monoid mix)]]]
[math
[number
["n" nat]]]]])
@@ -101,7 +98,6 @@
(template [<name> <side>]
[(def: .public (<name> dict)
- {#.doc (example (~~ (template.text ["Yields value under the " <name> "imum key."])))}
(All [k v] (-> (Dictionary k v) (Maybe v)))
(case (value@ #root dict)
#.None
@@ -537,10 +533,10 @@
(def: .public (of_list order list)
(All [k v] (-> (Order k) (List [k v]) (Dictionary k v)))
- (list\fold (function (_ [key value] dict)
- (has key value dict))
- (empty order)
- list))
+ (list\mix (function (_ [key value] dict)
+ (has key value dict))
+ (empty order)
+ list))
(template [<name> <type> <output>]
[(def: .public (<name> dict)
diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux
index a4bb340e7..98a3224e4 100644
--- a/stdlib/source/library/lux/data/collection/list.lux
+++ b/stdlib/source/library/lux/data/collection/list.lux
@@ -7,7 +7,7 @@
[apply (#+ Apply)]
[equivalence (#+ Equivalence)]
[hash (#+ Hash)]
- [fold (#+ Fold)]
+ [mix (#+ Mix)]
[predicate (#+ Predicate)]
["." functor (#+ Functor)]
["." monad (#+ do Monad)]
@@ -23,32 +23,32 @@
... #End
... (#Item a (List a)))
-(implementation: .public fold
- (Fold List)
+(implementation: .public mix
+ (Mix List)
- (def: (fold f init xs)
+ (def: (mix f init xs)
(case xs
#.End
init
(#.Item x xs')
- (fold f (f x init) xs'))))
+ (mix f (f x init) xs'))))
-(def: .public (aggregates f init inputs)
+(def: .public (mixes f init inputs)
(All [a b] (-> (-> a b b) b (List a) (List b)))
(case inputs
#.End
(list init)
(#.Item [head tail])
- (#.Item [init (aggregates f (f head init) tail)])))
+ (#.Item [init (mixes f (f head init) tail)])))
(def: .public (reversed xs)
(All [a]
(-> (List a) (List a)))
- (fold (function (_ head tail) (#.Item head tail))
- #.End
- xs))
+ (mix (function (_ head tail) (#.Item head tail))
+ #.End
+ xs))
(def: .public (only keep? xs)
(All [a]
@@ -205,15 +205,15 @@
(-> (-> a (Maybe b)) (List a) (List b)))
(for {... TODO: Stop relying on this ASAP.
@.js
- (fold (function (_ head tail)
- (case (check head)
- (#.Some head)
- (#.Item head tail)
-
- #.None
- tail))
- #.End
- (reversed xs))}
+ (mix (function (_ head tail)
+ (case (check head)
+ (#.Some head)
+ (#.Item head tail)
+
+ #.None
+ tail))
+ #.End
+ (reversed xs))}
(case xs
#.End
#.End
@@ -250,7 +250,7 @@
(def: .public (size list)
(All [a] (-> (List a) Nat))
- (fold (function (_ _ acc) (n.+ 1 acc)) 0 list))
+ (mix (function (_ _ acc) (n.+ 1 acc)) 0 list))
(template [<name> <init> <op>]
[(def: .public (<name> predicate items)
@@ -303,7 +303,7 @@
(..equivalence (\ super &equivalence)))
(def: hash
- (\ ..fold fold
+ (\ ..mix mix
(function (_ member hash)
(n.+ (\ super hash member) hash))
0)))
@@ -340,13 +340,15 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(case ff
#.End
#.End
(#.Item f ff')
- (compose (map f fa) (apply ff' fa)))))
+ (|> ff'
+ (on fa)
+ (compose (map f fa))))))
(implementation: .public monad
(Monad List)
@@ -357,7 +359,7 @@
(#.Item a #.End))
(def: join
- (|>> reversed (fold compose identity))))
+ (|>> reversed (mix compose identity))))
(def: .public (sorted < xs)
(All [a] (-> (-> a a Bit) (List a) (List a)))
@@ -366,12 +368,12 @@
(list)
(#.Item x xs')
- (let [[pre post] (fold (function (_ x' [pre post])
- (if (< x x')
- [(#.Item x' pre) post]
- [pre (#.Item x' post)]))
- [(list) (list)]
- xs')]
+ (let [[pre post] (mix (function (_ x' [pre post])
+ (if (< x x')
+ [(#.Item x' pre) post]
+ [pre (#.Item x' post)]))
+ [(list) (list)]
+ xs')]
($_ compose (sorted < pre) (list x) (sorted < post)))))
(def: .public (empty? xs)
@@ -393,9 +395,8 @@
(or (\ eq = x x')
(member? eq xs' x))))
-(template [<name> <output> <side> <doc>]
+(template [<name> <output> <side>]
[(def: .public (<name> xs)
- {#.doc <doc>}
(All [a] (-> (List a) (Maybe <output>)))
(case xs
#.End
@@ -404,8 +405,8 @@
(#.Item x xs')
(#.Some <side>)))]
- [head a x "Yields the first element of a list."]
- [tail (List a) xs' "For a list of size N, yields the N-1 elements after the first one."]
+ [head a x]
+ [tail (List a) xs']
)
(def: .public (indices size)
@@ -418,7 +419,7 @@
(-> Text Code)
[["" 0 0] (#.Identifier "" name)])
-(def: (nat\encode value)
+(def: (nat\encoded value)
(-> Nat Text)
(loop [input value
output ""]
@@ -446,7 +447,7 @@
(if (n.> 0 num_lists)
(let [(^open ".") ..functor
indices (..indices num_lists)
- type_vars (: (List Code) (map (|>> nat\encode identifier$) indices))
+ type_vars (: (List Code) (map (|>> nat\encoded identifier$) indices))
zipped_type (` (All [(~+ type_vars)]
(-> (~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var)))))
type_vars))
@@ -454,7 +455,7 @@
vars+lists (|> indices
(map ++)
(map (function (_ idx)
- (let [base (nat\encode idx)]
+ (let [base (nat\encoded idx)]
[(identifier$ base)
(identifier$ ("lux text concat" base "'"))]))))
pattern (` [(~+ (map (function (_ [v vs]) (` (#.Item (~ v) (~ vs))))
@@ -488,7 +489,7 @@
indices (..indices num_lists)
g!return_type (identifier$ "0return_type0")
g!func (identifier$ "0func0")
- type_vars (: (List Code) (map (|>> nat\encode identifier$) indices))
+ type_vars (: (List Code) (map (|>> nat\encoded identifier$) indices))
zipped_type (` (All [(~+ type_vars) (~ g!return_type)]
(-> (-> (~+ type_vars) (~ g!return_type))
(~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var)))))
@@ -497,7 +498,7 @@
vars+lists (|> indices
(map ++)
(map (function (_ idx)
- (let [base (nat\encode idx)]
+ (let [base (nat\encoded idx)]
[(identifier$ base)
(identifier$ ("lux text concat" base "'"))]))))
pattern (` [(~+ (map (function (_ [v vs]) (` (#.Item (~ v) (~ vs))))
diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux
index 16929459e..d7a792cdc 100644
--- a/stdlib/source/library/lux/data/collection/row.lux
+++ b/stdlib/source/library/lux/data/collection/row.lux
@@ -11,7 +11,7 @@
[monad (#+ Monad do)]
[equivalence (#+ Equivalence)]
[monoid (#+ Monoid)]
- [fold (#+ Fold)]
+ [mix (#+ Mix)]
[predicate (#+ Predicate)]]
[control
["." maybe]
@@ -22,8 +22,8 @@
[data
["." product]
[collection
- ["." list ("#\." fold functor monoid)]
- ["." array (#+ Array) ("#\." functor fold)]]]
+ ["." list ("#\." mix functor monoid)]
+ ["." array (#+ Array) ("#\." functor mix)]]]
[macro
[syntax (#+ syntax:)]
["." code]]
@@ -179,8 +179,8 @@
(|> hierarchy
array.list
list.reversed
- (list\fold (function (_ sub acc) (list\compose (list' sub) acc))
- #.End))))
+ (list\mix (function (_ sub acc) (list\compose (list' sub) acc))
+ #.End))))
(type: .public (Row a)
{#level Level
@@ -235,8 +235,8 @@
(exception: incorrect_row_structure)
(exception: .public [a] (index_out_of_bounds {row (Row a)} {index Nat})
- (exception.report ["Size" (\ n.decimal encode (value@ #size row))]
- ["Index" (\ n.decimal encode index)]))
+ (exception.report ["Size" (\ n.decimal encoded (value@ #size row))]
+ ["Index" (\ n.decimal encoded index)]))
(exception: base_was_not_found)
@@ -346,7 +346,7 @@
(def: .public of_list
(All [a] (-> (List a) (Row a)))
- (list\fold ..suffix ..empty))
+ (list\mix ..suffix ..empty))
(def: .public (member? equivalence row val)
(All [a] (-> (Equivalence a) (Row a) a Bit))
@@ -384,29 +384,29 @@
(node\= (#Hierarchy (value@ #root v1))
(#Hierarchy (value@ #root v2))))))))
-(implementation: node_fold
- (Fold Node)
+(implementation: node_mix
+ (Mix Node)
- (def: (fold f init xs)
+ (def: (mix f init xs)
(case xs
(#Base base)
- (array\fold f init base)
+ (array\mix f init base)
(#Hierarchy hierarchy)
- (array\fold (function (_ node init') (fold f init' node))
- init
- hierarchy))))
+ (array\mix (function (_ node init') (mix f init' node))
+ init
+ hierarchy))))
-(implementation: .public fold
- (Fold Row)
+(implementation: .public mix
+ (Mix Row)
- (def: (fold f init xs)
- (let [(^open ".") node_fold]
- (fold f
- (fold f
- init
- (#Hierarchy (value@ #root xs)))
- (#Base (value@ #tail xs))))))
+ (def: (mix f init xs)
+ (let [(^open ".") node_mix]
+ (mix f
+ (mix f
+ init
+ (#Hierarchy (value@ #root xs)))
+ (#Base (value@ #tail xs))))))
(implementation: .public monoid
(All [a] (Monoid (Row a)))
@@ -414,7 +414,7 @@
(def: identity ..empty)
(def: (compose xs ys)
- (list\fold suffix xs (..list ys))))
+ (list\mix suffix xs (..list ys))))
(implementation: node_functor
(Functor Node)
@@ -441,13 +441,13 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(let [(^open ".") ..functor
- (^open ".") ..fold
+ (^open ".") ..mix
(^open ".") ..monoid
results (map (function (_ f) (map f fa))
ff)]
- (fold compose identity results))))
+ (mix compose identity results))))
(implementation: .public monad
(Monad Row)
@@ -457,15 +457,15 @@
(def: in (|>> row))
(def: join
- (let [(^open ".") ..fold
+ (let [(^open ".") ..mix
(^open ".") ..monoid]
- (fold (function (_ post pre) (compose pre post)) identity))))
+ (mix (function (_ post pre) (compose pre post)) identity))))
(def: .public reversed
(All [a] (-> (Row a) (Row a)))
(|>> ..list
list.reversed
- (list\fold suffix ..empty)))
+ (list\mix suffix ..empty)))
(template [<name> <array> <init> <op>]
[(def: .public <name>
diff --git a/stdlib/source/library/lux/data/collection/set.lux b/stdlib/source/library/lux/data/collection/set.lux
index bd18afe96..00edc5a47 100644
--- a/stdlib/source/library/lux/data/collection/set.lux
+++ b/stdlib/source/library/lux/data/collection/set.lux
@@ -8,7 +8,7 @@
[monoid (#+ Monoid)]]
[data
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
[number
["n" nat]]]]]
@@ -16,8 +16,6 @@
["#" dictionary (#+ Dictionary)]])
(type: .public (Set a)
- {#.doc (example "An un-ordered data-structure with unique items."
- "This means there is no repetition/duplication among the items.")}
(Dictionary a Any))
(def: .public member_hash
@@ -54,7 +52,7 @@
(def: .public (difference sub base)
(All [a] (-> (Set a) (Set a) (Set a)))
- (list\fold ..lacks base (..list sub)))
+ (list\mix ..lacks base (..list sub)))
(def: .public (intersection filter base)
(All [a] (-> (Set a) (Set a) (Set a)))
@@ -92,7 +90,7 @@
(def: .public (of_list hash elements)
(All [a] (-> (Hash a) (List a) (Set a)))
- (list\fold ..has (..empty hash) elements))
+ (list\mix ..has (..empty hash) elements))
(def: .public (sub? super sub)
(All [a] (-> (Set a) (Set a) Bit))
diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux
index b4786c825..f176dc46a 100644
--- a/stdlib/source/library/lux/data/collection/set/multi.lux
+++ b/stdlib/source/library/lux/data/collection/set/multi.lux
@@ -15,7 +15,7 @@
[abstract (#+ abstract: :abstraction :representation ^:representation)]]]]
["." //
[//
- ["." list ("#\." fold monoid)]
+ ["." list ("#\." mix monoid)]
["." dictionary (#+ Dictionary)]]])
(abstract: .public (Set a)
@@ -29,7 +29,7 @@
(def: .public size
(All [a] (-> (Set a) Nat))
- (|>> :representation dictionary.values (list\fold n.+ 0)))
+ (|>> :representation dictionary.values (list\mix n.+ 0)))
(def: .public (has multiplicity elem set)
(All [a] (-> Nat a (Set a) (Set a)))
@@ -62,9 +62,9 @@
(All [a] (-> (Set a) (List a)))
(|>> :representation
dictionary.entries
- (list\fold (function (_ [elem multiplicity] output)
- (list\compose (list.repeated multiplicity elem) output))
- #.End)))
+ (list\mix (function (_ [elem multiplicity] output)
+ (list\compose (list.repeated multiplicity elem) output))
+ #.End)))
(template [<name> <compose>]
[(def: .public (<name> parameter subject)
@@ -77,22 +77,22 @@
(def: .public (intersection parameter (^:representation subject))
(All [a] (-> (Set a) (Set a) (Set a)))
- (list\fold (function (_ [elem multiplicity] output)
- (..has (n.min (..multiplicity parameter elem)
- multiplicity)
- elem
- output))
- (..empty (dictionary.key_hash subject))
- (dictionary.entries subject)))
+ (list\mix (function (_ [elem multiplicity] output)
+ (..has (n.min (..multiplicity parameter elem)
+ multiplicity)
+ elem
+ output))
+ (..empty (dictionary.key_hash subject))
+ (dictionary.entries subject)))
(def: .public (difference parameter subject)
(All [a] (-> (Set a) (Set a) (Set a)))
(|> parameter
:representation
dictionary.entries
- (list\fold (function (_ [elem multiplicity] output)
- (..lacks multiplicity elem output))
- subject)))
+ (list\mix (function (_ [elem multiplicity] output)
+ (..lacks multiplicity elem output))
+ subject)))
(def: .public (sub? reference subject)
{#.doc (example "Is 'subject' a sub-set of 'reference'?")}
@@ -133,10 +133,10 @@
(def: (hash (^:representation set))
(let [[hash _] set]
- (list\fold (function (_ [elem multiplicity] acc)
- (|> elem (\ hash hash) (n.* multiplicity) (n.+ acc)))
- 0
- (dictionary.entries set)))))
+ (list\mix (function (_ [elem multiplicity] acc)
+ (|> elem (\ hash hash) (n.* multiplicity) (n.+ acc)))
+ 0
+ (dictionary.entries set)))))
)
(def: .public (member? set elem)
@@ -149,7 +149,7 @@
(def: .public (of_list hash subject)
(All [a] (-> (Hash a) (List a) (Set a)))
- (list\fold (..has 1) (..empty hash) subject))
+ (list\mix (..has 1) (..empty hash) subject))
(def: .public (of_set subject)
(All [a] (-> (//.Set a) (Set a)))
diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux
index 28bbf1876..d6d532d02 100644
--- a/stdlib/source/library/lux/data/collection/set/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/set/ordered.lux
@@ -6,7 +6,7 @@
[order (#+ Order)]]
[data
[collection
- ["." list ("#\." fold)]
+ ["." list ("#\." mix)]
[dictionary
["/" ordered]]]]
[type
@@ -50,11 +50,11 @@
(def: .public (of_list &order list)
(All [a] (-> (Order a) (List a) (Set a)))
- (list\fold has (..empty &order) list))
+ (list\mix has (..empty &order) list))
(def: .public (union left right)
(All [a] (-> (Set a) (Set a) (Set a)))
- (list\fold ..has right (..list left)))
+ (list\mix ..has right (..list left)))
(def: .public (intersection left right)
(All [a] (-> (Set a) (Set a) (Set a)))
diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux
index 112932a50..bdf10e85b 100644
--- a/stdlib/source/library/lux/data/collection/tree.lux
+++ b/stdlib/source/library/lux/data/collection/tree.lux
@@ -4,14 +4,14 @@
[abstract
[functor (#+ Functor)]
[equivalence (#+ Equivalence)]
- [fold (#+ Fold)]
+ [mix (#+ Mix)]
[monad (#+ do)]]
[control
["<>" parser
["<.>" code (#+ Parser)]]]
[data
[collection
- ["." list ("#\." monad fold)]]]
+ ["." list ("#\." monad mix)]]]
[macro
[syntax (#+ syntax:)]
["." code]]]])
@@ -80,11 +80,11 @@
#children (list\map (map f)
(value@ #children fa))}))
-(implementation: .public fold
- (Fold Tree)
+(implementation: .public mix
+ (Mix Tree)
- (def: (fold f init tree)
- (list\fold (function (_ tree' init') (fold f init' tree'))
- (f (value@ #value tree)
- init)
- (value@ #children tree))))
+ (def: (mix f init tree)
+ (list\mix (function (_ tree' init') (mix f init' tree'))
+ (f (value@ #value tree)
+ init)
+ (value@ #children tree))))
diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux
index 6d1709c55..1c99353bc 100644
--- a/stdlib/source/library/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux
@@ -14,7 +14,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold monoid)]]]]]
+ ["." list ("#\." functor monoid)]]]]]
["." // (#+ Tree) ("#\." functor)])
(type: (Family Zipper a)
diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux
index d34918cf2..fb67c971f 100644
--- a/stdlib/source/library/lux/data/color.lux
+++ b/stdlib/source/library/lux/data/color.lux
@@ -9,14 +9,8 @@
[parser
["<.>" code]]]
[data
- ["." text
- ["%" format (#+ format)]]
[collection
["." list ("#\." functor)]]]
- [macro
- [syntax (#+ syntax:)]
- ["." template]
- ["." code]]
["." math
[number
["n" nat]
@@ -355,14 +349,8 @@
+0.0
luminance])))
-(syntax: (color_scheme_documentation [name <code>.local_identifier])
- (let [name (text.replaced "_" "-" name)
- g!documentation (code.text (format "A " name " color scheme."))]
- (in (list (` {#.doc (.example (~ g!documentation))})))))
-
(template [<name> <1> <2>]
[(`` (def: .public (<name> color)
- (~~ (..color_scheme_documentation <name>))
(-> Color [Color Color Color])
(let [[hue saturation luminance] (hsl color)]
[color
@@ -380,7 +368,6 @@
(template [<name> <1> <2> <3>]
[(`` (def: .public (<name> color)
- (~~ (..color_scheme_documentation <name>))
(-> Color [Color Color Color Color])
(let [[hue saturation luminance] (hsb color)]
[color
diff --git a/stdlib/source/library/lux/data/color/named.lux b/stdlib/source/library/lux/data/color/named.lux
index 5e5e5bc65..43fd25f16 100644
--- a/stdlib/source/library/lux/data/color/named.lux
+++ b/stdlib/source/library/lux/data/color/named.lux
@@ -7,7 +7,6 @@
(template [<red> <green> <blue> <name>]
[(`` (def: .public <name>
- {#.doc (example (~~ (..documentation <red> <green> <blue> <name>)))}
Color
(//.of_rgb {#//.red (hex <red>)
#//.green (hex <green>)
diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux
index bb0510528..85eb0534d 100644
--- a/stdlib/source/library/lux/data/format/binary.lux
+++ b/stdlib/source/library/lux/data/format/binary.lux
@@ -165,7 +165,7 @@
(template [<name> <binary>]
[(def: .public <name>
(Writer Text)
- (|>> (\ utf8.codec encode) <binary>))]
+ (|>> (\ utf8.codec encoded) <binary>))]
[utf8/8 ..binary/8]
[utf8/16 ..binary/16]
@@ -188,7 +188,7 @@
(^open "specification\.") ..monoid
[size mutation] (|> value
(row\map valueW)
- (\ row.fold fold
+ (\ row.mix mix
(function (_ post pre)
(specification\compose pre post))
specification\identity))]
diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux
index 8b3a9270c..75e886e0d 100644
--- a/stdlib/source/library/lux/data/format/css.lux
+++ b/stdlib/source/library/lux/data/format/css.lux
@@ -53,8 +53,8 @@
(-> Font (CSS Special))
(let [with_unicode (case (value@ #/font.unicode_range font)
(#.Some unicode_range)
- (let [unicode_range' (format "U+" (\ nat.hex encode (value@ #/font.start unicode_range))
- "-" (\ nat.hex encode (value@ #/font.end unicode_range)))]
+ (let [unicode_range' (format "U+" (\ nat.hex encoded (value@ #/font.start unicode_range))
+ "-" (\ nat.hex encoded (value@ #/font.end unicode_range)))]
(list ["unicode-range" unicode_range']))
#.None
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 3a8daf5c0..5bb422c0d 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -9,7 +9,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[type
abstract]
[host
@@ -219,7 +219,7 @@
(def: .public (svg attributes content)
(-> Attributes XML Element)
(|> content
- (\ xml.codec encode)
+ (\ xml.codec encoded)
(..raw "svg" attributes)))
(type: .public Coord
@@ -300,7 +300,7 @@
(#.Item head tail)
(..tag "map" attributes
- (list\fold (function.flipped ..and) head tail)))))
+ (list\mix (function.flipped ..and) head tail)))))
(template [<name> <tag> <type>]
[(def: .public <name>
@@ -465,7 +465,7 @@
(#.Item head tail)
(..tag "dl" attributes
- (list\fold (function.flipped ..and) head tail))))
+ (list\mix (function.flipped ..and) head tail))))
(def: .public p ..paragraph)
@@ -524,7 +524,7 @@
(#.Item first rest)
(..and head
(..table_body
- (list\fold (function.flipped ..and) first rest))))
+ (list\mix (function.flipped ..and) first rest))))
content (case footer
#.None
content
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index ed2643efa..bcfd44f80 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -19,7 +19,7 @@
["." product]
["." text ("#\." equivalence monoid)]
[collection
- ["." list ("#\." fold functor)]
+ ["." list ("#\." mix functor)]
["." row (#+ Row row) ("#\." monad)]
["." dictionary (#+ Dictionary)]]]
[macro
@@ -169,25 +169,25 @@
[(#Array xs) (#Array ys)]
(and (n.= (row.size xs) (row.size ys))
- (list\fold (function (_ idx prev)
- (and prev
- (maybe.else #0
- (do maybe.monad
- [x' (row.item idx xs)
- y' (row.item idx ys)]
- (in (= x' y'))))))
- #1
- (list.indices (row.size xs))))
+ (list\mix (function (_ idx prev)
+ (and prev
+ (maybe.else #0
+ (do maybe.monad
+ [x' (row.item idx xs)
+ y' (row.item idx ys)]
+ (in (= x' y'))))))
+ #1
+ (list.indices (row.size xs))))
[(#Object xs) (#Object ys)]
(and (n.= (dictionary.size xs) (dictionary.size ys))
- (list\fold (function (_ [xk xv] prev)
- (and prev
- (case (dictionary.value xk ys)
- #.None #0
- (#.Some yv) (= xv yv))))
- #1
- (dictionary.entries xs)))
+ (list\mix (function (_ [xk xv] prev)
+ (and prev
+ (case (dictionary.value xk ys)
+ #.None #0
+ (#.Some yv) (= xv yv))))
+ #1
+ (dictionary.entries xs)))
_
#0)))
@@ -210,7 +210,7 @@
(-> Number Text)
(|>> (case>
(^or +0.0 -0.0) "0.0"
- value (let [raw (\ f.decimal encode value)]
+ value (let [raw (\ f.decimal encoded value)]
(if (f.< +0.0 value)
raw
(|> raw (text.split_at 1) maybe.trusted product.right))))))
@@ -327,7 +327,7 @@
signed?' (<>.parses? (<text>.this "-"))
offset (<text>.many <text>.decimal)]
(in ($_ text\compose mark (if signed?' "-" "") offset))))]
- (case (f\decode ($_ text\compose (if signed? "-" "") digits "." decimals exp))
+ (case (f\decoded ($_ text\compose (if signed? "-" "") digits "." decimals exp))
(#try.Failure message)
(<>.failure message)
@@ -406,5 +406,5 @@
(implementation: .public codec
(Codec Text JSON)
- (def: encode ..format)
- (def: decode (<text>.result json_parser)))
+ (def: encoded ..format)
+ (def: decoded (<text>.result json_parser)))
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux
index 59a24a875..f452a2693 100644
--- a/stdlib/source/library/lux/data/format/tar.lux
+++ b/stdlib/source/library/lux/data/format/tar.lux
@@ -19,8 +19,8 @@
["." format #_
["#" binary (#+ Writer) ("#\." monoid)]]
[collection
- ["." list ("#\." fold)]
- ["." row (#+ Row) ("#\." fold)]]]
+ ["." list ("#\." mix)]
+ ["." row (#+ Row) ("#\." mix)]]]
[math
["." number
["n" nat]
@@ -62,7 +62,7 @@
Nat
(|> ..octal_size
(list.repeated <size>)
- (list\fold n.* 1)
+ (list\mix n.* 1)
++))
(exception: .public (<exception> {value Nat})
@@ -90,10 +90,10 @@
(let [suffix <suffix>
padded_size (n.+ (text.size suffix) <size>)]
(|>> :representation
- (\ n.octal encode)
+ (\ n.octal encoded)
(..octal_padding <size>)
(text.suffix suffix)
- (\ utf8.codec encode)
+ (\ utf8.codec encoded)
(format.segment padded_size))))
(def: <coercion>
@@ -134,25 +134,25 @@
(Parser Small)
(do <>.monad
[digits (<binary>.segment ..small_size)
- digits (<>.lifted (\ utf8.codec decode digits))
+ digits (<>.lifted (\ utf8.codec decoded digits))
_ ..small_suffix]
(<>.lifted
(do {! try.monad}
- [value (\ n.octal decode digits)]
+ [value (\ n.octal decoded digits)]
(..small value)))))
(def: big_parser
(Parser Big)
(do <>.monad
[digits (<binary>.segment ..big_size)
- digits (<>.lifted (\ utf8.codec decode digits))
+ digits (<>.lifted (\ utf8.codec decoded digits))
end <binary>.bits/8
_ (let [expected (`` (char (~~ (static ..blank))))]
(<>.assertion (exception.error ..wrong_character [expected end])
(n.= expected end)))]
(<>.lifted
(do {! try.monad}
- [value (\ n.octal decode digits)]
+ [value (\ n.octal decoded digits)]
(..big value)))))
(abstract: Checksum
@@ -178,7 +178,7 @@
(def: checksum_checksum
(|> ..dummy_checksum
:representation
- (\ utf8.codec encode)
+ (\ utf8.codec encoded)
..checksum))
(def: checksum_code
@@ -186,7 +186,7 @@
(|>> ..checksum
..as_small
..from_small
- (\ n.octal encode)
+ (\ n.octal encoded)
(..octal_padding ..small_size)
(text.suffix ..checksum_suffix)
:abstraction))
@@ -196,17 +196,17 @@
(let [padded_size (n.+ (text.size ..checksum_suffix)
..small_size)]
(|>> :representation
- (\ utf8.codec encode)
+ (\ utf8.codec encoded)
(format.segment padded_size))))
(def: checksum_parser
(Parser [Nat Checksum])
(do <>.monad
[ascii (<binary>.segment ..small_size)
- digits (<>.lifted (\ utf8.codec decode ascii))
+ digits (<>.lifted (\ utf8.codec decoded ascii))
_ ..small_suffix
value (<>.lifted
- (\ n.octal decode digits))]
+ (\ n.octal decoded digits))]
(in [value
(:abstraction (format digits ..checksum_suffix))])))
)
@@ -217,7 +217,7 @@
(def: ascii?
(-> Text Bit)
- (|>> (\ utf8.codec encode)
+ (|>> (\ utf8.codec encoded)
(binary.aggregate (function (_ char verdict)
(.and verdict
(n.<= ..last_ascii char)))
@@ -236,7 +236,7 @@
0 (#try.Success string)
size (loop [end (-- size)]
(case end
- 0 (#try.Success (\ utf8.codec encode ""))
+ 0 (#try.Success (\ utf8.codec encoded ""))
_ (do try.monad
[last_char (binary.read/8! end string)]
(`` (case (.nat last_char)
@@ -261,7 +261,7 @@
(def: .public (<in> value)
(-> <representation> (Try <type>))
(if (..ascii? value)
- (if (|> value (\ utf8.codec encode) binary.size (n.<= <size>))
+ (if (|> value (\ utf8.codec encoded) binary.size (n.<= <size>))
(#try.Success (:abstraction value))
(exception.except <exception> [value]))
(exception.except ..not_ascii [value])))
@@ -276,7 +276,7 @@
padded_size (n.+ (text.size suffix) <size>)]
(|>> :representation
(text.suffix suffix)
- (\ utf8.codec encode)
+ (\ utf8.codec encoded)
(format.segment padded_size))))
(def: <parser>
@@ -290,7 +290,7 @@
(<>.lifted
(do {! try.monad}
[ascii (..un_padded string)
- text (\ utf8.codec decode ascii)]
+ text (\ utf8.codec decoded ascii)]
(<in> text)))))
(def: .public <none>
@@ -320,7 +320,7 @@
(let [padded_size (n.+ (text.size ..null)
..magic_size)]
(|>> :representation
- (\ utf8.codec encode)
+ (\ utf8.codec encoded)
(format.segment padded_size))))
(def: magic_parser
@@ -333,7 +333,7 @@
(n.= expected end))]
(<>.lifted
(\ try.monad map (|>> :abstraction)
- (\ utf8.codec decode string)))))
+ (\ utf8.codec decoded string)))))
)
(def: block_size Size 512)
@@ -530,7 +530,7 @@
Nat
(|> ..octal_size
(list.repeated ..content_size)
- (list\fold n.* 1)))
+ (list\mix n.* 1)))
(abstract: .public Content
{}
@@ -739,10 +739,10 @@
(Writer Tar)
(let [end_of_archive (binary.empty ..end_of_archive_size)]
(function (_ tar)
- (format\compose (row\fold (function (_ next total)
- (format\compose total (..entry_writer next)))
- format\identity
- tar)
+ (format\compose (row\mix (function (_ next total)
+ (format\compose total (..entry_writer next)))
+ format\identity
+ tar)
(format.segment ..end_of_archive_size end_of_archive)))))
(exception: .public (wrong_checksum {expected Nat} {actual Nat})
@@ -763,7 +763,7 @@
(-> Checksum Binary Nat)
(let [|checksum| (|> checksum
..from_checksum
- (\ utf8.codec encode)
+ (\ utf8.codec encoded)
..checksum)]
(|> (..checksum header)
(n.- |checksum|)
diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux
index 4e358f91d..064476a7f 100644
--- a/stdlib/source/library/lux/data/format/xml.lux
+++ b/stdlib/source/library/lux/data/format/xml.lux
@@ -127,8 +127,8 @@
(<>.after (<text>.this "/"))
(<text>.enclosed ["<" ">"]))]
(<>.assertion ($_ text\compose "Close tag does not match open tag." text.new_line
- "Expected: " (name\encode expected) text.new_line
- " Actual: " (name\encode actual) text.new_line)
+ "Expected: " (name\encoded expected) text.new_line
+ " Actual: " (name\encoded actual) text.new_line)
(name\= expected actual))))
(def: comment^
@@ -229,7 +229,7 @@
(implementation: .public codec
(Codec Text XML)
- (def: encode
+ (def: encoded
(let [attributes (: (-> Attrs Text)
(function (_ attrs)
(|> attrs
@@ -269,7 +269,7 @@
text.together)
text.new_line prefix "</" tag ">")))))
))))
- (def: decode
+ (def: decoded
(<text>.result ..xml^)))
(implementation: .public equivalence
diff --git a/stdlib/source/library/lux/data/identity.lux b/stdlib/source/library/lux/data/identity.lux
index 72ae09d38..300c0cd7b 100644
--- a/stdlib/source/library/lux/data/identity.lux
+++ b/stdlib/source/library/lux/data/identity.lux
@@ -21,7 +21,8 @@
(Apply Identity)
(def: &functor ..functor)
- (def: (apply ff fa) (ff fa)))
+ (def: (on fa ff)
+ (ff fa)))
(implementation: .public monad
(Monad Identity)
diff --git a/stdlib/source/library/lux/data/name.lux b/stdlib/source/library/lux/data/name.lux
index 3dfa6dcce..99d158095 100644
--- a/stdlib/source/library/lux/data/name.lux
+++ b/stdlib/source/library/lux/data/name.lux
@@ -45,12 +45,12 @@
(implementation: .public codec
(Codec Text Name)
- (def: (encode [module short])
+ (def: (encoded [module short])
(case module
"" short
_ ($_ text\compose module ..separator short)))
- (def: (decode input)
+ (def: (decoded input)
(case (text.all_split_by ..separator input)
(^ (list short))
(#.Right ["" short])
diff --git a/stdlib/source/library/lux/data/product.lux b/stdlib/source/library/lux/data/product.lux
index 9a3bf40dc..1e0bc9c96 100644
--- a/stdlib/source/library/lux/data/product.lux
+++ b/stdlib/source/library/lux/data/product.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Functionality for working with tuples (particularly 2-tuples/pairs)."}
[library
[lux #*
[abstract
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index 70b0360b1..5a1b8a981 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -13,7 +13,7 @@
["." maybe]]
[data
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
[number
["n" nat]
@@ -288,7 +288,7 @@
(-> (List Text) Text)
(let [(^open ".") ..monoid]
(|>> list.reversed
- (list\fold compose identity))))
+ (list\mix compose identity))))
(def: .public (interposed separator texts)
(-> Text (List Text) Text)
diff --git a/stdlib/source/library/lux/data/text/buffer.lux b/stdlib/source/library/lux/data/text/buffer.lux
index 08f640648..e23a11f63 100644
--- a/stdlib/source/library/lux/data/text/buffer.lux
+++ b/stdlib/source/library/lux/data/text/buffer.lux
@@ -11,7 +11,7 @@
["%" format (#+ format)]]
[collection
["." array]
- ["." row (#+ Row) ("#\." fold)]]]
+ ["." row (#+ Row) ("#\." mix)]]]
[math
[number
["n" nat]]]
@@ -108,9 +108,9 @@
@.lua <jvm>}
... default
(|>> :representation
- (row\fold (function (_ chunk total)
- (n.+ (//.size chunk) total))
- 0)))))
+ (row\mix (function (_ chunk total)
+ (n.+ (//.size chunk) total))
+ 0)))))
(def: .public (text buffer)
(-> Buffer Text)
@@ -128,8 +128,8 @@
@.lua (let [[capacity transform] (:representation buffer)]
(table/concat [(transform (array.empty 0)) ""]))}
... default
- (row\fold (function (_ chunk total)
- (format total chunk))
- ""
- (:representation buffer)))))
+ (row\mix (function (_ chunk total)
+ (format total chunk))
+ ""
+ (:representation buffer)))))
))
diff --git a/stdlib/source/library/lux/data/text/encoding.lux b/stdlib/source/library/lux/data/text/encoding.lux
index fbe70b92d..b1947bf67 100644
--- a/stdlib/source/library/lux/data/text/encoding.lux
+++ b/stdlib/source/library/lux/data/text/encoding.lux
@@ -14,7 +14,6 @@
(template [<name> <encoding>]
[(`` (def: .public <name>
- {#.doc (example (~~ (template.text ["'" <encoding> "' text encoding. "])))}
Encoding
(:abstraction <encoding>)))]
diff --git a/stdlib/source/library/lux/data/text/encoding/utf8.lux b/stdlib/source/library/lux/data/text/encoding/utf8.lux
index 0adb95c82..e7d9b611c 100644
--- a/stdlib/source/library/lux/data/text/encoding/utf8.lux
+++ b/stdlib/source/library/lux/data/text/encoding/utf8.lux
@@ -24,8 +24,8 @@
... On Node
(ffi.import: Buffer
["#::."
- (#static from #as from|encode [ffi.String ffi.String] Buffer)
- (#static from #as from|decode [Uint8Array] Buffer)
+ (#static from #as from|encoded [ffi.String ffi.String] Buffer)
+ (#static from #as from|decoded [Uint8Array] Buffer)
(toString [ffi.String] ffi.String)])
... On the browser
@@ -62,7 +62,7 @@
(ffi.import: (utf8->string [Binary] Text)))}
(as_is)))
-(def: (encode value)
+(def: (encoded value)
(-> Text Binary)
(for {@.old
(java/lang/String::getBytes (//.name //.utf_8)
@@ -80,7 +80,7 @@
(:as Binary ("js object do" "getBytes" value ["utf8"]))
ffi.on_node_js?
- (|> (Buffer::from|encode [value "utf8"])
+ (|> (Buffer::from|encoded [value "utf8"])
... This coercion is valid as per NodeJS's documentation:
... https://nodejs.org/api/buffer.html#buffer_buffers_and_typedarrays
(:as Uint8Array))
@@ -111,7 +111,7 @@
@.scheme
(..string->utf8 value)}))
-(def: (decode value)
+(def: (decoded value)
(-> Binary (Try Text))
(with_expansions [<jvm> (#try.Success (java/lang/String::new value (//.name //.utf_8)))]
(for {@.old <jvm>
@@ -124,7 +124,7 @@
#try.Success)
ffi.on_node_js?
- (|> (Buffer::from|decode [value])
+ (|> (Buffer::from|decoded [value])
(Buffer::toString ["utf8"])
#try.Success)
@@ -158,8 +158,7 @@
#try.Success)})))
(implementation: .public codec
- {#.doc (example "A codec for binary encoding of text as UTF-8.")}
(Codec Binary Text)
- (def: encode ..encode)
- (def: decode ..decode))
+ (def: encoded ..encoded)
+ (def: decoded ..decoded))
diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux
index dc847995a..4d99b6c8c 100644
--- a/stdlib/source/library/lux/data/text/escape.lux
+++ b/stdlib/source/library/lux/data/text/escape.lux
@@ -94,7 +94,7 @@
(def: (unicode_escaped char pre_offset pre_limit previous current)
(-> Char Nat Nat Text Text [Text Text Nat])
- (let [code (\ n.hex encode char)
+ (let [code (\ n.hex encoded char)
replacement (format ..sigil "u"
(case ("lux text size" code)
1 (format "000" code)
@@ -178,7 +178,7 @@
(-> Nat Text Text Nat (Try [Text Text Nat]))
(case (|> current
("lux text clip" (n.+ ..ascii_escape_offset offset) ..code_size)
- (\ n.hex decode))
+ (\ n.hex decoded))
(#try.Success char)
(let [limit' (|> limit (n.- offset) (n.- ..unicode_escape_offset))]
(#try.Success [(format previous
diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux
index de6482910..cd953ef05 100644
--- a/stdlib/source/library/lux/data/text/format.lux
+++ b/stdlib/source/library/lux/data/text/format.lux
@@ -56,35 +56,35 @@
(Format <type>)
<formatter>)]
- [bit Bit (\ bit.codec encode)]
- [nat Nat (\ nat.decimal encode)]
- [int Int (\ int.decimal encode)]
- [rev Rev (\ rev.decimal encode)]
- [frac Frac (\ frac.decimal encode)]
+ [bit Bit (\ bit.codec encoded)]
+ [nat Nat (\ nat.decimal encoded)]
+ [int Int (\ int.decimal encoded)]
+ [rev Rev (\ rev.decimal encoded)]
+ [frac Frac (\ frac.decimal encoded)]
[text Text text.format]
- [ratio ratio.Ratio (\ ratio.codec encode)]
- [name Name (\ name.codec encode)]
+ [ratio ratio.Ratio (\ ratio.codec encoded)]
+ [name Name (\ name.codec encoded)]
[location Location location.format]
[code Code code.format]
[type Type type.format]
- [instant instant.Instant (\ instant.codec encode)]
- [duration duration.Duration (\ duration.codec encode)]
- [date date.Date (\ date.codec encode)]
- [time time.Time (\ time.codec encode)]
- [day day.Day (\ day.codec encode)]
- [month month.Month (\ month.codec encode)]
+ [instant instant.Instant (\ instant.codec encoded)]
+ [duration duration.Duration (\ duration.codec encoded)]
+ [date date.Date (\ date.codec encoded)]
+ [time time.Time (\ time.codec encoded)]
+ [day day.Day (\ day.codec encoded)]
+ [month month.Month (\ month.codec encoded)]
- [xml xml.XML (\ xml.codec encode)]
- [json json.JSON (\ json.codec encode)]
+ [xml xml.XML (\ xml.codec encoded)]
+ [json json.JSON (\ json.codec encoded)]
)
(template [<type> <format>,<codec>]
[(`` (template [<format> <codec>]
[(def: .public <format>
(Format <type>)
- (\ <codec> encode))]
+ (\ <codec> encoded))]
(~~ (template.spliced <format>,<codec>))))]
@@ -113,7 +113,7 @@
(def: .public (mod modular)
(All [m] (Format (modular.Mod m)))
(let [codec (modular.codec (modular.modulus modular))]
- (\ codec encode modular)))
+ (\ codec encoded modular)))
(def: .public (list formatter)
(All [a] (-> (Format a) (Format (List a))))
diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux
index 8c626ed6e..fa822c33b 100644
--- a/stdlib/source/library/lux/data/text/regex.lux
+++ b/stdlib/source/library/lux/data/text/regex.lux
@@ -14,7 +14,7 @@
[data
["." product]
[collection
- ["." list ("#\." fold monad)]]]
+ ["." list ("#\." mix monad)]]]
[macro (#+ with_identifiers)
[syntax (#+ syntax:)]
["." code]]
@@ -119,10 +119,10 @@
[_ (in [])
init re_user_class^'
rest (<>.some (<>.after (<text>.this "&&") (<text>.enclosed ["[" "]"] re_user_class^')))]
- (in (list\fold (function (_ refinement base)
- (` ((~! refine^) (~ refinement) (~ base))))
- init
- rest))))
+ (in (list\mix (function (_ refinement base)
+ (` ((~! refine^) (~ refinement) (~ base))))
+ init
+ rest))))
(def: blank^
(Parser Text)
@@ -195,7 +195,7 @@
(<>.either (do <>.monad
[_ (<text>.this "\")
id number^]
- (in (` ((~! ..copy) (~ (code.identifier ["" (n\encode id)]))))))
+ (in (` ((~! ..copy) (~ (code.identifier ["" (n\encoded id)]))))))
(do <>.monad
[_ (<text>.this "\k<")
captured_name name_part^
@@ -282,38 +282,38 @@
(re_scoped^ current_module)))
.let [g!total (code.identifier ["" "0total"])
g!temp (code.identifier ["" "0temp"])
- [_ names steps] (list\fold (: (-> (Either Code [Re_Group Code])
- [Nat (List Code) (List (List Code))]
- [Nat (List Code) (List (List Code))])
- (function (_ part [idx names steps])
- (case part
- (^or (#.Left complex) (#.Right [#Non_Capturing complex]))
- [idx
- names
- (list& (list g!temp complex
- (` .let) (` [(~ g!total) (\ (~! //.monoid) (~' compose) (~ g!total) (~ g!temp))]))
- steps)]
-
- (#.Right [(#Capturing [?name num_captures]) scoped])
- (let [[idx! name!] (case ?name
- (#.Some _name)
- [idx (code.identifier ["" _name])]
-
- #.None
- [(++ idx) (code.identifier ["" (n\encode idx)])])
- access (if (n.> 0 num_captures)
- (` ((~! product.left) (~ name!)))
- name!)]
- [idx!
- (list& name! names)
- (list& (list name! scoped
- (` .let) (` [(~ g!total) (\ (~! //.monoid) (~' compose) (~ g!total) (~ access))]))
- steps)])
- )))
- [0
- (: (List Code) (list))
- (: (List (List Code)) (list))]
- parts)]]
+ [_ names steps] (list\mix (: (-> (Either Code [Re_Group Code])
+ [Nat (List Code) (List (List Code))]
+ [Nat (List Code) (List (List Code))])
+ (function (_ part [idx names steps])
+ (case part
+ (^or (#.Left complex) (#.Right [#Non_Capturing complex]))
+ [idx
+ names
+ (list& (list g!temp complex
+ (` .let) (` [(~ g!total) (\ (~! //.monoid) (~' compose) (~ g!total) (~ g!temp))]))
+ steps)]
+
+ (#.Right [(#Capturing [?name num_captures]) scoped])
+ (let [[idx! name!] (case ?name
+ (#.Some _name)
+ [idx (code.identifier ["" _name])]
+
+ #.None
+ [(++ idx) (code.identifier ["" (n\encoded idx)])])
+ access (if (n.> 0 num_captures)
+ (` ((~! product.left) (~ name!)))
+ name!)]
+ [idx!
+ (list& name! names)
+ (list& (list name! scoped
+ (` .let) (` [(~ g!total) (\ (~! //.monoid) (~' compose) (~ g!total) (~ access))]))
+ steps)])
+ )))
+ [0
+ (: (List Code) (list))
+ (: (List (List Code)) (list))]
+ parts)]]
(in [(if capturing?
(list.size names)
0)
@@ -374,7 +374,7 @@
tail (<>.some (<>.after (<text>.this "|") sub^))]
(if (list.empty? tail)
(in head)
- (in [(list\fold n.max (product.left head) (list\map product.left tail))
+ (in [(list\mix n.max (product.left head) (list\map product.left tail))
(` ($_ ((~ (if capturing?
(` (~! |||^))
(` (~! |||_^)))))
diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux
index be47d038a..ef489af08 100644
--- a/stdlib/source/library/lux/data/text/unicode/set.lux
+++ b/stdlib/source/library/lux/data/text/unicode/set.lux
@@ -5,7 +5,7 @@
[equivalence (#+ Equivalence)]]
[data
[collection
- ["." list ("#\." fold functor)]
+ ["." list ("#\." mix functor)]
["." set ("#\." equivalence)]
["." tree #_
["#" finger (#+ Tree)]]]]
@@ -45,11 +45,11 @@
(def: .public (set [head tail])
(-> [Block (List Block)] Set)
- (list\fold (: (-> Block Set Set)
- (function (_ block set)
- (..composite (..singleton block) set)))
- (..singleton head)
- tail))
+ (list\mix (: (-> Block Set Set)
+ (function (_ block set)
+ (..composite (..singleton block) set)))
+ (..singleton head)
+ tail))
(def: character/0
Set
diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux
index aca2b4e89..4768a1975 100644
--- a/stdlib/source/library/lux/documentation.lux
+++ b/stdlib/source/library/lux/documentation.lux
@@ -15,7 +15,7 @@
["." text (#+ \n) ("#\." order)
["%" format (#+ format)]]
[collection
- ["." list ("#\." monad fold monoid)]
+ ["." list ("#\." monad mix monoid)]
["." set (#+ Set)]]
[format
["md" markdown (#+ Markdown Block)]]]
@@ -60,14 +60,14 @@
[[[_ _ column] (<tag> members)]
(|> members
(list\map reference_column)
- (list\fold n.min column))])
+ (list\mix n.min column))])
([#.Form]
[#.Tuple])
[[_ _ column] (#.Record pairs)]
(|> (list\compose (list\map (|>> product.left reference_column) pairs)
(list\map (|>> product.right reference_column) pairs))
- (list\fold n.min column))
+ (list\mix n.min column))
))
(def: (padding reference_column [_ old_line old_column] [_ new_line new_column])
@@ -89,7 +89,7 @@
(function (_ [left right] tail)
(list& left right tail)))]
(|>> list.reversed
- (list\fold melded #.End))))
+ (list\mix melded #.End))))
(def: (code_documentation old_location reference_column example)
(-> Location Nat Code [Location Text])
@@ -111,11 +111,11 @@
(^template [|<| |>| <tag> <prep>]
[[group_location (<tag> members)]
- (let [[group_location' members_documentation] (list\fold (function (_ part [last_location text_accum])
- (let [[member_location member_documentation] (code_documentation last_location reference_column part)]
- [member_location (format text_accum member_documentation)]))
- [(revised@ #.column ++ group_location) ""]
- (<prep> members))]
+ (let [[group_location' members_documentation] (list\mix (function (_ part [last_location text_accum])
+ (let [[member_location member_documentation] (code_documentation last_location reference_column part)]
+ [member_location (format text_accum member_documentation)]))
+ [(revised@ #.column ++ group_location) ""]
+ (<prep> members))]
[(revised@ #.column ++ group_location')
(format (padding reference_column old_location group_location)
|<| members_documentation |>|)])])
@@ -279,7 +279,7 @@
(text\< (value@ #definition right)
(value@ #definition left))))
(list\map (value@ #documentation))
- (list\fold md.then md.empty)))
+ (list\mix md.then md.empty)))
(def: expected_separator
Text
@@ -287,11 +287,11 @@
(def: expected_format
(-> (List Text) Text)
- (list\fold (function (_ short aggregate)
- (case aggregate
- "" short
- _ (format aggregate ..expected_separator short)))
- ""))
+ (list\mix (function (_ short aggregate)
+ (case aggregate
+ "" short
+ _ (format aggregate ..expected_separator short)))
+ ""))
(def: expected
(-> Text (Set Text))
@@ -354,9 +354,9 @@
... Missing documentation
(case (|> module
(value@ #definitions)
- (list\fold (function (_ definition missing)
- (set.lacks (value@ #definition definition) missing))
- expected)
+ (list\mix (function (_ definition missing)
+ (set.lacks (value@ #definition definition) missing))
+ expected)
set.list)
#.End
md.empty
@@ -385,5 +385,5 @@
(text\< (value@ #module right) (value@ #module left))))
(list\map ..module_documentation)
(list.interposed md.horizontal_rule)
- (list\fold md.then (: (Markdown Block) md.empty))
+ (list\mix md.then (: (Markdown Block) md.empty))
md.markdown))
diff --git a/stdlib/source/library/lux/ffi.js.lux b/stdlib/source/library/lux/ffi.js.lux
index 65665bcd3..6d8ed9658 100644
--- a/stdlib/source/library/lux/ffi.js.lux
+++ b/stdlib/source/library/lux/ffi.js.lux
@@ -14,7 +14,7 @@
["." text
["%" format]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor)]]]
[type
abstract]
[macro (#+ with_identifiers)
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index a025b8108..16c4887ab 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -19,7 +19,7 @@
["%" format (#+ format)]]
[collection
["." array]
- ["." list ("#\." monad fold monoid)]
+ ["." list ("#\." monad mix monoid)]
["." dictionary (#+ Dictionary)]]]
[macro (#+ with_identifiers)
[syntax (#+ syntax:)]
@@ -71,7 +71,6 @@
(template [<name> <class>]
[(`` (def: .public <name>
- {#.doc (example (~~ (template.text ["The type of an (unboxed) " <name> " value."])))}
.Type
(#.Primitive (reflection.reflection <class>) #.End)))]
@@ -126,9 +125,6 @@
(template [<name> <op> <from> <to>]
[(template: .public (<name> value)
- {#.doc (example "Type converter."
- (: <to>
- (<name> (: <from> foo))))}
[(|> value
(: <from>)
"jvm object cast"
@@ -169,9 +165,6 @@
(template [<name> <from> <to> <0> <1>]
[(template: .public (<name> value)
- {#.doc (example "Type converter."
- (: <to>
- (<name> (: <from> foo))))}
[(|> value <0> <1>)])]
[long_to_char ..Long ..Character ..long_to_int ..int_to_char]
@@ -1098,7 +1091,7 @@
(case method_def
(#ConstructorMethod strict_fp? type_vars self_name arguments constructor_args body exs)
(let [replacer (|> (list\map (field->parser fully_qualified_class_name self_name) fields)
- (list\fold <>.either method_parser)
+ (list\mix <>.either method_parser)
parser->replacer)]
(` ("init"
(~ (privacy_modifier$ pm))
@@ -1114,7 +1107,7 @@
(#VirtualMethod final? strict_fp? type_vars self_name arguments return_type body exs)
(let [replacer (|> (list\map (field->parser fully_qualified_class_name self_name) fields)
- (list\fold <>.either method_parser)
+ (list\mix <>.either method_parser)
parser->replacer)]
(` ("virtual"
(~ (code.text name))
@@ -1131,7 +1124,7 @@
(#OverridenMethod strict_fp? declaration type_vars self_name arguments return_type body exs)
(let [replacer (|> (list\map (field->parser fully_qualified_class_name self_name) fields)
- (list\fold <>.either method_parser)
+ (list\mix <>.either method_parser)
parser->replacer)
super_replacer (parser->replacer (<code>.form (do <>.monad
[_ (<code>.this! (' ::super!))
@@ -1215,7 +1208,7 @@
method_parser (: (Parser Code)
(|> methods
(list\map (method->parser fully_qualified_class_name))
- (list\fold <>.either (<>.failure ""))))]]
+ (list\mix <>.either (<>.failure ""))))]]
(in (list (` ("jvm class"
(~ (declaration$ (type.declaration full_class_name class_vars)))
(~ (class$ super))
diff --git a/stdlib/source/library/lux/ffi.lua.lux b/stdlib/source/library/lux/ffi.lua.lux
index ddfeede9d..4d3f5aa26 100644
--- a/stdlib/source/library/lux/ffi.lua.lux
+++ b/stdlib/source/library/lux/ffi.lua.lux
@@ -15,7 +15,7 @@
["." text
["%" format]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[type
abstract]
[macro (#+ with_identifiers)
@@ -231,11 +231,11 @@
real_class (text.replaced "/" "." class)
imported (case (text.all_split_by "/" class)
(#.Item head tail)
- (list\fold (function (_ sub super)
- (` ("lua object get" (~ (code.text sub))
- (:as (..Object .Any) (~ super)))))
- (` ("lua import" (~ (code.text head))))
- tail)
+ (list\mix (function (_ sub super)
+ (` ("lua object get" (~ (code.text sub))
+ (:as (..Object .Any) (~ super)))))
+ (` ("lua import" (~ (code.text head))))
+ tail)
#.End
(` ("lua import" (~ (code.text class)))))]
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 9acf8e055..9ec503f1b 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -19,7 +19,7 @@
["%" format (#+ format)]]
[collection
["." array (#+ Array)]
- ["." list ("#\." monad fold monoid)]]]
+ ["." list ("#\." monad mix monoid)]]]
[macro (#+ with_identifiers)
[syntax (#+ syntax:)]
["." code]]
@@ -1067,7 +1067,7 @@
(with_parens
(spaced (list "init"
(privacy_modifier$ pm)
- (bit\encode strict_fp?)
+ (bit\encoded strict_fp?)
(with_brackets (spaced (list\map annotation$ anns)))
(with_brackets (spaced (list\map type_param$ type_vars)))
(with_brackets (spaced (list\map generic_type$ exs)))
@@ -1081,8 +1081,8 @@
(spaced (list "virtual"
name
(privacy_modifier$ pm)
- (bit\encode final?)
- (bit\encode strict_fp?)
+ (bit\encoded final?)
+ (bit\encoded strict_fp?)
(with_brackets (spaced (list\map annotation$ anns)))
(with_brackets (spaced (list\map type_param$ type_vars)))
(with_brackets (spaced (list\map generic_type$ exs)))
@@ -1106,7 +1106,7 @@
(spaced (list "override"
(class_decl$ class_decl)
name
- (bit\encode strict_fp?)
+ (bit\encoded strict_fp?)
(with_brackets (spaced (list\map annotation$ anns)))
(with_brackets (spaced (list\map type_param$ type_vars)))
(with_brackets (spaced (list\map generic_type$ exs)))
@@ -1124,7 +1124,7 @@
(spaced (list "static"
name
(privacy_modifier$ pm)
- (bit\encode strict_fp?)
+ (bit\encoded strict_fp?)
(with_brackets (spaced (list\map annotation$ anns)))
(with_brackets (spaced (list\map type_param$ type_vars)))
(with_brackets (spaced (list\map generic_type$ exs)))
@@ -1211,9 +1211,9 @@
.let [fully_qualified_class_name (format (safe current_module) "." full_class_name)
field_parsers (list\map (field_parser fully_qualified_class_name) fields)
method_parsers (list\map (method_parser (product.right class_decl) fully_qualified_class_name) methods)
- replacer (parser_replacer (list\fold <>.either
- (<>.failure "")
- (list\compose field_parsers method_parsers)))
+ replacer (parser_replacer (list\mix <>.either
+ (<>.failure "")
+ (list\compose field_parsers method_parsers)))
def_code (format "jvm class:"
(spaced (list (class_decl$ class_decl)
(super_class_decl$ super)
diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux
index 112c0c0be..453f2c59e 100644
--- a/stdlib/source/library/lux/ffi.php.lux
+++ b/stdlib/source/library/lux/ffi.php.lux
@@ -15,7 +15,7 @@
["." text
["%" format]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor)]]]
[type
abstract]
[macro (#+ with_identifiers)
diff --git a/stdlib/source/library/lux/ffi.py.lux b/stdlib/source/library/lux/ffi.py.lux
index c4d8e1298..e3eea52e2 100644
--- a/stdlib/source/library/lux/ffi.py.lux
+++ b/stdlib/source/library/lux/ffi.py.lux
@@ -15,7 +15,7 @@
["." text
["%" format]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[type
abstract]
[macro (#+ with_identifiers)
@@ -251,11 +251,11 @@
real_class (text.replaced "/" "." class)
imported (case (text.all_split_by "/" class)
(#.Item head tail)
- (list\fold (function (_ sub super)
- (` ("python object get" (~ (code.text sub))
- (:as (..Object .Any) (~ super)))))
- (` ("python import" (~ (code.text head))))
- tail)
+ (list\mix (function (_ sub super)
+ (` ("python object get" (~ (code.text sub))
+ (:as (..Object .Any) (~ super)))))
+ (` ("python import" (~ (code.text head))))
+ tail)
#.End
(` ("python import" (~ (code.text class)))))]
diff --git a/stdlib/source/library/lux/ffi.rb.lux b/stdlib/source/library/lux/ffi.rb.lux
index 7175fe4c9..c01b88565 100644
--- a/stdlib/source/library/lux/ffi.rb.lux
+++ b/stdlib/source/library/lux/ffi.rb.lux
@@ -15,7 +15,7 @@
["." text
["%" format]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor)]]]
[type
abstract]
[macro (#+ with_identifiers)
diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux
index c3b77f830..ab2e6cdff 100644
--- a/stdlib/source/library/lux/ffi.scm.lux
+++ b/stdlib/source/library/lux/ffi.scm.lux
@@ -15,7 +15,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor)]]]
[type
abstract]
[macro (#+ with_identifiers)
diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux
index 8e11c4a58..cdd76278b 100644
--- a/stdlib/source/library/lux/macro.lux
+++ b/stdlib/source/library/lux/macro.lux
@@ -106,7 +106,7 @@
(do //.monad
[id //.seed]
(in (|> id
- (\ nat.decimal encode)
+ (\ nat.decimal encoded)
($_ text\compose "__gensym__" prefix)
[""] code.identifier))))
@@ -121,7 +121,7 @@
(def: .public wrong_syntax_error
(-> Name Text)
- (|>> name\encode
+ (|>> name\encoded
(text.prefix (text\compose "Wrong syntax for " text.\''))
(text.suffix (text\compose text.\'' "."))))
@@ -171,7 +171,7 @@
(do //.monad
[location //.location
output (<func> token)
- .let [_ ("lux io log" ($_ text\compose (name\encode macro_name) " " (location.format location)))
+ .let [_ ("lux io log" ($_ text\compose (name\encoded macro_name) " " (location.format location)))
_ (list\map (|>> code.format "lux io log")
output)
_ ("lux io log" "")]]
diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux
index 79eebb5df..5de323722 100644
--- a/stdlib/source/library/lux/macro/code.lux
+++ b/stdlib/source/library/lux/macro/code.lux
@@ -9,7 +9,7 @@
["." name]
["." text ("#\." monoid equivalence)]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["." nat]
@@ -96,7 +96,7 @@
(case ast
(^template [<tag> <struct>]
[[_ (<tag> value)]
- (\ <struct> encode value)])
+ (\ <struct> encoded value)])
([#.Bit bit.codec]
[#.Nat nat.decimal]
[#.Int int.decimal]
@@ -108,19 +108,19 @@
(text.format value)
[_ (#.Tag name)]
- (text\compose "#" (\ name.codec encode name))
+ (text\compose "#" (\ name.codec encoded name))
(^template [<tag> <open> <close>]
[[_ (<tag> members)]
($_ text\compose
<open>
- (list\fold (function (_ next prev)
- (let [next (format next)]
- (if (text\= "" prev)
- next
- ($_ text\compose prev " " next))))
- ""
- members)
+ (list\mix (function (_ next prev)
+ (let [next (format next)]
+ (if (text\= "" prev)
+ next
+ ($_ text\compose prev " " next))))
+ ""
+ members)
<close>)])
([#.Form "(" ")"]
[#.Tuple "[" "]"])
@@ -128,18 +128,17 @@
[_ (#.Record pairs)]
($_ text\compose
"{"
- (list\fold (function (_ [left right] prev)
- (let [next ($_ text\compose (format left) " " (format right))]
- (if (text\= "" prev)
- next
- ($_ text\compose prev " " next))))
- ""
- pairs)
+ (list\mix (function (_ [left right] prev)
+ (let [next ($_ text\compose (format left) " " (format right))]
+ (if (text\= "" prev)
+ next
+ ($_ text\compose prev " " next))))
+ ""
+ pairs)
"}")
))
(def: .public (replaced original substitute ast)
- {#.doc "Replaces all code that looks like the 'original' with the 'substitute'."}
(-> Code Code Code Code)
(if (\ ..equivalence = original ast)
substitute
diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux
index aac7af03c..aea5bfb5c 100644
--- a/stdlib/source/library/lux/macro/template.lux
+++ b/stdlib/source/library/lux/macro/template.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Utilities commonly used while templating."}
[library
[lux (#- let local)
["." meta]
@@ -69,11 +68,11 @@
full_tag
(<>.either <code>.local_tag
full_tag))
- (<>\map bit\encode <code>.bit)
- (<>\map nat\encode <code>.nat)
- (<>\map int\encode <code>.int)
- (<>\map rev\encode <code>.rev)
- (<>\map frac\encode <code>.frac)
+ (<>\map bit\encoded <code>.bit)
+ (<>\map nat\encoded <code>.nat)
+ (<>\map int\encoded <code>.int)
+ (<>\map rev\encoded <code>.rev)
+ (<>\map frac\encoded <code>.frac)
)))
(def: (part module_side?)
@@ -135,8 +134,8 @@
(exception: .public (irregular_arguments {expected Nat} {actual Nat})
(exception.report
- ["Expected" (\ nat.decimal encode expected)]
- ["Actual" (\ nat.decimal encode actual)]))
+ ["Expected" (\ nat.decimal encoded expected)]
+ ["Actual" (\ nat.decimal encoded actual)]))
(def: (macro (^slots [#parameters #template]))
(-> Local Macro)
diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux
index e088df673..a0a31472d 100644
--- a/stdlib/source/library/lux/math.lux
+++ b/stdlib/source/library/lux/math.lux
@@ -1,4 +1,4 @@
-(.module: {#.doc "Common mathematical constants and functions."}
+(.module:
[library
[lux #*
["@" target]
@@ -7,23 +7,22 @@
["n" nat]
["i" int]]]]])
-(template [<name> <value> <doc>]
+(template [<name> <value>]
[(def: .public <name>
- {#.doc <doc>}
<value>)]
- [e +2.7182818284590452354 "The base of the natural logarithm."]
+ [e +2.7182818284590452354]
... ["Ï€ is wrong!" by Bob Palais](https://www.math.utah.edu/~palais/pi.html)
- [pi +3.14159265358979323846 "The ratio of a circle's circumference to its diameter."]
+ [pi +3.14159265358979323846]
... [The Tau Manifesto](https://tauday.com/tau-manifesto)
- [tau +6.28318530717958647692 "The ratio of a circle's circumference to its radius."]
+ [tau +6.28318530717958647692]
)
(for {@.old
(as_is (template [<name> <method>]
- [(def: .public (<name> input)
+ [(def: .public (<name> it)
(-> Frac Frac)
- (<method> input))]
+ (<method> it))]
[cos "jvm invokestatic:java.lang.Math:cos:double"]
[sin "jvm invokestatic:java.lang.Math:sin:double"]
@@ -285,10 +284,10 @@
(..pow ("lux f64 /" +3.0 +1.0))))
})
-(def: .public (round input)
+(def: .public (round it)
(-> Frac Frac)
- (let [floored (floor input)
- diff ("lux f64 -" floored input)]
+ (let [floored (floor it)
+ diff ("lux f64 -" floored it)]
(cond ("lux f64 <" diff +0.5)
("lux f64 +" +1.0 floored)
@@ -319,19 +318,19 @@
... ("lux f64 =" +0.0 y)
("lux f64 /" +0.0 +0.0))))
-(def: .public (log' base input)
+(def: .public (log' base it)
(-> Frac Frac Frac)
("lux f64 /"
(..log base)
- (..log input)))
+ (..log it)))
-(def: .public (factorial n)
+(def: .public (factorial it)
(-> Nat Nat)
(loop [acc 1
- n n]
- (if (n.<= 1 n)
+ it it]
+ (if (n.<= 1 it)
acc
- (recur (n.* n acc) (-- n)))))
+ (recur (n.* it acc) (-- it)))))
(def: .public (hypotenuse catA catB)
(-> Frac Frac Frac)
@@ -342,23 +341,23 @@
... Hyperbolic functions
... https://en.wikipedia.org/wiki/Hyperbolic_function#Definitions
(template [<name> <comp> <inverse>]
- [(def: .public (<name> x)
+ [(def: .public (<name> it)
(-> Frac Frac)
- (|> (..exp x) (<comp> (..exp ("lux f64 *" -1.0 x))) ("lux f64 /" +2.0)))
+ (|> (..exp it) (<comp> (..exp ("lux f64 *" -1.0 it))) ("lux f64 /" +2.0)))
- (def: .public (<inverse> x)
+ (def: .public (<inverse> it)
(-> Frac Frac)
- (|> +2.0 ("lux f64 /" (|> (..exp x) (<comp> (..exp ("lux f64 *" -1.0 x)))))))]
+ (|> +2.0 ("lux f64 /" (|> (..exp it) (<comp> (..exp ("lux f64 *" -1.0 it)))))))]
[sinh "lux f64 -" csch]
[cosh "lux f64 +" sech]
)
(template [<name> <top> <bottom>]
- [(def: .public (<name> x)
+ [(def: .public (<name> it)
(-> Frac Frac)
- (let [e+ (exp x)
- e- (exp ("lux f64 *" -1.0 x))
+ (let [e+ (exp it)
+ e- (exp ("lux f64 *" -1.0 it))
sinh' (|> e+ ("lux f64 -" e-))
cosh' (|> e+ ("lux f64 +" e-))]
(|> <top> ("lux f64 /" <bottom>))))]
@@ -369,30 +368,30 @@
... https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions#Definitions_in_terms_of_logarithms
(template [<name> <comp>]
- [(def: .public (<name> x)
+ [(def: .public (<name> it)
(-> Frac Frac)
- (|> x (pow +2.0) (<comp> +1.0) (pow +0.5) ("lux f64 +" x) log))]
+ (|> it (pow +2.0) (<comp> +1.0) (pow +0.5) ("lux f64 +" it) log))]
[asinh "lux f64 +"]
[acosh "lux f64 -"]
)
(template [<name> <base> <diff>]
- [(def: .public (<name> x)
+ [(def: .public (<name> it)
(-> Frac Frac)
- (let [x+ (|> <base> ("lux f64 +" <diff>))
- x- (|> <base> ("lux f64 -" <diff>))]
- (|> x+ ("lux f64 /" x-) log ("lux f64 /" +2.0))))]
+ (let [it+ (|> <base> ("lux f64 +" <diff>))
+ it- (|> <base> ("lux f64 -" <diff>))]
+ (|> it+ ("lux f64 /" it-) log ("lux f64 /" +2.0))))]
- [atanh +1.0 x]
- [acoth x +1.0]
+ [atanh +1.0 it]
+ [acoth it +1.0]
)
(template [<name> <op>]
- [(def: .public (<name> x)
+ [(def: .public (<name> it)
(-> Frac Frac)
- (let [x^2 (|> x (pow +2.0))]
- (|> +1.0 (<op> x^2) (pow +0.5) ("lux f64 +" +1.0) ("lux f64 /" x) log)))]
+ (let [it^2 (|> it (pow +2.0))]
+ (|> +1.0 (<op> it^2) (pow +0.5) ("lux f64 +" +1.0) ("lux f64 /" it) log)))]
[asech "lux f64 -"]
[acsch "lux f64 +"]
diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux
index f63e86a4d..d2a210e7b 100644
--- a/stdlib/source/library/lux/math/infix.lux
+++ b/stdlib/source/library/lux/math/infix.lux
@@ -9,7 +9,7 @@
[data
["." product]
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[macro
[syntax (#+ syntax:)]
["." code]]
@@ -50,21 +50,21 @@
init_op <code>.any
init_param expression
steps (<>.some (<>.and <code>.any expression))]
- (in (product.right (list\fold (function (_ [op param] [subject [_subject _op _param]])
- [param [(#Binary _subject _op _param)
- (` and)
- (#Binary subject op param)]])
- [init_param [init_subject init_op init_param]]
- steps))))
+ (in (product.right (list\mix (function (_ [op param] [subject [_subject _op _param]])
+ [param [(#Binary _subject _op _param)
+ (` and)
+ (#Binary subject op param)]])
+ [init_param [init_subject init_op init_param]]
+ steps))))
(do <>.monad
[init_subject expression
init_op <code>.any
init_param expression
steps (<>.some (<>.and <code>.any expression))]
- (in (list\fold (function (_ [op param] [_subject _op _param])
- [(#Binary _subject _op _param) op param])
- [init_subject init_op init_param]
- steps)))
+ (in (list\mix (function (_ [op param] [_subject _op _param])
+ [(#Binary _subject _op _param) op param])
+ [init_subject init_op init_param]
+ steps)))
))
)))
diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux
index 5588ed574..9a94151c4 100644
--- a/stdlib/source/library/lux/math/modular.lux
+++ b/stdlib/source/library/lux/math/modular.lux
@@ -28,7 +28,7 @@
["#" modulus (#+ Modulus)]])
(abstract: .public (Mod m)
- {#.doc "A number under a modulus."}
+ {}
{#modulus (Modulus m)
#value Int}
@@ -50,8 +50,8 @@
(exception: .public [%] (incorrect_modulus {modulus (Modulus %)}
{parsed Int})
(exception.report
- ["Expected" (i\encode (//.divisor modulus))]
- ["Actual" (i\encode parsed)]))
+ ["Expected" (i\encoded (//.divisor modulus))]
+ ["Actual" (i\encoded parsed)]))
(def: separator
" mod ")
@@ -64,14 +64,14 @@
(implementation: .public (codec expected)
(All [%] (-> (Modulus %) (Codec Text (Mod %))))
- (def: (encode modular)
+ (def: (encoded modular)
(let [[_ value] (:representation modular)]
($_ text\compose
- (i\encode value)
+ (i\encoded value)
..separator
- (i\encode (//.divisor expected)))))
+ (i\encoded (//.divisor expected)))))
- (def: decode
+ (def: decoded
(<text>.result
(do <>.monad
[[value _ actual] ($_ <>.and intL (<text>.this ..separator) intL)
@@ -144,8 +144,8 @@
(exception: .public [r% s%] (moduli_are_not_equal {reference (Modulus r%)}
{subject (Modulus s%)})
(exception.report
- ["Reference" (i\encode (//.divisor reference))]
- ["Subject" (i\encode (//.divisor subject))]))
+ ["Reference" (i\encoded (//.divisor reference))]
+ ["Subject" (i\encoded (//.divisor subject))]))
(def: .public (adapter reference subject)
(All [r% s%]
diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux
index 3c360bf60..f52210e24 100644
--- a/stdlib/source/library/lux/math/modulus.lux
+++ b/stdlib/source/library/lux/math/modulus.lux
@@ -21,8 +21,7 @@
(exception: .public zero_cannot_be_a_modulus)
(abstract: .public (Modulus %)
- {#.doc (example "A number used as a modulus in modular arithmetic."
- "It cannot be 0.")}
+ {}
Int
@@ -50,11 +49,6 @@
)
(syntax: .public (literal [divisor <code>.int])
- {#.doc (example "Success!"
- (literal 123)
-
- "Failure!"
- (literal 0))}
(meta.lifted
(do try.monad
[_ (..modulus divisor)]
diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux
index 2f2259c18..03007c32e 100644
--- a/stdlib/source/library/lux/math/number.lux
+++ b/stdlib/source/library/lux/math/number.lux
@@ -13,22 +13,6 @@
["#." rev]
["#." frac]])
-(macro: (documentation tokens state)
- (case tokens
- (^ (list [location (#.Text encoding)] example_1 example_2))
- (let [encoding ($_ "lux text concat"
- "Given syntax for a "
- encoding
- " number, generates a Nat, an Int, a Rev or a Frac.")
- separators "Allows for the presence of commas among the digits."
- description [location (#.Text ($_ "lux text concat" encoding " " separators))]]
- (#try.Success [state (list (` (.example (~ description)
- (~ example_1)
- (~ example_2))))]))
-
- _
- (#try.Failure "Wrong syntax for 'documentation'.")))
-
(def: separator
",")
@@ -45,28 +29,27 @@
(-> Text Text)
(text.replaced ..separator ""))
-(template [<macro> <nat> <int> <rev> <frac> <error> <doc>]
+(template [<macro> <nat> <int> <rev> <frac> <error>]
[(macro: .public (<macro> tokens state)
- {#.doc <doc>}
(case tokens
(#.Item [meta (#.Text repr')] #.End)
(if (..separator_prefixed? repr')
(#try.Failure <error>)
(let [repr (..without_separators repr')]
- (case (\ <nat> decode repr)
+ (case (\ <nat> decoded repr)
(#try.Success value)
(#try.Success [state (list [meta (#.Nat value)])])
(^multi (#try.Failure _)
- {(\ <int> decode repr) (#try.Success value)})
+ {(\ <int> decoded repr) (#try.Success value)})
(#try.Success [state (list [meta (#.Int value)])])
(^multi (#try.Failure _)
- {(\ <rev> decode repr) (#try.Success value)})
+ {(\ <rev> decoded repr) (#try.Success value)})
(#try.Success [state (list [meta (#.Rev value)])])
(^multi (#try.Failure _)
- {(\ <frac> decode repr) (#try.Success value)})
+ {(\ <frac> decoded repr) (#try.Success value)})
(#try.Success [state (list [meta (#.Frac value)])])
_
@@ -75,13 +58,7 @@
_
(#try.Failure <error>)))]
- [bin /nat.binary /int.binary /rev.binary /frac.binary
- "Invalid binary syntax."
- (..documentation "binary" (bin "11001001") (bin "11,00,10,01"))]
- [oct /nat.octal /int.octal /rev.octal /frac.octal
- "Invalid octal syntax."
- (..documentation "octal" (oct "615243") (oct "615,243"))]
- [hex /nat.hex /int.hex /rev.hex /frac.hex
- "Invalid hexadecimal syntax."
- (..documentation "hexadecimal" (hex "deadBEEF") (hex "dead,BEEF"))]
+ [bin /nat.binary /int.binary /rev.binary /frac.binary "Invalid binary syntax."]
+ [oct /nat.octal /int.octal /rev.octal /frac.octal "Invalid octal syntax."]
+ [hex /nat.hex /int.hex /rev.hex /frac.hex "Invalid hexadecimal syntax."]
)
diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux
index d26544c0b..324b84d43 100644
--- a/stdlib/source/library/lux/math/number/complex.lux
+++ b/stdlib/source/library/lux/math/number/complex.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Complex arithmetic."}
[library
[lux #*
["." math]
@@ -24,16 +23,11 @@
["." int]]]]])
(type: .public Complex
- {#.doc (example "A complex number.")}
{#real Frac
#imaginary Frac})
(syntax: .public (complex [real <code>.any
?imaginary (<>.maybe <code>.any)])
- {#.doc (example "Complex literals."
- (complex real imaginary)
- "The imaginary part can be omitted if it's +0.0."
- (complex real))}
(in (list (` {#..real (~ real)
#..imaginary (~ (maybe.else (' +0.0) ?imaginary))}))))
@@ -50,6 +44,7 @@
(..complex +0.0 +0.0))
(def: .public (not_a_number? complex)
+ (-> Complex Bit)
(or (f.not_a_number? (value@ #real complex))
(f.not_a_number? (value@ #imaginary complex))))
diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux
index 1d92184b8..4e5eee846 100644
--- a/stdlib/source/library/lux/math/number/frac.lux
+++ b/stdlib/source/library/lux/math/number/frac.lux
@@ -23,28 +23,23 @@
["/#" //]])
(def: .public (= reference sample)
- {#.doc "Frac(tion) equivalence."}
(-> Frac Frac Bit)
("lux f64 =" reference sample))
(def: .public (< reference sample)
- {#.doc "Frac(tion) less-than."}
(-> Frac Frac Bit)
("lux f64 <" reference sample))
(def: .public (<= reference sample)
- {#.doc "Frac(tion) less-than or equal."}
(-> Frac Frac Bit)
(or ("lux f64 <" reference sample)
("lux f64 =" reference sample)))
(def: .public (> reference sample)
- {#.doc "Frac(tion) greater-than."}
(-> Frac Frac Bit)
("lux f64 <" sample reference))
(def: .public (>= reference sample)
- {#.doc "Frac(tion) greater-than or equal."}
(-> Frac Frac Bit)
(or ("lux f64 <" sample reference)
("lux f64 =" sample reference)))
@@ -59,17 +54,16 @@
[..= zero?]
)
-(template [<name> <op> <doc>]
+(template [<name> <op>]
[(def: .public (<name> param subject)
- {#.doc <doc>}
(-> Frac Frac Frac)
(<op> param subject))]
- [+ "lux f64 +" "Frac(tion) addition."]
- [- "lux f64 -" "Frac(tion) substraction."]
- [* "lux f64 *" "Frac(tion) multiplication."]
- [/ "lux f64 /" "Frac(tion) division."]
- [% "lux f64 %" "Frac(tion) remainder."]
+ [+ "lux f64 +"]
+ [- "lux f64 -"]
+ [* "lux f64 *"]
+ [/ "lux f64 /"]
+ [% "lux f64 %"]
)
(def: .public (/% param subject)
@@ -81,32 +75,31 @@
(-> Frac Frac)
(..* -1.0))
-(def: .public (abs x)
+(def: .public (abs it)
(-> Frac Frac)
- (if (..< +0.0 x)
- (..* -1.0 x)
- x))
+ (if (..< +0.0 it)
+ (..* -1.0 it)
+ it))
-(def: .public (signum x)
+(def: .public (signum it)
(-> Frac Frac)
- (cond (..= +0.0 x) +0.0
- (..< +0.0 x) -1.0
+ (cond (..= +0.0 it) +0.0
+ (..< +0.0 it) -1.0
... else
+1.0))
(def: min_exponent -1022)
(def: max_exponent (//int.frac +1023))
-(template [<name> <test> <doc>]
+(template [<name> <test>]
[(def: .public (<name> left right)
- {#.doc <doc>}
(-> Frac Frac Frac)
(if (<test> right left)
left
right))]
- [min ..< "Frac(tion) minimum."]
- [max ..> "Frac(tion) minimum."]
+ [min ..<]
+ [max ..>]
)
(def: .public nat
@@ -170,36 +163,33 @@
[maximum ..max (..* -1.0 ..biggest)]
)
-(template [<name> <numerator> <doc>]
+(template [<name> <numerator>]
[(def: .public <name>
- {#.doc <doc>}
Frac
(../ +0.0 <numerator>))]
- [not_a_number +0.0 "Not a number."]
- [positive_infinity +1.0 "Positive infinity."]
+ [not_a_number +0.0]
+ [positive_infinity +1.0]
)
(def: .public negative_infinity
- {#.doc "Negative infinity."}
Frac
(..* -1.0 ..positive_infinity))
-(def: .public (not_a_number? number)
- {#.doc "Tests whether a frac is actually not-a-number."}
+(def: .public (not_a_number? it)
(-> Frac Bit)
- (not (..= number number)))
+ (not (..= it it)))
-(def: .public (number? value)
+(def: .public (number? it)
(-> Frac Bit)
- (not (or (..not_a_number? value)
- (..= ..positive_infinity value)
- (..= ..negative_infinity value))))
+ (not (or (..not_a_number? it)
+ (..= ..positive_infinity it)
+ (..= ..negative_infinity it))))
(implementation: .public decimal
(Codec Text Frac)
- (def: (encode x)
+ (def: (encoded x)
(case x
-0.0 (let [output ("lux f64 encode" x)]
(if (text.starts_with? "-" output)
@@ -209,7 +199,7 @@
("lux f64 encode" x)
("lux text concat" "+" ("lux f64 encode" x)))))
- (def: (decode input)
+ (def: (decoded input)
(case ("lux f64 decode" [input])
(#.Some value)
(#try.Success value)
@@ -232,7 +222,7 @@
(template [<cast> <hex> <name>]
[(def: <name>
(|> <hex>
- (\ //nat.hex decode)
+ (\ //nat.hex decoded)
try.trusted
<cast>))]
@@ -247,19 +237,19 @@
(def: smallest_exponent
(..log/2 ..smallest))
-(def: .public (bits input)
+(def: .public (bits it)
(-> Frac I64)
- (.i64 (cond (..not_a_number? input)
+ (.i64 (cond (..not_a_number? it)
..not_a_number_bits
- (..= positive_infinity input)
+ (..= positive_infinity it)
..positive_infinity_bits
- (..= negative_infinity input)
+ (..= negative_infinity it)
..negative_infinity_bits
- (..= +0.0 input)
- (let [reciprocal (../ input +1.0)]
+ (..= +0.0 it)
+ (let [reciprocal (../ it +1.0)]
(if (..= positive_infinity reciprocal)
... Positive zero
..positive_zero_bits
@@ -267,11 +257,11 @@
..negative_zero_bits))
... else
- (let [sign_bit (if (..< -0.0 input)
+ (let [sign_bit (if (..< -0.0 it)
1
0)
- input (..abs input)
- exponent (|> input
+ it (..abs it)
+ exponent (|> it
..log/2
///.floor
(..min ..max_exponent))
@@ -280,7 +270,7 @@
(..+ (..min +0.0 min_gap))
(..- exponent))
max_gap (..- ..max_exponent power)
- mantissa (|> input
+ mantissa (|> it
(..* (///.pow (..min ..max_exponent power) +2.0))
(..* (if (..> +0.0 max_gap)
(///.pow max_gap +2.0)
@@ -310,11 +300,11 @@
[sign 1 ..sign_offset]
)
-(def: .public (of_bits input)
+(def: .public (of_bits it)
(-> I64 Frac)
- (case [(: Nat (..exponent input))
- (: Nat (..mantissa input))
- (: Nat (..sign input))]
+ (case [(: Nat (..exponent it))
+ (: Nat (..mantissa it))
+ (: Nat (..sign it))]
(^ [(static ..special_exponent_bits) 0 0])
..positive_infinity
@@ -362,7 +352,7 @@
after_length (//nat.- after_offset ("lux text size" representation))]
exponent (|> representation
("lux text clip" after_offset after_length)
- (\ codec decode))]
+ (\ codec decoded))]
(in [("lux text clip" 0 split_index representation)
(//int.* <factor> (.int exponent))]))])
([+1 (^or [(#.Some split_index) #.None #.None #.None]
@@ -377,7 +367,7 @@
[(implementation: .public <struct>
(Codec Text Frac)
- (def: (encode value)
+ (def: (encoded value)
(let [bits (..bits value)
mantissa (..mantissa bits)
exponent (//int.- (.int ..double_bias) (..exponent bits))
@@ -387,11 +377,11 @@
1 "-"
0 "+"
_ (undefined))
- (\ <nat> encode (.nat mantissa))
+ (\ <nat> encoded (.nat mantissa))
".0E"
- (\ <int> encode exponent))))
+ (\ <int> encoded exponent))))
- (def: (decode representation)
+ (def: (decoded representation)
(let [negative? (text.starts_with? "-" representation)
positive? (text.starts_with? "+" representation)]
(if (or negative? positive?)
@@ -404,16 +394,16 @@
after_length (//nat.- after_offset ("lux text size" mantissa))]
decimal (|> mantissa
("lux text clip" after_offset after_length)
- (\ <nat> decode))]
+ (\ <nat> decoded))]
(in [("lux text clip" 0 split_index mantissa)
decimal]))
#.None
(#try.Failure ("lux text concat" <error> representation)))
.let [whole ("lux text clip" 1 (-- ("lux text size" whole)) whole)]
- mantissa (\ <nat> decode (case decimal
- 0 whole
- _ ("lux text concat" whole (\ <nat> encode decimal))))
+ mantissa (\ <nat> decoded (case decimal
+ 0 whole
+ _ ("lux text concat" whole (\ <nat> encoded decimal))))
.let [sign (if negative? 1 0)]]
(in (..of_bits
($_ //i64.or
diff --git a/stdlib/source/library/lux/math/number/i16.lux b/stdlib/source/library/lux/math/number/i16.lux
index 59d067f31..9bbfc83a7 100644
--- a/stdlib/source/library/lux/math/number/i16.lux
+++ b/stdlib/source/library/lux/math/number/i16.lux
@@ -13,7 +13,6 @@
(maybe.trusted (i64.sub 16)))
(def: .public I16
- {#.doc (example "A 16-bit integer.")}
(:by_example [size]
(Sub size)
..sub
@@ -23,4 +22,4 @@
(def: .public equivalence (Equivalence I16) (\ ..sub &equivalence))
(def: .public width Nat (\ ..sub width))
(def: .public i16 (-> I64 I16) (\ ..sub narrow))
-(def: .public i64 (-> I16 I64) (\ ..sub widen))
+(def: .public i64 (-> I16 I64) (\ ..sub wide))
diff --git a/stdlib/source/library/lux/math/number/i32.lux b/stdlib/source/library/lux/math/number/i32.lux
index 75e6c6ec3..63edd2244 100644
--- a/stdlib/source/library/lux/math/number/i32.lux
+++ b/stdlib/source/library/lux/math/number/i32.lux
@@ -13,7 +13,6 @@
(maybe.trusted (i64.sub 32)))
(def: .public I32
- {#.doc (example "A 32-bit integer.")}
(:by_example [size]
(Sub size)
..sub
@@ -23,4 +22,4 @@
(def: .public equivalence (Equivalence I32) (\ ..sub &equivalence))
(def: .public width Nat (\ ..sub width))
(def: .public i32 (-> I64 I32) (\ ..sub narrow))
-(def: .public i64 (-> I32 I64) (\ ..sub widen))
+(def: .public i64 (-> I32 I64) (\ ..sub wide))
diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux
index 42c08e00a..3f02cb4bd 100644
--- a/stdlib/source/library/lux/math/number/i64.lux
+++ b/stdlib/source/library/lux/math/number/i64.lux
@@ -21,37 +21,32 @@
(n.* ..bits_per_byte
..bytes_per_i64))
-(template [<parameter_type> <name> <op> <doc>]
+(template [<parameter_type> <name> <op>]
[(def: .public (<name> parameter subject)
- {#.doc <doc>}
(All [s] (-> <parameter_type> (I64 s) (I64 s)))
(<op> parameter subject))]
- [(I64 Any) or "lux i64 or" "Bitwise or."]
- [(I64 Any) xor "lux i64 xor" "Bitwise xor."]
- [(I64 Any) and "lux i64 and" "Bitwise and."]
+ [(I64 Any) or "lux i64 or"]
+ [(I64 Any) xor "lux i64 xor"]
+ [(I64 Any) and "lux i64 and"]
- [Nat left_shifted "lux i64 left-shift" "Bitwise left-shift."]
- [Nat right_shifted "lux i64 right-shift" "Unsigned/logic bitwise right-shift."]
+ [Nat left_shifted "lux i64 left-shift"]
+ [Nat right_shifted "lux i64 right-shift"]
)
... https://en.wikipedia.org/wiki/Mask_(computing)
(type: .public Mask
- {#.doc (example "A pattern of bits that can be imposed on I64 values.")}
I64)
(def: .public (bit position)
- {#.doc (example "A mask with only a specific bit set.")}
(-> Nat Mask)
(|> 1 .i64 (..left_shifted (n.% ..width position))))
(def: .public sign
- {#.doc (example "A mask for the sign bit of ints.")}
Mask
(..bit (-- ..width)))
(def: .public not
- {#.doc "Bitwise negation."}
(All [s] (-> (I64 s) (I64 s)))
(..xor (.i64 (-- 0))))
@@ -64,7 +59,6 @@
(..not ..false))
(def: .public (mask amount_of_bits)
- {#.doc (example "Mask a block of bits of the specified size.")}
(-> Nat Mask)
(case amount_of_bits
0 ..false
@@ -76,11 +70,10 @@
(-> Nat Nat Nat)
(|> value (right_shifted shift) (n.+ value)))
-(def: .public (ones subject)
- {#.doc "Count the number of 1s in a bit-map."}
+(def: .public (ones it)
(-> (I64 Any) Nat)
- (let [ones' (n.- (|> subject (right_shifted 1) (..and 6148914691236517205) i64)
- (i64 subject))]
+ (let [ones' (n.- (|> it (right_shifted 1) (..and 6148914691236517205) i64)
+ (i64 it))]
(|> ones'
(right_shifted 2) (..and 3689348814741910323) (n.+ (..and 3689348814741910323 ones'))
(with_shift 4) (..and 1085102592571150095)
@@ -90,18 +83,16 @@
(..and 127))))
(def: .public (zero index input)
- {#.doc "Clear bit at the given index."}
(All [s] (-> Nat (I64 s) (I64 s)))
(|> index ..bit ..not (..and input)))
-(template [<name> <op> <doc>]
+(template [<name> <op>]
[(def: .public (<name> index input)
- {#.doc <doc>}
(All [s] (-> Nat (I64 s) (I64 s)))
(|> index ..bit (<op> input)))]
- [one ..or "Set bit at given index."]
- [flipped ..xor "Flip bit at given index."]
+ [one ..or]
+ [flipped ..xor]
)
(def: .public (one? index input)
@@ -123,7 +114,6 @@
)
(def: .public (region offset size)
- {#.doc (example "A mask for a block of bits of the given size, starting at the given offset.")}
(-> Nat Nat Mask)
(..left_rotated offset (..mask size)))
@@ -169,7 +159,7 @@
(repetitions size "1")
(repetitions size "0")))
- high (try.trusted (\ n.binary decode pattern))
+ high (try.trusted (\ n.binary decoded pattern))
low (..right_rotated size high)]
(function (_ value)
(..or (..right_shifted size (..and high value))
@@ -189,8 +179,6 @@
swap/01)))
(interface: .public (Sub size)
- {#.doc (example "A sub-space of I64 with a reduce amount of bits.")}
-
(: (Equivalence (I64 size))
&equivalence)
(: Nat
@@ -198,10 +186,9 @@
(: (-> I64 (I64 size))
narrow)
(: (-> (I64 size) I64)
- widen))
+ wide))
(def: .public (sub width)
- {#.doc (example "Given a width in the interval (0,64), yields an implementation for integers of that width.")}
(Ex [size] (-> Nat (Maybe (Sub size))))
(if (.and (n.> 0 width)
(n.< ..width width))
@@ -216,7 +203,7 @@
(def: (narrow value)
(..or (|> value (..and ..sign) (..right_shifted sign_shift))
(|> value (..and mantissa))))
- (def: (widen value)
+ (def: (wide value)
(.i64 (case (.nat (..and sign value))
0 value
_ (..or co_mantissa value))))))))
diff --git a/stdlib/source/library/lux/math/number/i8.lux b/stdlib/source/library/lux/math/number/i8.lux
index e0721117c..7fb3e8e8b 100644
--- a/stdlib/source/library/lux/math/number/i8.lux
+++ b/stdlib/source/library/lux/math/number/i8.lux
@@ -13,7 +13,6 @@
(maybe.trusted (i64.sub 8)))
(def: .public I8
- {#.doc (example "An 8-bit integer.")}
(:by_example [size]
(Sub size)
..sub
@@ -23,4 +22,4 @@
(def: .public equivalence (Equivalence I8) (\ ..sub &equivalence))
(def: .public width Nat (\ ..sub width))
(def: .public i8 (-> I64 I8) (\ ..sub narrow))
-(def: .public i64 (-> I8 I64) (\ ..sub widen))
+(def: .public i64 (-> I8 I64) (\ ..sub wide))
diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux
index d5546a4a5..657780bd9 100644
--- a/stdlib/source/library/lux/math/number/int.lux
+++ b/stdlib/source/library/lux/math/number/int.lux
@@ -20,29 +20,24 @@
["#." i64]])
(def: .public (= reference sample)
- {#.doc "Int(eger) equivalence."}
(-> Int Int Bit)
("lux i64 =" reference sample))
(def: .public (< reference sample)
- {#.doc "Int(eger) less-than."}
(-> Int Int Bit)
("lux i64 <" reference sample))
(def: .public (<= reference sample)
- {#.doc "Int(eger) less-than or equal."}
(-> Int Int Bit)
(if ("lux i64 <" reference sample)
#1
("lux i64 =" reference sample)))
(def: .public (> reference sample)
- {#.doc "Int(eger) greater-than."}
(-> Int Int Bit)
("lux i64 <" sample reference))
(def: .public (>= reference sample)
- {#.doc "Int(eger) greater-than or equal."}
(-> Int Int Bit)
(if ("lux i64 <" sample reference)
#1
@@ -60,7 +55,6 @@
(template [<name> <test> <doc>]
[(def: .public (<name> left right)
- {#.doc <doc>}
(-> Int Int Int)
(if (<test> right left)
left
@@ -72,7 +66,6 @@
(template [<name> <op> <doc>]
[(def: .public (<name> param subject)
- {#.doc <doc>}
(-> Int Int Int)
(<op> param subject))]
@@ -84,35 +77,29 @@
)
(def: .public (/% param subject)
- {#.doc "Int(eger) [division remainder]."}
(-> Int Int [Int Int])
[(../ param subject)
(..% param subject)])
-(def: .public (opposite value)
- {#.doc (example "A value of equal magnitude and opposite sign.")}
+(def: .public (opposite it)
(-> Int Int)
- (..- value +0))
+ (..- it +0))
-(def: .public (abs x)
- {#.doc (example "A value of equal magnitude and positive sign.")}
+(def: .public (abs it)
(-> Int Int)
- (if (..< +0 x)
- (..* -1 x)
- x))
+ (if (..< +0 it)
+ (..* -1 it)
+ it))
-(def: .public (signum x)
- {#.doc (example "A value (either -1, 0 or +0) which represents the sign.")}
+(def: .public (signum it)
(-> Int Int)
- (cond (..= +0 x) +0
- (..< +0 x) -1
+ (cond (..= +0 it) +0
+ (..< +0 it) -1
... else
+1))
... https://rob.conery.io/2018/08/21/mod-and-remainder-are-not-the-same/
(def: .public (mod divisor dividend)
- {#.doc (example "Integer modulo."
- "Note: The modulo and the remainder are not the same.")}
(All [m] (-> Int Int Int))
(let [remainder (..% divisor dividend)]
(if (or (and (..< +0 divisor)
@@ -132,7 +119,6 @@
... https://en.wikipedia.org/wiki/Greatest_common_divisor
(def: .public (gcd a b)
- {#.doc "Greatest Common Divisor."}
(-> Int Int Int)
(case b
+0 a
@@ -144,7 +130,6 @@
... https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
(def: .public (extended_gcd a b)
- {#.doc "Extended euclidean algorithm."}
(-> Int Int [[Int Int] Int])
(loop [x +1 x1 +0
y +0 y1 +1
@@ -158,7 +143,6 @@
... https://en.wikipedia.org/wiki/Least_common_multiple
(def: .public (lcm a b)
- {#.doc "Least Common Multiple."}
(-> Int Int Int)
(case [a b]
(^or [_ +0] [+0 _])
@@ -223,25 +207,25 @@
[(implementation: .public <struct>
(Codec Text Int)
- (def: (encode value)
+ (def: (encoded value)
(if (..< +0 value)
- (|> value ++ ..opposite .nat ++ (\ <codec> encode) ("lux text concat" ..-sign))
- (|> value .nat (\ <codec> encode) ("lux text concat" ..+sign))))
+ (|> value ++ ..opposite .nat ++ (\ <codec> encoded) ("lux text concat" ..-sign))
+ (|> value .nat (\ <codec> encoded) ("lux text concat" ..+sign))))
- (def: (decode repr)
+ (def: (decoded repr)
(let [input_size ("lux text size" repr)]
(if (//nat.> 1 input_size)
(case ("lux text clip" 0 1 repr)
(^ (static ..+sign))
(|> repr
("lux text clip" 1 (-- input_size))
- (\ <codec> decode)
+ (\ <codec> decoded)
(\ try.functor map .int))
(^ (static ..-sign))
(|> repr
("lux text clip" 1 (-- input_size))
- (\ <codec> decode)
+ (\ <codec> decoded)
(\ try.functor map (|>> -- .int ..opposite --)))
_
@@ -261,7 +245,6 @@
(def: hash .nat))
(def: .public (right_shifted parameter subject)
- {#.doc "Signed/arithmetic bitwise right-shift."}
(-> Nat Int Int)
(//i64.or (//i64.and //i64.sign subject)
(//i64.right_shifted parameter subject)))
diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux
index c72289e0d..2ec9333b7 100644
--- a/stdlib/source/library/lux/math/number/nat.lux
+++ b/stdlib/source/library/lux/math/number/nat.lux
@@ -14,15 +14,14 @@
["." maybe]
["." try (#+ Try)]]]])
-(template [<extension> <output> <name> <documentation>]
+(template [<extension> <output> <name>]
[(def: .public (<name> parameter subject)
- {#.doc <documentation>}
(-> Nat Nat <output>)
(<extension> parameter subject))]
- ["lux i64 =" Bit = "Nat(ural) equivalence."]
- ["lux i64 +" Nat + "Nat(ural) addition."]
- ["lux i64 -" Nat - "Nat(ural) substraction."]
+ ["lux i64 =" Bit =]
+ ["lux i64 +" Nat +]
+ ["lux i64 -" Nat -]
)
(def: high
@@ -35,7 +34,6 @@
(|>> ("lux i64 and" mask))))
(def: .public (< reference sample)
- {#.doc "Nat(ural) less-than."}
(-> Nat Nat Bit)
(let [referenceH (..high reference)
sampleH (..high sample)]
@@ -48,38 +46,33 @@
#0))))
(def: .public (<= reference sample)
- {#.doc "Nat(ural) less-than or equal."}
(-> Nat Nat Bit)
(if (..< reference sample)
#1
("lux i64 =" reference sample)))
(def: .public (> reference sample)
- {#.doc "Nat(ural) greater-than."}
(-> Nat Nat Bit)
(..< sample reference))
(def: .public (>= reference sample)
- {#.doc "Nat(ural) greater-than or equal."}
(-> Nat Nat Bit)
(if (..< sample reference)
#1
("lux i64 =" reference sample)))
-(template [<name> <test> <doc>]
+(template [<name> <test>]
[(def: .public (<name> left right)
- {#.doc <doc>}
(-> Nat Nat Nat)
(if (<test> right left)
left
right))]
- [min ..< "Nat(ural) minimum."]
- [max ..> "Nat(ural) maximum."]
+ [min ..<]
+ [max ..>]
)
(def: .public (* parameter subject)
- {#.doc "Nat(ural) multiplication."}
(-> Nat Nat Nat)
(:as Nat
("lux i64 *"
@@ -87,7 +80,6 @@
(:as Int subject))))
(def: .public (/ parameter subject)
- {#.doc "Nat(ural) division."}
(-> Nat Nat Nat)
(if ("lux i64 <" +0 (:as Int parameter))
(if (..< parameter subject)
@@ -106,7 +98,6 @@
("lux i64 +" 1 quotient)))))
(def: .public (/% parameter subject)
- {#.doc "Nat(ural) [division remainder]."}
(-> Nat Nat [Nat Nat])
(let [quotient (../ parameter subject)
flat ("lux i64 *"
@@ -115,7 +106,6 @@
[quotient ("lux i64 -" flat subject)]))
(def: .public (% parameter subject)
- {#.doc "Nat(ural) remainder."}
(-> Nat Nat Nat)
(let [flat ("lux i64 *"
(:as Int parameter)
@@ -123,7 +113,6 @@
("lux i64 -" flat subject)))
(def: .public (gcd a b)
- {#.doc "Greatest Common Divisor."}
(-> Nat Nat Nat)
(case b
0 a
@@ -134,7 +123,6 @@
(..= 1 (..gcd a b)))
(def: .public (lcm a b)
- {#.doc "Least Common Multiple."}
(-> Nat Nat Nat)
(case [a b]
(^or [_ 0] [0 _])
@@ -302,7 +290,7 @@
[(implementation: .public <struct>
(Codec Text Nat)
- (def: encode
+ (def: encoded
(let [mask (|> 1 ("lux i64 left-shift" <shift>) --)]
(function (_ value)
(loop [input value
@@ -317,7 +305,7 @@
input'
(recur input' output')))))))
- (def: (decode repr)
+ (def: (decoded repr)
(let [input_size ("lux text size" repr)]
(if (..> 0 input_size)
(loop [idx 0
@@ -343,7 +331,7 @@
(implementation: .public decimal
(Codec Text Nat)
- (def: (encode value)
+ (def: (encoded value)
(loop [input value
output ""]
(let [digit (decimal_character (..% 10 input))
@@ -355,7 +343,7 @@
input'
(recur input' output')))))
- (def: (decode repr)
+ (def: (decoded repr)
(let [input_size ("lux text size" repr)]
(with_expansions [<failure> (#try.Failure ("lux text concat" "Invalid decimal syntax for Nat: " repr))]
(if (..> 0 input_size)
diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux
index 5d5962b47..6ab6d1349 100644
--- a/stdlib/source/library/lux/math/number/ratio.lux
+++ b/stdlib/source/library/lux/math/number/ratio.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Rational numbers."}
[library
[lux (#- nat)
[abstract
@@ -24,7 +23,6 @@
["n" nat ("#\." decimal)]])
(type: .public Ratio
- {#.doc (example "An unsigned ratio of numbers.")}
{#numerator Nat
#denominator Nat})
@@ -42,10 +40,6 @@
(syntax: .public (ratio [numerator <code>.any
?denominator (<>.maybe <code>.any)])
- {#.doc (example "Rational literals."
- (ratio numerator denominator)
- "The denominator can be omitted if it is 1."
- (ratio numerator))}
(in (list (` ((~! ..normal) {#..numerator (~ numerator)
#..denominator (~ (maybe.else (' 1) ?denominator))})))))
@@ -136,15 +130,15 @@
(implementation: .public codec
(Codec Text Ratio)
- (def: (encode (^slots [#numerator #denominator]))
- ($_ text\compose (n\encode numerator) ..separator (n\encode denominator)))
+ (def: (encoded (^slots [#numerator #denominator]))
+ ($_ text\compose (n\encoded numerator) ..separator (n\encoded denominator)))
- (def: (decode input)
+ (def: (decoded input)
(case (text.split_by ..separator input)
(#.Some [num denom])
(do try.monad
- [numerator (n\decode num)
- denominator (n\decode denom)]
+ [numerator (n\decoded num)
+ denominator (n\decoded denom)]
(in (normal {#numerator numerator
#denominator denominator})))
diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux
index c7d5641ce..b4bf8bcd2 100644
--- a/stdlib/source/library/lux/math/number/rev.lux
+++ b/stdlib/source/library/lux/math/number/rev.lux
@@ -41,54 +41,47 @@
)
(def: .public (= reference sample)
- {#.doc "Rev(olution) equivalence."}
(-> Rev Rev Bit)
("lux i64 =" reference sample))
(def: .public (< reference sample)
- {#.doc "Rev(olution) less-than."}
(-> Rev Rev Bit)
(//nat.< (.nat reference) (.nat sample)))
(def: .public (<= reference sample)
- {#.doc "Rev(olution) less-than or equal."}
(-> Rev Rev Bit)
(if (//nat.< (.nat reference) (.nat sample))
true
("lux i64 =" reference sample)))
(def: .public (> reference sample)
- {#.doc "Rev(olution) greater-than."}
(-> Rev Rev Bit)
(..< sample reference))
(def: .public (>= reference sample)
- {#.doc "Rev(olution) greater-than or equal."}
(-> Rev Rev Bit)
(if (..< sample reference)
true
("lux i64 =" reference sample)))
-(template [<name> <test> <doc>]
+(template [<name> <test>]
[(def: .public (<name> left right)
- {#.doc <doc>}
(-> Rev Rev Rev)
(if (<test> right left)
left
right))]
- [min ..< "Rev(olution) minimum."]
- [max ..> "Rev(olution) maximum."]
+ [min ..<]
+ [max ..>]
)
-(template [<name> <op> <doc>]
+(template [<name> <op>]
[(def: .public (<name> param subject)
- {#.doc <doc>}
(-> Rev Rev Rev)
(<op> param subject))]
- [+ "lux i64 +" "Rev(olution) addition."]
- [- "lux i64 -" "Rev(olution) substraction."]
+ [+ "lux i64 +"]
+ [- "lux i64 -"]
)
(def: high
@@ -101,7 +94,6 @@
(|>> ("lux i64 and" mask))))
(def: .public (* param subject)
- {#.doc "Rev(olution) multiplication."}
(-> Rev Rev Rev)
(let [subjectH (..high subject)
subjectL (..low subject)
@@ -133,14 +125,12 @@
(with_expansions [<least_significant_bit> 1]
(def: .public (reciprocal numerator)
- {#.doc "Rev(olution) reciprocal of a Nat(ural)."}
(-> Nat Rev)
(.rev (case (: Nat ("lux i64 and" <least_significant_bit> numerator))
0 (..even_reciprocal numerator)
_ (..odd_reciprocal numerator))))
(def: .public (/ param subject)
- {#.doc "Rev(olution) division."}
(-> Rev Rev Rev)
(if ("lux i64 =" +0 param)
(panic! "Cannot divide Rev by zero!")
@@ -149,14 +139,13 @@
_ (..odd_reciprocal (.nat param)))]
(.rev (//nat.* reciprocal (.nat subject)))))))
-(template [<operator> <name> <output> <output_type> <documentation>]
+(template [<operator> <name> <output> <output_type>]
[(def: .public (<name> param subject)
- {#.doc <documentation>}
(-> Rev Rev <output_type>)
(<output> (<operator> (.nat param) (.nat subject))))]
- [//nat.% % .rev Rev "Rev(olution) remainder."]
- [//nat./ ratio |> Nat "Ratio between two rev(olution)s."]
+ [//nat.% % .rev Rev]
+ [//nat./ ratio |> Nat]
)
(template [<operator> <name>]
@@ -237,8 +226,8 @@
(implementation: .public <struct>
(Codec Text Rev)
- (def: (encode value)
- (let [raw_output (\ <codec> encode (.nat value))
+ (def: (encoded value)
+ (let [raw_output (\ <codec> encoded (.nat value))
max_num_chars (//nat.+ (//nat./ <char_bit_size> //i64.width)
(case (//nat.% <char_bit_size> //i64.width)
0 0
@@ -255,12 +244,12 @@
("lux text concat" zero_padding)
("lux text concat" "."))))
- (def: (decode repr)
+ (def: (decoded repr)
(let [repr_size ("lux text size" repr)]
(if (//nat.> 1 repr_size)
(case ("lux text char" 0 repr)
(^ (char "."))
- (case (\ <codec> decode (..decimals repr))
+ (case (\ <codec> decoded (..decimals repr))
(#try.Success output)
(#try.Success (.rev output))
@@ -340,7 +329,7 @@
(recur (-- idx)
false
("lux text concat"
- (\ //nat.decimal encode digit)
+ (\ //nat.decimal encoded digit)
output))))
(if all_zeroes?
"0"
@@ -412,7 +401,7 @@
(implementation: .public decimal
(Codec Text Rev)
- (def: (encode input)
+ (def: (encoded input)
(case (.nat input)
0
".0"
@@ -432,7 +421,7 @@
("lux text concat" "." (..format digits))
)))))
- (def: (decode input)
+ (def: (decoded input)
(let [dotted? (case ("lux text index" 0 "." input)
(#.Some 0)
true
diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux
index 6b61b5159..3e9b14b8c 100644
--- a/stdlib/source/library/lux/math/random.lux
+++ b/stdlib/source/library/lux/math/random.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Pseudo-random number generation (PRNG) algorithms."}
[library
[lux (#- or and list i64 nat int rev char)
[abstract
@@ -12,7 +11,7 @@
["." unicode #_
["#" set]]]
[collection
- ["." list ("#\." fold)]
+ ["." list ("#\." mix)]
["." array (#+ Array)]
["." dictionary (#+ Dictionary)]
["." queue (#+ Queue)]
@@ -39,11 +38,9 @@
[refinement (#+ Refiner Refined)]]]])
(type: .public #rec PRNG
- {#.doc "An abstract way to represent any PRNG."}
(-> Any [PRNG I64]))
(type: .public (Random a)
- {#.doc "A producer of random values based on a PRNG."}
(-> PRNG [PRNG a]))
(implementation: .public functor
@@ -59,7 +56,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ state)
(let [[state' f] (ff state)
[state'' a] (fa state')]
@@ -80,7 +77,6 @@
(fa state')))))
(def: .public (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]
@@ -101,7 +97,6 @@
(one check random))))
(def: .public (refined refiner gen)
- {#.doc "Retries the generator until the output can be refined."}
(All [t r] (-> (Refiner t r) (Random t) (Random (Refined t r))))
(do ..monad
[sample gen]
@@ -142,7 +137,6 @@
(\ ..monad map (|>> .i64 f.of_bits) ..nat))
(def: .public safe_frac
- {#.doc (example "A number in the interval [0.0,1.0].")}
(Random Frac)
(let [mantissa_range (.int (i64.left_shifted 53 1))
mantissa_max (i.frac (-- mantissa_range))]
@@ -199,7 +193,6 @@
)
(def: .public (and left right)
- {#.doc "Sequencing combinator."}
(All [a b] (-> (Random a) (Random b) (Random [a b])))
(do ..monad
[=left left
@@ -207,7 +200,6 @@
(in [=left =right])))
(def: .public (or left right)
- {#.doc "Heterogeneous alternative combinator."}
(All [a b] (-> (Random a) (Random b) (Random (Or a b))))
(do {! ..monad}
[? bit]
@@ -220,7 +212,6 @@
(in (0 #1 =right))))))
(def: .public (either left right)
- {#.doc "Homogeneous alternative combinator."}
(All [a] (-> (Random a) (Random a) (Random a)))
(do ..monad
[? bit]
@@ -229,7 +220,6 @@
right)))
(def: .public (rec gen)
- {#.doc "A combinator for producing recursive random generators."}
(All [a] (-> (-> (Random a) (Random a)) (Random a)))
(function (_ state)
(let [gen' (gen (rec gen))]
@@ -268,7 +258,7 @@
[array Array array.of_list]
[queue Queue queue.of_list]
- [stack Stack (list\fold stack.top stack.empty)]
+ [stack Stack (list\mix stack.top stack.empty)]
)
(def: .public (set hash size value_gen)
@@ -355,8 +345,6 @@
(return state)])))
(def: .public (pcg_32 [increase seed])
- {#.doc (example "An implementation of the PCG32 algorithm."
- "For more information, please see: http://www.pcg-random.org/")}
(-> [(I64 Any) (I64 Any)] PRNG)
(let [magic 6364136223846793005]
(function (_ _)
@@ -370,8 +358,6 @@
.i64))])))
(def: .public (xoroshiro_128+ [s0 s1])
- {#.doc (example "An implementation of the Xoroshiro128+ algorithm."
- "For more information, please see: http://xoroshiro.di.unimi.it/")}
(-> [(I64 Any) (I64 Any)] PRNG)
(function (_ _)
[(let [s01 (i64.xor s0 s1)]
@@ -385,7 +371,6 @@
... https://en.wikipedia.org/wiki/Xorshift#Initialization
... http://xorshift.di.unimi.it/splitmix64.c
(def: .public split_mix_64
- {#.doc (example "An implementation of the SplitMix64 algorithm.")}
(-> Nat PRNG)
(let [twist (: (-> Nat Nat Nat)
(function (_ shift value)
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index 0b4b809fc..13b7d9937 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Functions for extracting information from the state of the compiler."}
[library
[lux (#- type)
[abstract
@@ -46,7 +45,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ lux)
(case (ff lux)
(#try.Success [lux' f])
@@ -79,13 +78,10 @@
(ma lux')))))
(def: .public (result' lux action)
- {#.doc (example "Evaluates a computation that depends on Lux's compiler state."
- "Also returns a (potentially modified) compiler state.")}
(All [a] (-> Lux (Meta a) (Try [Lux a])))
(action lux))
(def: .public (result lux action)
- {#.doc (example "Evaluates a computation that depends on Lux's compiler state.")}
(All [a] (-> Lux (Meta a) (Try a)))
(case (action lux)
(#try.Failure error)
@@ -95,7 +91,6 @@
(#try.Success output)))
(def: .public (either left right)
- {#.doc "Pick whichever computation succeeds."}
(All [a] (-> (Meta a) (Meta a) (Meta a)))
(function (_ lux)
(case (left lux)
@@ -106,7 +101,6 @@
(#try.Success [lux' output]))))
(def: .public (assertion message test)
- {#.doc "Fails with the given message if the test is #0."}
(-> Text Bit (Meta Any))
(function (_ lux)
(if test
@@ -114,14 +108,12 @@
(#try.Failure message))))
(def: .public (failure error)
- {#.doc "Fails with the given error message."}
(All [a]
(-> Text (Meta a)))
(function (_ state)
(#try.Failure (location.with (value@ #.location state) error))))
(def: .public (module name)
- {#.doc (example "Looks-up a module with the given name.")}
(-> Text (Meta Module))
(function (_ lux)
(case (plist.value name (value@ #.modules lux))
@@ -132,7 +124,6 @@
(#try.Failure ($_ text\compose "Unknown module: " name)))))
(def: .public current_module_name
- {#.doc (example "The name of the module currently being compiled, if any.")}
(Meta Text)
(function (_ lux)
(case (value@ #.current_module lux)
@@ -143,7 +134,6 @@
(#try.Failure "No current module."))))
(def: .public current_module
- {#.doc (example "The module currently being compiled, if any.")}
(Meta Module)
(let [(^open "\.") ..monad]
(|> ..current_module_name
@@ -160,8 +150,6 @@
false)))
(def: .public (normal name)
- {#.doc (example "If given a name without a module prefix, gives it the current module's name as prefix."
- "Otherwise, returns the name as-is.")}
(-> Name (Meta Name))
(case name
["" name]
@@ -191,7 +179,6 @@
#.None))))
(def: .public (macro full_name)
- {#.doc (example "Looks-up a macro known by the given name.")}
(-> Name (Meta (Maybe Macro)))
(do ..monad
[[module name] (..normal full_name)]
@@ -206,9 +193,6 @@
(#try.Success [lux macro]))))))
(def: .public seed
- {#.doc (example "The current value of a number tracked by the compiler."
- "Also increases the value, so it's different next time it is seen."
- "This number can be used for generating data 'randomly' during compilation.")}
(Meta Nat)
(function (_ lux)
(#try.Success [(revised@ #.seed ++ lux)
@@ -260,7 +244,6 @@
(\ ..monad in type)))
(def: .public (var_type name)
- {#.doc "Looks-up the type of a local variable somewhere in the environment."}
(-> Text (Meta Type))
(function (_ lux)
(let [test (: (-> [Text [Type Any]] Bit)
@@ -301,7 +284,6 @@
(text.interposed ..listing_separator)))
(def: .public (definition name)
- {#.doc "Looks-up a definition's whole data in the available modules (including the current one)."}
(-> Name (Meta Global))
(do ..monad
[name (..normal name)
@@ -323,7 +305,7 @@
(list\map product.left)
..module_listing)]
(#try.Failure ($_ text\compose
- "Unknown definition: " (name\encode name) text.new_line
+ "Unknown definition: " (name\encoded name) text.new_line
" Current module: " current_module text.new_line
(case (plist.value current_module (value@ #.modules lux))
(#.Some this_module)
@@ -337,7 +319,7 @@
(#.Definition [exported? _ _ _])
(if (and exported?
(text\= normal_short def_name))
- (#.Some (name\encode [module_name def_name]))
+ (#.Some (name\encoded [module_name def_name]))
#.None)
(#.Alias _)
@@ -363,8 +345,6 @@
" All known modules: " all_known_modules text.new_line)))))))
(def: .public (export name)
- {#.doc (example "Looks-up a definition in the available modules (including the current one)."
- "The look-up only succeeds if the definition has been exported.")}
(-> Name (Meta Definition))
(do ..monad
[definition (..definition name)]
@@ -372,16 +352,15 @@
(#.Left de_aliased)
(failure ($_ text\compose
"Aliases are not considered exports: "
- (name\encode name)))
+ (name\encoded name)))
(#.Right definition)
(let [[exported? def_type def_data def_value] definition]
(if exported?
(in definition)
- (failure ($_ text\compose "Definition is not an export: " (name\encode name))))))))
+ (failure ($_ text\compose "Definition is not an export: " (name\encoded name))))))))
(def: .public (definition_type name)
- {#.doc "Looks-up a definition's type in the available modules (including the current one)."}
(-> Name (Meta Type))
(do ..monad
[definition (definition name)]
@@ -393,7 +372,6 @@
(clean_type def_type))))
(def: .public (type name)
- {#.doc "Looks-up the type of either a local variable or a definition."}
(-> Name (Meta Type))
(case name
["" _name]
@@ -404,7 +382,6 @@
(definition_type name)))
(def: .public (type_definition name)
- {#.doc "Finds the value of a type definition (such as Int, Any or Lux)."}
(-> Name (Meta Type))
(do ..monad
[definition (definition name)]
@@ -419,10 +396,9 @@
(type_code .Type)
(type_code def_type)))
(in (:as Type def_value))
- (..failure ($_ text\compose "Definition is not a type: " (name\encode name))))))))
+ (..failure ($_ text\compose "Definition is not a type: " (name\encoded name))))))))
(def: .public (globals module)
- {#.doc "The entire list of globals in a module (including the non-exported/private ones)."}
(-> Text (Meta (List [Text Global])))
(function (_ lux)
(case (plist.value module (value@ #.modules lux))
@@ -433,7 +409,6 @@
(#try.Success [lux (value@ #.definitions module)]))))
(def: .public (definitions module)
- {#.doc "The entire list of definitions in a module (including the non-exported/private ones)."}
(-> Text (Meta (List [Text Definition])))
(\ ..monad map
(list.all (function (_ [name global])
@@ -446,7 +421,6 @@
(..globals module)))
(def: .public (exports module_name)
- {#.doc "All the exported definitions in a module."}
(-> Text (Meta (List [Text Definition])))
(do ..monad
[constants (..definitions module_name)]
@@ -457,7 +431,6 @@
(list))))))
(def: .public modules
- {#.doc "All the available modules (including the current one)."}
(Meta (List [Text Module]))
(function (_ lux)
(|> lux
@@ -466,7 +439,6 @@
#try.Success)))
(def: .public (tags_of type_name)
- {#.doc "All the tags associated with a type definition."}
(-> Name (Meta (Maybe (List Name))))
(do ..monad
[.let [[module name] type_name]
@@ -479,13 +451,11 @@
(in #.None))))
(def: .public location
- {#.doc "The location of the current expression being analyzed."}
(Meta Location)
(function (_ lux)
(#try.Success [lux (value@ #.location lux)])))
(def: .public expected_type
- {#.doc "The expected type of the current expression being analyzed."}
(Meta Type)
(function (_ lux)
(case (value@ #.expected lux)
@@ -496,7 +466,6 @@
(#try.Failure "Not expecting any type."))))
(def: .public (imported_modules module_name)
- {#.doc "All the modules imported by a specified module."}
(-> Text (Meta (List Text)))
(do ..monad
[(^slots [#.imports]) (..module module_name)]
@@ -509,14 +478,12 @@
(in (list.any? (text\= import) imports))))
(def: .public (imported? import)
- {#.doc (example "Checks if the given module has been imported by the current module.")}
(-> Text (Meta Bit))
(\ ..functor map
(|>> (value@ #.imports) (list.any? (text\= import)))
..current_module))
(def: .public (tag tag_name)
- {#.doc "Given a tag, finds out what is its index, its related tag-list and its associated type."}
(-> Name (Meta [Nat (List Name) Type]))
(do ..monad
[.let [[module name] tag_name]
@@ -528,19 +495,18 @@
(if (or (text\= this_module_name module)
(and imported! exported?))
(in [idx tag_list type])
- (..failure ($_ text\compose "Cannot access tag: " (name\encode tag_name) " from module " this_module_name)))
+ (..failure ($_ text\compose "Cannot access tag: " (name\encoded tag_name) " from module " this_module_name)))
_
(..failure ($_ text\compose
- "Unknown tag: " (name\encode tag_name) text.new_line
+ "Unknown tag: " (name\encoded tag_name) text.new_line
" Known tags: " (|> =module
(value@ #.tags)
- (list\map (|>> product.left [module] name\encode (text.prefix text.new_line)))
+ (list\map (|>> product.left [module] name\encoded (text.prefix text.new_line)))
text.together)
)))))
(def: .public (tag_lists module)
- {#.doc "All the tag-lists defined in a module, with their associated types."}
(-> Text (Meta (List [(List Name) Type])))
(do ..monad
[=module (..module module)
@@ -553,7 +519,6 @@
[tag_list type]))))))
(def: .public locals
- {#.doc "All the local variables currently in scope, separated in different scopes."}
(Meta (List (List [Text Type])))
(function (_ lux)
(case (list.inits (value@ #.scopes lux))
@@ -568,7 +533,6 @@
scopes)]))))
(def: .public (de_aliased def_name)
- {#.doc "Given an aliased definition's name, returns the original definition being referenced."}
(-> Name (Meta Name))
(do ..monad
[constant (..definition def_name)]
@@ -580,13 +544,11 @@
def_name))))
(def: .public compiler_state
- {#.doc "Obtains the current state of the compiler."}
(Meta Lux)
(function (_ lux)
(#try.Success [lux lux])))
(def: .public type_context
- {#.doc (example "The current type-checking context.")}
(Meta Type_Context)
(function (_ lux)
(#try.Success [lux (value@ #.type_context lux)])))
diff --git a/stdlib/source/library/lux/meta/annotation.lux b/stdlib/source/library/lux/meta/annotation.lux
index 42d151df3..c73cc9247 100644
--- a/stdlib/source/library/lux/meta/annotation.lux
+++ b/stdlib/source/library/lux/meta/annotation.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc (.example "Machinary for querying annotations on modules and definitions.")}
[library
[lux (#- nat int rev)
[abstract
diff --git a/stdlib/source/library/lux/meta/location.lux b/stdlib/source/library/lux/meta/location.lux
index 24511eb26..f8d3a9023 100644
--- a/stdlib/source/library/lux/meta/location.lux
+++ b/stdlib/source/library/lux/meta/location.lux
@@ -19,8 +19,6 @@
#.column 0})
(macro: .public (here tokens compiler)
- {#.doc (example "The Location of the current form."
- (here))}
(case tokens
#.End
(let [location (value@ #.location compiler)]
@@ -33,15 +31,15 @@
_
(#.Left (`` (("lux in-module" (~~ (static .prelude_module)) wrong_syntax_error) (name_of ..here))))))
-(def: .public (format value)
+(def: .public (format it)
(-> Location Text)
(let [separator ","
- [file line column] value]
+ [file line column] it]
($_ "lux text concat"
"@"
- (`` (("lux in-module" (~~ (static .prelude_module)) .text\encode) file)) separator
- (`` (("lux in-module" (~~ (static .prelude_module)) .nat\encode) line)) separator
- (`` (("lux in-module" (~~ (static .prelude_module)) .nat\encode) column)))))
+ (`` (("lux in-module" (~~ (static .prelude_module)) .text\encoded) file)) separator
+ (`` (("lux in-module" (~~ (static .prelude_module)) .nat\encoded) line)) separator
+ (`` (("lux in-module" (~~ (static .prelude_module)) .nat\encoded) column)))))
(def: \n
("lux i64 char" +10))
diff --git a/stdlib/source/library/lux/target.lux b/stdlib/source/library/lux/target.lux
index 0821593ea..fca7b2f6c 100644
--- a/stdlib/source/library/lux/target.lux
+++ b/stdlib/source/library/lux/target.lux
@@ -3,8 +3,6 @@
[lux #*]])
(type: .public Target
- {#.doc (example "The name/ID of a platform targetted by a Lux compiler."
- "This information can be used to generate code targetting specific platforms, and to make programs cross-platform.")}
Text)
(template [<name> <value>]
diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux
index a53fac36f..3019924da 100644
--- a/stdlib/source/library/lux/target/common_lisp.lux
+++ b/stdlib/source/library/lux/target/common_lisp.lux
@@ -7,7 +7,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." monad fold monoid)]]]
+ ["." list ("#\." monad monoid)]]]
[macro
["." template]]
[math
diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux
index 191b5520a..b2af12ac2 100644
--- a/stdlib/source/library/lux/target/js.lux
+++ b/stdlib/source/library/lux/target/js.lux
@@ -7,7 +7,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
["." template]]
[math
@@ -427,10 +427,10 @@
(def: .public (cond clauses else!)
(-> (List [Expression Statement]) Statement Statement)
- (list\fold (.function (_ [test then!] next!)
- (..if test then! next!))
- else!
- (list.reversed clauses)))
+ (list\mix (.function (_ [test then!] next!)
+ (..if test then! next!))
+ else!
+ (list.reversed clauses)))
(template [<apply> <arg>+ <type>+ <function>+]
[(`` (def: .public (<apply> function)
diff --git a/stdlib/source/library/lux/target/jvm/attribute/code.lux b/stdlib/source/library/lux/target/jvm/attribute/code.lux
index 81f487d2d..265c951a2 100644
--- a/stdlib/source/library/lux/target/jvm/attribute/code.lux
+++ b/stdlib/source/library/lux/target/jvm/attribute/code.lux
@@ -9,7 +9,7 @@
[format
[".F" binary (#+ Writer) ("#\." monoid)]]
[collection
- ["." row (#+ Row) ("#\." functor fold)]]]
+ ["." row (#+ Row) ("#\." functor mix)]]]
[math
[number
["n" nat]]]]]
@@ -51,7 +51,7 @@
(|> code
(value@ #attributes)
(row\map length)
- (row\fold n.+ 0))))
+ (row\mix n.+ 0))))
(def: .public (equivalence attribute_equivalence)
(All [attribute]
diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux
index a97f4a1c2..9b16b5be6 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode.lux
@@ -17,7 +17,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]
["." row (#+ Row)]]]
[macro
@@ -847,7 +847,7 @@
(in (let [@from (value@ #program_counter tracker)]
[[pool
environment'
- (|> (list\fold (..acknowledge_label actual) tracker (list& default at_minimum afterwards))
+ (|> (list\mix (..acknowledge_label actual) tracker (list& default at_minimum afterwards))
(with@ #program_counter program_counter'))]
[(function (_ resolver)
(let [get (: (-> Label (Maybe [Stack (Maybe Address)]))
@@ -890,7 +890,7 @@
(in (let [@from (value@ #program_counter tracker)]
[[pool
environment'
- (|> (list\fold (..acknowledge_label actual) tracker (list& default (list\map product.right cases)))
+ (|> (list\mix (..acknowledge_label actual) tracker (list& default (list\map product.right cases)))
(with@ #program_counter program_counter'))]
[(function (_ resolver)
(let [get (: (-> Label (Maybe [Stack (Maybe Address)]))
@@ -975,7 +975,7 @@
#//constant/pool.descriptor (type.descriptor type)})
.let [consumption (|> inputs
(list\map ..type_size)
- (list\fold n.+ (if <static?> 0 1))
+ (list\mix n.+ (if <static?> 0 1))
//unsigned.u1
try.trusted)
production (|> output ..type_size //unsigned.u1 try.trusted)]]
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 43cb70e87..b1d51e164 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
@@ -9,7 +9,7 @@
[format
[binary (#+ Writer)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["n" nat]]]
@@ -45,7 +45,7 @@
(same? /////type.double input))
..wide
..normal)))
- (list\fold n.+ 0))))
+ (list\mix n.+ 0))))
(template [<start> <name>]
[(def: .public <name>
diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux
index 586cc2394..0b792934b 100644
--- a/stdlib/source/library/lux/target/jvm/class.lux
+++ b/stdlib/source/library/lux/target/jvm/class.lux
@@ -73,12 +73,12 @@
[@this (//constant/pool.class this)
@super (//constant/pool.class super)
@interfaces (: (Resource (Row (Index //constant.Class)))
- (monad.fold ! (function (_ interface @interfaces)
- (do !
- [@interface (//constant/pool.class interface)]
- (in (row.suffix @interface @interfaces))))
- row.empty
- interfaces))]
+ (monad.mix ! (function (_ interface @interfaces)
+ (do !
+ [@interface (//constant/pool.class interface)]
+ (in (row.suffix @interface @interfaces))))
+ row.empty
+ interfaces))]
(in [@this @super @interfaces])))
(def: .public (class version modifier
diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux
index 346dd0f9e..99597756d 100644
--- a/stdlib/source/library/lux/target/jvm/constant/pool.lux
+++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux
@@ -14,7 +14,7 @@
["." format #_
["#" binary (#+ Writer) ("specification\." monoid)]]
[collection
- ["." row (#+ Row) ("#\." fold)]]]
+ ["." row (#+ Row) ("#\." mix)]]]
[macro
["." template]]
[math
@@ -147,10 +147,10 @@
(def: .public writer
(Writer Pool)
(function (_ [next pool])
- (row\fold (function (_ [_index post] pre)
- (specification\compose pre (//.writer post)))
- (format.bits/16 (!index next))
- pool)))
+ (row\mix (function (_ [_index post] pre)
+ (specification\compose pre (//.writer post)))
+ (format.bits/16 (!index next))
+ pool)))
(def: .public empty
Pool
diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux
index db554e4fb..f23e3c019 100644
--- a/stdlib/source/library/lux/target/jvm/reflection.lux
+++ b/stdlib/source/library/lux/target/jvm/reflection.lux
@@ -14,7 +14,7 @@
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold functor)]
+ ["." list ("#\." mix functor)]
["." array]
["." dictionary]]]
[math
@@ -305,9 +305,9 @@
(|> params
(list.zipped/2 (list\map (|>> java/lang/reflect/TypeVariable::getName)
class_params))
- (list\fold (function (_ [name paramT] mapping)
- (dictionary.has name paramT mapping))
- /lux.fresh)
+ (list\mix (function (_ [name paramT] mapping)
+ (dictionary.has name paramT mapping))
+ /lux.fresh)
#try.Success)
(exception.except ..type_parameter_mismatch [num_class_params num_type_params class type]))
(exception.except ..cannot_correspond [class type])))
diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux
index b70cf80f0..8bac227eb 100644
--- a/stdlib/source/library/lux/target/lua.lux
+++ b/stdlib/source/library/lux/target/lua.lux
@@ -14,7 +14,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
[syntax (#+ syntax:)]
["." template]
@@ -96,7 +96,7 @@
(-> Int Literal)
... Integers must be turned into hexadecimal to avoid quirks in how Lua parses integers.
... In particular, the number -9223372036854775808 will be incorrectly parsed as a float by Lua.
- (.let [to_hex (\ n.hex encode)]
+ (.let [to_hex (\ n.hex encoded)]
(|>> .nat
to_hex
(format "0x")
@@ -366,10 +366,10 @@
(def: .public (cond clauses else!)
(-> (List [Expression Statement]) Statement Statement)
- (list\fold (.function (_ [test then!] next!)
- (..if test then! next!))
- else!
- (list.reversed clauses)))
+ (list\mix (.function (_ [test then!] next!)
+ (..if test then! next!))
+ else!
+ (list.reversed clauses)))
(syntax: (arity_inputs [arity <code>.nat])
(in (case arity
diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux
index 860c33713..4d9817ae4 100644
--- a/stdlib/source/library/lux/target/php.lux
+++ b/stdlib/source/library/lux/target/php.lux
@@ -14,7 +14,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
[syntax (#+ syntax:)]
["." template]
@@ -136,7 +136,7 @@
(def: .public int
(-> Int Literal)
- (.let [to_hex (\ n.hex encode)]
+ (.let [to_hex (\ n.hex encoded)]
(|>> .nat
to_hex
(format "0x")
@@ -537,10 +537,10 @@
(def: .public (cond clauses else!)
(-> (List [Expression Statement]) Statement Statement)
- (list\fold (function (_ [test then!] next!)
- (..if test then! next!))
- else!
- (list.reversed clauses)))
+ (list\mix (function (_ [test then!] next!)
+ (..if test then! next!))
+ else!
+ (list.reversed clauses)))
(def: .public command_line_arguments
Var
diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux
index 06ad85593..47fbc7fdc 100644
--- a/stdlib/source/library/lux/target/python.lux
+++ b/stdlib/source/library/lux/target/python.lux
@@ -15,7 +15,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
[syntax (#+ syntax:)]
["." template]
@@ -452,10 +452,10 @@
(def: .public (cond clauses else!)
(-> (List [(Expression Any) (Statement Any)]) (Statement Any) (Statement Any))
- (list\fold (.function (_ [test then!] next!)
- (..if test then! next!))
- else!
- (list.reversed clauses)))
+ (list\mix (.function (_ [test then!] next!)
+ (..if test then! next!))
+ else!
+ (list.reversed clauses)))
(syntax: (arity_inputs [arity <code>.nat])
(in (case arity
diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux
index d5344a1c9..2b4fcede3 100644
--- a/stdlib/source/library/lux/target/r.lux
+++ b/stdlib/source/library/lux/target/r.lux
@@ -11,7 +11,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
[syntax (#+ syntax:)]
["." template]
@@ -264,10 +264,10 @@
(def: .public (cond clauses else)
(-> (List [Expression Expression]) Expression Expression)
- (list\fold (.function (_ [test then] next)
- (if test then next))
- else
- (list.reversed clauses)))
+ (list\mix (.function (_ [test then] next)
+ (if test then next))
+ else
+ (list.reversed clauses)))
(template [<name> <op>]
[(def: .public (<name> param subject)
diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux
index 954a91d97..a63a15d09 100644
--- a/stdlib/source/library/lux/target/ruby.lux
+++ b/stdlib/source/library/lux/target/ruby.lux
@@ -14,7 +14,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
[syntax (#+ syntax:)]
["." template]
@@ -428,10 +428,10 @@
(def: .public (cond clauses else!)
(-> (List [Expression Statement]) Statement Statement)
- (list\fold (.function (_ [test then!] next!)
- (..if test then! next!))
- else!
- (list.reversed clauses)))
+ (list\mix (.function (_ [test then!] next!)
+ (..if test then! next!))
+ else!
+ (list.reversed clauses)))
(syntax: (arity_inputs [arity <code>.nat])
(in (case arity
diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux
index 4390d9981..c91478519 100644
--- a/stdlib/source/library/lux/target/scheme.lux
+++ b/stdlib/source/library/lux/target/scheme.lux
@@ -11,7 +11,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold monoid)]]]
+ ["." list ("#\." functor monoid)]]]
[macro
["." template]]
[math
diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux
index e92cd49e4..8df92c80a 100644
--- a/stdlib/source/library/lux/test.lux
+++ b/stdlib/source/library/lux/test.lux
@@ -23,7 +23,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set (#+ Set)]
["." dictionary #_
["#" ordered (#+ Dictionary)]]]]
@@ -312,11 +312,11 @@
(def: encoded_coverage
(-> (List Text) Text)
- (list\fold (function (_ short aggregate)
- (case aggregate
- "" short
- _ (format aggregate ..coverage_separator short)))
- ""))
+ (list\mix (function (_ short aggregate)
+ (case aggregate
+ "" short
+ _ (format aggregate ..coverage_separator short)))
+ ""))
(def: (coverage module encoding)
(-> Text Text (Set Name))
@@ -383,11 +383,11 @@
[.let [module (name.module module)]
definitions (meta.definitions module)
.let [coverage (|> definitions
- (list\fold (function (_ [short [exported? _]] aggregate)
- (if exported?
- (#.Item short aggregate)
- aggregate))
- #.End)
+ (list\mix (function (_ [short [exported? _]] aggregate)
+ (if exported?
+ (#.Item short aggregate)
+ aggregate))
+ #.End)
..encoded_coverage)]]
(in (list (` ((~! ..covering')
(~ (code.text module))
@@ -438,7 +438,7 @@
(list\map product.right))]
(write! [(|> assertions
(list\map product.left)
- (list\fold ..total ..start))
+ (list\mix ..total ..start))
(|> assertions
(list\map product.right)
(text.interposed ..separator))]))
diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux
index c6206e167..051012a8d 100644
--- a/stdlib/source/library/lux/time.lux
+++ b/stdlib/source/library/lux/time.lux
@@ -45,8 +45,8 @@
(exception: .public (time_exceeds_a_day {time Nat})
(exception.report
- ["Time (in milli-seconds)" (n\encode time)]
- ["Maximum (in milli-seconds)" (n\encode (-- limit))]))
+ ["Time (in milli-seconds)" (n\encoded time)]
+ ["Maximum (in milli-seconds)" (n\encoded (-- limit))]))
(def: separator ":")
@@ -64,9 +64,9 @@
(template [<maximum> <parser> <exception> <sub_parser>]
[(exception: .public (<exception> {value Nat})
(exception.report
- ["Value" (n\encode value)]
- ["Minimum" (n\encode 0)]
- ["Maximum" (n\encode (-- <maximum>))]))
+ ["Value" (n\encoded value)]
+ ["Minimum" (n\encoded 0)]
+ ["Maximum" (n\encoded (-- <maximum>))]))
(def: <parser>
(Parser Nat)
@@ -156,8 +156,8 @@
(def: (padded value)
(-> Nat Text)
(if (n.< 10 value)
- (text\compose "0" (n\encode value))
- (n\encode value)))
+ (text\compose "0" (n\encoded value))
+ (n\encoded value)))
(def: (positive space duration)
(-> Duration Duration Duration)
@@ -168,10 +168,10 @@
(def: (millis_format millis)
(-> Nat Text)
(cond (n.= 0 millis) ""
- (n.< 10 millis) ($_ text\compose ".00" (n\encode millis))
- (n.< 100 millis) ($_ text\compose ".0" (n\encode millis))
+ (n.< 10 millis) ($_ text\compose ".00" (n\encoded millis))
+ (n.< 100 millis) ($_ text\compose ".0" (n\encoded millis))
... (n.< 1,000 millis)
- ($_ text\compose "." (n\encode millis))))
+ ($_ text\compose "." (n\encoded millis))))
(type: .public Clock
{#.doc (example "A clock marking the specific hour, minute, second, and milli-second in a day.")}
@@ -219,5 +219,5 @@
"For example: 21:14:51.827")}
(Codec Text Time)
- (def: encode ..format)
- (def: decode (<text>.result ..parser)))
+ (def: encoded ..format)
+ (def: decoded (<text>.result ..parser)))
diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux
index d06910711..dd2cae8de 100644
--- a/stdlib/source/library/lux/time/date.lux
+++ b/stdlib/source/library/lux/time/date.lux
@@ -16,7 +16,7 @@
[data
["." text ("#\." monoid)]
[collection
- ["." list ("#\." fold)]
+ ["." list ("#\." mix)]
["." dictionary (#+ Dictionary)]]]
[math
[number
@@ -30,10 +30,10 @@
(def: month_by_number
(Dictionary Nat Month)
- (list\fold (function (_ month mapping)
- (dictionary.has (//month.number month) month mapping))
- (dictionary.empty n.hash)
- //month.year))
+ (list\mix (function (_ month mapping)
+ (dictionary.has (//month.number month) month mapping))
+ (dictionary.empty n.hash)
+ //month.year))
(def: minimum_day
1)
@@ -51,15 +51,15 @@
(exception: .public (invalid_day {year Year} {month Month} {day Nat})
(exception.report
- ["Value" (n\encode day)]
- ["Minimum" (n\encode ..minimum_day)]
- ["Maximum" (n\encode (..month_days year month))]
- ["Year" (\ //year.codec encode year)]
- ["Month" (n\encode (//month.number month))]))
+ ["Value" (n\encoded day)]
+ ["Minimum" (n\encoded ..minimum_day)]
+ ["Maximum" (n\encoded (..month_days year month))]
+ ["Year" (\ //year.codec encoded year)]
+ ["Month" (n\encoded (//month.number month))]))
(def: (padded value)
(-> Nat Text)
- (let [digits (n\encode value)]
+ (let [digits (n\encoded value)]
(if (n.< 10 value)
(text\compose "0" digits)
digits)))
@@ -155,9 +155,9 @@
(template [<minimum> <maximum> <parser> <exception>]
[(exception: .public (<exception> {value Nat})
(exception.report
- ["Value" (n\encode value)]
- ["Minimum" (n\encode <minimum>)]
- ["Maximum" (n\encode <maximum>)]))
+ ["Value" (n\encoded value)]
+ ["Minimum" (n\encoded <minimum>)]
+ ["Maximum" (n\encoded <maximum>)]))
(def: <parser>
(Parser Nat)
@@ -185,7 +185,7 @@
(def: (format value)
(-> Date Text)
($_ text\compose
- (\ //year.codec encode (..year value))
+ (\ //year.codec encoded (..year value))
..separator (..padded (|> value ..month //month.number))
..separator (..padded (..day_of_month value))))
@@ -194,8 +194,8 @@
"For example: 2017-01-15")}
(Codec Text Date)
- (def: encode ..format)
- (def: decode (<text>.result ..parser)))
+ (def: encoded ..format)
+ (def: decoded (<text>.result ..parser)))
(def: days_per_leap
(|> //year.days
diff --git a/stdlib/source/library/lux/time/day.lux b/stdlib/source/library/lux/time/day.lux
index b44ace3a8..e091d2d5b 100644
--- a/stdlib/source/library/lux/time/day.lux
+++ b/stdlib/source/library/lux/time/day.lux
@@ -98,7 +98,7 @@
(implementation: .public codec
(Codec Text Day)
- (def: (encode value)
+ (def: (encoded value)
(case value
(^template [<tag>]
[<tag> (template.text [<tag>])])
@@ -109,7 +109,7 @@
[#..Friday]
[#..Saturday]
[#..Sunday])))
- (def: (decode value)
+ (def: (decoded value)
(case value
(^template [<tag>]
[(^ (template.text [<tag>])) (#try.Success <tag>)])
@@ -149,11 +149,11 @@
(exception: .public (invalid_day {number Nat})
(exception.report
- ["Number" (\ n.decimal encode number)]
+ ["Number" (\ n.decimal encoded number)]
["Valid range" ($_ "lux text concat"
- (\ n.decimal encode (..number #Sunday))
+ (\ n.decimal encoded (..number #Sunday))
" ~ "
- (\ n.decimal encode (..number #Saturday)))]))
+ (\ n.decimal encoded (..number #Saturday)))]))
(def: .public (by_number number)
(-> Nat (Try Day))
diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux
index 995d0c678..f36e0dff1 100644
--- a/stdlib/source/library/lux/time/duration.lux
+++ b/stdlib/source/library/lux/time/duration.lux
@@ -127,11 +127,11 @@
["-" negative_sign]
)
-(def: (encode duration)
+(def: (encoded duration)
(if (\ ..equivalence = ..empty duration)
($_ text\compose
..positive_sign
- (nat\encode 0)
+ (nat\encoded 0)
..milli_second_suffix)
(let [signed? (negative? duration)
[days time_left] [(ticks day duration) (framed day duration)]
@@ -147,11 +147,11 @@
millis (..millis time_left)]
($_ text\compose
(if signed? ..negative_sign ..positive_sign)
- (if (i.= +0 days) "" (text\compose (nat\encode (.nat days)) ..day_suffix))
- (if (i.= +0 hours) "" (text\compose (nat\encode (.nat hours)) ..hour_suffix))
- (if (i.= +0 minutes) "" (text\compose (nat\encode (.nat minutes)) ..minute_suffix))
- (if (i.= +0 seconds) "" (text\compose (nat\encode (.nat seconds)) ..second_suffix))
- (if (i.= +0 millis) "" (text\compose (nat\encode (.nat millis)) ..milli_second_suffix))
+ (if (i.= +0 days) "" (text\compose (nat\encoded (.nat days)) ..day_suffix))
+ (if (i.= +0 hours) "" (text\compose (nat\encoded (.nat hours)) ..hour_suffix))
+ (if (i.= +0 minutes) "" (text\compose (nat\encoded (.nat minutes)) ..minute_suffix))
+ (if (i.= +0 seconds) "" (text\compose (nat\encoded (.nat seconds)) ..second_suffix))
+ (if (i.= +0 millis) "" (text\compose (nat\encoded (.nat millis)) ..milli_second_suffix))
))))
(def: parser
@@ -186,8 +186,8 @@
(implementation: .public codec
(Codec Text Duration)
- (def: encode ..encode)
- (def: decode (<text>.result ..parser)))
+ (def: encoded ..encoded)
+ (def: decoded (<text>.result ..parser)))
(def: .public (difference from to)
(-> Duration Duration Duration)
diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux
index f454c1425..5b7b0e493 100644
--- a/stdlib/source/library/lux/time/instant.lux
+++ b/stdlib/source/library/lux/time/instant.lux
@@ -129,8 +129,8 @@
(let [[date time] (..date_time instant)
time (..clock_time time)]
($_ text\compose
- (\ date.codec encode date) ..date_suffix
- (\ //.codec encode time) ..time_suffix)))
+ (\ date.codec encoded date) ..date_suffix
+ (\ //.codec encoded time) ..time_suffix)))
(def: parser
(Parser Instant)
@@ -152,8 +152,8 @@
"For example: 2017-01-15T21:14:51.827Z")}
(Codec Text Instant)
- (def: encode ..format)
- (def: decode (<text>.result ..parser)))
+ (def: encoded ..format)
+ (def: decoded (<text>.result ..parser)))
(def: .public now
{#.doc (example "Yields the current instant, as measured from the operating-system's clock.")}
diff --git a/stdlib/source/library/lux/time/month.lux b/stdlib/source/library/lux/time/month.lux
index 07fcc6269..216365ac8 100644
--- a/stdlib/source/library/lux/time/month.lux
+++ b/stdlib/source/library/lux/time/month.lux
@@ -78,11 +78,11 @@
(exception: .public (invalid_month {number Nat})
(exception.report
- ["Number" (\ n.decimal encode number)]
+ ["Number" (\ n.decimal encoded number)]
["Valid range" ($_ "lux text concat"
- (\ n.decimal encode (..number #January))
+ (\ n.decimal encoded (..number #January))
" ~ "
- (\ n.decimal encode (..number #December)))]))
+ (\ n.decimal encoded (..number #December)))]))
(def: .public (by_number number)
(-> Nat (Try Month))
@@ -210,7 +210,7 @@
(implementation: .public codec
(Codec Text Month)
- (def: (encode value)
+ (def: (encoded value)
(case value
(^template [<tag>]
[<tag> (template.text [<tag>])])
@@ -226,7 +226,7 @@
[#..October]
[#..November]
[#..December])))
- (def: (decode value)
+ (def: (decoded value)
(case value
(^template [<tag>]
[(^ (template.text [<tag>])) (#try.Success <tag>)])
diff --git a/stdlib/source/library/lux/time/year.lux b/stdlib/source/library/lux/time/year.lux
index 3eb12ad90..4347aff81 100644
--- a/stdlib/source/library/lux/time/year.lux
+++ b/stdlib/source/library/lux/time/year.lux
@@ -112,12 +112,12 @@
))
(..with_year_0_leap year)))))
-(def: (encode year)
+(def: (encoded year)
(-> Year Text)
(let [year (..value year)]
(if (i.< +0 year)
- (i\encode year)
- (n\encode (.nat year)))))
+ (i\encoded year)
+ (n\encoded (.nat year)))))
(def: .public parser
(Parser Year)
@@ -134,8 +134,8 @@
"For example: 2017")}
(Codec Text Year)
- (def: encode ..encode)
- (def: decode (<text>.result ..parser)))
+ (def: encoded ..encoded)
+ (def: decoded (<text>.result ..parser)))
(implementation: .public equivalence
(Equivalence Year)
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index b5eed68f8..1894359a9 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -22,9 +22,9 @@
["%" format (#+ format)]]
[collection
["." dictionary (#+ Dictionary)]
- ["." row (#+ Row) ("#\." fold)]
+ ["." row (#+ Row) ("#\." mix)]
["." set (#+ Set)]
- ["." list ("#\." monoid functor fold)]]
+ ["." list ("#\." monoid functor mix)]]
[format
["_" binary (#+ Writer)]]]
[world
@@ -280,9 +280,9 @@
#///directive.state
#extension.state
#///generation.log])
- (row\fold (function (_ right left)
- (format left ..compilation_log_separator right))
- module)))
+ (row\mix (function (_ right left)
+ (format left ..compilation_log_separator right))
+ module)))
(def: with_reset_log
(All [<type_vars>]
@@ -329,10 +329,10 @@
(|> mapping
(dictionary.revised' source ..empty (set.has target))
(dictionary.revised source (set.union forward)))]
- (list\fold (function (_ previous)
- (dictionary.revised' previous ..empty (set.has target)))
- with_dependence+transitives
- (set.list backward))))))]
+ (list\mix (function (_ previous)
+ (dictionary.revised' previous ..empty (set.has target)))
+ with_dependence+transitives
+ (set.list backward))))))]
(|> dependence
(revised@ #depends_on
(update_dependence
@@ -561,17 +561,17 @@
... This currently assumes that all imports will be specified once in a single .module: form.
... This might not be the case in the future.
[all_dependencies duplicates _] (: [(Set Module) (Set Module) Bit]
- (list\fold (function (_ new [all duplicates seen_prelude?])
- (if (set.member? all new)
- (if (text\= .prelude_module new)
- (if seen_prelude?
- [all (set.has new duplicates) seen_prelude?]
- [all duplicates true])
- [all (set.has new duplicates) seen_prelude?])
- [(set.has new all) duplicates seen_prelude?]))
- (: [(Set Module) (Set Module) Bit]
- [all_dependencies ..empty (set.empty? all_dependencies)])
- new_dependencies))]
+ (list\mix (function (_ new [all duplicates seen_prelude?])
+ (if (set.member? all new)
+ (if (text\= .prelude_module new)
+ (if seen_prelude?
+ [all (set.has new duplicates) seen_prelude?]
+ [all duplicates true])
+ [all (set.has new duplicates) seen_prelude?])
+ [(set.has new all) duplicates seen_prelude?]))
+ (: [(Set Module) (Set Module) Bit]
+ [all_dependencies ..empty (set.empty? all_dependencies)])
+ new_dependencies))]
[archive state] (if (set.empty? duplicates)
(case new_dependencies
#.End
@@ -584,7 +584,7 @@
(monad.all ..monad))
.let [archive (|> archive,document+
(list\map product.left)
- (list\fold archive.merged archive))]]
+ (list\mix archive.merged archive))]]
(in [archive (try.trusted
(..updated_state archive state))])))
(async\in (exception.except ..cannot_import_twice [module duplicates])))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
index 45216a70f..6d1f355ba 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
@@ -16,7 +16,7 @@
["." text ("#\." equivalence)
["%" format (#+ Format format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["n" nat]
@@ -262,10 +262,10 @@
(def: .public (apply [abstraction inputs])
(-> (Application Analysis) Analysis)
- (list\fold (function (_ input abstraction')
- (#Apply input abstraction'))
- abstraction
- inputs))
+ (list\mix (function (_ input abstraction')
+ (#Apply input abstraction'))
+ abstraction
+ inputs))
(def: .public (application analysis)
(-> Analysis (Application Analysis))
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 fc7575260..6c31960e4 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
@@ -13,7 +13,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold monoid functor)]]]
+ ["." list ("#\." mix monoid functor)]]]
[math
[number
["n" nat]]]
@@ -216,19 +216,19 @@
_
(undefined)))]
(do !
- [[memberP+ thenA] (list\fold (: (All [a]
- (-> [Type Code] (Operation [(List Pattern) a])
- (Operation [(List Pattern) a])))
- (function (_ [memberT memberC] then)
- (do !
- [[memberP [memberP+ thenA]] ((:as (All [a] (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a])))
- analyse_pattern)
- #.None memberT memberC then)]
- (in [(list& memberP memberP+) thenA]))))
- (do !
- [nextA next]
- (in [(list) nextA]))
- matches)]
+ [[memberP+ thenA] (list\mix (: (All [a]
+ (-> [Type Code] (Operation [(List Pattern) a])
+ (Operation [(List Pattern) a])))
+ (function (_ [memberT memberC] then)
+ (do !
+ [[memberP [memberP+ thenA]] ((:as (All [a] (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a])))
+ analyse_pattern)
+ #.None memberT memberC then)]
+ (in [(list& memberP memberP+) thenA]))))
+ (do !
+ [nextA next]
+ (in [(list) nextA]))
+ matches)]
(in [(/.pattern/tuple memberP+)
thenA])))
@@ -320,7 +320,7 @@
branchesT)
outputHC (|> outputH product.left /coverage.determine)
outputTC (monad.map ! (|>> product.left /coverage.determine) outputT)
- _ (.case (monad.fold try.monad /coverage.merged outputHC outputTC)
+ _ (.case (monad.mix try.monad /coverage.merged outputHC outputTC)
(#try.Success coverage)
(///.assertion non_exhaustive_pattern_matching [inputC branches coverage]
(/coverage.exhaustive? coverage))
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 e7efacf3c..753f6a13e 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
@@ -13,7 +13,7 @@
["." text
["%" format (#+ Format format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]]]
[math
[number
@@ -128,17 +128,17 @@
(#.Item lastP prevsP+)
(do ////.monad
[lastC (determine lastP)]
- (monad.fold ////.monad
- (function (_ leftP rightC)
- (do ////.monad
- [leftC (determine leftP)]
- (case rightC
- #Exhaustive
- (in leftC)
-
- _
- (in (#Seq leftC rightC)))))
- lastC prevsP+)))
+ (monad.mix ////.monad
+ (function (_ leftP rightC)
+ (do ////.monad
+ [leftC (determine leftP)]
+ (case rightC
+ #Exhaustive
+ (in leftC)
+
+ _
+ (in (#Seq leftC rightC)))))
+ lastC prevsP+)))
... Variant patterns can be shown to be exhaustive if all the possible
... cases are handled exhaustively.
@@ -243,17 +243,17 @@
... else
(do {! try.monad}
- [casesM (monad.fold !
- (function (_ [tagA coverageA] casesSF')
- (case (dictionary.value tagA casesSF')
- (#.Some coverageSF)
- (do !
- [coverageM (merged coverageA coverageSF)]
- (in (dictionary.has tagA coverageM casesSF')))
-
- #.None
- (in (dictionary.has tagA coverageA casesSF'))))
- casesSF (dictionary.entries casesA))]
+ [casesM (monad.mix !
+ (function (_ [tagA coverageA] casesSF')
+ (case (dictionary.value tagA casesSF')
+ (#.Some coverageSF)
+ (do !
+ [coverageM (merged coverageA coverageSF)]
+ (in (dictionary.has tagA coverageM casesSF')))
+
+ #.None
+ (in (dictionary.has tagA coverageA casesSF'))))
+ casesSF (dictionary.entries casesA))]
(in (if (and (or (known_cases? addition_cases)
(known_cases? so_far_cases))
(n.= (++ (n.max addition_cases so_far_cases))
@@ -360,9 +360,9 @@
#.None
(case (list.reversed possibilitiesSF)
(#.Item last prevs)
- (in (list\fold (function (_ left right) (#Alt left right))
- last
- prevs))
+ (in (list\mix (function (_ left right) (#Alt left right))
+ last
+ prevs))
#.End
(undefined)))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux
index 8aa2f284f..3589b7224 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux
@@ -10,7 +10,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold monoid monad)]]]
+ ["." list ("#\." monoid monad)]]]
["." type
["." check]]
["." meta]]]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux
index 14e08a4c0..abe4b8df6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux
@@ -11,7 +11,7 @@
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold functor)]
+ ["." list ("#\." mix functor)]
[dictionary
["." plist]]]]
["." meta]]]
@@ -264,10 +264,10 @@
(#try.Success [(revised@ #.modules
(plist.revised self_name
(|>> (revised@ #.tags (function (_ tag_bindings)
- (list\fold (function (_ [idx tag] table)
- (plist.has tag [idx namespaced_tags exported? type] table))
- tag_bindings
- (list.enumeration tags))))
+ (list\mix (function (_ [idx tag] table)
+ (plist.has tag [idx namespaced_tags exported? type] table))
+ tag_bindings
+ (list.enumeration tags))))
(revised@ #.types (plist.has type_name [namespaced_tags exported? type]))))
state)
[]]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux
index 44d3b7deb..b859c7528 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux
@@ -11,7 +11,7 @@
["." text ("#\." equivalence)]
["." product]
[collection
- ["." list ("#\." functor fold monoid)]
+ ["." list ("#\." functor mix monoid)]
[dictionary
["." plist]]]]]]
["." /// #_
@@ -90,17 +90,17 @@
(#.Item top_outer _)
(let [[ref_type init_ref] (maybe.else (undefined)
(..reference name top_outer))
- [ref inner'] (list\fold (: (-> Scope [Variable (List Scope)] [Variable (List Scope)])
- (function (_ scope ref+inner)
- [(#variable.Foreign (value@ [#.captured #.counter] scope))
- (#.Item (revised@ #.captured
- (: (-> Foreign Foreign)
- (|>> (revised@ #.counter ++)
- (revised@ #.mappings (plist.has name [ref_type (product.left ref+inner)]))))
- scope)
- (product.right ref+inner))]))
- [init_ref #.End]
- (list.reversed inner))
+ [ref inner'] (list\mix (: (-> Scope [Variable (List Scope)] [Variable (List Scope)])
+ (function (_ scope ref+inner)
+ [(#variable.Foreign (value@ [#.captured #.counter] scope))
+ (#.Item (revised@ #.captured
+ (: (-> Foreign Foreign)
+ (|>> (revised@ #.counter ++)
+ (revised@ #.mappings (plist.has name [ref_type (product.left ref+inner)]))))
+ scope)
+ (product.right ref+inner))]))
+ [init_ref #.End]
+ (list.reversed inner))
scopes (list\compose inner' outer)]
(#.Right [(with@ #.scopes scopes state)
(#.Some [ref_type ref])]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
index 886ffe065..b23704981 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
@@ -318,21 +318,21 @@
(/.except ..record_size_mismatch [size_ts size_record recordT record]))
.let [tuple_range (list.indices size_ts)
tag->idx (dictionary.of_list name.hash (list.zipped/2 tag_set tuple_range))]
- idx->val (monad.fold !
- (function (_ [key val] idx->val)
- (do !
- [key (///extension.lifted (meta.normal key))]
- (case (dictionary.value key tag->idx)
- (#.Some idx)
- (if (dictionary.key? idx->val idx)
- (/.except ..cannot_repeat_tag [key record])
- (in (dictionary.has idx val idx->val)))
-
- #.None
- (/.except ..tag_does_not_belong_to_record [key recordT]))))
- (: (Dictionary Nat Code)
- (dictionary.empty n.hash))
- record)
+ idx->val (monad.mix !
+ (function (_ [key val] idx->val)
+ (do !
+ [key (///extension.lifted (meta.normal key))]
+ (case (dictionary.value key tag->idx)
+ (#.Some idx)
+ (if (dictionary.key? idx->val idx)
+ (/.except ..cannot_repeat_tag [key record])
+ (in (dictionary.has idx val idx->val)))
+
+ #.None
+ (/.except ..tag_does_not_belong_to_record [key recordT]))))
+ (: (Dictionary Nat Code)
+ (dictionary.empty n.hash))
+ record)
.let [ordered_tuple (list\map (function (_ idx)
(maybe.trusted (dictionary.value idx idx->val)))
tuple_range)]]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
index 3c6425da3..98163f30d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
@@ -11,7 +11,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold monoid)]]]]]
+ ["." list ("#\." mix monoid)]]]]]
["." // #_
["#." extension]
["#." analysis
@@ -101,7 +101,7 @@
_
(|> expansion
(monad.map ! (recur archive))
- (\ ! map (list\fold /.merge_requirements /.no_requirements)))))
+ (\ ! map (list\mix /.merge_requirements /.no_requirements)))))
_
(//.except ..not_a_directive code)))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux
index 206ae9f64..18da2442f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux
@@ -103,10 +103,10 @@
(-> Extender (Bundle s i o) (Operation s i o Any)))
(|> extensions
dictionary.entries
- (monad.fold //.monad
- (function (_ [extension handle] output)
- (..install extender extension handle))
- [])))
+ (monad.mix //.monad
+ (function (_ [extension handle] output)
+ (..install extender extension handle))
+ [])))
(def: .public (apply archive phase [name parameters])
(All [s i o]
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 508242cd8..d4ffdbb2b 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
@@ -18,7 +18,7 @@
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold monad monoid)]
+ ["." list ("#\." mix monad monoid)]
["." array]
["." dictionary (#+ Dictionary)]]]
[math
@@ -1110,20 +1110,20 @@
true)
arity_matches? (n.= (list.size inputsJT) (list.size parameters))
inputs_match? (and arity_matches?
- (list\fold (function (_ [expectedJC actualJC] prev)
- (and prev
- (jvm\= expectedJC (: (Type Value)
- (case (jvm_parser.var? actualJC)
- (#.Some name)
- (|> aliasing
- (dictionary.value name)
- (maybe.else name)
- jvm.var)
-
- #.None
- actualJC)))))
- true
- (list.zipped/2 parameters inputsJT)))]]
+ (list\mix (function (_ [expectedJC actualJC] prev)
+ (and prev
+ (jvm\= expectedJC (: (Type Value)
+ (case (jvm_parser.var? actualJC)
+ (#.Some name)
+ (|> aliasing
+ (dictionary.value name)
+ (maybe.else name)
+ jvm.var)
+
+ #.None
+ actualJC)))))
+ true
+ (list.zipped/2 parameters inputsJT)))]]
(in (and correct_class?
correct_method?
static_matches?
@@ -1685,7 +1685,7 @@
[scope bodyA] (|> arguments'
(#.Item [self_name selfT])
list.reversed
- (list\fold scope.with_local (analyse archive body))
+ (list\mix scope.with_local (analyse archive body))
(typeA.with_type .Any)
/////analysis.with_scope)]
(in (/////analysis.tuple (list (/////analysis.text ..constructor_tag)
@@ -1761,7 +1761,7 @@
[scope bodyA] (|> arguments'
(#.Item [self_name selfT])
list.reversed
- (list\fold scope.with_local (analyse archive body))
+ (list\mix scope.with_local (analyse archive body))
(typeA.with_type returnT)
/////analysis.with_scope)]
(in (/////analysis.tuple (list (/////analysis.text ..virtual_tag)
@@ -1834,7 +1834,7 @@
arguments)
[scope bodyA] (|> arguments'
list.reversed
- (list\fold scope.with_local (analyse archive body))
+ (list\mix scope.with_local (analyse archive body))
(typeA.with_type returnT)
/////analysis.with_scope)]
(in (/////analysis.tuple (list (/////analysis.text ..static_tag)
@@ -1930,19 +1930,19 @@
check.existential)]
(in [var exT])))
vars)]
- (in (list\fold (function (_ [varJ varT] mapping)
- (dictionary.has (jvm_parser.name varJ) varT mapping))
- mapping
- pairings))))
+ (in (list\mix (function (_ [varJ varT] mapping)
+ (dictionary.has (jvm_parser.name varJ) varT mapping))
+ mapping
+ pairings))))
(def: .public (with_override_mapping supers parent_type mapping)
(-> (List (Type Class)) (Type Class) Mapping (Operation Mapping))
(do phase.monad
[override_mapping (..override_mapping mapping supers parent_type)]
- (in (list\fold (function (_ [super_var bound_type] mapping)
- (dictionary.has super_var bound_type mapping))
- mapping
- override_mapping))))
+ (in (list\mix (function (_ [super_var bound_type] mapping)
+ (dictionary.has super_var bound_type mapping))
+ mapping
+ override_mapping))))
(def: .public (hide_method_body arity bodyA)
(-> Nat Analysis Analysis)
@@ -2001,7 +2001,7 @@
[scope bodyA] (|> arguments'
(#.Item [self_name selfT])
list.reversed
- (list\fold scope.with_local (analyse archive body))
+ (list\mix scope.with_local (analyse archive body))
(typeA.with_type returnT)
/////analysis.with_scope)]
(in (/////analysis.tuple (list (/////analysis.text ..overriden_tag)
@@ -2066,14 +2066,14 @@
(n.= (list.size expected_parameters)
(list.size actual_parameters)))]
(in (|> (list.zipped/2 expected_parameters actual_parameters)
- (list\fold (function (_ [expected actual] mapping)
- (case (jvm_parser.var? actual)
- (#.Some actual)
- (dictionary.has actual expected mapping)
-
- #.None
- mapping))
- jvm_alias.fresh)))))
+ (list\mix (function (_ [expected actual] mapping)
+ (case (jvm_parser.var? actual)
+ (#.Some actual)
+ (dictionary.has actual expected mapping)
+
+ #.None
+ mapping))
+ jvm_alias.fresh)))))
(def: (anonymous_class_name module id)
(-> Module Nat Text)
@@ -2125,12 +2125,12 @@
_ (monad.map ! (|>> ..reflection (..ensure_fresh_class! class_loader)) super_interfaces)
parameters (typeA.with_env
(..parameter_types parameters))
- .let [mapping (list\fold (function (_ [parameterJ parameterT] mapping)
- (dictionary.has (jvm_parser.name parameterJ)
- parameterT
- mapping))
- luxT.fresh
- parameters)]
+ .let [mapping (list\mix (function (_ [parameterJ parameterT] mapping)
+ (dictionary.has (jvm_parser.name parameterJ)
+ parameterT
+ mapping))
+ luxT.fresh
+ parameters)]
super_classT (typeA.with_env
(luxT.check (luxT.class mapping) (..signature super_class)))
super_interfaceT+ (typeA.with_env
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 0242d94b6..29de45227 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
@@ -14,7 +14,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary]
["." row]]]
[macro
@@ -263,10 +263,10 @@
[parameters (directive.lifted_analysis
(typeA.with_env
(jvm.parameter_types parameters)))
- .let [mapping (list\fold (function (_ [parameterJ parameterT] mapping)
- (dictionary.has (parser.name parameterJ) parameterT mapping))
- luxT.fresh
- parameters)]
+ .let [mapping (list\mix (function (_ [parameterJ parameterT] mapping)
+ (dictionary.has (parser.name parameterJ) parameterT mapping))
+ luxT.fresh
+ parameters)]
super_classT (directive.lifted_analysis
(typeA.with_env
(luxT.check (luxT.class mapping) (..signature super_class))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux
index e8518812e..49b696138 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux
@@ -15,7 +15,7 @@
[collection
["." dictionary]
["." set]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
@@ -75,7 +75,7 @@
... branchG])))
... conditionals))]
... (in (_.let (list [@input inputG])
-... (list (list\fold (function (_ [test then] else)
+... (list (list\mix (function (_ [test then] else)
... (_.if test then else))
... elseG
... conditionalsG))))))]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux
index 0e0c91e60..142691489 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux
@@ -14,7 +14,7 @@
["%" format (#+ format)]]
[collection
["." dictionary]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
@@ -70,18 +70,18 @@
[branchG (phase archive branch)]
(in [(|> chars
(list\map (|>> .int _.int (_.= @input)))
- (list\fold (function (_ clause total)
- (if (same? _.nil total)
- clause
- (_.or clause total)))
- _.nil))
+ (list\mix (function (_ clause total)
+ (if (same? _.nil total)
+ clause
+ (_.or clause total)))
+ _.nil))
branchG])))
conditionals))
.let [closure (_.closure (list @input)
- (list\fold (function (_ [test then] else)
- (_.if test (_.return then) else))
- (_.return elseG)
- conditionalsG))]]
+ (list\mix (function (_ [test then] else)
+ (_.if test (_.return then) else))
+ (_.return elseG)
+ conditionalsG))]]
(in (_.apply/1 closure inputG))))]))
(def: lux_procs
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 02ddfbd71..3acac79be 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
@@ -15,7 +15,7 @@
[collection
["." dictionary]
["." set]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
@@ -74,11 +74,11 @@
[branchG (phase archive branch)]
(in [(|> chars
(list\map (|>> .int _.int (_.=== @input)))
- (list\fold (function (_ clause total)
- (if (same? _.null total)
- clause
- (_.or clause total)))
- _.null))
+ (list\mix (function (_ clause total)
+ (if (same? _.null total)
+ clause
+ (_.or clause total)))
+ _.null))
branchG])))
conditionals))
.let [foreigns (|> conditionals
@@ -89,10 +89,10 @@
set.list)
@expression (_.constant (reference.artifact [context_module context_artifact]))
directive (_.define_function @expression (list& (_.parameter @input) (list\map _.reference foreigns))
- (list\fold (function (_ [test then] else)
- (_.if test (_.return then) else))
- (_.return elseG)
- conditionalsG))]
+ (list\mix (function (_ [test then] else)
+ (_.if test (_.return then) else))
+ (_.return elseG)
+ conditionalsG))]
_ (generation.execute! directive)
_ (generation.save! context_artifact directive)]
(in (_.apply/* (list& inputG foreigns) @expression))))]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
index c531d05d9..6f51e40f1 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
@@ -14,26 +14,72 @@
["%" format (#+ format)]]
[collection
["." dictionary]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
[target
- ["_" python (#+ Expression)]]]]
+ ["_" python (#+ Expression Statement)]]]]
["." //// #_
["/" bundle]
["/#" // #_
["." extension]
[generation
+ ["." reference]
[extension (#+ Nullary Unary Binary Trinary
nullary unary binary trinary)]
["//" python #_
- ["#." runtime (#+ Operation Phase Handler Bundle Generator)]]]
+ ["#." runtime (#+ Operation Phase Phase! Handler Bundle Generator)]
+ ["#." primitive]
+ ["#." structure]
+ ["#." reference]
+ ["#." function]
+ ["#." case]
+ ["#." loop]]]
[//
- [synthesis (#+ %synthesis)]
+ [analysis (#+)]
+ ["." synthesis (#+ %synthesis)]
["." generation]
[///
- ["#" phase]]]]])
+ ["#" phase ("#\." monad)]]]]])
+
+(def: .public (statement expression archive synthesis)
+ Phase!
+ (case synthesis
+ ... TODO: Get rid of this ASAP
+ (#synthesis.Extension "lux syntax char case!" parameters)
+ (do /////.monad
+ [body (expression archive synthesis)]
+ (in (:as (Statement Any) body)))
+
+ (^template [<tag>]
+ [(^ (<tag> value))
+ (/////\map _.return (expression archive synthesis))])
+ ([synthesis.bit]
+ [synthesis.i64]
+ [synthesis.f64]
+ [synthesis.text]
+ [synthesis.variant]
+ [synthesis.tuple]
+ [#synthesis.Reference]
+ [synthesis.branch/get]
+ [synthesis.function/apply]
+ [#synthesis.Extension])
+
+ (^ (synthesis.branch/case case))
+ (//case.case! false statement expression archive case)
+
+ (^template [<tag> <generator>]
+ [(^ (<tag> value))
+ (<generator> statement expression archive value)])
+ ([synthesis.branch/let //case.let!]
+ [synthesis.branch/if //case.if!]
+ [synthesis.loop/scope //loop.scope!]
+ [synthesis.loop/recur //loop.recur!])
+
+ (^ (synthesis.function/abstraction abstraction))
+ (/////\map _.return (//function.function statement expression archive abstraction))
+ ))
(def: .public (custom [parser handler])
(All [s]
@@ -59,28 +105,48 @@
(function (_ extension_name phase archive [input else conditionals])
(do {! /////.monad}
[inputG (phase archive input)
- elseG (phase archive else)
+ else! (..statement phase archive else)
@input (\ ! map _.var (generation.identifier "input"))
- conditionalsG (: (Operation (List [(Expression Any)
- (Expression Any)]))
+ conditionals! (: (Operation (List [(Expression Any)
+ (Statement Any)]))
(monad.map ! (function (_ [chars branch])
(do !
- [branchG (phase archive branch)]
+ [branch! (..statement phase archive branch)]
(in [(|> chars
(list\map (|>> .int _.int (_.= @input)))
- (list\fold (function (_ clause total)
- (if (same? _.none total)
- clause
- (_.or clause total)))
- _.none))
- branchG])))
+ (list\mix (function (_ clause total)
+ (if (same? _.none total)
+ clause
+ (_.or clause total)))
+ _.none))
+ branch!])))
conditionals))
- .let [closure (_.lambda (list @input)
- (list\fold (function (_ [test then] else)
- (_.? test then else))
- elseG
- conditionalsG))]]
- (in (_.apply/* closure (list inputG)))))]))
+ ... .let [dependencies (//case.dependencies (list\mix (function (_ right left)
+ ... (synthesis.path/seq left right))
+ ... (synthesis.path/then input)
+ ... (#.Item (synthesis.path/then else)
+ ... (list\map (|>> product.right
+ ... synthesis.path/then)
+ ... conditionals))))
+ ... @closure (_.var (reference.artifact artifact_id))
+ ... closure (_.def @closure dependencies
+ ... ($_ _.then
+ ... (_.set (list @input) inputG)
+ ... (list\mix (function (_ [test then!] else!)
+ ... (_.if test then! else!))
+ ... else!
+ ... conditionals!)))]
+ ... _ (generation.execute! closure)
+ ... _ (generation.save! (product.right artifact_id) #.None closure)
+ ]
+ ... (in (_.apply/* @closure dependencies))
+ (in (:as (Expression Any)
+ ($_ _.then
+ (_.set (list @input) inputG)
+ (list\mix (function (_ [test then!] else!)
+ (_.if test then! else!))
+ else!
+ conditionals!))))))]))
(def: lux_procs
Bundle
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux
index 25e244035..3cc7cf91c 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux
@@ -15,7 +15,7 @@
[collection
["." dictionary]
["." set]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
@@ -75,7 +75,7 @@
... ... branchG])))
... ... conditionals))]
... ... (in (_.let (list [@input inputG])
-... ... (list (list\fold (function (_ [test then] else)
+... ... (list (list\mix (function (_ [test then] else)
... ... (_.if test then else))
... ... elseG
... ... conditionalsG))))))]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
index db479ccd3..253b342e8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
@@ -14,7 +14,7 @@
["%" format (#+ format)]]
[collection
["." dictionary]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
@@ -67,18 +67,18 @@
[branchG (phase archive branch)]
(in [(|> chars
(list\map (|>> .int _.int (_.= @input)))
- (list\fold (function (_ clause total)
- (if (same? _.nil total)
- clause
- (_.or clause total)))
- _.nil))
+ (list\mix (function (_ clause total)
+ (if (same? _.nil total)
+ clause
+ (_.or clause total)))
+ _.nil))
branchG])))
conditionals))
.let [closure (_.lambda #.None (list @input)
- (list\fold (function (_ [test then] else)
- (_.if test (_.return then) else))
- (_.return elseG)
- conditionalsG))]]
+ (list\mix (function (_ [test then] else)
+ (_.if test (_.return then) else))
+ (_.return elseG)
+ conditionalsG))]]
(in (_.apply_lambda/* (list inputG) closure))))]))
(def: lux_procs
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux
index 2b2fca71f..79c3cce7b 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux
@@ -15,7 +15,7 @@
[collection
["." dictionary]
["." set]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
@@ -75,10 +75,10 @@
branchG])))
conditionals))]
(in (_.let (list [@input inputG])
- (list\fold (function (_ [test then] else)
- (_.if test then else))
- elseG
- conditionalsG)))))]))
+ (list\mix (function (_ [test then] else)
+ (_.if test then else))
+ elseG
+ conditionalsG)))))]))
(def: lux_procs
Bundle
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux
index fae91850c..982b48475 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux
@@ -9,7 +9,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold monoid)]
+ ["." list ("#\." functor mix monoid)]
["." set]]]
[math
[number
@@ -63,16 +63,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueG (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple//left]
- [#.Right //runtime.tuple//right]))]
- (method source)))
- valueG
- pathP))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple//left]
+ [#.Right //runtime.tuple//right]))]
+ (method source)))
+ valueG
+ pathP))))
(def: @savepoint (_.var "lux_pm_savepoint"))
(def: @cursor (_.var "lux_pm_cursor"))
@@ -180,10 +180,10 @@
..peek])
then!])))
(#.Item item))]
- (in (list\fold (function (_ [when then] else)
- (_.if when then else))
- (_.go @fail)
- clauses)))])
+ (in (list\mix (function (_ [when then] else)
+ (_.if when then else))
+ (_.go @fail)
+ clauses)))])
([#/////synthesis.I64_Fork //primitive.i64 _.=/2]
[#/////synthesis.F64_Fork //primitive.f64 _.=/2]
[#/////synthesis.Text_Fork //primitive.text _.string=/2])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux
index 41faa95b6..c54bae779 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux
@@ -10,7 +10,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor)]]]
[target
["_" common_lisp (#+ Expression Var/1)]]]]
["." // #_
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
index 7eca077bf..0b2328715 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
@@ -290,4 +290,4 @@
(row.row [(%.nat ..module_id)
(|> ..runtime
_.code
- (\ encoding.utf8 encode))])])))
+ (\ encoding.utf8 encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux
index 9b0431808..edce73735 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux
@@ -8,7 +8,7 @@
[data
["." text]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["n" nat]]]
@@ -77,16 +77,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueO (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.i32 (.int lefts)))])
- ([#.Left //runtime.tuple//left]
- [#.Right //runtime.tuple//right]))]
- (method source)))
- valueO
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.i32 (.int lefts)))])
+ ([#.Left //runtime.tuple//left]
+ [#.Right //runtime.tuple//right]))]
+ (method source)))
+ valueO
+ (list.reversed pathP)))))
(def: @savepoint (_.var "lux_pm_cursor_savepoint"))
(def: @cursor (_.var "lux_pm_cursor"))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
index fdfc768a0..90f1cca9a 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
@@ -8,7 +8,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[target
["_" js (#+ Expression Computation Var Statement)]]]]
["." // #_
@@ -81,12 +81,12 @@
apply_poly (.function (_ args func)
(|> func (_.do "apply" (list _.null args))))
initialize_self! (_.define (//case.register 0) @self)
- initialize! (list\fold (.function (_ post pre!)
- ($_ _.then
- pre!
- (_.define (..input post) (_.at (_.i32 (.int post)) @@arguments))))
- initialize_self!
- (list.indices arity))]
+ initialize! (list\mix (.function (_ post pre!)
+ ($_ _.then
+ pre!
+ (_.define (..input post) (_.at (_.i32 (.int post)) @@arguments))))
+ initialize_self!
+ (list.indices arity))]
environment (monad.map ! (expression archive) environment)
.let [[definition instantiation] (with_closure @self environment
($_ _.then
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux
index 08a3a7c80..8c3762238 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["n" nat]]]
@@ -39,7 +39,7 @@
(_.define variable value)
(_.set variable value)))))
list.reversed
- (list\fold _.then body)))
+ (list\mix _.then body)))
(def: .public (scope! statement expression archive [start initsS+ bodyS])
(Generator! (Scope Synthesis))
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 368c69bb0..3ea974987 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
@@ -783,4 +783,4 @@
#.None
(|> ..runtime
_.code
- (\ utf8.codec encode))])])))
+ (\ utf8.codec encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
index 417f74d2d..928fbb101 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
@@ -10,7 +10,7 @@
["." i32]
["n" nat]]
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[target
[jvm
["_" bytecode (#+ Label Bytecode) ("#\." monad)]
@@ -241,16 +241,16 @@
(Generator [(List synthesis.Member) Synthesis])
(do phase.monad
[recordG (phase archive recordS)]
- (in (list\fold (function (_ step so_far)
- (.let [next (.case step
- (#.Left lefts)
- (..left_projection lefts)
-
- (#.Right lefts)
- (..right_projection lefts))]
- (_.composite so_far next)))
- recordG
- (list.reversed path)))))
+ (in (list\mix (function (_ step so_far)
+ (.let [next (.case step
+ (#.Left lefts)
+ (..left_projection lefts)
+
+ (#.Right lefts)
+ (..right_projection lefts))]
+ (_.composite so_far next)))
+ recordG
+ (list.reversed path)))))
(def: .public (case phase archive [valueS path])
(Generator [Synthesis Path])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux
index ef53de88c..67c156db0 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux
@@ -7,7 +7,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[target
["_" lua (#+ Expression Var Statement)]]]]
@@ -62,16 +62,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueO (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple//left]
- [#.Right //runtime.tuple//right]))]
- (method source)))
- valueO
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple//left]
+ [#.Right //runtime.tuple//right]))]
+ (method source)))
+ valueO
+ (list.reversed pathP)))))
(def: .public (if expression archive [testS thenS elseS])
(Generator [Synthesis Synthesis Synthesis])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
index 509808d62..88f59675d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
@@ -10,7 +10,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[target
["_" lua (#+ Var Expression Label Statement)]]]]
["." // #_
@@ -79,12 +79,12 @@
@scope (..@scope function_name)
@self (_.var (///reference.artifact function_name))
initialize_self! (_.local/1 (//case.register 0) @self)
- initialize! (list\fold (.function (_ post pre!)
- ($_ _.then
- pre!
- (_.local/1 (..input post) (_.item (|> post ++ .int _.int) @curried))))
- initialize_self!
- (list.indices arity))
+ initialize! (list\mix (.function (_ post pre!)
+ ($_ _.then
+ pre!
+ (_.local/1 (..input post) (_.item (|> post ++ .int _.int) @curried))))
+ initialize_self!
+ (list.indices arity))
pack (|>> (list) _.array)
unpack (_.apply/1 (_.var "table.unpack"))
@var_args (_.var "...")]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
index 988274333..997030d05 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
@@ -430,4 +430,4 @@
#.None
(|> ..runtime
_.code
- (\ utf8.codec encode))])])))
+ (\ utf8.codec encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux
index 28744fe33..ccea519f2 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[math
[number
@@ -83,16 +83,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueG (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple//left]
- [#.Right //runtime.tuple//right]))]
- (method source)))
- valueG
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple//left]
+ [#.Right //runtime.tuple//right]))]
+ (method source)))
+ valueG
+ (list.reversed pathP)))))
(def: @savepoint (_.var "lux_pm_savepoint"))
(def: @cursor (_.var "lux_pm_cursor"))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux
index 175fadfc3..c749c30f2 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux
@@ -10,7 +10,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[target
["_" php (#+ Var Global Expression Argument Label Statement)]]]]
["." // #_
@@ -84,12 +84,12 @@
@selfG (_.global (///reference.artifact function_name))
@selfL (_.var (///reference.artifact function_name))
initialize_self! (_.set! (//case.register 0) @selfL)
- initialize! (list\fold (.function (_ post pre!)
- ($_ _.then
- pre!
- (_.set! (..input post) (_.item (|> post .int _.int) @curried))))
- initialize_self!
- (list.indices arity))]
+ initialize! (list\mix (.function (_ post pre!)
+ ($_ _.then
+ pre!
+ (_.set! (..input post) (_.item (|> post .int _.int) @curried))))
+ initialize_self!
+ (list.indices arity))]
.let [[definition instantiation] (..with_closure closureG+ @selfG @selfL
($_ _.then
(_.set! @num_args (_.func_num_args/0 []))
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 9f66b15b3..8baa09008 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
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set (#+ Set)]]]
[math
[number
@@ -45,7 +45,7 @@
(let [variable (//case.register (n.+ offset register))]
(_.set! variable value))))
list.reversed
- (list\fold _.then body)))
+ (list\mix _.then body)))
(def: .public (scope! statement expression archive [start initsS+ bodyS])
(Generator! (Scope Synthesis))
@@ -89,7 +89,7 @@
(set.of_list _.hash)))
[directive instantiation] (: [Statement Expression]
(case (|> (list\map referenced_variables initsS+)
- (list\fold set.union (referenced_variables bodyS))
+ (list\mix set.union (referenced_variables bodyS))
(set.difference loop_variables)
set.list)
#.End
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
index bd36c0785..8dfb51dd7 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
@@ -607,4 +607,4 @@
(row.row [..module_id
(|> ..runtime
_.code
- (\ utf8.codec encode))])])))
+ (\ utf8.codec encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux
index 4426bc6c8..10cb4d3b9 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux
@@ -8,7 +8,7 @@
[target
["_" python]]]]
["." / #_
- [runtime (#+ Phase Phase!)]
+ [runtime (#+ Phase)]
["#." primitive]
["#." structure]
["#." reference]
@@ -18,7 +18,10 @@
["/#" // #_
["#." reference]
["/#" // #_
- ["#." extension]
+ ["#." extension
+ [generation
+ [python
+ ["#/." common]]]]
["/#" // #_
[analysis (#+)]
["#." synthesis]
@@ -27,38 +30,6 @@
[reference (#+)
[variable (#+)]]]]]]])
-(def: (statement expression archive synthesis)
- Phase!
- (case synthesis
- (^template [<tag>]
- [(^ (<tag> value))
- (//////phase\map _.return (expression archive synthesis))])
- ([////synthesis.bit]
- [////synthesis.i64]
- [////synthesis.f64]
- [////synthesis.text]
- [////synthesis.variant]
- [////synthesis.tuple]
- [#////synthesis.Reference]
- [////synthesis.branch/get]
- [////synthesis.function/apply]
- [#////synthesis.Extension])
-
- (^ (////synthesis.branch/case case))
- (/case.case! false statement expression archive case)
-
- (^template [<tag> <generator>]
- [(^ (<tag> value))
- (<generator> statement expression archive value)])
- ([////synthesis.branch/let /case.let!]
- [////synthesis.branch/if /case.if!]
- [////synthesis.loop/scope /loop.scope!]
- [////synthesis.loop/recur /loop.recur!])
-
- (^ (////synthesis.function/abstraction abstraction))
- (//////phase\map _.return (/function.function statement expression archive abstraction))
- ))
-
(exception: .public cannot_recur_as_an_expression)
(def: .public (expression archive synthesis)
@@ -82,7 +53,7 @@
(//reference.reference /reference.system archive value)
(^ (////synthesis.branch/case case))
- (/case.case ..statement expression archive case)
+ (/case.case ///extension/common.statement expression archive case)
(^ (////synthesis.branch/let let))
(/case.let expression archive let)
@@ -94,13 +65,13 @@
(/case.get expression archive get)
(^ (////synthesis.loop/scope scope))
- (/loop.scope ..statement expression archive scope)
+ (/loop.scope ///extension/common.statement expression archive scope)
(^ (////synthesis.loop/recur updates))
(//////phase.except ..cannot_recur_as_an_expression [])
(^ (////synthesis.function/abstraction abstraction))
- (/function.function ..statement expression archive abstraction)
+ (/function.function ///extension/common.statement expression archive abstraction)
(^ (////synthesis.function/apply application))
(/function.apply expression archive application)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
index 5d66730d1..6262f0104 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
@@ -7,7 +7,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[math
[number
@@ -88,16 +88,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueO (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple::left]
- [#.Right //runtime.tuple::right]))]
- (method source)))
- valueO
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple::left]
+ [#.Right //runtime.tuple::right]))]
+ (method source)))
+ valueO
+ (list.reversed pathP)))))
(def: @savepoint (_.var "lux_pm_savepoint"))
(def: @cursor (_.var "lux_pm_cursor"))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
index eee714ea8..f4b31f61d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
@@ -8,7 +8,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[target
["_" python (#+ SVar Expression Statement)]]]]
["." // #_
@@ -80,12 +80,12 @@
apply_poly (.function (_ args func)
(_.apply_poly (list) args func))
initialize_self! (_.set (list (//case.register 0)) @self)
- initialize! (list\fold (.function (_ post pre!)
- ($_ _.then
- pre!
- (_.set (list (..input post)) (_.item (|> post .int _.int) @curried))))
- initialize_self!
- (list.indices arity))]]
+ initialize! (list\mix (.function (_ post pre!)
+ ($_ _.then
+ pre!
+ (_.set (list (..input post)) (_.item (|> post .int _.int) @curried))))
+ initialize_self!
+ (list.indices arity))]]
(with_closure function_artifact @self environment
(_.def @self (list (_.poly @curried))
($_ _.then
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 6739e6ec5..50469f64e 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
@@ -8,7 +8,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[math
[number
@@ -39,7 +39,7 @@
(_.set (list (//case.register (n.+ offset register)))
value)))
list.reversed
- (list\fold _.then body)))
+ (list\mix _.then body)))
(def: .public (set_scope body!)
(-> (Statement Any) (Statement Any))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
index 207b74654..9952ea02d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
@@ -458,4 +458,4 @@
#.None
(|> ..runtime
_.code
- (\ utf8.codec encode))])]))))
+ (\ utf8.codec encoded))])]))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux
index 288fdc4bf..e751e412b 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[macro
["." template]]
@@ -66,16 +66,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueO (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple::left]
- [#.Right //runtime.tuple::right]))]
- (method source)))
- valueO
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple::left]
+ [#.Right //runtime.tuple::right]))]
+ (method source)))
+ valueO
+ (list.reversed pathP)))))
(def: $savepoint (_.var "lux_pm_cursor_savepoint"))
(def: $cursor (_.var "lux_pm_cursor"))
@@ -171,10 +171,10 @@
..peek)
then!])))
(#.Item item))]
- (in (list\fold (function (_ [when then] else)
- (_.if when then else))
- ..fail!
- clauses)))])
+ (in (list\mix (function (_ [when then] else)
+ (_.if when then else))
+ ..fail!
+ clauses)))])
([#/////synthesis.I64_Fork //primitive.i64 //runtime.i64::=]
[#/////synthesis.F64_Fork //primitive.f64 _.=]
[#/////synthesis.Text_Fork //primitive.text _.=])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux
index 4ae6231c5..f2335374c 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux
@@ -10,7 +10,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[target
["_" r (#+ Expression SVar)]]]]
["." // #_
@@ -97,7 +97,7 @@
(|> arity
list.indices
(list\map input_declaration)
- (list\fold _.then bodyO)))]
+ (list\mix _.then bodyO)))]
[(|> $num_args (_.> arityO))
(let [arity_args (_.slice (_.int +1) arityO $curried)
output_func_args (_.slice (|> arityO (_.+ (_.int +1)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux
index 859744980..28ac47ffb 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor)]
["." set (#+ Set)]]]
[math
[number
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 21f2ded5a..f0ea2c3fb 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
@@ -850,4 +850,4 @@
(row.row [(%.nat ..module_id)
(|> ..runtime
_.code
- (\ utf8.codec encode))])])))
+ (\ utf8.codec encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux
index 2af4e0dee..df08d8a21 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux
@@ -9,7 +9,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[math
[number
@@ -90,16 +90,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueO (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple//left]
- [#.Right //runtime.tuple//right]))]
- (method source)))
- valueO
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple//left]
+ [#.Right //runtime.tuple//right]))]
+ (method source)))
+ valueO
+ (list.reversed pathP)))))
(def: @savepoint (_.local "lux_pm_savepoint"))
(def: @cursor (_.local "lux_pm_cursor"))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
index 192807829..efc132065 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
@@ -8,7 +8,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[target
["_" ruby (#+ LVar GVar Expression Statement)]]]]
["." // #_
@@ -77,12 +77,12 @@
@num_args (_.local "num_args")
@self (_.local function_name)
initialize_self! (_.set (list (//case.register 0)) @self)
- initialize! (list\fold (.function (_ post pre!)
- ($_ _.then
- pre!
- (_.set (list (..input post)) (_.item (|> post .int _.int) @curried))))
- initialize_self!
- (list.indices arity))
+ initialize! (list\mix (.function (_ post pre!)
+ ($_ _.then
+ pre!
+ (_.set (list (..input post)) (_.item (|> post .int _.int) @curried))))
+ initialize_self!
+ (list.indices arity))
[declaration instatiation] (with_closure closureO+ function_name
(_.lambda (#.Some @self) (list (_.variadic @curried))
($_ _.then
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux
index 9fe46c86d..caf3afb78 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[math
[number
@@ -39,7 +39,7 @@
(_.set (list (//case.register (n.+ offset register)))
value)))
list.reversed
- (list\fold _.then body)))
+ (list\mix _.then body)))
(def: symbol
(_.symbol "lux_continue"))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
index 8a825e466..b083c0a67 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
@@ -401,4 +401,4 @@
#.None
(|> ..runtime
_.code
- (\ utf8.codec encode))])])))
+ (\ utf8.codec encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux
index ae841dc5b..e68b23464 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[macro
["." template]]
@@ -64,16 +64,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueO (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple//left]
- [#.Right //runtime.tuple//right]))]
- (method source)))
- valueO
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple//left]
+ [#.Right //runtime.tuple//right]))]
+ (method source)))
+ valueO
+ (list.reversed pathP)))))
(def: @savepoint (_.var "lux_pm_cursor_savepoint"))
(def: @cursor (_.var "lux_pm_cursor"))
@@ -165,10 +165,10 @@
..peek)
then!])))
(#.Item item))]
- (in (list\fold (function (_ [when then] else)
- (_.if when then else))
- ..fail!
- clauses)))])
+ (in (list\mix (function (_ [when then] else)
+ (_.if when then else))
+ ..fail!
+ clauses)))])
([#/////synthesis.I64_Fork //primitive.i64 _.=/2]
[#/////synthesis.F64_Fork //primitive.f64 _.=/2]
[#/////synthesis.Text_Fork //primitive.text _.string=?/2])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux
index 58d8b55c6..cfb345097 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux
@@ -10,7 +10,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor)]]]
[target
["_" scheme (#+ Expression Computation Var)]]]]
["." // #_
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux
index fb9add0aa..87ddc4929 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor)]
["." set (#+ Set)]]]
[math
[number
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
index 452da33ef..221ee6d88 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
@@ -367,4 +367,4 @@
(row.row [(%.nat ..module_id)
(|> ..runtime
_.code
- (\ utf8.codec encode))])])))
+ (\ utf8.codec encoded))])])))
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 1a178900e..d2bf439da 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
@@ -11,7 +11,7 @@
["." bit ("#\." equivalence)]
["." text ("#\." equivalence)]
[collection
- ["." list ("#\." functor fold monoid)]
+ ["." list ("#\." functor mix monoid)]
["." set (#+ Set)]]]
[math
[number
@@ -72,22 +72,22 @@
(#///analysis.Complex (#///analysis.Tuple tuple))
(let [tuple::last (-- (list.size tuple))]
- (list\fold (function (_ [tuple::lefts tuple::member] nextC)
- (.case tuple::member
- (#///analysis.Simple #///analysis.Unit)
- nextC
-
- _
- (let [right? (n.= tuple::last tuple::lefts)
- end?' (and end? right?)]
- (<| (///\map (|>> (#/.Seq (#/.Access (#/.Member (if right?
- (#.Right (-- tuple::lefts))
- (#.Left tuple::lefts)))))))
- (path' tuple::member end?')
- (when> [(new> (not end?') [])] [(///\map ..clean_up)])
- nextC))))
- thenC
- (list.reversed (list.enumeration tuple))))
+ (list\mix (function (_ [tuple::lefts tuple::member] nextC)
+ (.case tuple::member
+ (#///analysis.Simple #///analysis.Unit)
+ nextC
+
+ _
+ (let [right? (n.= tuple::last tuple::lefts)
+ end?' (and end? right?)]
+ (<| (///\map (|>> (#/.Seq (#/.Access (#/.Member (if right?
+ (#.Right (-- tuple::lefts))
+ (#.Left tuple::lefts)))))))
+ (path' tuple::member end?')
+ (when> [(new> (not end?') [])] [(///\map ..clean_up)])
+ nextC))))
+ thenC
+ (list.reversed (list.enumeration tuple))))
))
(def: (path archive synthesize pattern bodyA)
@@ -110,7 +110,7 @@
(def: (weave_fork weave equivalence new_fork old_fork)
(All [a] (-> (-> Path Path Path) (Equivalence a) (/.Fork a Path) (/.Fork a Path)
(/.Fork a Path)))
- (list\fold (..weave_branch weave equivalence) old_fork (#.Item new_fork)))
+ (list\mix (..weave_branch weave equivalence) old_fork (#.Item new_fork)))
(def: (weave new old)
(-> Path Path Path)
@@ -228,7 +228,7 @@
(do {! ///.monad}
[headSP (path archive synthesize headP headA)
tailSP+ (monad.map ! (product.uncurried (path archive synthesize)) tailPA+)]
- (in (/.branch/case [input (list\fold weave headSP tailSP+)]))))
+ (in (/.branch/case [input (list\mix weave headSP tailSP+)]))))
(template: (!masking <variable> <output>)
[[[(#///analysis.Bind <variable>)
@@ -358,11 +358,11 @@
(#/.Text_Fork forks))
(|> (#.Item forks)
(list\map product.right)
- (list\fold for_path path_storage))
+ (list\mix for_path path_storage))
(^or (^ (/.path/seq left right))
(^ (/.path/alt left right)))
- (list\fold for_path path_storage (list left right))
+ (list\mix for_path path_storage (list left right))
(^ (/.path/then bodyS))
(loop for_synthesis
@@ -373,7 +373,7 @@
(for_synthesis valueS synthesis_storage)
(^ (/.tuple members))
- (list\fold for_synthesis synthesis_storage members)
+ (list\mix for_synthesis synthesis_storage members)
(#/.Reference (#///reference.Variable (#///reference/variable.Local register)))
(if (set.member? (value@ #bindings synthesis_storage) register)
@@ -384,10 +384,10 @@
(revised@ #dependencies (set.has var) synthesis_storage)
(^ (/.function/apply [functionS argsS]))
- (list\fold for_synthesis synthesis_storage (#.Item functionS argsS))
+ (list\mix for_synthesis synthesis_storage (#.Item functionS argsS))
(^ (/.function/abstraction [environment arity bodyS]))
- (list\fold for_synthesis synthesis_storage environment)
+ (list\mix for_synthesis synthesis_storage environment)
(^ (/.branch/case [inputS pathS]))
(revised@ #dependencies
@@ -403,7 +403,7 @@
(for_synthesis inputS synthesis_storage))
(^ (/.branch/if [testS thenS elseS]))
- (list\fold for_synthesis synthesis_storage (list testS thenS elseS))
+ (list\mix for_synthesis synthesis_storage (list testS thenS elseS))
(^ (/.branch/get [access whole]))
(for_synthesis whole synthesis_storage)
@@ -417,13 +417,13 @@
(set.of_list n.hash))))
(for_synthesis iterationS)
(value@ #dependencies)))
- (list\fold for_synthesis synthesis_storage initsS+))
+ (list\mix for_synthesis synthesis_storage initsS+))
(^ (/.loop/recur replacementsS+))
- (list\fold for_synthesis synthesis_storage replacementsS+)
+ (list\mix for_synthesis synthesis_storage replacementsS+)
(#/.Extension [extension argsS])
- (list\fold for_synthesis synthesis_storage argsS)
+ (list\mix for_synthesis synthesis_storage argsS)
_
synthesis_storage))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
index f26b13ade..2aeacc78d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
@@ -12,7 +12,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor monoid fold)]]]
+ ["." list ("#\." functor monoid)]]]
[math
[number
["n" nat]]]]]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
index 39082e826..bba61a90f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
@@ -178,22 +178,24 @@
... TODO: Stop relying on this custom code.
(^ (#/.Extension ["lux syntax char case!" (list& input else matches)]))
- (do {! maybe.monad}
- [input (recur false input)
- matches (monad.map !
- (function (_ match)
- (case match
- (^ (#/.Structure (#analysis.Tuple (list when then))))
- (do !
- [when (recur false when)
- then (recur return? then)]
- (in (#/.Structure (#analysis.Tuple (list when then)))))
-
- _
- (recur false match)))
- matches)
- else (recur return? else)]
- (in (#/.Extension ["lux syntax char case!" (list& input else matches)])))
+ (if return?
+ (do {! maybe.monad}
+ [input (recur false input)
+ matches (monad.map !
+ (function (_ match)
+ (case match
+ (^ (#/.Structure (#analysis.Tuple (list when then))))
+ (do !
+ [when (recur false when)
+ then (recur return? then)]
+ (in (#/.Structure (#analysis.Tuple (list when then)))))
+
+ _
+ (recur false match)))
+ matches)
+ else (recur return? else)]
+ (in (#/.Extension ["lux syntax char case!" (list& input else matches)])))
+ #.None)
(#/.Extension [name args])
(|> args
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 cb647c284..88b2d3f1f 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
@@ -13,7 +13,7 @@
["%" format]]
[collection
["." dictionary (#+ Dictionary)]
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[math
[number
@@ -181,10 +181,10 @@
(-> Register Nat Redundancy [(List Register) Redundancy])
(let [extension (|> amount list.indices (list\map (n.+ offset)))]
[extension
- (list\fold (function (_ register redundancy)
- (dictionary.has register ..necessary! redundancy))
- redundancy
- extension)]))
+ (list\mix (function (_ register redundancy)
+ (dictionary.has register ..necessary! redundancy))
+ redundancy
+ extension)]))
(def: (default arity)
(-> Arity Redundancy)
@@ -310,10 +310,10 @@
(and (set.member? bindings register)
redundant?)))
(list\map product.left))]]
- (in [(list\fold dictionary.lacks redundancy (set.list bindings))
+ (in [(list\mix dictionary.lacks redundancy (set.list bindings))
(|> redundants
(list.sorted n.>)
- (list\fold (..remove_local_from_path ..remove_local) (#/.Seq pre post)))]))
+ (list\mix (..remove_local_from_path ..remove_local) (#/.Seq pre post)))]))
(#/.Then then)
(do try.monad
@@ -405,7 +405,7 @@
[[redundancy inits] (..list_optimization optimization' [redundancy inits])
.let [[extension redundancy] (..extended start (list.size inits) redundancy)]
[redundancy iteration] (optimization' [redundancy iteration])]
- (in [(list\fold dictionary.lacks redundancy extension)
+ (in [(list\mix dictionary.lacks redundancy extension)
(#/.Control (#/.Loop (#/.Scope [start inits iteration])))]))
(#/.Recur resets)
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 d4b612bf2..3105f2ad8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
@@ -333,7 +333,7 @@
[(case (|> <source_code>
(!clip <start> <end>)
(text.replaced ..digit_separator "")
- (\ <codec> decode))
+ (\ <codec> decoded))
(#.Right output)
(#.Right [[(let [[where::file where::line where::column] where]
[where::file where::line (!n/+ (!n/- <start> <end>) where::column)])
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
index d810d7aca..e1ea19e37 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
@@ -20,7 +20,7 @@
[format
["." binary (#+ Writer)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]
["." set]
["." row (#+ Row)]]]
@@ -198,15 +198,15 @@
:representation
(revised@ #next (n.max +next))
(revised@ #resolver (function (_ resolver)
- (list\fold (function (_ [module [id entry]] resolver)
- (case entry
- (#.Some _)
- (dictionary.has module [id entry] resolver)
-
- #.None
- resolver))
- resolver
- (dictionary.entries +resolver))))
+ (list\mix (function (_ [module [id entry]] resolver)
+ (case entry
+ (#.Some _)
+ (dictionary.has module [id entry] resolver)
+
+ #.None
+ resolver))
+ resolver
+ (dictionary.entries +resolver))))
:abstraction)))
(type: Reservation
@@ -279,8 +279,8 @@
(correct_reservations? reservations))]
(in (:abstraction
{#next next
- #resolver (list\fold (function (_ [module id] archive)
- (dictionary.has module [id #.None] archive))
- (value@ #resolver (:representation ..empty))
- reservations)}))))
+ #resolver (list\mix (function (_ [module id] archive)
+ (dictionary.has module [id #.None] archive))
+ (value@ #resolver (:representation ..empty))
+ reservations)}))))
)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
index e4cc633de..af69bbdc9 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
@@ -14,7 +14,7 @@
["%" format (#+ format)]]
[collection
["." list]
- ["." row (#+ Row) ("#\." functor fold)]
+ ["." row (#+ Row) ("#\." functor mix)]
["." dictionary (#+ Dictionary)]]
[format
["." binary (#+ Writer)]]]
@@ -145,21 +145,21 @@
_ (<>.failure (exception.error ..invalid_category [tag])))))]
(|> (<binary>.row/64 category)
- (\ <>.monad map (row\fold (function (_ artifact registry)
- (product.right
- (case artifact
- #Anonymous
- (..resource registry)
-
- (^template [<tag> <create>]
- [(<tag> name)
- (<create> name registry)])
- ([#Definition ..definition]
- [#Analyser ..analyser]
- [#Synthesizer ..synthesizer]
- [#Generator ..generator]
- [#Directive ..directive]
- [#Custom ..custom])
- )))
- ..empty)))))
+ (\ <>.monad map (row\mix (function (_ artifact registry)
+ (product.right
+ (case artifact
+ #Anonymous
+ (..resource registry)
+
+ (^template [<tag> <create>]
+ [(<tag> name)
+ (<create> name registry)])
+ ([#Definition ..definition]
+ [#Analyser ..analyser]
+ [#Synthesizer ..synthesizer]
+ [#Generator ..generator]
+ [#Directive ..directive]
+ [#Custom ..custom])
+ )))
+ ..empty)))))
)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
index 6ee936f42..e2a3ef238 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
@@ -13,7 +13,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]
["." set (#+ Set)]]]]]
[///
@@ -46,9 +46,9 @@
(def: .public graph
(-> (List Dependency) Graph)
- (list\fold (function (_ [module imports] graph)
- (dictionary.has module imports graph))
- ..empty))
+ (list\mix (function (_ [module imports] graph)
+ (dictionary.has module imports graph))
+ ..empty))
(def: (ancestry archive)
(-> Archive Graph)
@@ -62,15 +62,15 @@
(#try.Failure error)
..fresh)]
ancestors (monad.map ! recur (set.list parents))]
- (in (list\fold set.union parents ancestors)))))
+ (in (list\mix set.union parents ancestors)))))
ancestry (memo.open memo)]
- (list\fold (function (_ module memory)
- (if (dictionary.key? memory module)
- memory
- (let [[memory _] (ancestry [memory module])]
- memory)))
- ..empty
- (archive.archived archive))))
+ (list\mix (function (_ module memory)
+ (if (dictionary.key? memory module)
+ memory
+ (let [[memory _] (ancestry [memory module])]
+ memory)))
+ ..empty
+ (archive.archived archive))))
(def: (dependency? ancestry target source)
(-> Graph Module Module Bit)
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 b4fa30d12..45f489e8b 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
@@ -19,7 +19,7 @@
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]
["." row (#+ Row)]
["." set]]]
@@ -384,19 +384,19 @@
(-> (List [Bit [Module [archive.ID [Descriptor (Document .Module)]]]])
dependency.Order
Purge)
- (list\fold (function (_ [module_name [module_id [descriptor document]]] purge)
- (let [purged? (: (Predicate Module)
- (dictionary.key? purge))]
- (if (purged? module_name)
- purge
- (if (|> descriptor
- (value@ #descriptor.references)
- set.list
- (list.any? purged?))
- (dictionary.has module_name module_id purge)
- purge))))
- (..initial_purge caches)
- load_order))
+ (list\mix (function (_ [module_name [module_id [descriptor document]]] purge)
+ (let [purged? (: (Predicate Module)
+ (dictionary.key? purge))]
+ (if (purged? module_name)
+ purge
+ (if (|> descriptor
+ (value@ #descriptor.references)
+ set.list
+ (list.any? purged?))
+ (dictionary.has module_name module_id purge)
+ purge))))
+ (..initial_purge caches)
+ load_order))
(def: pseudo_module
Text
@@ -422,10 +422,10 @@
[module_name [module_id [descriptor document]]]])))))))
load_order (|> pre_loaded_caches
(list\map product.right)
- (monad.fold try.monad
- (function (_ [module [module_id [descriptor document]]] archive)
- (archive.has module [descriptor document (: Output row.empty)] archive))
- archive)
+ (monad.mix try.monad
+ (function (_ [module [module_id [descriptor document]]] archive)
+ (archive.has module [descriptor document (: Output row.empty)] archive))
+ archive)
(\ try.monad map (dependency.load_order $.key))
(\ try.monad join)
async\in)
@@ -442,22 +442,22 @@
bundles])))))]
(async\in
(do {! try.monad}
- [archive (monad.fold !
- (function (_ [[module descriptor,document,output] _bundle] archive)
- (archive.has module descriptor,document,output archive))
- archive
- loaded_caches)
+ [archive (monad.mix !
+ (function (_ [[module descriptor,document,output] _bundle] archive)
+ (archive.has module descriptor,document,output archive))
+ archive
+ loaded_caches)
analysis_state (..analysis_state (value@ #static.host static) archive)]
(in [archive
analysis_state
- (list\fold (function (_ [_ [+analysers +synthesizers +generators +directives]]
- [analysers synthesizers generators directives])
- [(dictionary.merged +analysers analysers)
- (dictionary.merged +synthesizers synthesizers)
- (dictionary.merged +generators generators)
- (dictionary.merged +directives directives)])
- ..empty_bundles
- loaded_caches)])))))
+ (list\mix (function (_ [_ [+analysers +synthesizers +generators +directives]]
+ [analysers synthesizers generators directives])
+ [(dictionary.merged +analysers analysers)
+ (dictionary.merged +synthesizers synthesizers)
+ (dictionary.merged +generators generators)
+ (dictionary.merged +directives directives)])
+ ..empty_bundles
+ loaded_caches)])))))
(def: .public (thaw host_environment fs static import contexts)
(All [expression directive]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
index 979edaa76..74d5aab33 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
@@ -127,7 +127,7 @@
(Async (Try Input)))
(do (try.with async.monad)
[[path binary] (..find_any_source_file fs importer import contexts partial_host_extension module)]
- (case (\ utf8.codec decode binary)
+ (case (\ utf8.codec decoded binary)
(#try.Success code)
(in {#////.module module
#////.file path
@@ -145,17 +145,17 @@
(do {! (try.with async.monad)}
[enumeration (|> directory
(\ fs directory_files)
- (\ ! map (monad.fold ! (function (_ file enumeration)
- (if (text.ends_with? ..lux_extension file)
- (do !
- [source_code (\ fs read file)]
- (async\in (dictionary.has' (text.replaced context "" file) source_code enumeration)))
- (in enumeration)))
- enumeration))
+ (\ ! map (monad.mix ! (function (_ file enumeration)
+ (if (text.ends_with? ..lux_extension file)
+ (do !
+ [source_code (\ fs read file)]
+ (async\in (dictionary.has' (text.replaced context "" file) source_code enumeration)))
+ (in enumeration)))
+ enumeration))
(\ ! join))]
(|> directory
(\ fs sub_directories)
- (\ ! map (monad.fold ! (context_listing fs context) enumeration))
+ (\ ! map (monad.mix ! (context_listing fs context) enumeration))
(\ ! join))))
(def: Action
@@ -175,14 +175,14 @@
(-> (file.System Async) (List Context) (Action Enumeration))
(let [! (: (Monad Action)
(try.with async.monad))]
- (monad.fold !
- (function (_ context enumeration)
- (do !
- [context (..canonical fs context)]
- (..context_listing fs
- (format context (\ fs separator))
- context
- enumeration)))
- (: Enumeration
- (dictionary.empty text.hash))
- contexts)))
+ (monad.mix !
+ (function (_ context enumeration)
+ (do !
+ [context (..canonical fs context)]
+ (..context_listing fs
+ (format context (\ fs separator))
+ context
+ enumeration)))
+ (: Enumeration
+ (dictionary.empty text.hash))
+ contexts)))
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 d9707b0c0..ffee37de6 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
@@ -154,11 +154,11 @@
(def: (write_module static [module output] sink)
(-> Static [archive.ID Output] java/util/jar/JarOutputStream
(Try java/util/jar/JarOutputStream))
- (monad.fold try.monad
- (function (_ [artifact custom content] sink)
- (..write_class static module artifact custom content sink))
- sink
- (row.list output)))
+ (monad.mix try.monad
+ (function (_ [artifact custom content] sink)
+ (..write_class static module artifact custom content sink))
+ sink
+ (row.list output)))
(def: (read_jar_entry_with_unknown_size input)
(-> java/util/jar/JarInputStream [Nat Binary])
@@ -251,14 +251,14 @@
sink (|> order
(list\map (function (_ [module [module_id [descriptor document output]]])
[module_id output]))
- (monad.fold ! (..write_module static)
- (java/util/jar/JarOutputStream::new buffer (..manifest program))))
+ (monad.mix ! (..write_module static)
+ (java/util/jar/JarOutputStream::new buffer (..manifest program))))
[entries duplicates sink] (|> host_dependencies
dictionary.values
- (monad.fold ! ..write_host_dependency
- [(set.empty text.hash)
- (set.empty text.hash)
- sink]))
+ (monad.mix ! ..write_host_dependency
+ [(set.empty text.hash)
+ (set.empty text.hash)
+ sink]))
.let [_ (do_to sink
(java/io/Flushable::flush)
(java/io/Closeable::close))]]
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 a229c78a1..f888e6975 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
@@ -14,7 +14,7 @@
["." encoding]]
[collection
["." row]
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]
["." set]]
[format
@@ -58,19 +58,19 @@
(-> Output (Try _.Expression))
(|>> row.list
(list\map product.right)
- (monad.fold try.monad
- (function (_ content so_far)
- (|> content
- (\ encoding.utf8 decode)
- (\ try.monad map
- (|>> :expected
- (:sharing [directive]
- directive
- so_far
-
- directive)
- (..then so_far)))))
- (: _.Expression (_.manual "")))))
+ (monad.mix try.monad
+ (function (_ content so_far)
+ (|> content
+ (\ encoding.utf8 decoded)
+ (\ try.monad map
+ (|>> :expected
+ (:sharing [directive]
+ directive
+ so_far
+
+ directive)
+ (..then so_far)))))
+ (: _.Expression (_.manual "")))))
(def: module_file
(-> archive.ID file.Path)
@@ -108,10 +108,10 @@
set.list
(list.all (function (_ module) (dictionary.value module mapping)))
(list\map (|>> ..module_file _.string _.load_relative/1))
- (list\fold ..then bundle)
+ (list\mix ..then bundle)
(: _.Expression)
_.code
- (\ encoding.utf8 encode)
+ (\ encoding.utf8 encoded)
tar.content))
module_file (tar.path (..module_file module_id))]
(in (#tar.Normal [module_file now ..mode ..ownership entry_content]))))
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 fd6437557..9b49232e3 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux
@@ -40,19 +40,19 @@
(|> output
row.list
(list\map (|>> product.right product.right))
- (monad.fold try.monad
- (function (_ content so_far)
- (|> content
- (\ utf8.codec decode)
- (\ try.monad map
- (|>> :expected
- (:sharing [directive]
- directive
- so_far
-
- directive)
- (sequence so_far)))))
- so_far)))
+ (monad.mix try.monad
+ (function (_ content so_far)
+ (|> content
+ (\ utf8.codec decoded)
+ (\ try.monad map
+ (|>> :expected
+ (:sharing [directive]
+ directive
+ so_far
+
+ directive)
+ (sequence so_far)))))
+ so_far)))
(def: .public (package header code sequence scope)
(All [directive]
@@ -67,5 +67,5 @@
(|> order
(list\map (function (_ [module [module_id [descriptor document output]]])
[module_id output]))
- (monad.fold ! (..write_module sequence) header)
- (\ ! map (|>> scope code (\ utf8.codec encode)))))))
+ (monad.mix ! (..write_module sequence) header)
+ (\ ! map (|>> scope code (\ utf8.codec encoded)))))))
diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux
index 2a99dded3..e1e42c28c 100644
--- a/stdlib/source/library/lux/type.lux
+++ b/stdlib/source/library/lux/type.lux
@@ -18,7 +18,7 @@
["." name ("#\." equivalence codec)]
[collection
["." array]
- ["." list ("#\." functor monoid fold)]]]
+ ["." list ("#\." functor monoid mix)]]]
["." macro
[syntax (#+ syntax:)]
["." code]]
@@ -92,7 +92,7 @@
(text.enclosed' text.double_quote name)
(|> params
(list\map (|>> format (text\compose " ")))
- (list\fold (function.flipped text\compose) ""))
+ (list\mix (function.flipped text\compose) ""))
")")
(^template [<tag> <open> <close> <flat>]
@@ -102,7 +102,7 @@
(list\map format)
list.reversed
(list.interposed " ")
- (list\fold text\compose ""))
+ (list\mix text\compose ""))
<close>)])
([#.Sum "(Or " ")" flat_variant]
[#.Product "[" "]" flat_tuple])
@@ -114,21 +114,21 @@
(list\map format)
list.reversed
(list.interposed " ")
- (list\fold text\compose ""))
+ (list\mix text\compose ""))
" " (format out) ")"))
(#.Parameter idx)
- (n\encode idx)
+ (n\encoded idx)
(#.Var id)
- ($_ text\compose "⌈v:" (n\encode id) "⌋")
+ ($_ text\compose "⌈v:" (n\encoded id) "⌋")
(#.Ex id)
- ($_ text\compose "⟨e:" (n\encode id) "⟩")
+ ($_ text\compose "⟨e:" (n\encoded id) "⟩")
(#.Apply param fun)
(let [[type_func type_args] (flat_application type)]
- ($_ text\compose "(" (format type_func) " " (|> type_args (list\map format) list.reversed (list.interposed " ") (list\fold text\compose "")) ")"))
+ ($_ text\compose "(" (format type_func) " " (|> type_args (list\map format) list.reversed (list.interposed " ") (list\mix text\compose "")) ")"))
(^template [<tag> <desc>]
[(<tag> env body)
@@ -167,12 +167,12 @@
(#.Parameter idx)
(maybe.else (panic! ($_ text\compose
"Unknown type parameter" text.new_line
- " Index: " (n\encode idx) text.new_line
+ " Index: " (n\encoded idx) text.new_line
"Environment: " (|> env
list.enumeration
(list\map (.function (_ [index type])
($_ text\compose
- (n\encode index)
+ (n\encoded index)
" " (..format type))))
(text.interposed (text\compose text.new_line " ")))))
(list.item idx env))
@@ -191,9 +191,9 @@
[(#.Primitive xname xparams) (#.Primitive yname yparams)]
(and (text\= xname yname)
(n.= (list.size yparams) (list.size xparams))
- (list\fold (.function (_ [x y] prev) (and prev (= x y)))
- #1
- (list.zipped/2 xparams yparams)))
+ (list\mix (.function (_ [x y] prev) (and prev (= x y)))
+ #1
+ (list.zipped/2 xparams yparams)))
(^template [<tag>]
[[(<tag> xid) (<tag> yid)]
@@ -218,9 +218,9 @@
[(#.ExQ xenv xbody) (#.ExQ yenv ybody)])
(and (n.= (list.size yenv) (list.size xenv))
(= xbody ybody)
- (list\fold (.function (_ [x y] prev) (and prev (= x y)))
- #1
- (list.zipped/2 xenv yenv)))
+ (list\mix (.function (_ [x y] prev) (and prev (= x y)))
+ #1
+ (list.zipped/2 xenv yenv)))
_
#0
@@ -421,13 +421,13 @@
valueT (meta.type valueN)
.let [_ ("lux io log"
($_ text\compose
- (name\encode (name_of ..:log!)) " " (location.format location) text.new_line
+ (name\encoded (name_of ..:log!)) " " (location.format location) text.new_line
"Expression: " (case valueC
(#.Some valueC)
(code.format valueC)
#.None
- (name\encode valueN))
+ (name\encoded valueN))
text.new_line
" Type: " (..format valueT)))]]
(in (list (code.identifier valueN))))
diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux
index 9b657cb19..57d9ae3ab 100644
--- a/stdlib/source/library/lux/type/abstract.lux
+++ b/stdlib/source/library/lux/type/abstract.lux
@@ -194,15 +194,15 @@
(def: abstraction_type_name
(-> Name Text)
- (|>> name\encode
+ (|>> name\encoded
($_ text\compose
- (name\encode (name_of #..Abstraction))
+ (name\encoded (name_of #..Abstraction))
" ")))
(def: representation_definition_name
(-> Text Text)
(|>> ($_ text\compose
- (name\encode (name_of #..Representation))
+ (name\encoded (name_of #..Representation))
" ")))
(def: declaration
diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux
index aa8e213af..3e6f6a8c4 100644
--- a/stdlib/source/library/lux/type/check.lux
+++ b/stdlib/source/library/lux/type/check.lux
@@ -30,11 +30,11 @@
(exception: .public (unknown_type_var {id Nat})
(exception.report
- ["ID" (n\encode id)]))
+ ["ID" (n\encoded id)]))
(exception: .public (unbound_type_var {id Nat})
(exception.report
- ["ID" (n\encode id)]))
+ ["ID" (n\encoded id)]))
(exception: .public (invalid_type_application {funcT Type} {argT Type})
(exception.report
@@ -43,7 +43,7 @@
(exception: .public (cannot_rebind_var {id Nat} {type Type} {bound Type})
(exception.report
- ["Var" (n\encode id)]
+ ["Var" (n\encoded id)]
["Wanted Type" (//.format type)]
["Current Type" (//.format bound)]))
@@ -86,7 +86,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ context)
(case (ff context)
(#try.Success [context' f])
@@ -441,12 +441,12 @@
(in assumptions)
... Fuse 2 rings
(do !
- [_ (monad.fold ! (function (_ interpose to)
- (do !
- [_ (link/3 interpose to idE)]
- (in interpose)))
- targetE
- (set.list ringA))]
+ [_ (monad.mix ! (function (_ interpose to)
+ (do !
+ [_ (link/3 interpose to idE)]
+ (in interpose)))
+ targetE
+ (set.list ringA))]
(in assumptions))))
(^template [<pattern> <id> <type>]
diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux
index cc54a82a1..8af389efc 100644
--- a/stdlib/source/library/lux/type/implicit.lux
+++ b/stdlib/source/library/lux/type/implicit.lux
@@ -14,7 +14,7 @@
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list ("#\." monad fold)]
+ ["." list ("#\." monad mix)]
["." dictionary (#+ Dictionary)]]]
["." macro
["." code]
@@ -119,24 +119,24 @@
(def: (available_definitions source_module target_module constants aggregate)
(-> Text Text (List [Text Definition]) (-> (List [Name Type]) (List [Name Type])))
- (list\fold (function (_ [name [exported? def_type def_anns def_value]] aggregate)
- (if (and (annotation.implementation? def_anns)
- (or (text\= target_module source_module)
- exported?))
- (#.Item [[source_module name] def_type] aggregate)
- aggregate))
- aggregate
- constants))
+ (list\mix (function (_ [name [exported? def_type def_anns def_value]] aggregate)
+ (if (and (annotation.implementation? def_anns)
+ (or (text\= target_module source_module)
+ exported?))
+ (#.Item [[source_module name] def_type] aggregate)
+ aggregate))
+ aggregate
+ constants))
(def: local_env
(Meta (List [Name Type]))
(do meta.monad
[local_batches meta.locals
- .let [total_locals (list\fold (function (_ [name type] table)
- (try.else table (dictionary.has' name type table)))
- (: (Dictionary Text Type)
- (dictionary.empty text.hash))
- (list\join local_batches))]]
+ .let [total_locals (list\mix (function (_ [name type] table)
+ (try.else table (dictionary.has' name type table)))
+ (: (Dictionary Text Type)
+ (dictionary.empty text.hash))
+ (list\join local_batches))]]
(in (|> total_locals
dictionary.entries
(list\map (function (_ [name type]) [["" name] type]))))))
@@ -154,10 +154,10 @@
[this_module_name meta.current_module_name
imported_modules (meta.imported_modules this_module_name)
accessible_definitions (monad.map ! meta.definitions imported_modules)]
- (in (list\fold (function (_ [imported_module definitions] tail)
- (available_definitions imported_module this_module_name definitions tail))
- #.End
- (list.zipped/2 imported_modules accessible_definitions)))))
+ (in (list\mix (function (_ [imported_module definitions] tail)
+ (available_definitions imported_module this_module_name definitions tail))
+ #.End
+ (list.zipped/2 imported_modules accessible_definitions)))))
(def: (on_argument arg func)
(-> Type Type (Check Type))
@@ -197,7 +197,7 @@
(def: (ensure_function_application! member_type input_types expected_output)
(-> Type (List Type) Type (Check []))
(do check.monad
- [actual_output (monad.fold check.monad ..on_argument member_type input_types)]
+ [actual_output (monad.mix check.monad ..on_argument member_type input_types)]
(check.check expected_output actual_output)))
(type: #rec Instance
diff --git a/stdlib/source/library/lux/type/poly.lux b/stdlib/source/library/lux/type/poly.lux
index 51f0b7618..8fba22756 100644
--- a/stdlib/source/library/lux/type/poly.lux
+++ b/stdlib/source/library/lux/type/poly.lux
@@ -14,7 +14,7 @@
["." product]
["." text]
[collection
- ["." list ("#\." fold functor)]
+ ["." list ("#\." functor)]
["." dictionary]]]
[macro (#+ with_identifiers)
["." code]
diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux
index fee4aaf79..3e37d8b30 100644
--- a/stdlib/source/library/lux/type/resource.lux
+++ b/stdlib/source/library/lux/type/resource.lux
@@ -16,7 +16,7 @@
[collection
["." set]
["." row (#+ Row)]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
["." macro
[syntax (#+ syntax:)]]
[math
@@ -165,15 +165,15 @@
(#.Item head tail)
(do {! meta.monad}
- [.let [max_idx (list\fold n.max head tail)]
+ [.let [max_idx (list\mix n.max head tail)]
g!inputs (<| (monad.all !) (list.repeated (++ max_idx)) (macro.identifier "input"))
- .let [g!outputs (|> (monad.fold maybe.monad
- (function (_ from to)
- (do maybe.monad
- [input (list.item from g!inputs)]
- (in (row.suffix input to))))
- (: (Row Code) row.empty)
- swaps)
+ .let [g!outputs (|> (monad.mix maybe.monad
+ (function (_ from to)
+ (do maybe.monad
+ [input (list.item from g!inputs)]
+ (in (row.suffix input to))))
+ (: (Row Code) row.empty)
+ swaps)
maybe.trusted
row.list)
g!inputsT+ (list\map (|>> (~) (..Key ..Commutative) (`)) g!inputs)
diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux
index 0e5deec4a..1625f79ef 100644
--- a/stdlib/source/library/lux/world/file/watch.lux
+++ b/stdlib/source/library/lux/world/file/watch.lux
@@ -20,7 +20,7 @@
["%" format (#+ format)]]
[collection
["." dictionary (#+ Dictionary)]
- ["." list ("#\." functor monoid fold)]
+ ["." list ("#\." functor monoid mix)]
["." set]
["." array]]]
[math
@@ -35,43 +35,43 @@
(abstract: .public Concern
{#.doc (example "A particular concern to watch-out for.")}
- {#create Bit
- #modify Bit
- #delete Bit}
+ {#creation Bit
+ #modification Bit
+ #deletion Bit}
(def: none
Concern
(:abstraction
- {#create false
- #modify false
- #delete false}))
+ {#creation false
+ #modification false
+ #deletion false}))
(template [<concern> <predicate> <event> <create> <modify> <delete>]
[(def: .public <concern>
Concern
(:abstraction
- {#create <create>
- #modify <modify>
- #delete <delete>}))
+ {#creation <create>
+ #modification <modify>
+ #deletion <delete>}))
(def: .public <predicate>
(Predicate Concern)
(|>> :representation (value@ <event>)))]
- [creation creation? #create
+ [creation creation? #creation
true false false]
- [modification modification? #modify
+ [modification modification? #modification
false true false]
- [deletion deletion? #delete
+ [deletion deletion? #deletion
false false true]
)
(def: .public (also left right)
(-> Concern Concern Concern)
(:abstraction
- {#create (or (..creation? left) (..creation? right))
- #modify (or (..modification? left) (..modification? right))
- #delete (or (..deletion? left) (..deletion? right))}))
+ {#creation (or (..creation? left) (..creation? right))
+ #modification (or (..modification? left) (..modification? right))
+ #deletion (or (..deletion? left) (..deletion? right))}))
(def: .public all
Concern
@@ -126,14 +126,14 @@
(-> (//.System Async) //.Path (Async (Try File_Tracker)))
(do {! (try.with async.monad)}
[files (\ fs directory_files directory)]
- (monad.fold !
- (function (_ file tracker)
- (do !
- [last_modified (\ fs last_modified file)]
- (in (dictionary.has file last_modified tracker))))
- (: File_Tracker
- (dictionary.empty text.hash))
- files)))
+ (monad.mix !
+ (function (_ file tracker)
+ (do !
+ [last_modified (\ fs last_modified file)]
+ (in (dictionary.has file last_modified tracker))))
+ (: File_Tracker
+ (dictionary.empty text.hash))
+ files)))
(def: (available_files fs directory)
(-> (//.System Async) //.Path (Async (Try (List [//.Path Instant]))))
@@ -172,15 +172,15 @@
current_files)]]
(in [[directory
[concern
- (let [with_deletions (list\fold dictionary.lacks file_tracker deletions)
- with_creations (list\fold (function (_ [path last_modified] tracker)
- (dictionary.has path last_modified tracker))
- with_deletions
- creations)
- with_modifications (list\fold (function (_ [path previous_modification current_modification] tracker)
- (dictionary.has path current_modification tracker))
- with_creations
- modifications)]
+ (let [with_deletions (list\mix dictionary.lacks file_tracker deletions)
+ with_creations (list\mix (function (_ [path last_modified] tracker)
+ (dictionary.has path last_modified tracker))
+ with_deletions
+ creations)
+ with_modifications (list\mix (function (_ [path previous_modification current_modification] tracker)
+ (dictionary.has path current_modification tracker))
+ with_creations
+ modifications)]
with_modifications)]]
[creations
modifications
@@ -243,13 +243,13 @@
tracker))]
(in (#try.Success [])))
.let [[creations modifications deletions]
- (list\fold (function (_ [_ [creations modifications deletions]]
- [all_creations all_modifications all_deletions])
- [(list\compose creations all_creations)
- (list\compose modifications all_modifications)
- (list\compose deletions all_deletions)])
- [(list) (list) (list)]
- changes)]]
+ (list\mix (function (_ [_ [creations modifications deletions]]
+ [all_creations all_modifications all_deletions])
+ [(list\compose creations all_creations)
+ (list\compose modifications all_modifications)
+ (list\compose deletions all_deletions)])
+ [(list) (list) (list)]
+ changes)]]
(in ($_ list\compose
(list\map (|>> product.left [..creation]) creations)
(|> modifications
@@ -340,7 +340,7 @@
(|>> java/nio/file/WatchKey::pollEvents
(\ io.monad map (|>> ..default_list
(list\map default_event_concern)
- (list\fold ..also ..none)))))
+ (list\mix ..also ..none)))))
(import: java/nio/file/WatchService
["#::."
@@ -364,11 +364,11 @@
(def: (default_start watch_events watcher path)
(-> (List Watch_Event) java/nio/file/WatchService //.Path (Async (Try java/nio/file/WatchKey)))
- (let [watch_events' (list\fold (function (_ [index watch_event] watch_events')
- (ffi.write! index watch_event watch_events'))
- (ffi.array (java/nio/file/WatchEvent$Kind java/lang/Object)
- (list.size watch_events))
- (list.enumeration watch_events))]
+ (let [watch_events' (list\mix (function (_ [index watch_event] watch_events')
+ (ffi.write! index watch_event watch_events'))
+ (ffi.array (java/nio/file/WatchEvent$Kind java/lang/Object)
+ (list.size watch_events))
+ (list.enumeration watch_events))]
(async.future
(java/nio/file/Path::register watcher
watch_events'
diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux
index 5b0a254e4..30adaea99 100644
--- a/stdlib/source/library/lux/world/net/http/request.lux
+++ b/stdlib/source/library/lux/world/net/http/request.lux
@@ -20,7 +20,7 @@
["." json (#+ JSON)]
["." context (#+ Context Property)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary]]]
[world
["." binary (#+ Binary)]]]]
@@ -32,23 +32,23 @@
(def: (merge inputs)
(-> (List Binary) Binary)
(let [[_ output] (try.trusted
- (monad.fold try.monad
- (function (_ input [offset output])
- (let [amount (binary.size input)]
- (\ try.functor map (|>> [(n.+ amount offset)])
- (binary.copy amount 0 input offset output))))
- [0 (|> inputs
- (list\map binary.size)
- (list\fold n.+ 0)
- binary.empty)]
- inputs))]
+ (monad.mix try.monad
+ (function (_ input [offset output])
+ (let [amount (binary.size input)]
+ (\ try.functor map (|>> [(n.+ amount offset)])
+ (binary.copy amount 0 input offset output))))
+ [0 (|> inputs
+ (list\map binary.size)
+ (list\mix n.+ 0)
+ binary.empty)]
+ inputs))]
output))
(def: (read_text_body body)
(-> Body (Async (Try Text)))
(do async.monad
[blobs (frp.list body)]
- (in (\ encoding.utf8 decode (merge blobs)))))
+ (in (\ encoding.utf8 decoded (merge blobs)))))
(def: failure (//response.bad_request ""))
@@ -59,7 +59,7 @@
[?raw (read_text_body (value@ #//.body message))]
(case (do try.monad
[raw ?raw
- content (\ json.codec decode raw)]
+ content (\ json.codec decoded raw)]
(json.result content reader))
(#try.Success input)
(server input request)
diff --git a/stdlib/source/library/lux/world/net/http/response.lux b/stdlib/source/library/lux/world/net/http/response.lux
index b49715c4d..b129584d5 100644
--- a/stdlib/source/library/lux/world/net/http/response.lux
+++ b/stdlib/source/library/lux/world/net/http/response.lux
@@ -29,7 +29,7 @@
(def: .public empty
(-> Status Response)
- (let [body (frp\in (\ encoding.utf8 encode ""))]
+ (let [body (frp\in (\ encoding.utf8 encoded ""))]
(function (_ status)
[status
{#//.headers (|> context.empty
@@ -56,7 +56,7 @@
(def: .public bad_request
(-> Text Response)
- (|>> (\ encoding.utf8 encode) (content status.bad_request mime.utf_8)))
+ (|>> (\ encoding.utf8 encoded) (content status.bad_request mime.utf_8)))
(def: .public ok
(-> MIME Binary Response)
@@ -65,10 +65,10 @@
(template [<name> <type> <mime> <pre>]
[(def: .public <name>
(-> <type> Response)
- (|>> <pre> (\ encoding.utf8 encode) (..ok <mime>)))]
+ (|>> <pre> (\ encoding.utf8 encoded) (..ok <mime>)))]
[text Text mime.utf_8 (<|)]
[html html.Document mime.html html.html]
[css CSS mime.css css.css]
- [json JSON mime.json json\encode]
+ [json JSON mime.json json\encoded]
)
diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux
index d59b72786..a86f33a67 100644
--- a/stdlib/source/library/lux/world/shell.lux
+++ b/stdlib/source/library/lux/world/shell.lux
@@ -25,7 +25,7 @@
["." utf8]]]
[collection
["." array (#+ Array)]
- ["." list ("#\." fold functor)]
+ ["." list ("#\." mix functor)]
["." dictionary]]]
[math
[number (#+ hex)
@@ -181,12 +181,12 @@
(def: (jvm::arguments_array arguments)
(-> (List Argument) (Array java/lang/String))
(product.right
- (list\fold (function (_ argument [idx output])
- [(++ idx) (jvm.write! idx
- (:as java/lang/String argument)
- output)])
- [0 (jvm.array java/lang/String (list.size arguments))]
- arguments)))
+ (list\mix (function (_ argument [idx output])
+ [(++ idx) (jvm.write! idx
+ (:as java/lang/String argument)
+ output)])
+ [0 (jvm.array java/lang/String (list.size arguments))]
+ arguments)))
(import: (java/util/Map k v)
["#::."
@@ -196,14 +196,14 @@
(-> Environment
(java/util/Map java/lang/String java/lang/String)
(java/util/Map java/lang/String java/lang/String))
- (list\fold (function (_ [key value] target')
- (exec
- (java/util/Map::put (:as java/lang/String key)
- (:as java/lang/String value)
- target')
- target'))
- target
- (dictionary.entries input)))
+ (list\mix (function (_ [key value] target')
+ (exec
+ (java/util/Map::put (:as java/lang/String key)
+ (:as java/lang/String value)
+ target')
+ target'))
+ target
+ (dictionary.entries input)))
(import: java/io/Reader
["#::."
@@ -263,7 +263,7 @@
[error jvm_error]
))
(def: (write message)
- (java/io/OutputStream::write (\ utf8.codec encode message) jvm_output))
+ (java/io/OutputStream::write (\ utf8.codec encoded message) jvm_output))
(~~ (template [<name> <method>]
[(def: (<name> _)
(<method> process))]
diff --git a/stdlib/source/poly/lux/abstract/equivalence.lux b/stdlib/source/poly/lux/abstract/equivalence.lux
index bcb2574bc..bc633d1ed 100644
--- a/stdlib/source/poly/lux/abstract/equivalence.lux
+++ b/stdlib/source/poly/lux/abstract/equivalence.lux
@@ -131,8 +131,8 @@
[g!eqs (<type>.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)
- g!rights (list\map (|>> nat\encode (text\compose "right") code.local_identifier) indices)]]
+ g!lefts (list\map (|>> nat\encoded (text\compose "left") code.local_identifier) indices)
+ g!rights (list\map (|>> nat\encoded (text\compose "right") code.local_identifier) indices)]]
(in (` (: (~ (@Equivalence inputT))
(function ((~ g!_) [(~+ g!lefts)] [(~+ g!rights)])
(and (~+ (|> (list.zipped/3 g!eqs g!lefts g!rights)
diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux
index 1496026a7..be290d301 100644
--- a/stdlib/source/poly/lux/data/format/json.lux
+++ b/stdlib/source/poly/lux/data/format/json.lux
@@ -44,12 +44,12 @@
(-> Nat Frac)
(|>> .int int.frac))
-(def: (rec_encode non_rec)
+(def: (rec_encoded non_rec)
(All [a] (-> (-> (-> a JSON)
(-> a JSON))
(-> a JSON)))
(function (_ input)
- (non_rec (rec_encode non_rec) input)))
+ (non_rec (rec_encoded non_rec) input)))
(def: low_mask Nat (|> 1 (i64.left_shifted 32) --))
(def: high_mask Nat (|> low_mask (i64.left_shifted 32)))
@@ -57,12 +57,12 @@
(implementation: nat_codec
(codec.Codec JSON Nat)
- (def: (encode input)
+ (def: (encoded input)
(let [high (|> input (i64.and high_mask) (i64.right_shifted 32))
low (i64.and low_mask input)]
(#/.Array (row (|> high .int int.frac #/.Number)
(|> low .int int.frac #/.Number)))))
- (def: decode
+ (def: decoded
(</>.result (</>.array
(do <>.monad
[high </>.number
@@ -73,9 +73,10 @@
(implementation: int_codec
(codec.Codec JSON Int)
- (def: encode (|>> .nat (\ nat_codec encode)))
- (def: decode
- (|>> (\ nat_codec decode) (\ try.functor map .int))))
+ (def: encoded
+ (|>> .nat (\ nat_codec encoded)))
+ (def: decoded
+ (|>> (\ nat_codec decoded) (\ try.functor map .int))))
(def: (nullable writer)
{#.doc "Builds a JSON generator for potentially inexistent values."}
@@ -89,33 +90,33 @@
(All [unit]
(codec.Codec JSON (unit.Qty unit)))
- (def: encode
+ (def: encoded
(|>> ((debug.private unit.out))
- (\ ..int_codec encode)))
- (def: decode
- (|>> (\ ..int_codec decode)
+ (\ ..int_codec encoded)))
+ (def: decoded
+ (|>> (\ ..int_codec decoded)
(\ try.functor map (debug.private unit.in)))))
-(poly: encode
+(poly: encoded
(with_expansions
[<basic> (template [<matcher> <encoder>]
[(do !
[.let [g!_ (code.local_identifier "_______")]
_ <matcher>]
- (in (` (: (~ (@JSON\encode inputT))
+ (in (` (: (~ (@JSON\encoded inputT))
<encoder>))))]
[(<type>.exactly Any) (function ((~ g!_) (~ (code.identifier ["" "0"]))) #/.Null)]
[(<type>.sub Bit) (|>> #/.Boolean)]
- [(<type>.sub Nat) (\ (~! ..nat_codec) (~' encode))]
- [(<type>.sub Int) (\ (~! ..int_codec) (~' encode))]
+ [(<type>.sub Nat) (\ (~! ..nat_codec) (~' encoded))]
+ [(<type>.sub Int) (\ (~! ..int_codec) (~' encoded))]
[(<type>.sub Frac) (|>> #/.Number)]
[(<type>.sub Text) (|>> #/.String)])
<time> (template [<type> <codec>]
[(do !
[_ (<type>.exactly <type>)]
- (in (` (: (~ (@JSON\encode inputT))
- (|>> (\ (~! <codec>) (~' encode)) #/.String)))))]
+ (in (` (: (~ (@JSON\encoded inputT))
+ (|>> (\ (~! <codec>) (~' encoded)) #/.String)))))]
... [duration.Duration duration.codec]
... [instant.Instant instant.codec]
@@ -124,9 +125,9 @@
[month.Month month.codec])]
(do {! <>.monad}
[*env* <type>.env
- .let [@JSON\encode (: (-> Type Code)
- (function (_ type)
- (` (-> (~ (poly.code *env* type)) /.JSON))))]
+ .let [@JSON\encoded (: (-> Type Code)
+ (function (_ type)
+ (` (-> (~ (poly.code *env* type)) /.JSON))))]
inputT <type>.next]
($_ <>.either
<basic>
@@ -134,8 +135,8 @@
(do !
[unitT (<type>.applied (<>.after (<type>.exactly unit.Qty)
<type>.any))]
- (in (` (: (~ (@JSON\encode inputT))
- (\ (~! qty_codec) (~' encode))))))
+ (in (` (: (~ (@JSON\encoded inputT))
+ (\ (~! qty_codec) (~' encoded))))))
(do !
[.let [g!_ (code.local_identifier "_______")
g!key (code.local_identifier "_______key")
@@ -143,8 +144,8 @@
[_ _ =val=] (<type>.applied ($_ <>.and
(<type>.exactly dictionary.Dictionary)
(<type>.exactly .Text)
- encode))]
- (in (` (: (~ (@JSON\encode inputT))
+ encoded))]
+ (in (` (: (~ (@JSON\encoded inputT))
(|>> ((~! dictionary.entries))
((~! list\map) (function ((~ g!_) [(~ g!key) (~ g!val)])
[(~ g!key) ((~ =val=) (~ g!val))]))
@@ -153,60 +154,60 @@
(do !
[[_ =sub=] (<type>.applied ($_ <>.and
(<type>.exactly .Maybe)
- encode))]
- (in (` (: (~ (@JSON\encode inputT))
+ encoded))]
+ (in (` (: (~ (@JSON\encoded inputT))
((~! ..nullable) (~ =sub=))))))
(do !
[[_ =sub=] (<type>.applied ($_ <>.and
(<type>.exactly .List)
- encode))]
- (in (` (: (~ (@JSON\encode inputT))
+ encoded))]
+ (in (` (: (~ (@JSON\encoded inputT))
(|>> ((~! list\map) (~ =sub=)) ((~! row.of_list)) #/.Array)))))
(do !
[.let [g!_ (code.local_identifier "_______")
g!input (code.local_identifier "_______input")]
- members (<type>.variant (<>.many encode))
+ members (<type>.variant (<>.many encoded))
.let [last (-- (list.size members))]]
- (in (` (: (~ (@JSON\encode inputT))
+ (in (` (: (~ (@JSON\encoded inputT))
(function ((~ g!_) (~ g!input))
(case (~ g!input)
- (~+ (list\join (list\map (function (_ [tag g!encode])
+ (~+ (list\join (list\map (function (_ [tag g!encoded])
(if (n.= last tag)
(.list (` ((~ (code.nat (-- tag))) #1 (~ g!input)))
(` ((~! /.json) [(~ (code.frac (..tag (-- tag))))
#1
- ((~ g!encode) (~ g!input))])))
+ ((~ g!encoded) (~ g!input))])))
(.list (` ((~ (code.nat tag)) #0 (~ g!input)))
(` ((~! /.json) [(~ (code.frac (..tag tag)))
#0
- ((~ g!encode) (~ g!input))])))))
+ ((~ g!encoded) (~ g!input))])))))
(list.enumeration members))))))))))
(do !
- [g!encoders (<type>.tuple (<>.many encode))
+ [g!encoders (<type>.tuple (<>.many encoded))
.let [g!_ (code.local_identifier "_______")
g!members (|> (list.size g!encoders)
list.indices
- (list\map (|>> n\encode code.local_identifier)))]]
- (in (` (: (~ (@JSON\encode inputT))
+ (list\map (|>> n\encoded code.local_identifier)))]]
+ (in (` (: (~ (@JSON\encoded inputT))
(function ((~ g!_) [(~+ g!members)])
- ((~! /.json) [(~+ (list\map (function (_ [g!member g!encode])
- (` ((~ g!encode) (~ g!member))))
+ ((~! /.json) [(~+ (list\map (function (_ [g!member g!encoded])
+ (` ((~ g!encoded) (~ g!member))))
(list.zipped/2 g!members g!encoders)))]))))))
... Type recursion
(do !
- [[selfC non_recC] (<type>.recursive encode)
+ [[selfC non_recC] (<type>.recursive encoded)
.let [g! (code.local_identifier "____________")]]
- (in (` (: (~ (@JSON\encode inputT))
- ((~! ..rec_encode) (.function ((~ g!) (~ selfC))
- (~ non_recC)))))))
+ (in (` (: (~ (@JSON\encoded inputT))
+ ((~! ..rec_encoded) (.function ((~ g!) (~ selfC))
+ (~ non_recC)))))))
<type>.recursive_self
... Type applications
(do !
- [partsC (<type>.applied (<>.many encode))]
+ [partsC (<type>.applied (<>.many encoded))]
(in (` ((~+ partsC)))))
... Polymorphism
(do !
- [[funcC varsC bodyC] (<type>.polymorphic encode)]
+ [[funcC varsC bodyC] (<type>.polymorphic encoded)]
(in (` (: (All [(~+ varsC)]
(-> (~+ (list\map (function (_ varC) (` (-> (~ varC) /.JSON)))
varsC))
@@ -220,12 +221,12 @@
(<>.failure (format "Cannot create JSON encoder for: " (type.format inputT)))
))))
-(poly: decode
+(poly: decoded
(with_expansions
[<basic> (template [<matcher> <decoder>]
[(do !
[_ <matcher>]
- (in (` (: (~ (@JSON\decode inputT))
+ (in (` (: (~ (@JSON\decoded inputT))
(~! <decoder>)))))]
[(<type>.exactly Any) </>.null]
@@ -237,7 +238,7 @@
<time> (template [<type> <codec>]
[(do !
[_ (<type>.exactly <type>)]
- (in (` (: (~ (@JSON\decode inputT))
+ (in (` (: (~ (@JSON\decoded inputT))
((~! <>.codec) (~! <codec>) (~! </>.string))))))]
... [duration.Duration duration.codec]
@@ -247,9 +248,9 @@
[month.Month month.codec])]
(do {! <>.monad}
[*env* <type>.env
- .let [@JSON\decode (: (-> Type Code)
- (function (_ type)
- (` (</>.Parser (~ (poly.code *env* type))))))]
+ .let [@JSON\decoded (: (-> Type Code)
+ (function (_ type)
+ (` (</>.Parser (~ (poly.code *env* type))))))]
inputT <type>.next]
($_ <>.either
<basic>
@@ -257,29 +258,29 @@
(do !
[unitT (<type>.applied (<>.after (<type>.exactly unit.Qty)
<type>.any))]
- (in (` (: (~ (@JSON\decode inputT))
+ (in (` (: (~ (@JSON\decoded inputT))
((~! <>.codec) (~! qty_codec) (~! </>.any))))))
(do !
[[_ _ valC] (<type>.applied ($_ <>.and
(<type>.exactly dictionary.Dictionary)
(<type>.exactly .Text)
- decode))]
- (in (` (: (~ (@JSON\decode inputT))
+ decoded))]
+ (in (` (: (~ (@JSON\decoded inputT))
((~! </>.dictionary) (~ valC))))))
(do !
[[_ subC] (<type>.applied (<>.and (<type>.exactly .Maybe)
- decode))]
- (in (` (: (~ (@JSON\decode inputT))
+ decoded))]
+ (in (` (: (~ (@JSON\decoded inputT))
((~! </>.nullable) (~ subC))))))
(do !
[[_ subC] (<type>.applied (<>.and (<type>.exactly .List)
- decode))]
- (in (` (: (~ (@JSON\decode inputT))
+ decoded))]
+ (in (` (: (~ (@JSON\decoded inputT))
((~! </>.array) ((~! <>.some) (~ subC)))))))
(do !
- [members (<type>.variant (<>.many decode))
+ [members (<type>.variant (<>.many decoded))
.let [last (-- (list.size members))]]
- (in (` (: (~ (@JSON\decode inputT))
+ (in (` (: (~ (@JSON\decoded inputT))
($_ ((~! <>.or))
(~+ (list\map (function (_ [tag memberC])
(if (n.= last tag)
@@ -293,24 +294,24 @@
((~! </>.array))))))
(list.enumeration members))))))))
(do !
- [g!decoders (<type>.tuple (<>.many decode))]
- (in (` (: (~ (@JSON\decode inputT))
+ [g!decoders (<type>.tuple (<>.many decoded))]
+ (in (` (: (~ (@JSON\decoded inputT))
((~! </>.array) ($_ ((~! <>.and)) (~+ g!decoders)))))))
... Type recursion
(do !
- [[selfC bodyC] (<type>.recursive decode)
+ [[selfC bodyC] (<type>.recursive decoded)
.let [g! (code.local_identifier "____________")]]
- (in (` (: (~ (@JSON\decode inputT))
+ (in (` (: (~ (@JSON\decoded inputT))
((~! <>.rec) (.function ((~ g!) (~ selfC))
(~ bodyC)))))))
<type>.recursive_self
... Type applications
(do !
- [[funcC argsC] (<type>.applied (<>.and decode (<>.many decode)))]
+ [[funcC argsC] (<type>.applied (<>.and decoded (<>.many decoded)))]
(in (` ((~ funcC) (~+ argsC)))))
... Polymorphism
(do !
- [[funcC varsC bodyC] (<type>.polymorphic decode)]
+ [[funcC varsC bodyC] (<type>.polymorphic decoded)]
(in (` (: (All [(~+ varsC)]
(-> (~+ (list\map (|>> (~) </>.Parser (`)) varsC))
(</>.Parser ((~ (poly.code *env* inputT)) (~+ varsC)))))
@@ -343,8 +344,8 @@
(..codec Record)))}
(in (.list (` (: (codec.Codec /.JSON (~ inputT))
(implementation
- (def: (~' encode)
- ((~! ..encode) (~ inputT)))
- (def: (~' decode)
- ((~! </>.result) ((~! ..decode) (~ inputT))))
+ (def: (~' encoded)
+ ((~! ..encoded) (~ inputT)))
+ (def: (~' decoded)
+ ((~! </>.result) ((~! ..decoded) (~ inputT))))
))))))
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux
index e4de9ab0a..d3c5b17a0 100644
--- a/stdlib/source/program/aedifex/command/build.lux
+++ b/stdlib/source/program/aedifex/command/build.lux
@@ -16,7 +16,7 @@
["." text ("#\." order)
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]
["." set]]]
[math
@@ -159,21 +159,21 @@
(list.only (|>> (value@ #///dependency.type)
(text\= ///artifact/type.lux_library)
not))
- (list\fold (function (_ dependency uniques)
- (let [artifact (value@ #///dependency.artifact dependency)
- identity [(value@ #///artifact.group artifact)
- (value@ #///artifact.name artifact)]
- version (value@ #///artifact.version artifact)]
- (case (dictionary.value identity uniques)
- (#.Some [current_version current_path])
- (if (\ version_order < version current_version)
- (dictionary.has identity [version dependency] uniques)
- uniques)
-
- #.None
- (dictionary.has identity [version dependency] uniques))))
- (: (Dictionary [Group Name] [Version Dependency])
- (dictionary.empty (product.hash text.hash text.hash))))
+ (list\mix (function (_ dependency uniques)
+ (let [artifact (value@ #///dependency.artifact dependency)
+ identity [(value@ #///artifact.group artifact)
+ (value@ #///artifact.name artifact)]
+ version (value@ #///artifact.version artifact)]
+ (case (dictionary.value identity uniques)
+ (#.Some [current_version current_path])
+ (if (\ version_order < version current_version)
+ (dictionary.has identity [version dependency] uniques)
+ uniques)
+
+ #.None
+ (dictionary.has identity [version dependency] uniques))))
+ (: (Dictionary [Group Name] [Version Dependency])
+ (dictionary.empty (product.hash text.hash text.hash))))
dictionary.values
(list\map (|>> product.right (..path fs home)))))
diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux
index 38f975939..62ec8e985 100644
--- a/stdlib/source/program/aedifex/command/deploy.lux
+++ b/stdlib/source/program/aedifex/command/deploy.lux
@@ -69,8 +69,8 @@
repository
[artifact ///artifact/type.lux_library]
(let [pom_data (|> pom
- (\ xml.codec encode)
- (\ utf8.codec encode))]
+ (\ xml.codec encoded)
+ (\ utf8.codec encoded))]
{#///package.origin (#///repository/origin.Remote "")
#///package.library [library
(///dependency/status.verified library)]
diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux
index 3c8381e51..c1b0990f5 100644
--- a/stdlib/source/program/aedifex/command/deps.lux
+++ b/stdlib/source/program/aedifex/command/deps.lux
@@ -10,7 +10,7 @@
[data
[collection
["." set (#+ Set)]
- ["." list ("#\." fold)]
+ ["." list ("#\." mix)]
["." dictionary]]
[text
["%" format]]]
@@ -55,7 +55,7 @@
cache)]
(do ///action.monad
[cached (|> (dictionary.keys cache)
- (list\fold dictionary.lacks resolution)
+ (list\mix dictionary.lacks resolution)
(///dependency/deployment.all local))
_ (console.write_line (exception.report
["Local successes" (|> local_successes
diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux
index f0677afc7..37a5c77b1 100644
--- a/stdlib/source/program/aedifex/command/install.lux
+++ b/stdlib/source/program/aedifex/command/install.lux
@@ -64,8 +64,8 @@
_ (///dependency/deployment.one repository
[identity ///artifact/type.lux_library]
(let [pom_data (|> pom
- (\ xml.codec encode)
- (\ utf8.codec encode))]
+ (\ xml.codec encoded)
+ (\ utf8.codec encoded))]
{#///package.origin (#///origin.Local "")
#///package.library (let [library (binary.result tar.writer package)]
[library (///dependency/status.verified library)])
diff --git a/stdlib/source/program/aedifex/command/pom.lux b/stdlib/source/program/aedifex/command/pom.lux
index 163fa87fa..c43982a98 100644
--- a/stdlib/source/program/aedifex/command/pom.lux
+++ b/stdlib/source/program/aedifex/command/pom.lux
@@ -29,8 +29,8 @@
(-> (Console Async) (file.System Async) (Command Any))
(do ///action.monad
[content (|> (///pom.write profile)
- (try\map (|>> (\ xml.codec encode)
- (\ utf8.codec encode)))
+ (try\map (|>> (\ xml.codec encoded)
+ (\ utf8.codec encoded)))
async\in)
_ (\ fs write content ///pom.file)]
(console.write_line ..success console)))
diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux
index 0e9ab0def..c637ae931 100644
--- a/stdlib/source/program/aedifex/dependency/deployment.lux
+++ b/stdlib/source/program/aedifex/dependency/deployment.lux
@@ -47,8 +47,8 @@
deploy_hash (: (All [h] (-> (Codec Text (Hash h)) Extension (Hash h) (Async (Try Any))))
(function (_ codec extension hash)
(|> hash
- (\ codec encode)
- (\ utf8.codec encode)
+ (\ codec encoded)
+ (\ utf8.codec encoded)
(\ repository upload (format artifact extension)))))]
(do {! (try.with async.monad)}
[_ (\ repository upload artifact data)]
diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux
index 73c5f6608..50415b61f 100644
--- a/stdlib/source/program/aedifex/dependency/resolution.lux
+++ b/stdlib/source/program/aedifex/dependency/resolution.lux
@@ -88,12 +88,12 @@
java/lang/String::trim
(:as Text))
@.jvm (|>> java/lang/String::trim)})
- (\ utf8.codec decode actual))
+ (\ utf8.codec decoded actual))
actual (|> output
(text.all_split_by " ")
list.head
(maybe.else output)
- (\ codec decode))
+ (\ codec decoded))
_ (exception.assertion exception [artifact extension output]
(\ ///hash.equivalence = (hash library) actual))]
(in (#.Some actual))))
@@ -138,8 +138,8 @@
library_&_status (..hashed repository version_template artifact extension)]
(\ async.monad in
(do try.monad
- [pom (\ utf8.codec decode pom_data)
- pom (\ xml.codec decode pom)
+ [pom (\ utf8.codec decoded pom_data)
+ pom (\ xml.codec decoded pom)
profile (<xml>.result ///pom.parser (list pom))]
(in {#///package.origin (#///repository/origin.Remote "")
#///package.library library_&_status
diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux
index 92414c441..74e78ca55 100644
--- a/stdlib/source/program/aedifex/hash.lux
+++ b/stdlib/source/program/aedifex/hash.lux
@@ -54,10 +54,10 @@
[md5 ..MD5 "MD5"]
)
- (def: encode
+ (def: encoded
(Format Binary)
(binary.aggregate (function (_ byte representation)
- (let [hex (\ n.hex encode byte)
+ (let [hex (\ n.hex encoded byte)
hex (case (text.size hex)
1 (format "0" hex)
_ hex)]
@@ -88,7 +88,7 @@
(template [<name> <size>]
[(exception: .public (<name> {data Binary})
(exception.report
- ["Pseudo hash" (%.text (..encode data))]
+ ["Pseudo hash" (%.text (..encoded data))]
["Expected size" (%.nat <size>)]
["Actual size" (%.nat (binary.size data))]))]
@@ -115,7 +115,7 @@
(-> Nat Nat)
(n.* ..hex_per_byte))
- (def: (decode size constructor encoded)
+ (def: (decoded size constructor encoded)
(All [h]
(-> Nat (-> Binary (Try (Hash h)))
(-> Text (Try (Hash h)))))
@@ -128,7 +128,7 @@
(case (text.split_at ..hex_per_chunk input)
(#.Some [head tail])
(do try.monad
- [head (\ n.hex decode head)
+ [head (\ n.hex decoded head)
output (binary.write/64! index head output)]
(recur tail (++ chunk) output))
@@ -138,7 +138,7 @@
(^template [<size> <write>]
[<size>
(do try.monad
- [head (\ n.hex decode input)
+ [head (\ n.hex decoded input)
output (<write> index head output)]
(constructor output))])
([1 binary.write/8!]
@@ -151,8 +151,8 @@
[(implementation: .public <codec>
(Codec Text (Hash <hash>))
- (def: encode (|>> :representation ..encode))
- (def: decode (..decode <nat> <constructor>)))]
+ (def: encoded (|>> :representation ..encoded))
+ (def: decoded (..decoded <nat> <constructor>)))]
[sha-1_codec SHA-1 ..sha-1::size ..as_sha-1]
[md5_codec MD5 ..md5::size ..as_md5]
diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux
index 58f37e252..b78e502a6 100644
--- a/stdlib/source/program/aedifex/input.lux
+++ b/stdlib/source/program/aedifex/input.lux
@@ -42,7 +42,7 @@
(def: project_parser
(-> Binary (Try Project))
(|>> (do> try.monad
- [(\ utf8.codec decode)]
+ [(\ utf8.codec decoded)]
[..lux_parser]
[(list) (<code>.result //parser.project)])))
diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux
index 3512114be..d8134515c 100644
--- a/stdlib/source/program/aedifex/metadata/artifact.lux
+++ b/stdlib/source/program/aedifex/metadata/artifact.lux
@@ -180,8 +180,8 @@
(#try.Success project)
(in (|> project
(do> try.monad
- [(\ utf8.codec decode)]
- [(\ xml.codec decode)]
+ [(\ utf8.codec decoded)]
+ [(\ xml.codec decoded)]
[list (<xml>.result ..parser)])))
(#try.Failure error)
@@ -196,6 +196,6 @@
(-> (Repository Async) Artifact Metadata (Async (Try Any)))
(|> metadata
..format
- (\ xml.codec encode)
- (\ utf8.codec encode)
+ (\ xml.codec encoded)
+ (\ utf8.codec encoded)
(\ repository upload (..uri artifact))))
diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux
index 6a32effef..3852f5fe1 100644
--- a/stdlib/source/program/aedifex/metadata/snapshot.lux
+++ b/stdlib/source/program/aedifex/metadata/snapshot.lux
@@ -130,8 +130,8 @@
(#try.Success project)
(in (|> project
(do> try.monad
- [(\ utf8.codec decode)]
- [(\ xml.codec decode)]
+ [(\ utf8.codec decoded)]
+ [(\ xml.codec decoded)]
[list (<xml>.result ..parser)])))
(#try.Failure error)
@@ -143,6 +143,6 @@
(-> (Repository Async) Artifact Metadata (Async (Try Any)))
(|> metadata
..format
- (\ xml.codec encode)
- (\ utf8.codec encode)
+ (\ xml.codec encoded)
+ (\ utf8.codec encoded)
(\ repository upload (..uri artifact))))
diff --git a/stdlib/source/program/aedifex/package.lux b/stdlib/source/program/aedifex/package.lux
index c0c73e0fd..7611cdac9 100644
--- a/stdlib/source/program/aedifex/package.lux
+++ b/stdlib/source/program/aedifex/package.lux
@@ -53,7 +53,7 @@
#library [library
(#//status.Verified (//hash.sha-1 library)
(//hash.md5 library))]
- #pom (let [binary_pom (|> pom (\ xml.codec encode) (\ utf8.codec encode))]
+ #pom (let [binary_pom (|> pom (\ xml.codec encoded) (\ utf8.codec encoded))]
[pom
binary_pom
(#//status.Verified (//hash.sha-1 binary_pom)
diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux
index 810c30588..7f9464e5c 100644
--- a/stdlib/source/program/aedifex/pom.lux
+++ b/stdlib/source/program/aedifex/pom.lux
@@ -16,7 +16,7 @@
[format
["_" xml (#+ Tag XML)]]
[collection
- ["." list ("#\." monoid functor fold)]
+ ["." list ("#\." monoid functor mix)]
["." set]
["." dictionary]]]
[world
@@ -226,6 +226,6 @@
_ (<>.some <xml>.any)]
(in (|> (\ /.monoid identity)
(revised@ #/.dependencies (function (_ empty)
- (list\fold set.has empty dependencies)))
+ (list\mix set.has empty dependencies)))
(revised@ #/.repositories (function (_ empty)
- (list\fold set.has empty repositories)))))))))
+ (list\mix set.has empty repositories)))))))))
diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux
index 5717221d1..687fd215b 100644
--- a/stdlib/source/program/aedifex/project.lux
+++ b/stdlib/source/program/aedifex/project.lux
@@ -14,7 +14,7 @@
[collection
["." dictionary (#+ Dictionary)]
["." set (#+ Set)]
- ["." list ("#\." fold)]]]]]
+ ["." list ("#\." mix)]]]]]
["." // #_
["#" profile (#+ Name Profile)]])
@@ -63,10 +63,10 @@
(do {! try.monad}
[parents (monad.map ! (profile' (set.has name lineage) project)
(value@ #//.parents profile))]
- (in (list\fold (function (_ parent child)
- (\ //.monoid compose child parent))
- (with@ #//.parents (list) profile)
- parents))))
+ (in (list\mix (function (_ parent child)
+ (\ //.monoid compose child parent))
+ (with@ #//.parents (list) profile)
+ parents))))
#.None
(exception.except ..unknown_profile [name])))
diff --git a/stdlib/source/program/aedifex/repository/identity.lux b/stdlib/source/program/aedifex/repository/identity.lux
index 742c1aef2..4201123c0 100644
--- a/stdlib/source/program/aedifex/repository/identity.lux
+++ b/stdlib/source/program/aedifex/repository/identity.lux
@@ -38,7 +38,7 @@
(def: .public (basic_auth user password)
(-> User Password Text)
- (let [credentials (\ utf8.codec encode (format user ":" password))]
+ (let [credentials (\ utf8.codec encoded (format user ":" password))]
(|> (java/util/Base64::getEncoder)
(java/util/Base64$Encoder::encodeToString credentials)
(format "Basic "))))
diff --git a/stdlib/source/program/compositor/import.lux b/stdlib/source/program/compositor/import.lux
index 5d1eba51c..1950c4ebb 100644
--- a/stdlib/source/program/compositor/import.lux
+++ b/stdlib/source/program/compositor/import.lux
@@ -51,26 +51,26 @@
(|>> (\ ! map (<binary>.result tar.parser))
(\ ! join)
(\ ! map (|>> row.list
- (monad.fold ! (function (_ entry import)
- (case entry
- (#tar.Normal [path instant mode ownership content])
- (let [path (tar.from_path path)]
- (case (dictionary.has' path (tar.data content) import)
- (#try.Failure error)
- (exception.except ..duplicate [library path])
+ (monad.mix ! (function (_ entry import)
+ (case entry
+ (#tar.Normal [path instant mode ownership content])
+ (let [path (tar.from_path path)]
+ (case (dictionary.has' path (tar.data content) import)
+ (#try.Failure error)
+ (exception.except ..duplicate [library path])
- import'
- import'))
-
- _
- (exception.except ..useless_tar_entry [])))
- import)))
+ import'
+ import'))
+
+ _
+ (exception.except ..useless_tar_entry [])))
+ import)))
(\ ! join)))))))
(def: .public (import system libraries)
(-> (file.System Async) (List Library) (Action Import))
- (monad.fold (: (Monad Action)
- (try.with async.monad))
- (..import_library system)
- (dictionary.empty text.hash)
- libraries))
+ (monad.mix (: (Monad Action)
+ (try.with async.monad))
+ (..import_library system)
+ (dictionary.empty text.hash)
+ libraries))
diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux
index 5083e0afc..e99367e91 100644
--- a/stdlib/source/program/scriptum.lux
+++ b/stdlib/source/program/scriptum.lux
@@ -24,7 +24,7 @@
["." utf8]]]
[collection
["." sequence (#+ Sequence) ("#\." functor)]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["n" nat]]]
@@ -318,7 +318,7 @@
#macros (list)
#implementations (list)
#values (list)}]
- (|> (list\fold add_definition init defs)
+ (|> (list\mix add_definition init defs)
(revised@ #types (list.sorted name_sort))
(revised@ #macros (list.sorted name_sort))
(revised@ #implementations (list.sorted name_sort))
@@ -399,9 +399,9 @@
md.empty)
type_code)))))
types)]
- (in (list\fold (function.flipped md.then)
- (md.heading/2 "Types")
- type_docs))))
+ (in (list\mix (function.flipped md.then)
+ (md.heading/2 "Types")
+ type_docs))))
(def: (document_macros module_name names)
(-> Text (List [Text Code]) (Markdown Block))
@@ -415,8 +415,8 @@
(do maybe.monad
[documentation (annotation.documentation def_annotations)]
(in (md.code documentation))))))))
- (list\fold (function.flipped md.then)
- (md.heading/2 "Macros"))))
+ (list\mix (function.flipped md.then)
+ (md.heading/2 "Macros"))))
(template [<singular> <plural> <header>]
[(def: (<singular> module type)
@@ -443,8 +443,8 @@
_
md.empty)
(<singular> module value_type)))))
- (list\fold (function.flipped md.then)
- (md.heading/2 <header>))))]
+ (list\mix (function.flipped md.then)
+ (md.heading/2 <header>))))]
[document_implementation document_implementations "Implementations"]
[document_value document_values "Values"]
@@ -493,7 +493,7 @@
(-> [Text (Markdown Block)] (IO Any))
(let [path (format (text.replaced "/" "_" module_name) ".md")]
(do io.monad
- [outcome (\ file.default write (\ utf8.codec encode (md.markdown documentation)) path)]
+ [outcome (\ file.default write (\ utf8.codec encoded (md.markdown documentation)) path)]
(in (case outcome
(#try.Failure error)
(debug.log! (exception.error io_error error))
diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux
index 8508220ed..87fc1a5fc 100644
--- a/stdlib/source/specification/compositor/generation/case.lux
+++ b/stdlib/source/specification/compositor/generation/case.lux
@@ -13,7 +13,7 @@
["n" nat]
["f" frac]]
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
["r" random (#+ Random)]]
[tool
@@ -152,7 +152,7 @@
(function (_ head tail)
(synthesis.variant [0 #1 (synthesis.tuple (list head tail))])))
_list_ (: (-> (List Synthesis) Synthesis)
- (list\fold _item_ _end_))]
+ (list\mix _item_ _end_))]
(let [__tuple__ (: (-> (List Synthesis) Synthesis)
(|>> list.reversed _list_ [9 #0] synthesis.variant _code_))
__form__ (: (-> (List Synthesis) Synthesis)
@@ -169,9 +169,9 @@
(_code_ (synthesis.variant [7 #0 (synthesis.tuple (list (synthesis.text module)
(synthesis.text short)))]))))
__list__ (: (-> (List Synthesis) Synthesis)
- (list\fold (function (_ head tail)
- (__form__ (list (__tag__ ["" "Item"]) head tail)))
- (__tag__ ["" "End"])))
+ (list\mix (function (_ head tail)
+ (__form__ (list (__tag__ ["" "Item"]) head tail)))
+ (__tag__ ["" "End"])))
__apply__ (: (-> Synthesis Synthesis Synthesis)
(function (_ func arg)
(__form__ (list func arg))))]
diff --git a/stdlib/source/specification/lux/abstract/apply.lux b/stdlib/source/specification/lux/abstract/apply.lux
index 71df69a83..e857c81e5 100644
--- a/stdlib/source/specification/lux/abstract/apply.lux
+++ b/stdlib/source/specification/lux/abstract/apply.lux
@@ -21,7 +21,7 @@
[sample (\ ! map injection random.nat)]
(_.test "Identity."
((comparison n.=)
- (\apply (injection function.identity) sample)
+ (\on sample (injection function.identity))
sample))))
(def: (homomorphism injection comparison (^open "\."))
@@ -31,7 +31,7 @@
increase (\ ! map n.+ random.nat)]
(_.test "Homomorphism."
((comparison n.=)
- (\apply (injection increase) (injection sample))
+ (\on (injection sample) (injection increase))
(injection (increase sample))))))
(def: (interchange injection comparison (^open "\."))
@@ -41,8 +41,9 @@
increase (\ ! map n.+ random.nat)]
(_.test "Interchange."
((comparison n.=)
- (\apply (injection increase) (injection sample))
- (\apply (injection (function (_ f) (f sample))) (injection increase))))))
+ (\on (injection sample) (injection increase))
+ (\on (injection increase) (injection (: (-> (-> Nat Nat) Nat)
+ (function (_ f) (f sample)))))))))
(def: (composition injection comparison (^open "\."))
(All [f] (-> (Injection f) (Comparison f) (Apply f) Test))
@@ -52,15 +53,13 @@
decrease (\ ! map n.- random.nat)]
(_.test "Composition."
((comparison n.=)
- (_$ \apply
- (injection function.composite)
- (injection increase)
- (injection decrease)
- (injection sample))
- ($_ \apply
- (injection increase)
- (injection decrease)
- (injection sample))))))
+ (|> (injection function.composite)
+ (\on (injection increase))
+ (\on (injection decrease))
+ (\on (injection sample)))
+ (\on (\on (injection sample)
+ (injection increase))
+ (injection decrease))))))
(def: .public (spec injection comparison apply)
(All [f] (-> (Injection f) (Comparison f) (Apply f) Test))
diff --git a/stdlib/source/specification/lux/abstract/codec.lux b/stdlib/source/specification/lux/abstract/codec.lux
index 3cbb712d2..1725bbc92 100644
--- a/stdlib/source/specification/lux/abstract/codec.lux
+++ b/stdlib/source/specification/lux/abstract/codec.lux
@@ -19,7 +19,7 @@
[expected generator]
(_.for [/.Codec]
(_.test "Isomorphism."
- (case (|> expected @//encode @//decode)
+ (case (|> expected @//encoded @//decoded)
(#try.Success actual)
(@//= expected actual)
diff --git a/stdlib/source/specification/lux/abstract/fold.lux b/stdlib/source/specification/lux/abstract/mix.lux
index 6d3ad1f7e..1097ac37f 100644
--- a/stdlib/source/specification/lux/abstract/fold.lux
+++ b/stdlib/source/specification/lux/abstract/mix.lux
@@ -14,10 +14,10 @@
["." /]])
(def: .public (spec injection comparison (^open "@//."))
- (All [f] (-> (Injection f) (Comparison f) (/.Fold f) Test))
+ (All [f] (-> (Injection f) (Comparison f) (/.Mix f) Test))
(do random.monad
[subject random.nat
parameter random.nat]
- (_.cover [/.Fold]
- (n.= (@//fold n.+ parameter (injection subject))
+ (_.cover [/.Mix]
+ (n.= (@//mix n.+ parameter (injection subject))
(n.+ parameter subject)))))
diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux
index 0b5414dea..504990ea4 100644
--- a/stdlib/source/specification/lux/world/file.lux
+++ b/stdlib/source/specification/lux/world/file.lux
@@ -260,8 +260,8 @@
in
(do {! async.monad}
[fs (async.future fs)
- make_file!/0 (/.make_file ! fs (utf8\encode file/0) file/0)
- make_file!/1 (/.make_file ! fs (utf8\encode file/0) file/0)])
+ make_file!/0 (/.make_file ! fs (utf8\encoded file/0) file/0)
+ make_file!/1 (/.make_file ! fs (utf8\encoded file/0) file/0)])
($_ _.and'
(_.cover' [/.make_file]
(case make_file!/0
@@ -298,7 +298,7 @@
pre_dir/0 (\ fs directory? dir)
pre_dir/1 (/.exists? ! fs dir)
- made_file? (/.make_file ! fs (utf8\encode file) file)
+ made_file? (/.make_file ! fs (utf8\encoded file) file)
made_dir? (\ fs make_directory dir)
post_file/0 (\ fs file? file)
diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux
index ea62b6daa..1ed19ddf7 100644
--- a/stdlib/source/test/aedifex/command/auto.lux
+++ b/stdlib/source/test/aedifex/command/auto.lux
@@ -57,7 +57,7 @@
(if (n.= expected_runs actual_runs)
(in (#try.Failure end_signal))
(do (try.with !)
- [_ (\ fs write (\ utf8.codec encode (%.nat actual_runs)) dummy_file)
+ [_ (\ fs write (\ utf8.codec encoded (%.nat actual_runs)) dummy_file)
_ (\ fs modify
(|> actual_runs .int instant.of_millis)
dummy_file)]
diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux
index 1df6a4180..526227f2d 100644
--- a/stdlib/source/test/aedifex/command/deploy.lux
+++ b/stdlib/source/test/aedifex/command/deploy.lux
@@ -91,13 +91,13 @@
actual_sha-1 (\ repository download (///repository/remote.uri (value@ #///artifact.version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.sha-1)))
actual_sha-1 (\ async.monad in
(do try.monad
- [actual_sha-1 (\ utf8.codec decode actual_sha-1)]
- (\ ///hash.sha-1_codec decode actual_sha-1)))
+ [actual_sha-1 (\ utf8.codec decoded actual_sha-1)]
+ (\ ///hash.sha-1_codec decoded actual_sha-1)))
actual_md5 (\ repository download (///repository/remote.uri (value@ #///artifact.version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.md5)))
actual_md5 (\ async.monad in
(do try.monad
- [actual_md5 (\ utf8.codec decode actual_md5)]
- (\ ///hash.md5_codec decode actual_md5)))
+ [actual_md5 (\ utf8.codec decoded actual_md5)]
+ (\ ///hash.md5_codec decoded actual_md5)))
.let [succeeded!
(text\= /.success logging)
@@ -107,7 +107,7 @@
actual_library)
deployed_pom!
- (binary\= (|> expected_pom (\ xml.codec encode) (\ utf8.codec encode))
+ (binary\= (|> expected_pom (\ xml.codec encoded) (\ utf8.codec encoded))
actual_pom)
deployed_sha-1!
diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux
index ec45ba697..87a3e1731 100644
--- a/stdlib/source/test/aedifex/command/deps.lux
+++ b/stdlib/source/test/aedifex/command/deps.lux
@@ -85,12 +85,12 @@
dependee_package (|> dependee_package
(with@ #///package.origin (#///repository/origin.Remote ""))
(with@ #///package.pom [dependee_pom
- (|> dependee_pom (\ xml.codec encode) (\ utf8.codec encode))
+ (|> dependee_pom (\ xml.codec encoded) (\ utf8.codec encoded))
#///dependency/status.Unverified]))
depender_package (|> depender_package
(with@ #///package.origin (#///repository/origin.Remote ""))
(with@ #///package.pom [depender_pom
- (|> depender_pom (\ xml.codec encode) (\ utf8.codec encode))
+ (|> depender_pom (\ xml.codec encoded) (\ utf8.codec encoded))
#///dependency/status.Unverified]))
fs (file.mock (\ file.default separator))
diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux
index b06a7c944..7c2097a4d 100644
--- a/stdlib/source/test/aedifex/command/pom.lux
+++ b/stdlib/source/test/aedifex/command/pom.lux
@@ -44,8 +44,8 @@
(do !
[verdict (do ///action.monad
[expected (|> (///pom.write sample)
- (try\map (|>> (\ xml.codec encode)
- (\ utf8.codec encode)))
+ (try\map (|>> (\ xml.codec encoded)
+ (\ utf8.codec encoded)))
(\ ! in))
actual (\ fs read ///pom.file)
diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux
index 009298783..97fd9f1f4 100644
--- a/stdlib/source/test/aedifex/dependency/deployment.lux
+++ b/stdlib/source/test/aedifex/dependency/deployment.lux
@@ -20,7 +20,7 @@
[collection
["." dictionary (#+ Dictionary)]
["." set]
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
["." random (#+ Random)]
[number
@@ -171,10 +171,10 @@
bundles (|> ..bundle
(random.set hash num_bundles)
(\ ! map set.list))
- .let [resolution (list\fold (function (_ [dependency expected_artifact package] resolution)
- (dictionary.has dependency package resolution))
- resolution.empty
- bundles)
+ .let [resolution (list\mix (function (_ [dependency expected_artifact package] resolution)
+ (dictionary.has dependency package resolution))
+ resolution.empty
+ bundles)
cache (: Cache
(atom.atom (dictionary.empty text.hash)))
http (..http cache)
diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux
index 44420243d..355cf9c98 100644
--- a/stdlib/source/test/aedifex/dependency/resolution.lux
+++ b/stdlib/source/test/aedifex/dependency/resolution.lux
@@ -77,14 +77,14 @@
(def: sha-1
(-> Binary Binary)
(|>> ///hash.sha-1
- (\ ///hash.sha-1_codec encode)
- (\ utf8.codec encode)))
+ (\ ///hash.sha-1_codec encoded)
+ (\ utf8.codec encoded)))
(def: md5
(-> Binary Binary)
(|>> ///hash.md5
- (\ ///hash.md5_codec encode)
- (\ utf8.codec encode)))
+ (\ ///hash.md5_codec encoded)
+ (\ utf8.codec encoded)))
(def: .public nope
(Mock Any)
@@ -112,8 +112,8 @@
(|> package
(value@ #///package.pom)
product.left
- (\ xml.codec encode)
- (\ utf8.codec encode)))]
+ (\ xml.codec encoded)
+ (\ utf8.codec encoded)))]
(cond (text.ends_with? ///artifact/extension.lux_library uri)
(#try.Success [state library])
@@ -166,23 +166,23 @@
(#try.Success [state (|> expected_package
(value@ #///package.pom)
product.left
- (\ xml.codec encode)
- (\ utf8.codec encode))])
+ (\ xml.codec encoded)
+ (\ utf8.codec encoded))])
(text.ends_with? ..pom_sha-1 uri)
(#try.Success [state (|> dummy_package
(value@ #///package.pom)
product.left
- (\ xml.codec encode)
- (\ utf8.codec encode)
+ (\ xml.codec encoded)
+ (\ utf8.codec encoded)
..sha-1)])
(text.ends_with? ..pom_md5 uri)
(#try.Success [state (|> expected_package
(value@ #///package.pom)
product.left
- (\ xml.codec encode)
- (\ utf8.codec encode)
+ (\ xml.codec encoded)
+ (\ utf8.codec encoded)
..md5)])
... else
@@ -219,23 +219,23 @@
(#try.Success [state (|> expected_package
(value@ #///package.pom)
product.left
- (\ xml.codec encode)
- (\ utf8.codec encode))])
+ (\ xml.codec encoded)
+ (\ utf8.codec encoded))])
(text.ends_with? ..pom_sha-1 uri)
(#try.Success [state (|> expected_package
(value@ #///package.pom)
product.left
- (\ xml.codec encode)
- (\ utf8.codec encode)
+ (\ xml.codec encoded)
+ (\ utf8.codec encoded)
..sha-1)])
(text.ends_with? ..pom_md5 uri)
(#try.Success [state (|> dummy_package
(value@ #///package.pom)
product.left
- (\ xml.codec encode)
- (\ utf8.codec encode)
+ (\ xml.codec encoded)
+ (\ utf8.codec encoded)
..md5)])
... else
@@ -381,17 +381,17 @@
dependee_package (with@ #///package.pom
[dependee_pom
- (|> dependee_pom (\ xml.codec encode) (\ utf8.codec encode))
+ (|> dependee_pom (\ xml.codec encoded) (\ utf8.codec encoded))
#///dependency/status.Unverified]
dependee_package)
depender_package (with@ #///package.pom
[depender_pom
- (|> depender_pom (\ xml.codec encode) (\ utf8.codec encode))
+ (|> depender_pom (\ xml.codec encoded) (\ utf8.codec encoded))
#///dependency/status.Unverified]
depender_package)
ignored_package (with@ #///package.pom
[ignored_pom
- (|> ignored_pom (\ xml.codec encode) (\ utf8.codec encode))
+ (|> ignored_pom (\ xml.codec encoded) (\ utf8.codec encoded))
#///dependency/status.Unverified]
ignored_package)]]
(in [[dependee depender ignored]
diff --git a/stdlib/source/test/aedifex/hash.lux b/stdlib/source/test/aedifex/hash.lux
index dc5633040..5e267091d 100644
--- a/stdlib/source/test/aedifex/hash.lux
+++ b/stdlib/source/test/aedifex/hash.lux
@@ -80,8 +80,8 @@
[(do random.monad
[expected (..random <hash>)]
(_.cover [<codec>]
- (case (\ <codec> decode
- (format (\ <codec> encode expected)
+ (case (\ <codec> decoded
+ (format (\ <codec> encoded expected)
"AABBCC"))
(#try.Success actual)
false
diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux
index 1c47fdd6f..675357e7e 100644
--- a/stdlib/source/test/aedifex/input.lux
+++ b/stdlib/source/test/aedifex/input.lux
@@ -53,7 +53,7 @@
[.let [profile (|> expected
//format.profile
%.code
- (\ utf8.codec encode))]
+ (\ utf8.codec encoded))]
_ (\ fs write profile //project.file)
actual (: (Async (Try Profile))
(/.read async.monad fs //.default))]
diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux
index 9596eb63f..7e9cf1dd6 100644
--- a/stdlib/source/test/aedifex/package.lux
+++ b/stdlib/source/test/aedifex/package.lux
@@ -92,8 +92,8 @@
expected_md5 (//hash.md5 binary_pom)]
(and (same? expected_pom actual_pom)
(|> (do try.monad
- [xml_pom (\ utf8.codec decode binary_pom)
- decoded_pom (\ xml.codec decode xml_pom)]
+ [xml_pom (\ utf8.codec decoded binary_pom)
+ decoded_pom (\ xml.codec decoded xml_pom)]
(in (\ xml.equivalence = actual_pom decoded_pom)))
(try.else false))
(case pom_status
diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux
index b2352bdd2..ccc13752f 100644
--- a/stdlib/source/test/aedifex/repository/local.lux
+++ b/stdlib/source/test/aedifex/repository/local.lux
@@ -35,7 +35,7 @@
repo (/.repository program fs)]
uri (random.ascii/lower 10)
- expected (\ ! map (\ utf8.codec encode)
+ expected (\ ! map (\ utf8.codec encoded)
(random.ascii/lower 10))]
($_ _.and
(in (do async.monad
diff --git a/stdlib/source/test/aedifex/repository/remote.lux b/stdlib/source/test/aedifex/repository/remote.lux
index 44f913863..96d62ef6f 100644
--- a/stdlib/source/test/aedifex/repository/remote.lux
+++ b/stdlib/source/test/aedifex/repository/remote.lux
@@ -33,7 +33,7 @@
(def: (url_body url)
(-> URL (@http.Body IO))
- (let [url (\ utf8.codec encode url)]
+ (let [url (\ utf8.codec encoded url)]
(function (_ _)
(io.io (#try.Success [(binary.size url) url])))))
@@ -90,7 +90,7 @@
user (random.ascii/lower 10)
password (random.ascii/lower 10)
- content (\ ! map (\ utf8.codec encode)
+ content (\ ! map (\ utf8.codec encoded)
(random.ascii/lower 10))]
($_ _.and
(_.cover [/.repository /.user_agent /.Address]
@@ -100,7 +100,7 @@
address)]
(and (|> (\ repo download uri)
io.run!
- (try\map (\ utf8.codec decode))
+ (try\map (\ utf8.codec decoded))
try\join
(try\map (text\= (format address uri)))
(try.else false))
diff --git a/stdlib/source/test/lux/abstract.lux b/stdlib/source/test/lux/abstract.lux
index cb41844eb..d65330a22 100644
--- a/stdlib/source/test/lux/abstract.lux
+++ b/stdlib/source/test/lux/abstract.lux
@@ -10,7 +10,7 @@
["#." enum]
["#." equivalence]
["#." hash]
- ["#." fold]
+ ["#." mix]
["#." functor
["#/." contravariant]]
["#." interval]
@@ -49,7 +49,7 @@
/enum.test
/equivalence.test
/hash.test
- /fold.test
+ /mix.test
/interval.test
/monoid.test
/order.test
diff --git a/stdlib/source/test/lux/abstract/apply.lux b/stdlib/source/test/lux/abstract/apply.lux
index fcdf5d793..75da1dc47 100644
--- a/stdlib/source/test/lux/abstract/apply.lux
+++ b/stdlib/source/test/lux/abstract/apply.lux
@@ -25,9 +25,9 @@
($_ _.and
(_.cover [/.composite]
(let [expected (n.+ left right)]
- (case (\ (/.composite maybe.monad maybe.apply list.apply) apply
- (#.Some (list (n.+ left)))
- (#.Some (list right)))
+ (case (\ (/.composite maybe.monad maybe.apply list.apply) on
+ (#.Some (list right))
+ (#.Some (list (n.+ left))))
(^ (#.Some (list actual)))
(n.= expected actual)
diff --git a/stdlib/source/test/lux/abstract/codec.lux b/stdlib/source/test/lux/abstract/codec.lux
index e3fd09626..32668c30f 100644
--- a/stdlib/source/test/lux/abstract/codec.lux
+++ b/stdlib/source/test/lux/abstract/codec.lux
@@ -21,12 +21,12 @@
(Codec JSON Bit)
(let [field "value"]
(implementation
- (def: encode
+ (def: encoded
(|>> #json.Boolean
[field]
list
json.object))
- (def: decode
+ (def: decoded
(json.boolean_field field)))))
(def: codec
@@ -39,7 +39,7 @@
[expected random.bit]
(<| (_.covering /._)
(_.cover [/.composite]
- (case (|> expected (\ ..codec encode) (\ ..codec decode))
+ (case (|> expected (\ ..codec encoded) (\ ..codec decoded))
(#try.Success actual)
(bit\= expected actual)
diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux
index 179dad8df..33dff9472 100644
--- a/stdlib/source/test/lux/abstract/enum.lux
+++ b/stdlib/source/test/lux/abstract/enum.lux
@@ -9,7 +9,7 @@
[data
["." product]
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
["." random (#+ Random)]
[number
@@ -39,12 +39,12 @@
(list.reversed (/.range n.enum end start)))
every_element_is_a_successor? (case range
(#.Item head tail)
- (|> (list\fold (function (_ next [verdict prev])
- [(and verdict
- (n.= next (\ n.enum succ prev)))
- next])
- [true head]
- tail)
+ (|> (list\mix (function (_ next [verdict prev])
+ [(and verdict
+ (n.= next (\ n.enum succ prev)))
+ next])
+ [true head]
+ tail)
product.left)
#.End
diff --git a/stdlib/source/test/lux/abstract/fold.lux b/stdlib/source/test/lux/abstract/mix.lux
index 1dbf9eec8..5aac1fd2b 100644
--- a/stdlib/source/test/lux/abstract/fold.lux
+++ b/stdlib/source/test/lux/abstract/mix.lux
@@ -12,7 +12,7 @@
[number
["n" nat]]]]]
[\\library
- ["." / (#+ Fold)]])
+ ["." / (#+ Mix)]])
(def: .public test
Test
@@ -21,6 +21,6 @@
(<| (_.covering /._)
($_ _.and
(_.cover [/.with_monoid]
- (n.= (\ list.fold fold (\ n.addition compose) (\ n.addition identity) samples)
- (/.with_monoid n.addition list.fold samples)))
+ (n.= (\ list.mix mix (\ n.addition compose) (\ n.addition identity) samples)
+ (/.with_monoid n.addition list.mix samples)))
))))
diff --git a/stdlib/source/test/lux/abstract/monad.lux b/stdlib/source/test/lux/abstract/monad.lux
index 051f63a5c..5ede269ef 100644
--- a/stdlib/source/test/lux/abstract/monad.lux
+++ b/stdlib/source/test/lux/abstract/monad.lux
@@ -5,7 +5,7 @@
[data
["." identity (#+ Identity)]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
["." random]
[number
@@ -52,13 +52,13 @@
(|> poly
(/.only identity.monad (|>> n.even? (\ identity.monad in)))
(: (Identity (List Nat))))))
- (_.cover [/.fold]
- (n.= (list\fold n.+ 0 poly)
+ (_.cover [/.mix]
+ (n.= (list\mix n.+ 0 poly)
(|> poly
- (/.fold identity.monad
- (function (_ part whole)
- (\ identity.monad in
- (n.+ part whole)))
- 0)
+ (/.mix identity.monad
+ (function (_ part whole)
+ (\ identity.monad in
+ (n.+ part whole)))
+ 0)
(: (Identity Nat)))))
))))
diff --git a/stdlib/source/test/lux/abstract/monoid.lux b/stdlib/source/test/lux/abstract/monoid.lux
index 75eee67c6..c78d2d8f6 100644
--- a/stdlib/source/test/lux/abstract/monoid.lux
+++ b/stdlib/source/test/lux/abstract/monoid.lux
@@ -23,8 +23,8 @@
intR random.int]
(<| (_.covering /._)
($_ _.and
- (_.cover [/.composite]
- (let [[natLR intLR] (\ (/.composite nat.addition int.multiplication) compose
+ (_.cover [/.and]
+ (let [[natLR intLR] (\ (/.and nat.addition int.multiplication) compose
[natL intL] [natR intR])]
(and (nat.= (\ nat.addition compose natL natR)
natLR)
diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux
index 5876331b6..174c8adc7 100644
--- a/stdlib/source/test/lux/control/concurrency/frp.lux
+++ b/stdlib/source/test/lux/control/concurrency/frp.lux
@@ -14,7 +14,7 @@
["." io (#+ IO io)]]
[data
[collection
- ["." list ("#\." fold monoid)]
+ ["." list ("#\." mix monoid)]
["." row (#+ Row)]]]
[math
["." random]
@@ -161,22 +161,22 @@
(_.cover' [/.Subscriber /.subscribe!]
(list\= inputs listened))))
(in (do async.monad
- [actual (/.aggregate (function (_ input total)
- (async.resolved (n.+ input total)))
- 0
- (/.sequential 0 inputs))]
- (_.cover' [/.aggregate]
- (n.= (list\fold n.+ 0 inputs)
+ [actual (/.mix (function (_ input total)
+ (async.resolved (n.+ input total)))
+ 0
+ (/.sequential 0 inputs))]
+ (_.cover' [/.mix]
+ (n.= (list\mix n.+ 0 inputs)
actual))))
(in (do async.monad
[actual (|> inputs
(/.sequential 0)
- (/.aggregates (function (_ input total)
- (async.resolved (n.+ input total)))
- 0)
+ (/.mixes (function (_ input total)
+ (async.resolved (n.+ input total)))
+ 0)
/.list)]
- (_.cover' [/.aggregates]
- (list\= (list.aggregates n.+ 0 inputs)
+ (_.cover' [/.mixes]
+ (list\= (list.mixes n.+ 0 inputs)
actual))))
(in (do async.monad
[actual (|> (list distint/0 distint/0 distint/0
@@ -218,6 +218,6 @@
/.list)]
(_.cover' [/.iterations]
(and (n.= max_iterations (list.size actual))
- (list\= (list.aggregates n.+ sample (list.repeated (-- max_iterations) shift))
+ (list\= (list.mixes n.+ sample (list.repeated (-- max_iterations) shift))
actual)))))
)))))
diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux
index 914247204..3941998fc 100644
--- a/stdlib/source/test/lux/control/function/memo.lux
+++ b/stdlib/source/test/lux/control/function/memo.lux
@@ -11,7 +11,7 @@
["." product]
[collection
["." dictionary (#+ Dictionary)]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
["." random]
[number
@@ -112,7 +112,7 @@
(in (n.* input output')))))))
expected (|> (list.indices input)
(list\map ++)
- (list\fold n.* 1))
+ (list\mix n.* 1))
actual (|> (memo input)
(state.result (dictionary.empty n.hash))
product.right)]
diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux
index b41da5623..001626888 100644
--- a/stdlib/source/test/lux/control/function/mixin.lux
+++ b/stdlib/source/test/lux/control/function/mixin.lux
@@ -13,7 +13,7 @@
[data
["." product]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
["." random (#+ Random)]
[number
@@ -40,7 +40,7 @@
output))))
expected (|> (list.indices input)
(list\map ++)
- (list\fold n.* 1))]])
+ (list\mix n.* 1))]])
($_ _.and
(_.for [/.Mixin]
($_ _.and
diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux
index dcf4d0e80..a3c20dbde 100644
--- a/stdlib/source/test/lux/control/parser/binary.lux
+++ b/stdlib/source/test/lux/control/parser/binary.lux
@@ -54,8 +54,8 @@
(def: (utf8_conversion_does_not_alter? value)
(Predicate Text)
(|> value
- (\ utf8.codec encode)
- (\ utf8.codec decode)
+ (\ utf8.codec encoded)
+ (\ utf8.codec decoded)
(case> (#try.Success converted)
(text\= value converted)
@@ -148,7 +148,7 @@
(`` ($_ _.and
(~~ (template [<parser> <format>]
[(do {! random.monad}
- [expected (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))]
+ [expected (\ ! map (\ utf8.codec encoded) (random.ascii ..segment_size))]
(_.cover [<parser> <format>]
(|> (format.result <format> expected)
(/.result <parser>)
@@ -329,14 +329,14 @@
(/.result /.any)
(!expect (#try.Success _))))
(do {! random.monad}
- [data (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))]
+ [data (\ ! map (\ utf8.codec encoded) (random.ascii ..segment_size))]
(_.cover [/.binary_was_not_fully_read]
(|> data
(/.result /.any)
(!expect (^multi (#try.Failure error)
(exception.match? /.binary_was_not_fully_read error))))))
(do {! random.monad}
- [expected (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))]
+ [expected (\ ! map (\ utf8.codec encoded) (random.ascii ..segment_size))]
(_.cover [/.segment format.segment format.result]
(|> expected
(format.result (format.segment ..segment_size))
@@ -344,7 +344,7 @@
(!expect (^multi (#try.Success actual)
(\ binary.equivalence = expected actual))))))
(do {! random.monad}
- [data (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))]
+ [data (\ ! map (\ utf8.codec encoded) (random.ascii ..segment_size))]
(_.cover [/.end?]
(|> data
(/.result (do <>.monad
@@ -356,7 +356,7 @@
(!expect (#try.Success #1)))))
(do {! random.monad}
[to_read (\ ! map (n.% (++ ..segment_size)) random.nat)
- data (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))]
+ data (\ ! map (\ utf8.codec encoded) (random.ascii ..segment_size))]
(_.cover [/.Offset /.offset]
(|> data
(/.result (do <>.monad
@@ -371,7 +371,7 @@
(!expect (#try.Success #1)))))
(do {! random.monad}
[to_read (\ ! map (n.% (++ ..segment_size)) random.nat)
- data (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))]
+ data (\ ! map (\ utf8.codec encoded) (random.ascii ..segment_size))]
(_.cover [/.remaining]
(|> data
(/.result (do <>.monad
diff --git a/stdlib/source/test/lux/control/parser/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux
index 529986ad4..9c1247775 100644
--- a/stdlib/source/test/lux/control/parser/cli.lux
+++ b/stdlib/source/test/lux/control/parser/cli.lux
@@ -31,7 +31,7 @@
(<| (_.covering /._)
(_.for [/.Parser])
(do {! random.monad}
- [expected (\ ! map n\encode random.nat)
+ [expected (\ ! map n\encoded random.nat)
.let [random_dummy (random.only (|>> (text\= expected) not)
(random.unicode 5))]
dummy random_dummy
@@ -45,10 +45,10 @@
(!expect (^multi (#try.Success actual)
(text\= expected actual)))))
(_.cover [/.parse]
- (|> (/.result (/.parse n\decode) (list expected))
+ (|> (/.result (/.parse n\decoded) (list expected))
(!expect (^multi (#try.Success actual)
(text\= expected
- (n\encode actual))))))
+ (n\encoded actual))))))
(_.cover [/.this]
(and (|> (/.result (/.this expected) (list expected))
(!expect (#try.Success _)))
diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux
index 951bed82e..b3767ab01 100644
--- a/stdlib/source/test/lux/control/parser/text.lux
+++ b/stdlib/source/test/lux/control/parser/text.lux
@@ -100,19 +100,19 @@
[expected (\ ! map (n.% 10) random.nat)
invalid (random.char (unicode.set [unicode/block.number_forms (list)]))]
(_.cover [/.decimal]
- (and (..should_pass (\ n.decimal encode expected) /.decimal)
+ (and (..should_pass (\ n.decimal encoded expected) /.decimal)
(..should_fail (text.of_char invalid) /.decimal))))
(do {! random.monad}
[expected (\ ! map (n.% 8) random.nat)
invalid (random.char (unicode.set [unicode/block.number_forms (list)]))]
(_.cover [/.octal]
- (and (..should_pass (\ n.octal encode expected) /.octal)
+ (and (..should_pass (\ n.octal encoded expected) /.octal)
(..should_fail (text.of_char invalid) /.octal))))
(do {! random.monad}
[expected (\ ! map (n.% 16) random.nat)
invalid (random.char (unicode.set [unicode/block.number_forms (list)]))]
(_.cover [/.hexadecimal]
- (and (..should_pass (\ n.hex encode expected) /.hexadecimal)
+ (and (..should_pass (\ n.hex encoded expected) /.hexadecimal)
(..should_fail (text.of_char invalid) /.hexadecimal))))
(do {! random.monad}
[expected (random.char unicode.ascii/alpha)
@@ -210,26 +210,26 @@
(let [octal! (/.one_of! "01234567")]
($_ _.and
(do {! random.monad}
- [left (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)
- right (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)
+ [left (\ ! map (|>> (n.% 8) (\ n.octal encoded)) random.nat)
+ right (\ ! map (|>> (n.% 8) (\ n.octal encoded)) random.nat)
.let [expected (format left right)]
invalid (|> random.nat
(\ ! map (n.% 16))
(random.only (n.>= 8))
- (\ ! map (\ n.hex encode)))]
+ (\ ! map (\ n.hex encoded)))]
(_.cover [/.many /.many!]
(and (..should_pass expected (/.many /.octal))
(..should_fail invalid (/.many /.octal))
(..should_pass! expected (/.many! octal!)))))
(do {! random.monad}
- [left (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)
- right (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)
+ [left (\ ! map (|>> (n.% 8) (\ n.octal encoded)) random.nat)
+ right (\ ! map (|>> (n.% 8) (\ n.octal encoded)) random.nat)
.let [expected (format left right)]
invalid (|> random.nat
(\ ! map (n.% 16))
(random.only (n.>= 8))
- (\ ! map (\ n.hex encode)))]
+ (\ ! map (\ n.hex encoded)))]
(_.cover [/.some /.some!]
(and (..should_pass expected (/.some /.octal))
(..should_pass "" (/.some /.octal))
@@ -238,7 +238,7 @@
(..should_pass! expected (/.some! octal!))
(..should_pass! "" (/.some! octal!)))))
(do {! random.monad}
- [.let [octal (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)]
+ [.let [octal (\ ! map (|>> (n.% 8) (\ n.octal encoded)) random.nat)]
first octal
second octal
third octal]
@@ -251,7 +251,7 @@
(..should_fail (format first second third) (/.exactly! 2 octal!))
(..should_fail (format first) (/.exactly! 2 octal!)))))
(do {! random.monad}
- [.let [octal (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)]
+ [.let [octal (\ ! map (|>> (n.% 8) (\ n.octal encoded)) random.nat)]
first octal
second octal
third octal]
@@ -264,7 +264,7 @@
(..should_pass! (format first) (/.at_most! 2 octal!))
(..should_fail (format first second third) (/.at_most! 2 octal!)))))
(do {! random.monad}
- [.let [octal (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)]
+ [.let [octal (\ ! map (|>> (n.% 8) (\ n.octal encoded)) random.nat)]
first octal
second octal
third octal]
@@ -277,7 +277,7 @@
(..should_pass! (format first second third) (/.at_least! 2 octal!))
(..should_fail (format first) (/.at_least! 2 octal!)))))
(do {! random.monad}
- [.let [octal (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)]
+ [.let [octal (\ ! map (|>> (n.% 8) (\ n.octal encoded)) random.nat)]
first octal
second octal
third octal]
@@ -389,7 +389,7 @@
(/.this output)))
(!expect (#try.Success _)))))
(do {! random.monad}
- [expected (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)]
+ [expected (\ ! map (|>> (n.% 8) (\ n.octal encoded)) random.nat)]
(_.cover [/.then]
(|> (list (code.text expected))
(<c>.result (/.then /.octal <c>.text))
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux
index 331e05142..9d843b540 100644
--- a/stdlib/source/test/lux/data/binary.lux
+++ b/stdlib/source/test/lux/data/binary.lux
@@ -93,7 +93,7 @@
(_.for [/.monoid]
($monoid.spec /.equivalence /.monoid (..random size)))
(_.cover [/.aggregate]
- (n.= (\ list.fold fold n.+ 0 (..as_list sample))
+ (n.= (\ list.mix mix n.+ 0 (..as_list sample))
(/.aggregate n.+ 0 sample)))
(_.cover [/.empty]
@@ -142,7 +142,7 @@
false
(#.Item head tail)
- (n.= (list.fold n.+ 0 tail)
+ (n.= (list.mix n.+ 0 tail)
(/.aggregate n.+ 0 (/.after 1 sample))))))
(_.cover [/.copy]
(and (case (/.copy size 0 sample 0 (/.empty size))
diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux
index 4045c008a..c7fad1619 100644
--- a/stdlib/source/test/lux/data/collection/array.lux
+++ b/stdlib/source/test/lux/data/collection/array.lux
@@ -7,7 +7,7 @@
[\\specification
["$." equivalence]
["$." monoid]
- ["$." fold]
+ ["$." mix]
["$." functor (#+ Injection)]]]
[control
["." maybe]]
@@ -43,8 +43,8 @@
($monoid.spec (/.equivalence n.equivalence) /.monoid (random.array size random.nat)))
(_.for [/.functor]
($functor.spec ..injection /.equivalence /.functor))
- (_.for [/.fold]
- ($fold.spec ..injection /.equivalence /.fold))
+ (_.for [/.mix]
+ ($mix.spec ..injection /.equivalence /.mix))
)))
(def: search
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux
index f635eca05..41139da07 100644
--- a/stdlib/source/test/lux/data/collection/list.lux
+++ b/stdlib/source/test/lux/data/collection/list.lux
@@ -9,7 +9,7 @@
["$." equivalence]
["$." hash]
["$." monoid]
- ["$." fold]
+ ["$." mix]
["$." functor]
["$." apply]
["$." monad]]]
@@ -56,8 +56,8 @@
($hash.spec (/.hash n.hash))))
(_.for [/.monoid]
($monoid.spec (/.equivalence n.equivalence) /.monoid ..random))
- (_.for [/.fold]
- ($fold.spec /\in /.equivalence /.fold))
+ (_.for [/.mix]
+ ($mix.spec /\in /.equivalence /.mix))
(_.for [/.functor]
($functor.spec /\in /.equivalence /.functor))
(_.for [/.apply]
@@ -355,7 +355,7 @@
choose (: (-> Nat (Maybe Text))
(function (_ value)
(if (n.even? value)
- (#.Some (\ n.decimal encode value))
+ (#.Some (\ n.decimal encoded value))
#.None)))]
(do {! random.monad}
[sample ..random]
@@ -363,7 +363,7 @@
(_.cover [/.one]
(case [(|> sample
(/.only n.even?)
- (/\map (\ n.decimal encode))
+ (/\map (\ n.decimal encoded))
/.head)
(/.one choose sample)]
[(#.Some expected) (#.Some actual)]
@@ -378,7 +378,7 @@
(\ (/.equivalence text.equivalence) =
(|> sample
(/.only n.even?)
- (/\map (\ n.decimal encode)))
+ (/\map (\ n.decimal encoded)))
(/.all choose sample)))
(_.cover [/.example]
(case (/.example n.even? sample)
@@ -422,11 +422,11 @@
(#.Some (++ index))
#.None))
0)))))
- (_.cover [/.aggregates]
+ (_.cover [/.mixes]
(/\= (/\map (function (_ index)
- (\ /.fold fold n.+ 0 (/.first index sample)))
+ (\ /.mix mix n.+ 0 (/.first index sample)))
(/.indices (++ (/.size sample))))
- (/.aggregates n.+ 0 sample)))
+ (/.mixes n.+ 0 sample)))
(do random.monad
[expected random.nat
.let [(^open "/\.") (/.equivalence n.equivalence)]]
diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux
index 9be7c183f..1e199d23e 100644
--- a/stdlib/source/test/lux/data/collection/queue/priority.lux
+++ b/stdlib/source/test/lux/data/collection/queue/priority.lux
@@ -19,12 +19,12 @@
(-> Nat (Random (Queue Nat)))
(do {! random.monad}
[inputs (random.list size random.nat)]
- (monad.fold ! (function (_ head tail)
- (do !
- [priority random.nat]
- (in (/.end priority head tail))))
- /.empty
- inputs)))
+ (monad.mix ! (function (_ head tail)
+ (do !
+ [priority random.nat]
+ (in (/.end priority head tail))))
+ /.empty
+ inputs)))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux
index 8e8348617..a8ff3a7ab 100644
--- a/stdlib/source/test/lux/data/collection/row.lux
+++ b/stdlib/source/test/lux/data/collection/row.lux
@@ -7,7 +7,7 @@
[\\specification
["$." equivalence]
["$." monoid]
- ["$." fold]
+ ["$." mix]
["$." functor (#+ Injection)]
["$." apply]
["$." monad]]]
@@ -17,7 +17,7 @@
[data
["." bit ("#\." equivalence)]
[collection
- ["." list ("#\." fold)]
+ ["." list ("#\." mix)]
["." set]]]
[math
["." random]
@@ -35,8 +35,8 @@
($equivalence.spec (/.equivalence n.equivalence) (random.row size random.nat)))
(_.for [/.monoid]
($monoid.spec (/.equivalence n.equivalence) /.monoid (random.row size random.nat)))
- (_.for [/.fold]
- ($fold.spec /\in /.equivalence /.fold))
+ (_.for [/.mix]
+ ($mix.spec /\in /.equivalence /.mix))
(_.for [/.functor]
($functor.spec /\in /.equivalence /.functor))
(_.for [/.apply]
diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux
index 4ca359ddb..0afe973ef 100644
--- a/stdlib/source/test/lux/data/collection/set/multi.lux
+++ b/stdlib/source/test/lux/data/collection/set/multi.lux
@@ -13,7 +13,7 @@
["." bit ("#\." equivalence)]
[collection
["." set]
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
["." random (#+ Random)]
[number
@@ -30,11 +30,11 @@
(do {! random.monad}
[elements (random.set hash size element)
element_counts (random.list size ..count)]
- (in (list\fold (function (_ [count element] set)
- (/.has count element set))
- (/.empty hash)
- (list.zipped/2 element_counts
- (set.list elements))))))
+ (in (list\mix (function (_ [count element] set)
+ (/.has count element set))
+ (/.empty hash)
+ (list.zipped/2 element_counts
+ (set.list elements))))))
(def: signature
Test
diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux
index 986ef566e..be610c25d 100644
--- a/stdlib/source/test/lux/data/collection/tree.lux
+++ b/stdlib/source/test/lux/data/collection/tree.lux
@@ -6,12 +6,12 @@
["." monad (#+ do)]
[\\specification
["$." equivalence]
- ["$." fold]
+ ["$." mix]
["$." functor]]]
[data
["." product]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
["." random (#+ Random)]
[number
@@ -27,7 +27,7 @@
children (random.list num_children (tree gen_value))]
(in [(|> children
(list\map product.left)
- (list\fold n.+ 1))
+ (list\mix n.+ 1))
{#/.value value
#/.children (list\map product.right children)}])))
@@ -40,8 +40,8 @@
(|> (..tree random.nat)
(\ random.monad map product.right)
($equivalence.spec (/.equivalence n.equivalence))))
- (_.for [/.fold]
- ($fold.spec /.leaf /.equivalence /.fold))
+ (_.for [/.mix]
+ ($mix.spec /.leaf /.equivalence /.mix))
(_.for [/.functor]
($functor.spec /.leaf /.equivalence /.functor))
diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux
index 370a39a53..53631edbf 100644
--- a/stdlib/source/test/lux/data/collection/tree/finger.lux
+++ b/stdlib/source/test/lux/data/collection/tree/finger.lux
@@ -9,7 +9,7 @@
[data
["." text ("#\." equivalence monoid)]
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
["." random]
[number
@@ -86,10 +86,10 @@
values/H random.nat
values/T (random.list 5 random.nat)]
(_.cover [/.tags /.values]
- (let [tree (list\fold (function (_ [tag value] tree)
- (\ builder branch tree (\ builder leaf tag value)))
- (\ builder leaf tags/H values/H)
- (list.zipped/2 tags/T values/T))]
+ (let [tree (list\mix (function (_ [tag value] tree)
+ (\ builder branch tree (\ builder leaf tag value)))
+ (\ builder leaf tags/H values/H)
+ (list.zipped/2 tags/T values/T))]
(and (\ tags_equivalence = (list& tags/H tags/T) (/.tags tree))
(\ values_equivalence = (list& values/H values/T) (/.values tree))))))
(_.cover [/.one]
diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux
index 33b2622f4..9e5a03843 100644
--- a/stdlib/source/test/lux/data/format/json.lux
+++ b/stdlib/source/test/lux/data/format/json.lux
@@ -84,7 +84,7 @@
(_.cover [/.format]
(|> expected
/.format
- (\ /.codec decode)
+ (\ /.codec decoded)
(try\map (\= expected))
(try.else false))))
(do random.monad
diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux
index 9bed1f5ed..7a84f12fd 100644
--- a/stdlib/source/test/lux/data/format/tar.lux
+++ b/stdlib/source/test/lux/data/format/tar.lux
@@ -22,7 +22,7 @@
["#/." block]]]
[collection
["." row]
- ["." list ("#\." fold)]]
+ ["." list ("#\." mix)]]
["." format #_
["#" binary]]]
[time
@@ -165,7 +165,7 @@
.let [content (|> chunk
(list.repeated chunks)
text.together
- (\ utf8.codec encode))]]
+ (\ utf8.codec encoded))]]
(`` ($_ _.and
(~~ (template [<type> <tag>]
[(_.cover [<type>]
@@ -245,7 +245,7 @@
(do {! random.monad}
[path (random.ascii/lower 10)
modes (random.list 4 ..random_mode)
- .let [expected_mode (list\fold /.and /.none modes)]]
+ .let [expected_mode (list\mix /.and /.none modes)]]
(`` ($_ _.and
(_.cover [/.and]
(|> (do try.monad
diff --git a/stdlib/source/test/lux/data/name.lux b/stdlib/source/test/lux/data/name.lux
index 2856d3476..0a882efaf 100644
--- a/stdlib/source/test/lux/data/name.lux
+++ b/stdlib/source/test/lux/data/name.lux
@@ -52,7 +52,7 @@
(let [(^open "/\.") /.codec]
(_.test "Encoding an name without a module component results in text equal to the short of the name."
(if (text.empty? module1)
- (text\= short1 (/\encode name1))
+ (text\= short1 (/\encoded name1))
#1)))))
(_.cover [/.module /.short]
diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux
index 432e98257..ca28e316d 100644
--- a/stdlib/source/test/lux/data/text/encoding.lux
+++ b/stdlib/source/test/lux/data/text/encoding.lux
@@ -12,7 +12,7 @@
[data
["." text ("#\." equivalence)]
[collection
- ["." list ("#\." fold)]
+ ["." list ("#\." mix)]
["." set]]]
[macro
["." template]]
@@ -193,10 +193,10 @@
(list.together (list <named>)))
(def: unique_encodings
- (list\fold (function (_ encoding set)
- (set.has (/.name encoding) set))
- (set.empty text.hash)
- ..all_encodings))
+ (list\mix (function (_ encoding set)
+ (set.has (/.name encoding) set))
+ (set.empty text.hash)
+ ..all_encodings))
(def: verdict
(n.= (list.size ..all_encodings)
diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux
index 707a06996..49b125cba 100644
--- a/stdlib/source/test/lux/data/text/escape.lux
+++ b/stdlib/source/test/lux/data/text/escape.lux
@@ -138,7 +138,7 @@
(\ ! map (n.% (hex "1000"))))
code (|> (random.unicode 4)
(random.only (function (_ code)
- (case (\ n.hex decode code)
+ (case (\ n.hex decoded code)
(#try.Failure error) true
(#try.Success _) false))))]
(_.cover [/.invalid_unicode_escape]
@@ -149,7 +149,7 @@
(#try.Failure error)
(exception.match? /.invalid_unicode_escape error))]]
- (and (!invalid (\ n.hex encode too_short))
+ (and (!invalid (\ n.hex encoded too_short))
(!invalid code)))))
(_.cover [/.literal]
(with_expansions [<example> (..static_sample)]
diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux
index 24746c45d..cbeedd65a 100644
--- a/stdlib/source/test/lux/data/text/format.lux
+++ b/stdlib/source/test/lux/data/text/format.lux
@@ -76,7 +76,7 @@
[(do random.monad
[sample <random>]
(_.cover [<format>]
- (text\= (\ <codec> encode sample)
+ (text\= (\ <codec> encoded sample)
(<format> sample))))]
[/.bit bit.codec random.bit]
@@ -180,6 +180,6 @@
sample (\ ! map (modular.modular modulus)
random.int)]
(_.cover [/.mod]
- (text\= (\ (modular.codec modulus) encode sample)
+ (text\= (\ (modular.codec modulus) encoded sample)
(/.mod sample))))
))))
diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux
index e6ded5090..b8ac893fd 100644
--- a/stdlib/source/test/lux/locale/language.lux
+++ b/stdlib/source/test/lux/locale/language.lux
@@ -13,7 +13,7 @@
["." text]
[collection
["." set (#+ Set)]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
["." template]]
[math
@@ -188,29 +188,29 @@
(Hash a)
(List Bundle)
[Nat (Set a)]))
- (list\fold (function (_ bundle [amount set])
- [(n.+ amount (value@ #amount bundle))
- (set.union set (lens bundle))])
- [0 (set.empty hash)]
- territories))
+ (list\mix (function (_ bundle [amount set])
+ [(n.+ amount (value@ #amount bundle))
+ (set.union set (lens bundle))])
+ [0 (set.empty hash)]
+ territories))
(def: languages_test
Test
(|> ..languages
list.reversed
(list\map (value@ #test))
- (list\fold _.and
- (`` ($_ _.and
- (~~ (template [<lens> <tag> <hash>]
- [(let [[amount set] (..aggregate (value@ <tag>) <hash> ..languages)]
- (_.cover [<lens>]
- (n.= amount (set.size set))))]
+ (list\mix _.and
+ (`` ($_ _.and
+ (~~ (template [<lens> <tag> <hash>]
+ [(let [[amount set] (..aggregate (value@ <tag>) <hash> ..languages)]
+ (_.cover [<lens>]
+ (n.= amount (set.size set))))]
- [/.name #names text.hash]
- [/.code #codes text.hash]
- [/.equivalence #languages /.hash]
- ))
- )))))
+ [/.name #names text.hash]
+ [/.code #codes text.hash]
+ [/.equivalence #languages /.hash]
+ ))
+ )))))
(template: (!aliases <reference> <aliases>)
[(_.cover <aliases>
diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux
index d25308c49..b8a36d4fd 100644
--- a/stdlib/source/test/lux/locale/territory.lux
+++ b/stdlib/source/test/lux/locale/territory.lux
@@ -13,7 +13,7 @@
["." text]
[collection
["." set (#+ Set)]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
["." template]]
[math
@@ -143,31 +143,31 @@
(Hash a)
(List Bundle)
[Nat (Set a)]))
- (list\fold (function (_ bundle [amount set])
- [(n.+ amount (value@ #amount bundle))
- (set.union set (lens bundle))])
- [0 (set.empty hash)]
- territories))
+ (list\mix (function (_ bundle [amount set])
+ [(n.+ amount (value@ #amount bundle))
+ (set.union set (lens bundle))])
+ [0 (set.empty hash)]
+ territories))
(def: territories_test
Test
(|> ..territories
list.reversed
(list\map (value@ #test))
- (list\fold _.and
- (`` ($_ _.and
- (~~ (template [<lens> <tag> <hash>]
- [(let [[amount set] (..aggregate (value@ <tag>) <hash> ..territories)]
- (_.cover [<lens>]
- (n.= amount (set.size set))))]
+ (list\mix _.and
+ (`` ($_ _.and
+ (~~ (template [<lens> <tag> <hash>]
+ [(let [[amount set] (..aggregate (value@ <tag>) <hash> ..territories)]
+ (_.cover [<lens>]
+ (n.= amount (set.size set))))]
- [/.name #names text.hash]
- [/.short_code #shorts text.hash]
- [/.long_code #longs text.hash]
- [/.numeric_code #numbers n.hash]
- [/.equivalence #territories /.hash]
- ))
- )))))
+ [/.name #names text.hash]
+ [/.short_code #shorts text.hash]
+ [/.long_code #longs text.hash]
+ [/.numeric_code #numbers n.hash]
+ [/.equivalence #territories /.hash]
+ ))
+ )))))
(template: (!aliases <reference> <aliases>)
[(_.cover <aliases>
diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux
index b87f30bb1..ce10c6ca2 100644
--- a/stdlib/source/test/lux/math/modular.lux
+++ b/stdlib/source/test/lux/math/modular.lux
@@ -64,8 +64,8 @@
(_.cover [/.incorrect_modulus]
(case (|> param
- (\ (/.codec param\\%) encode)
- (\ (/.codec subject\\%) decode))
+ (\ (/.codec param\\%) encoded)
+ (\ (/.codec subject\\%) decoded))
(#try.Failure error)
(exception.match? /.incorrect_modulus error)
diff --git a/stdlib/source/test/lux/math/number.lux b/stdlib/source/test/lux/math/number.lux
index 8a298338f..08a044d60 100644
--- a/stdlib/source/test/lux/math/number.lux
+++ b/stdlib/source/test/lux/math/number.lux
@@ -34,7 +34,7 @@
($_ _.and
(_.cover [/.bin]
(`` (and (~~ (template [<=> <codec> <number>]
- [(case (\ <codec> decode (..clean_commas <number>))
+ [(case (\ <codec> decoded (..clean_commas <number>))
(#try.Success actual)
(<=> (/.bin <number>) actual)
@@ -55,7 +55,7 @@
)))))
(_.cover [/.oct]
(`` (and (~~ (template [<=> <codec> <number>]
- [(case (\ <codec> decode (..clean_commas <number>))
+ [(case (\ <codec> decoded (..clean_commas <number>))
(#try.Success actual)
(<=> (/.oct <number>) actual)
@@ -76,7 +76,7 @@
)))))
(_.cover [/.hex]
(`` (and (~~ (template [<=> <codec> <number>]
- [(case (\ <codec> decode (..clean_commas <number>))
+ [(case (\ <codec> decoded (..clean_commas <number>))
(#try.Success actual)
(<=> (/.hex <number>) actual)
diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux
index ac82addce..4692a646c 100644
--- a/stdlib/source/test/lux/math/number/i64.lux
+++ b/stdlib/source/test/lux/math/number/i64.lux
@@ -142,7 +142,7 @@
($_ _.and
($equivalence.spec (\ sub &equivalence) (random (\ sub narrow)))
(_.cover [/.sub]
- (let [actual (|> expected .i64 (\ sub narrow) (\ sub widen))]
+ (let [actual (|> expected .i64 (\ sub narrow) (\ sub wide))]
(\= expected actual)))
))))))
diff --git a/stdlib/source/test/lux/time.lux b/stdlib/source/test/lux/time.lux
index 671afe39d..81c56089d 100644
--- a/stdlib/source/test/lux/time.lux
+++ b/stdlib/source/test/lux/time.lux
@@ -75,7 +75,7 @@
%.nat
(text.prefix <prefix>)
(text.suffix <suffix>)
- (\ /.codec decode)
+ (\ /.codec decoded)
(case> (#try.Success _) true
(#try.Failure error) false))
@@ -84,7 +84,7 @@
%.nat
(text.prefix <prefix>)
(text.suffix <suffix>)
- (\ /.codec decode)
+ (\ /.codec decoded)
(case> (#try.Success _)
false
@@ -101,7 +101,7 @@
(|> valid_milli_second
%.nat
(format "00:00:00.")
- (\ /.codec decode)
+ (\ /.codec decoded)
(case> (#try.Success _) true
(#try.Failure error) false)))
))))
@@ -138,7 +138,7 @@
(n.= 0)))
(_.cover [/.parser]
(|> expected
- (\ /.codec encode)
+ (\ /.codec encoded)
(<text>.result /.parser)
(try\map (\ /.equivalence = expected))
(try.else false)))
diff --git a/stdlib/source/test/lux/time/date.lux b/stdlib/source/test/lux/time/date.lux
index 70bb0a93e..87e54e623 100644
--- a/stdlib/source/test/lux/time/date.lux
+++ b/stdlib/source/test/lux/time/date.lux
@@ -72,7 +72,7 @@
(do random.monad
[expected random.date]
(_.cover [/.parser]
- (|> (\ /.codec encode expected)
+ (|> (\ /.codec encoded expected)
(<text>.result /.parser)
(try\map (\ /.equivalence = expected))
(try.else false))))
diff --git a/stdlib/source/test/lux/time/day.lux b/stdlib/source/test/lux/time/day.lux
index dd71f0f93..462a96939 100644
--- a/stdlib/source/test/lux/time/day.lux
+++ b/stdlib/source/test/lux/time/day.lux
@@ -59,7 +59,7 @@
(do random.monad
[not_a_day (random.ascii/upper 1)]
(_.cover [/.not_a_day_of_the_week]
- (case (\ /.codec decode not_a_day)
+ (case (\ /.codec decoded not_a_day)
(#try.Failure error)
(exception.match? /.not_a_day_of_the_week error)
diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux
index a7659421a..b9b2996e6 100644
--- a/stdlib/source/test/lux/time/instant.lux
+++ b/stdlib/source/test/lux/time/instant.lux
@@ -15,7 +15,7 @@
["." io]]
[data
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
["." random]]
[time
@@ -71,9 +71,9 @@
(_.cover [/.day_of_week]
(let [apply (: (-> (-> Duration Duration) (-> Day Day) Nat Bit)
(function (_ polarity move steps)
- (let [day_shift (list\fold (function.constant move)
- d0
- (list.repeated steps []))
+ (let [day_shift (list\mix (function.constant move)
+ d0
+ (list.repeated steps []))
instant_shift (|> instant
(/.after (polarity (duration.up steps duration.day)))
/.day_of_week)]
diff --git a/stdlib/source/test/lux/time/month.lux b/stdlib/source/test/lux/time/month.lux
index 77a0a9702..7f5487069 100644
--- a/stdlib/source/test/lux/time/month.lux
+++ b/stdlib/source/test/lux/time/month.lux
@@ -17,7 +17,7 @@
[data
[collection
["." set]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
["." random (#+ Random)]
[number
@@ -80,18 +80,18 @@
(let [expected (.nat (duration.ticks duration.day duration.normal_year))]
(|> /.year
(list\map /.days)
- (list\fold n.+ 0)
+ (list\mix n.+ 0)
(n.= expected))))
(_.cover [/.leap_year_days]
(let [expected (.nat (duration.ticks duration.day duration.leap_year))]
(|> /.year
(list\map /.leap_year_days)
- (list\fold n.+ 0)
+ (list\mix n.+ 0)
(n.= expected))))
(do random.monad
[not_a_month (random.ascii/upper 1)]
(_.cover [/.not_a_month_of_the_year]
- (case (\ /.codec decode not_a_month)
+ (case (\ /.codec decoded not_a_month)
(#try.Failure error)
(exception.match? /.not_a_month_of_the_year error)
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux
index b634c0115..f7b169ea3 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux
@@ -17,7 +17,7 @@
["." rev]
["." frac]]
[collection
- ["." list ("#\." functor fold monoid)]
+ ["." list ("#\." functor mix monoid)]
["." set]]]
[math
["." random (#+ Random)]]]
@@ -127,19 +127,19 @@
(Random [analysis.Pattern Register]))
(do random.monad
[@member random.nat]
- (in [(list\fold (function (_ member inner)
- (case member
- (#.Left lefts)
- (analysis.pattern/tuple
- (list\compose (list.repeated lefts (analysis.pattern/unit))
- (list inner (analysis.pattern/unit))))
-
- (#.Right lefts)
- (analysis.pattern/tuple
- (list\compose (list.repeated (++ lefts) (analysis.pattern/unit))
- (list inner)))))
- (#analysis.Bind @member)
- (list.reversed path))
+ (in [(list\mix (function (_ member inner)
+ (case member
+ (#.Left lefts)
+ (analysis.pattern/tuple
+ (list\compose (list.repeated lefts (analysis.pattern/unit))
+ (list inner (analysis.pattern/unit))))
+
+ (#.Right lefts)
+ (analysis.pattern/tuple
+ (list\compose (list.repeated (++ lefts) (analysis.pattern/unit))
+ (list inner)))))
+ (#analysis.Bind @member)
+ (list.reversed path))
@member])))
(def: get_test
@@ -297,15 +297,15 @@
(list (analysis.pattern/text value)
(analysis.pattern/unit)))))
#analysis.then (analysis.frac body)}))]]
- (in [(list\fold (function (_ left right)
- (#synthesis.Alt left right))
- (path (++ mid_size) true value/last body/last)
- (|> (list.zipped/2 value/mid body/mid)
- (#.Item [value/first body/first])
- list.enumeration
- (list\map (function (_ [lefts' [value body]])
- (path lefts' false value body)))
- list.reversed))
+ (in [(list\mix (function (_ left right)
+ (#synthesis.Alt left right))
+ (path (++ mid_size) true value/last body/last)
+ (|> (list.zipped/2 value/mid body/mid)
+ (#.Item [value/first body/first])
+ list.enumeration
+ (list\map (function (_ [lefts' [value body]])
+ (path lefts' false value body)))
+ list.reversed))
[(branch 0 false value/first body/first)
(list\compose (|> (list.zipped/2 value/mid body/mid)
list.enumeration
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux
index a25bd787c..6190c05aa 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux
@@ -12,7 +12,7 @@
[number
["n" nat]]
[collection
- ["." list ("#\." functor fold monoid)]
+ ["." list ("#\." functor mix monoid)]
["." dictionary (#+ Dictionary)]
["." set]]]
[math
@@ -50,16 +50,16 @@
(def: (n_abstraction arity body)
(-> Arity Analysis Analysis)
- (list\fold (function (_ arity_1 body)
- (case arity_1
- 0 (#analysis.Function (list) body)
- _ (#analysis.Function ($_ list\compose
- (list\map (|>> #variable.Foreign)
- (list.indices arity_1))
- (list (#variable.Local 1)))
- body)))
- body
- (list.reversed (list.indices arity))))
+ (list\mix (function (_ arity_1 body)
+ (case arity_1
+ 0 (#analysis.Function (list) body)
+ _ (#analysis.Function ($_ list\compose
+ (list\map (|>> #variable.Foreign)
+ (list.indices arity_1))
+ (list (#variable.Local 1)))
+ body)))
+ body
+ (list.reversed (list.indices arity))))
(template: (!expect <pattern> <value>)
(case <value>
@@ -318,10 +318,10 @@
(do {! random.monad}
[resets (random.list arity (..random_variable arity output?))
[_ expected_output actual_output] (..random_nat output?)]
- (in [(list\fold (function (_ new old)
- (and new old))
- true
- (list\map product.left resets))
+ (in [(list\mix (function (_ new old)
+ (and new old))
+ true
+ (list\map product.left resets))
(synthesis.loop/scope
{#synthesis.start (++ arity)
#synthesis.inits (list\map (|>> product.right product.left) resets)
@@ -364,10 +364,10 @@
[[loop?_abstraction expected_abstraction actual_abstraction] (..random_nat output?)
arity (|> random.nat (\ ! map (|>> (n.% 5) ++)))
inputs (random.list arity (random_value false))]
- (in [(list\fold (function (_ new old)
- (and new old))
- loop?_abstraction
- (list\map product.left inputs))
+ (in [(list\mix (function (_ new old)
+ (and new old))
+ loop?_abstraction
+ (list\map product.left inputs))
(synthesis.function/apply [expected_abstraction
(list\map (|>> product.right product.left) inputs)])
(analysis.apply [actual_abstraction
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
index 10a6ca270..690ac7ce2 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
@@ -15,7 +15,7 @@
[number
["n" nat]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]]]]
[\\
["." /
@@ -244,12 +244,12 @@
inits (random.list ..scope_arity (scenario context))
[expected_iteration actual_iteration] (scenario (revised@ #necessary
(function (_ necessary)
- (list\fold (function (_ [idx _] context)
- (dictionary.has (n.+ real_start idx)
- (n.+ fake_start idx)
- context))
- necessary
- (list.enumeration inits)))
+ (list\mix (function (_ [idx _] context)
+ (dictionary.has (n.+ real_start idx)
+ (n.+ fake_start idx)
+ context))
+ necessary
+ (list.enumeration inits)))
context))]
(in [(synthesis.loop/scope [real_start (list\map product.left inits) expected_iteration])
(synthesis.loop/scope [fake_start (list\map product.right inits) actual_iteration])])))
diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux
index d148e9fdc..12370e87a 100644
--- a/stdlib/source/test/lux/type/check.lux
+++ b/stdlib/source/test/lux/type/check.lux
@@ -421,12 +421,12 @@
[[id/T var/tail] /.var]
(in var/tail)))
(list.repeated tail_size /.var))
- var/last (monad.fold ! (function (_ var/next var/prev)
- (do !
- [_ (/.check var/prev var/next)]
- (in var/next)))
- var/head
- var/tail+)
+ var/last (monad.mix ! (function (_ var/next var/prev)
+ (do !
+ [_ (/.check var/prev var/next)]
+ (in var/next)))
+ var/head
+ var/tail+)
_ (/.check var/last var/head)]
(in [var/head var/tail+ var/last])))
diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux
index c9b3f12c9..994e2cbf3 100644
--- a/stdlib/source/test/lux/world/net/http/client.lux
+++ b/stdlib/source/test/lux/world/net/http/client.lux
@@ -57,8 +57,8 @@
#//.Options on_options
#//.Trace on_trace)
data (|> value
- (\ nat.decimal encode)
- (\ utf8.codec encode))]
+ (\ nat.decimal encoded)
+ (\ utf8.codec encoded))]
(#try.Success [//status.ok
{#//.headers headers
#//.body (function (_ ?wanted_bytes)
@@ -71,8 +71,8 @@
(do> try.monad
[io.run!]
[product.right (value@ #//.body) (function.on #.None) io.run!]
- [product.right (\ utf8.codec decode)]
- [(\ nat.decimal decode)]
+ [product.right (\ utf8.codec decoded)]
+ [(\ nat.decimal decoded)]
[(nat.= <expected>) in])
(try.else false)))]