aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/source/documentation/lux.lux31
-rw-r--r--stdlib/source/documentation/lux/control/concatenative.lux4
-rw-r--r--stdlib/source/documentation/lux/control/parser/analysis.lux2
-rw-r--r--stdlib/source/documentation/lux/control/parser/binary.lux6
-rw-r--r--stdlib/source/documentation/lux/control/parser/code.lux6
-rw-r--r--stdlib/source/documentation/lux/control/parser/json.lux4
-rw-r--r--stdlib/source/documentation/lux/control/parser/synthesis.lux2
-rw-r--r--stdlib/source/documentation/lux/control/parser/text.lux12
-rw-r--r--stdlib/source/documentation/lux/control/parser/tree.lux2
-rw-r--r--stdlib/source/documentation/lux/control/parser/type.lux4
-rw-r--r--stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux2
-rw-r--r--stdlib/source/documentation/lux/data/collection/list.lux2
-rw-r--r--stdlib/source/documentation/lux/data/color.lux2
-rw-r--r--stdlib/source/documentation/lux/data/color/named.lux2
-rw-r--r--stdlib/source/documentation/lux/data/format/json.lux2
-rw-r--r--stdlib/source/documentation/lux/data/text/encoding.lux2
-rw-r--r--stdlib/source/documentation/lux/data/text/unicode/block.lux2
-rw-r--r--stdlib/source/documentation/lux/ffi.jvm.lux6
-rw-r--r--stdlib/source/documentation/lux/ffi.old.lux2
-rw-r--r--stdlib/source/documentation/lux/math/number.lux2
-rw-r--r--stdlib/source/documentation/lux/math/number/frac.lux6
-rw-r--r--stdlib/source/documentation/lux/math/number/i64.lux4
-rw-r--r--stdlib/source/documentation/lux/math/number/int.lux4
-rw-r--r--stdlib/source/documentation/lux/math/number/nat.lux4
-rw-r--r--stdlib/source/documentation/lux/math/number/rev.lux4
-rw-r--r--stdlib/source/documentation/lux/static.lux4
-rw-r--r--stdlib/source/documentation/lux/time.lux2
-rw-r--r--stdlib/source/documentation/lux/type.lux8
-rw-r--r--stdlib/source/documentation/lux/type/primitive.lux2
-rw-r--r--stdlib/source/documentation/lux/type/resource.lux4
-rw-r--r--stdlib/source/documentation/lux/type/unit.lux4
-rw-r--r--stdlib/source/documentation/lux/world/net/http/client.lux2
-rw-r--r--stdlib/source/documentation/lux/world/net/http/status.lux2
-rw-r--r--stdlib/source/documentation/lux/world/output/video/resolution.lux2
-rw-r--r--stdlib/source/library/lux.lux66
-rw-r--r--stdlib/source/library/lux/abstract/interval.lux8
-rw-r--r--stdlib/source/library/lux/abstract/predicate.lux4
-rw-r--r--stdlib/source/library/lux/control/concatenative.lux4
-rw-r--r--stdlib/source/library/lux/control/concurrency/async.lux4
-rw-r--r--stdlib/source/library/lux/control/concurrency/semaphore.lux2
-rw-r--r--stdlib/source/library/lux/control/function/contract.lux2
-rw-r--r--stdlib/source/library/lux/control/io.lux18
-rw-r--r--stdlib/source/library/lux/control/parser/analysis.lux2
-rw-r--r--stdlib/source/library/lux/control/parser/binary.lux40
-rw-r--r--stdlib/source/library/lux/control/parser/code.lux4
-rw-r--r--stdlib/source/library/lux/control/parser/json.lux4
-rw-r--r--stdlib/source/library/lux/control/parser/synthesis.lux2
-rw-r--r--stdlib/source/library/lux/control/parser/text.lux18
-rw-r--r--stdlib/source/library/lux/control/parser/tree.lux2
-rw-r--r--stdlib/source/library/lux/control/parser/type.lux13
-rw-r--r--stdlib/source/library/lux/control/remember.lux2
-rw-r--r--stdlib/source/library/lux/control/security/policy.lux2
-rw-r--r--stdlib/source/library/lux/data/binary.lux4
-rw-r--r--stdlib/source/library/lux/data/bit.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/array.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/bits.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/ordered.lux10
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/plist.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/list.lux8
-rw-r--r--stdlib/source/library/lux/data/collection/sequence.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/set/multi.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/set/ordered.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/stream.lux6
-rw-r--r--stdlib/source/library/lux/data/collection/tree/finger.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/tree/zipper.lux6
-rw-r--r--stdlib/source/library/lux/data/color.lux8
-rw-r--r--stdlib/source/library/lux/data/color/named.lux2
-rw-r--r--stdlib/source/library/lux/data/format/binary.lux23
-rw-r--r--stdlib/source/library/lux/data/format/css.lux15
-rw-r--r--stdlib/source/library/lux/data/format/css/property.lux6
-rw-r--r--stdlib/source/library/lux/data/format/css/query.lux8
-rw-r--r--stdlib/source/library/lux/data/format/css/selector.lux18
-rw-r--r--stdlib/source/library/lux/data/format/css/value.lux72
-rw-r--r--stdlib/source/library/lux/data/format/html.lux34
-rw-r--r--stdlib/source/library/lux/data/format/json.lux18
-rw-r--r--stdlib/source/library/lux/data/format/markdown.lux8
-rw-r--r--stdlib/source/library/lux/data/format/tar.lux10
-rw-r--r--stdlib/source/library/lux/data/product.lux2
-rw-r--r--stdlib/source/library/lux/data/sum.lux4
-rw-r--r--stdlib/source/library/lux/data/text.lux4
-rw-r--r--stdlib/source/library/lux/data/text/encoding.lux2
-rw-r--r--stdlib/source/library/lux/data/text/escape.lux12
-rw-r--r--stdlib/source/library/lux/data/text/format.lux6
-rw-r--r--stdlib/source/library/lux/data/text/unicode/block.lux4
-rw-r--r--stdlib/source/library/lux/data/text/unicode/set.lux2
-rw-r--r--stdlib/source/library/lux/debug.lux18
-rw-r--r--stdlib/source/library/lux/documentation.lux23
-rw-r--r--stdlib/source/library/lux/extension.lux2
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux84
-rw-r--r--stdlib/source/library/lux/ffi.lux109
-rw-r--r--stdlib/source/library/lux/ffi.old.lux53
-rw-r--r--stdlib/source/library/lux/ffi.php.lux4
-rw-r--r--stdlib/source/library/lux/ffi.scm.lux4
-rw-r--r--stdlib/source/library/lux/ffi/export.rb.lux2
-rw-r--r--stdlib/source/library/lux/ffi/node_js.js.lux2
-rw-r--r--stdlib/source/library/lux/locale/language.lux8
-rw-r--r--stdlib/source/library/lux/locale/territory.lux6
-rw-r--r--stdlib/source/library/lux/macro.lux2
-rw-r--r--stdlib/source/library/lux/macro/code.lux14
-rw-r--r--stdlib/source/library/lux/macro/local.lux2
-rw-r--r--stdlib/source/library/lux/macro/pattern.lux16
-rw-r--r--stdlib/source/library/lux/macro/syntax.lux5
-rw-r--r--stdlib/source/library/lux/macro/template.lux4
-rw-r--r--stdlib/source/library/lux/math.lux14
-rw-r--r--stdlib/source/library/lux/math/logic/continuous.lux2
-rw-r--r--stdlib/source/library/lux/math/logic/fuzzy.lux13
-rw-r--r--stdlib/source/library/lux/math/modular.lux8
-rw-r--r--stdlib/source/library/lux/math/number.lux2
-rw-r--r--stdlib/source/library/lux/math/number/complex.lux6
-rw-r--r--stdlib/source/library/lux/math/number/frac.lux70
-rw-r--r--stdlib/source/library/lux/math/number/i64.lux8
-rw-r--r--stdlib/source/library/lux/math/number/int.lux12
-rw-r--r--stdlib/source/library/lux/math/number/nat.lux12
-rw-r--r--stdlib/source/library/lux/math/number/ratio.lux2
-rw-r--r--stdlib/source/library/lux/math/number/rev.lux14
-rw-r--r--stdlib/source/library/lux/math/random.lux8
-rw-r--r--stdlib/source/library/lux/meta.lux4
-rw-r--r--stdlib/source/library/lux/meta/configuration.lux2
-rw-r--r--stdlib/source/library/lux/meta/symbol.lux2
-rw-r--r--stdlib/source/library/lux/static.lux4
-rw-r--r--stdlib/source/library/lux/target.lux2
-rw-r--r--stdlib/source/library/lux/target/common_lisp.lux28
-rw-r--r--stdlib/source/library/lux/target/js.lux22
-rw-r--r--stdlib/source/library/lux/target/jvm/attribute.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode.lux60
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/instruction.lux44
-rw-r--r--stdlib/source/library/lux/target/jvm/class.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/constant.lux10
-rw-r--r--stdlib/source/library/lux/target/jvm/constant/pool.lux116
-rw-r--r--stdlib/source/library/lux/target/jvm/constant/tag.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/encoding/signed.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/encoding/unsigned.lux6
-rw-r--r--stdlib/source/library/lux/target/jvm/field.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/method.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/modifier.lux22
-rw-r--r--stdlib/source/library/lux/target/jvm/reflection.lux12
-rw-r--r--stdlib/source/library/lux/target/jvm/type.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/type/alias.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type/box.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type/category.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type/descriptor.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/type/lux.lux10
-rw-r--r--stdlib/source/library/lux/target/jvm/type/parser.lux10
-rw-r--r--stdlib/source/library/lux/target/jvm/type/reflection.lux6
-rw-r--r--stdlib/source/library/lux/target/jvm/type/signature.lux6
-rw-r--r--stdlib/source/library/lux/target/jvm/version.lux2
-rw-r--r--stdlib/source/library/lux/target/lua.lux18
-rw-r--r--stdlib/source/library/lux/target/php.lux26
-rw-r--r--stdlib/source/library/lux/target/python.lux28
-rw-r--r--stdlib/source/library/lux/target/r.lux26
-rw-r--r--stdlib/source/library/lux/target/ruby.lux32
-rw-r--r--stdlib/source/library/lux/target/scheme.lux20
-rw-r--r--stdlib/source/library/lux/test.lux4
-rw-r--r--stdlib/source/library/lux/time.lux4
-rw-r--r--stdlib/source/library/lux/time/date.lux4
-rw-r--r--stdlib/source/library/lux/time/day.lux12
-rw-r--r--stdlib/source/library/lux/time/duration.lux10
-rw-r--r--stdlib/source/library/lux/time/instant.lux6
-rw-r--r--stdlib/source/library/lux/time/month.lux14
-rw-r--r--stdlib/source/library/lux/time/year.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/arity.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux51
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis/pattern.lux28
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/directive.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/generation.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux96
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/simple.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux57
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux16
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux5
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux28
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux9
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux5
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux5
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux5
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux9
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux2
-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.lux12
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux12
-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.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux12
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux23
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux24
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux9
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux295
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux146
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cli.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/context.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/archive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/phase.lux9
-rw-r--r--stdlib/source/library/lux/tool/compiler/reference.lux29
-rw-r--r--stdlib/source/library/lux/tool/compiler/reference/variable.lux9
-rw-r--r--stdlib/source/library/lux/type.lux32
-rw-r--r--stdlib/source/library/lux/type/check.lux26
-rw-r--r--stdlib/source/library/lux/type/poly.lux8
-rw-r--r--stdlib/source/library/lux/type/primitive.lux46
-rw-r--r--stdlib/source/library/lux/type/quotient.lux2
-rw-r--r--stdlib/source/library/lux/type/refinement.lux2
-rw-r--r--stdlib/source/library/lux/type/resource.lux6
-rw-r--r--stdlib/source/library/lux/type/unit.lux8
-rw-r--r--stdlib/source/library/lux/type/variance.lux22
-rw-r--r--stdlib/source/library/lux/world/console.lux43
-rw-r--r--stdlib/source/library/lux/world/db/jdbc.lux4
-rw-r--r--stdlib/source/library/lux/world/db/jdbc/input.lux8
-rw-r--r--stdlib/source/library/lux/world/db/jdbc/output.lux6
-rw-r--r--stdlib/source/library/lux/world/db/sql.lux32
-rw-r--r--stdlib/source/library/lux/world/file.lux69
-rw-r--r--stdlib/source/library/lux/world/file/watch.lux4
-rw-r--r--stdlib/source/library/lux/world/input/keyboard.lux4
-rw-r--r--stdlib/source/library/lux/world/net/http/client.lux2
-rw-r--r--stdlib/source/library/lux/world/net/http/cookie.lux4
-rw-r--r--stdlib/source/library/lux/world/net/http/mime.lux2
-rw-r--r--stdlib/source/library/lux/world/net/http/response.lux2
-rw-r--r--stdlib/source/library/lux/world/net/http/route.lux4
-rw-r--r--stdlib/source/library/lux/world/net/http/status.lux2
-rw-r--r--stdlib/source/library/lux/world/net/http/version.lux2
-rw-r--r--stdlib/source/library/lux/world/output/video/resolution.lux2
-rw-r--r--stdlib/source/library/lux/world/program.lux4
-rw-r--r--stdlib/source/library/lux/world/shell.lux10
-rw-r--r--stdlib/source/poly/lux/abstract/equivalence.lux6
-rw-r--r--stdlib/source/poly/lux/data/format/json.lux8
-rw-r--r--stdlib/source/program/aedifex.lux2
-rw-r--r--stdlib/source/program/aedifex/artifact.lux2
-rw-r--r--stdlib/source/program/aedifex/artifact/extension.lux2
-rw-r--r--stdlib/source/program/aedifex/artifact/snapshot.lux2
-rw-r--r--stdlib/source/program/aedifex/artifact/snapshot/version.lux2
-rw-r--r--stdlib/source/program/aedifex/artifact/type.lux2
-rw-r--r--stdlib/source/program/aedifex/artifact/versioning.lux2
-rw-r--r--stdlib/source/program/aedifex/command/build.lux8
-rw-r--r--stdlib/source/program/aedifex/command/deploy/release.lux4
-rw-r--r--stdlib/source/program/aedifex/command/test.lux2
-rw-r--r--stdlib/source/program/aedifex/dependency/resolution.lux4
-rw-r--r--stdlib/source/program/aedifex/format.lux2
-rw-r--r--stdlib/source/program/aedifex/hash.lux12
-rw-r--r--stdlib/source/program/aedifex/metadata/artifact.lux4
-rw-r--r--stdlib/source/program/aedifex/metadata/snapshot.lux4
-rw-r--r--stdlib/source/program/aedifex/package.lux2
-rw-r--r--stdlib/source/program/aedifex/pom.lux2
-rw-r--r--stdlib/source/program/aedifex/profile.lux2
-rw-r--r--stdlib/source/program/aedifex/repository/remote.lux2
-rw-r--r--stdlib/source/program/aedifex/runtime.lux2
-rw-r--r--stdlib/source/specification/compositor/analysis/type.lux2
-rw-r--r--stdlib/source/specification/compositor/generation/case.lux2
-rw-r--r--stdlib/source/specification/compositor/generation/common.lux12
-rw-r--r--stdlib/source/specification/compositor/generation/primitive.lux2
-rw-r--r--stdlib/source/specification/lux/world/shell.lux2
-rw-r--r--stdlib/source/test/aedifex/artifact/extension.lux2
-rw-r--r--stdlib/source/test/aedifex/command/build.lux4
-rw-r--r--stdlib/source/test/aedifex/dependency/resolution.lux2
-rw-r--r--stdlib/source/test/aedifex/hash.lux6
-rw-r--r--stdlib/source/test/aedifex/runtime.lux2
-rw-r--r--stdlib/source/test/lux.lux20
-rw-r--r--stdlib/source/test/lux/abstract/interval.lux2
-rw-r--r--stdlib/source/test/lux/control/concatenative.lux45
-rw-r--r--stdlib/source/test/lux/control/function/inline.lux5
-rw-r--r--stdlib/source/test/lux/control/parser/analysis.lux15
-rw-r--r--stdlib/source/test/lux/control/parser/binary.lux27
-rw-r--r--stdlib/source/test/lux/control/parser/cli.lux15
-rw-r--r--stdlib/source/test/lux/control/parser/code.lux19
-rw-r--r--stdlib/source/test/lux/control/parser/json.lux17
-rw-r--r--stdlib/source/test/lux/control/parser/synthesis.lux17
-rw-r--r--stdlib/source/test/lux/control/parser/text.lux15
-rw-r--r--stdlib/source/test/lux/control/parser/tree.lux59
-rw-r--r--stdlib/source/test/lux/control/parser/type.lux19
-rw-r--r--stdlib/source/test/lux/control/parser/xml.lux36
-rw-r--r--stdlib/source/test/lux/data.lux11
-rw-r--r--stdlib/source/test/lux/data/binary.lux2
-rw-r--r--stdlib/source/test/lux/data/collection/list.lux2
-rw-r--r--stdlib/source/test/lux/data/collection/set/multi.lux2
-rw-r--r--stdlib/source/test/lux/data/collection/set/ordered.lux4
-rw-r--r--stdlib/source/test/lux/data/color.lux8
-rw-r--r--stdlib/source/test/lux/data/color/named.lux6
-rw-r--r--stdlib/source/test/lux/data/format/json.lux4
-rw-r--r--stdlib/source/test/lux/data/format/tar.lux6
-rw-r--r--stdlib/source/test/lux/data/format/xml.lux2
-rw-r--r--stdlib/source/test/lux/data/text.lux6
-rw-r--r--stdlib/source/test/lux/data/text/encoding.lux6
-rw-r--r--stdlib/source/test/lux/data/text/escape.lux2
-rw-r--r--stdlib/source/test/lux/data/text/format.lux4
-rw-r--r--stdlib/source/test/lux/data/text/unicode/block.lux6
-rw-r--r--stdlib/source/test/lux/data/text/unicode/set.lux2
-rw-r--r--stdlib/source/test/lux/debug.lux12
-rw-r--r--stdlib/source/test/lux/documentation.lux2
-rw-r--r--stdlib/source/test/lux/extension.lux4
-rw-r--r--stdlib/source/test/lux/ffi.js.lux4
-rw-r--r--stdlib/source/test/lux/ffi.jvm.lux6
-rw-r--r--stdlib/source/test/lux/ffi.lua.lux4
-rw-r--r--stdlib/source/test/lux/ffi.old.lux8
-rw-r--r--stdlib/source/test/lux/ffi.py.lux4
-rw-r--r--stdlib/source/test/lux/ffi.rb.lux4
-rw-r--r--stdlib/source/test/lux/ffi/export.jvm.lux8
-rw-r--r--stdlib/source/test/lux/locale/language.lux13
-rw-r--r--stdlib/source/test/lux/locale/territory.lux13
-rw-r--r--stdlib/source/test/lux/macro.lux18
-rw-r--r--stdlib/source/test/lux/macro/code.lux4
-rw-r--r--stdlib/source/test/lux/macro/pattern.lux11
-rw-r--r--stdlib/source/test/lux/math.lux8
-rw-r--r--stdlib/source/test/lux/math/logic/continuous.lux2
-rw-r--r--stdlib/source/test/lux/math/modular.lux2
-rw-r--r--stdlib/source/test/lux/math/number.lux6
-rw-r--r--stdlib/source/test/lux/math/number/frac.lux4
-rw-r--r--stdlib/source/test/lux/math/number/int.lux4
-rw-r--r--stdlib/source/test/lux/math/number/nat.lux4
-rw-r--r--stdlib/source/test/lux/math/number/ratio.lux2
-rw-r--r--stdlib/source/test/lux/math/number/rev.lux6
-rw-r--r--stdlib/source/test/lux/meta.lux9
-rw-r--r--stdlib/source/test/lux/static.lux2
-rw-r--r--stdlib/source/test/lux/target/js.lux14
-rw-r--r--stdlib/source/test/lux/target/jvm.lux63
-rw-r--r--stdlib/source/test/lux/target/lua.lux10
-rw-r--r--stdlib/source/test/lux/target/python.lux14
-rw-r--r--stdlib/source/test/lux/target/ruby.lux8
-rw-r--r--stdlib/source/test/lux/time.lux2
-rw-r--r--stdlib/source/test/lux/time/duration.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux17
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux6
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux6
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux18
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/analysis/scope.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux12
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux4
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux19
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux17
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux8
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux4
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux19
-rw-r--r--stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux23
-rw-r--r--stdlib/source/test/lux/tool/compiler/meta/cache/module.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/meta/cli.lux8
-rw-r--r--stdlib/source/test/lux/tool/compiler/meta/context.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/reference.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/version.lux2
-rw-r--r--stdlib/source/test/lux/type.lux4
-rw-r--r--stdlib/source/test/lux/type/check.lux10
-rw-r--r--stdlib/source/test/lux/type/primitive.lux2
-rw-r--r--stdlib/source/test/lux/type/resource.lux8
-rw-r--r--stdlib/source/test/lux/type/unit.lux10
-rw-r--r--stdlib/source/test/lux/world/input/keyboard.lux8
-rw-r--r--stdlib/source/test/lux/world/net/http/client.lux6
-rw-r--r--stdlib/source/test/lux/world/net/http/status.lux6
-rw-r--r--stdlib/source/unsafe/lux/data/binary.lux391
-rw-r--r--stdlib/source/unsafe/lux/data/collection/array.lux750
411 files changed, 2869 insertions, 2677 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux
index 59a5159b4..25389845a 100644
--- a/stdlib/source/documentation/lux.lux
+++ b/stdlib/source/documentation/lux.lux
@@ -284,7 +284,7 @@
(documentation: /.template
""
["By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary."
- (template [<name> <diff>]
+ (with_template [<name> <diff>]
[(def: .public <name>
(-> Int Int)
(+ <diff>))]
@@ -433,9 +433,9 @@
[(def: .public symbol
(macro (_ tokens)
(case tokens
- (^template [<tag>]
- [(pattern (list [_ {<tag> [module name]}]))
- (in (list (` [(~ (text$ module)) (~ (text$ name))])))])
+ (^with_template [<tag>]
+ [(pattern (list [_ {<tag> [module name]}]))
+ (in (list (` [(~ (text$ module)) (~ (text$ name))])))])
([#Symbol])
_
@@ -516,7 +516,7 @@
(is (-> a a Bit)
<)))])
-(.template [<name>]
+(.with_template [<name>]
[(documentation: <name>
"Safe type-casting for I64 values.")]
@@ -642,17 +642,17 @@
... {.#Primitive name params}
... {.#Primitive name (list#each (reduced env) params)}
-... (^template [<tag>]
+... (^with_template [<tag>]
... [{<tag> left right}
... {<tag> (reduced env left) (reduced env right)}])
... ([.#Sum] [.#Product])
-... (^template [<tag>]
+... (^with_template [<tag>]
... [{<tag> left right}
... {<tag> (reduced env left) (reduced env right)}])
... ([.#Function] [.#Apply])
-... (^template [<tag>]
+... (^with_template [<tag>]
... [{<tag> old_env def}
... (case old_env
... {.#End}
@@ -669,7 +669,7 @@
... type
... ))])
-(.template [<name> <doc>]
+(.with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
@@ -699,7 +699,7 @@
[(def: test
Test
(with_expansions
- [<tests> (template [<function> <parameter> <expected>]
+ [<tests> (with_template [<function> <parameter> <expected>]
[(cover [<function>]
(compare <text>
(at codec encoded <function> <parameter>)))]
@@ -825,11 +825,12 @@
"=="
Int])
-(documentation: /.template:
- (format "Define macros in the style of template and ^template."
+(documentation: /.template
+ (format "Define macros in the style of with_template."
\n "For simple macros that do not need any fancy features.")
- [(template: (square x)
- (* x x))])
+ [(def: square
+ (template (square x)
+ (* x x)))])
(documentation: /.these
(format "Given a (potentially empty) list of codes, just returns them immediately, without any work done."
@@ -999,7 +1000,7 @@
..as_expected
..undefined
..type_of
- ..template:
+ ..template
..these
..char
..for
diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux
index 635d0ab7e..aa750bda1 100644
--- a/stdlib/source/documentation/lux/control/concatenative.lux
+++ b/stdlib/source/documentation/lux/control/concatenative.lux
@@ -51,7 +51,7 @@
[(is (=> [Nat] [Nat])
((apply 1) ++))])
-(template [<arity>]
+(with_template [<arity>]
[(with_expansions [<name> (template.symbol [/._] ["apply_" <arity>])
<doc> (template.text ["Lift a function of arity " <arity>
" into a concatenative function of arity " <arity> "."])]
@@ -92,7 +92,7 @@
(documentation: /.||R
"Right-injects the top into sum.")
-(template [<input> <word> <func>]
+(with_template [<input> <word> <func>]
[(`` (documentation: (~~ (template.symbol [/._] [<word>]))
(~~ (template.text [<func> " for " <input> " arithmetic."]))))]
diff --git a/stdlib/source/documentation/lux/control/parser/analysis.lux b/stdlib/source/documentation/lux/control/parser/analysis.lux
index 4eeb442fe..7f61c1dca 100644
--- a/stdlib/source/documentation/lux/control/parser/analysis.lux
+++ b/stdlib/source/documentation/lux/control/parser/analysis.lux
@@ -26,7 +26,7 @@
(documentation: /.end?
"Checks whether there are no more inputs.")
-(template [<query> <assertion>]
+(with_template [<query> <assertion>]
[(`` (these (`` (documentation: <query>
(format "Queries for a " (~~ (template.text [<query>])) " value.")))
(`` (documentation: <assertion>
diff --git a/stdlib/source/documentation/lux/control/parser/binary.lux b/stdlib/source/documentation/lux/control/parser/binary.lux
index 42a25e1e3..7a890c827 100644
--- a/stdlib/source/documentation/lux/control/parser/binary.lux
+++ b/stdlib/source/documentation/lux/control/parser/binary.lux
@@ -42,7 +42,7 @@
"Parses a chunk of data of a given size."
[(segment size)])
-(template [<size> <name>]
+(with_template [<size> <name>]
[(documentation: <name>
(format "Parses a block of data prefixed with a size that is " (%.nat <size>) " bytes long."))]
@@ -52,7 +52,7 @@
[64 /.binary_64]
)
-(template [<size> <name>]
+(with_template [<size> <name>]
[(documentation: <name>
(format "Parses a block of (UTF-8 encoded) text prefixed with a size that is " (%.nat <size>) " bytes long."))]
@@ -62,7 +62,7 @@
[64 /.utf8_64]
)
-(template [<size> <name>]
+(with_template [<size> <name>]
[(documentation: <name>
(format "Parses a sequence of values prefixed with a size that is " (%.nat <size>) " bytes long."))]
diff --git a/stdlib/source/documentation/lux/control/parser/code.lux b/stdlib/source/documentation/lux/control/parser/code.lux
index fe1136b89..a742e1bbb 100644
--- a/stdlib/source/documentation/lux/control/parser/code.lux
+++ b/stdlib/source/documentation/lux/control/parser/code.lux
@@ -16,7 +16,7 @@
(documentation: /.any
"Yields the next input without applying any logic.")
-(template [<query> <check>]
+(with_template [<query> <check>]
[(`` (documentation: <query>
(format "Parses the next " (~~ (template.text [<query>])) " input.")))
(`` (documentation: <check>
@@ -35,7 +35,7 @@
"Ensures the given Code is the next input."
[(this code)])
-(template [<query> <check> <desc>]
+(with_template [<query> <check> <desc>]
[(documentation: <query>
(format "Parse a local " <desc> " (a " <desc> " that has no module prefix)."))
(documentation: <check>
@@ -44,7 +44,7 @@
[/.local /.this_local "local symbol"]
)
-(template [<name>]
+(with_template [<name>]
[(`` (documentation: <name>
(format "Parses the contents of a " (~~ (template.text [<name>])) ".")))]
diff --git a/stdlib/source/documentation/lux/control/parser/json.lux b/stdlib/source/documentation/lux/control/parser/json.lux
index ba2c434ef..0c554c35e 100644
--- a/stdlib/source/documentation/lux/control/parser/json.lux
+++ b/stdlib/source/documentation/lux/control/parser/json.lux
@@ -21,7 +21,7 @@
(documentation: /.any
"Just returns the JSON input without applying any logic.")
-(template [<name>]
+(with_template [<name>]
[(`` (documentation: <name>
(format "Reads a JSON value as " (~~ (template.text [<name>])) ".")))]
@@ -31,7 +31,7 @@
[/.string]
)
-(template [<test> <check> <read>]
+(with_template [<test> <check> <read>]
[(`` (documentation: <test>
(format "Asks whether a JSON value is a " (~~ (template.text [<read>])) ".")))
(`` (documentation: <check>
diff --git a/stdlib/source/documentation/lux/control/parser/synthesis.lux b/stdlib/source/documentation/lux/control/parser/synthesis.lux
index 137d08ba1..40a73b496 100644
--- a/stdlib/source/documentation/lux/control/parser/synthesis.lux
+++ b/stdlib/source/documentation/lux/control/parser/synthesis.lux
@@ -27,7 +27,7 @@
(documentation: /.end?
"Checks whether there are no more inputs.")
-(template [<query> <assertion>]
+(with_template [<query> <assertion>]
[(`` (documentation: <query>
(format "Queries for a " (~~ (template.text [<query>])) " synthesis node.")))
(`` (documentation: <assertion>
diff --git a/stdlib/source/documentation/lux/control/parser/text.lux b/stdlib/source/documentation/lux/control/parser/text.lux
index db886a7b4..f399d4886 100644
--- a/stdlib/source/documentation/lux/control/parser/text.lux
+++ b/stdlib/source/documentation/lux/control/parser/text.lux
@@ -33,7 +33,7 @@
(documentation: /.any!
"Yields the next character (as a slice) without applying any logic.")
-(template [<name> <caveat>]
+(with_template [<name> <caveat>]
[(`` (documentation: <name>
(format "Produce a character" (~~ (template.text [<caveat>])) " if the parser fails.")))]
@@ -58,7 +58,7 @@
"Only yields characters within a range."
[(range bottom top)])
-(template [<name> <desc>]
+(with_template [<name> <desc>]
[(documentation: <name>
(format "Only yields " <desc> " characters."))]
@@ -77,7 +77,7 @@
(documentation: /.hexadecimal
"Yields hexadecimal digits.")
-(template [<name> <description_modifier>]
+(with_template [<name> <description_modifier>]
[(documentation: <name>
(format "Yields characters that are" <description_modifier> " part of a piece of text."))]
@@ -85,7 +85,7 @@
[/.none_of " not"]
)
-(template [<name> <description_modifier>]
+(with_template [<name> <description_modifier>]
[(documentation: <name>
(format "Yields characters (as a slice) that are" <description_modifier> " part of a piece of text."))]
@@ -108,7 +108,7 @@
"Yields the outputs of both parsers composed together (as a slice)."
[(and! left right)])
-(template [<text> <slice>]
+(with_template [<text> <slice>]
[(`` (documentation: <text>
(format "Yields " (~~ (template.text [<name>])) " characters as a single continuous text.")))
(`` (documentation: <slice>
@@ -118,7 +118,7 @@
[/.many /.many!]
)
-(template [<text> <slice> <doc_modifier>]
+(with_template [<text> <slice> <doc_modifier>]
[(`` (documentation: <text>
(format "Yields " <doc_modifier> " N characters.")))
(`` (documentation: <slice>
diff --git a/stdlib/source/documentation/lux/control/parser/tree.lux b/stdlib/source/documentation/lux/control/parser/tree.lux
index d200cdfe7..af653e30c 100644
--- a/stdlib/source/documentation/lux/control/parser/tree.lux
+++ b/stdlib/source/documentation/lux/control/parser/tree.lux
@@ -24,7 +24,7 @@
(documentation: /.value
"Yields the value inside the current tree node.")
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
diff --git a/stdlib/source/documentation/lux/control/parser/type.lux b/stdlib/source/documentation/lux/control/parser/type.lux
index fa326176f..0aa20cac6 100644
--- a/stdlib/source/documentation/lux/control/parser/type.lux
+++ b/stdlib/source/documentation/lux/control/parser/type.lux
@@ -41,7 +41,7 @@
""
[(with_extension type poly)])
-(template [<name>]
+(with_template [<name>]
[(`` (documentation: <name>
(format "Parses the contents of a " (~~ (template.text [<name>])) " type.")))]
@@ -61,7 +61,7 @@
"Parses a type application."
[(applied poly)])
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux
index 0558eaed0..2120ef800 100644
--- a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux
@@ -29,7 +29,7 @@
""
[(key? dict key)])
-(template [<name>]
+(with_template [<name>]
[(`` (documentation: <name>
(format "Yields value under the " (~~ (template.text [<name>])) "imum key.")))]
diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux
index 28b8011f1..2da969a32 100644
--- a/stdlib/source/documentation/lux/data/collection/list.lux
+++ b/stdlib/source/documentation/lux/data/collection/list.lux
@@ -90,7 +90,7 @@
""
[(member? eq xs x)])
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux
index a3d452f5f..c82870c35 100644
--- a/stdlib/source/documentation/lux/data/color.lux
+++ b/stdlib/source/documentation/lux/data/color.lux
@@ -67,7 +67,7 @@
(documentation: /.Pigment
"A color with some degree of transparency.")
-(template [<name>]
+(with_template [<name>]
[(`` (documentation: <name>
(format "A "
(text.replaced "_" "-" (~~ (template.text [<name>])))
diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux
index 398a4d7ef..d09e90390 100644
--- a/stdlib/source/documentation/lux/data/color/named.lux
+++ b/stdlib/source/documentation/lux/data/color/named.lux
@@ -18,7 +18,7 @@
["[0]" /
["/[1]" //]]])
-(template [<name>]
+(with_template [<name>]
[(documentation: <name>
(let [[red green blue] (//.rgb <name>)
[_ name] (symbol <name>)]
diff --git a/stdlib/source/documentation/lux/data/format/json.lux b/stdlib/source/documentation/lux/data/format/json.lux
index 866fd5682..a2ea2866e 100644
--- a/stdlib/source/documentation/lux/data/format/json.lux
+++ b/stdlib/source/documentation/lux/data/format/json.lux
@@ -37,7 +37,7 @@
"A JSON object field setter."
[(has key value json)])
-(template [<name> <desc>]
+(with_template [<name> <desc>]
[(documentation: <name>
(format "A JSON object field getter for " <desc> "."))]
diff --git a/stdlib/source/documentation/lux/data/text/encoding.lux b/stdlib/source/documentation/lux/data/text/encoding.lux
index 792b904d0..ab9a71016 100644
--- a/stdlib/source/documentation/lux/data/text/encoding.lux
+++ b/stdlib/source/documentation/lux/data/text/encoding.lux
@@ -15,7 +15,7 @@
(documentation: /.Encoding
"Encoding formats for text.")
-(template [<name>]
+(with_template [<name>]
[(documentation: <name>
(format "'" (/.name <name>) "' text encoding. "))]
diff --git a/stdlib/source/documentation/lux/data/text/unicode/block.lux b/stdlib/source/documentation/lux/data/text/unicode/block.lux
index 3214f6038..de00765eb 100644
--- a/stdlib/source/documentation/lux/data/text/unicode/block.lux
+++ b/stdlib/source/documentation/lux/data/text/unicode/block.lux
@@ -24,7 +24,7 @@
""
[(within? block char)])
-(template [<name>]
+(with_template [<name>]
[(documentation: <name>
(let [[_ name] (symbol <name>)]
(format (hex#encoded (/.start <name>))
diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux
index 22bd01753..8c4c37046 100644
--- a/stdlib/source/documentation/lux/ffi.jvm.lux
+++ b/stdlib/source/documentation/lux/ffi.jvm.lux
@@ -10,7 +10,7 @@
[\\library
["[0]" /]])
-(template [<name>]
+(with_template [<name>]
[(`` (documentation: <name>
(format "The type of a (boxed) " (~~ (template.text [<name>])) " object.")))]
@@ -24,7 +24,7 @@
[/.Character]
)
-(template [<name>]
+(with_template [<name>]
[(`` (documentation: <name>
(format "The type of an (unboxed) " (~~ (template.text [<name>])) " value.")))]
@@ -38,7 +38,7 @@
[/.char]
)
-(template [<name> <from> <to>]
+(with_template [<name> <from> <to>]
[(`` (documentation: <name>
"Type converter."))]
diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux
index 863749adf..3f22f8fd2 100644
--- a/stdlib/source/documentation/lux/ffi.old.lux
+++ b/stdlib/source/documentation/lux/ffi.old.lux
@@ -10,7 +10,7 @@
[\\library
["[0]" /]])
-(template [<name> <from> <to>]
+(with_template [<name> <from> <to>]
[(documentation: <name>
"Type converter.")]
diff --git a/stdlib/source/documentation/lux/math/number.lux b/stdlib/source/documentation/lux/math/number.lux
index 90dce2151..2625f99d3 100644
--- a/stdlib/source/documentation/lux/math/number.lux
+++ b/stdlib/source/documentation/lux/math/number.lux
@@ -21,7 +21,7 @@
["[1][0]" ratio]
["[1][0]" complex]])
-(template [<name> <encoding> <no_commas> <with_commas>]
+(with_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>]
diff --git a/stdlib/source/documentation/lux/math/number/frac.lux b/stdlib/source/documentation/lux/math/number/frac.lux
index 57fd3dbd1..7e7cfa502 100644
--- a/stdlib/source/documentation/lux/math/number/frac.lux
+++ b/stdlib/source/documentation/lux/math/number/frac.lux
@@ -30,7 +30,7 @@
"Frac(tion) greater-than or equal."
[(>= reference sample)])
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
@@ -45,7 +45,7 @@
""
[(/% param subject)])
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
@@ -53,7 +53,7 @@
[/.max "Frac(tion) minimum."]
)
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
diff --git a/stdlib/source/documentation/lux/math/number/i64.lux b/stdlib/source/documentation/lux/math/number/i64.lux
index f69796e97..d9bf765ca 100644
--- a/stdlib/source/documentation/lux/math/number/i64.lux
+++ b/stdlib/source/documentation/lux/math/number/i64.lux
@@ -10,7 +10,7 @@
[\\library
["[0]" /]])
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
@@ -43,7 +43,7 @@
"Count the number of 1s in a bit-map."
[(ones it)])
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
diff --git a/stdlib/source/documentation/lux/math/number/int.lux b/stdlib/source/documentation/lux/math/number/int.lux
index 6a2f7ef24..646220cc3 100644
--- a/stdlib/source/documentation/lux/math/number/int.lux
+++ b/stdlib/source/documentation/lux/math/number/int.lux
@@ -30,7 +30,7 @@
"Int(eger) greater-than or equal."
[(>= reference sample)])
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
@@ -38,7 +38,7 @@
[/.max "Int(eger) maximum."]
)
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
diff --git a/stdlib/source/documentation/lux/math/number/nat.lux b/stdlib/source/documentation/lux/math/number/nat.lux
index f830b17fd..6f79389c7 100644
--- a/stdlib/source/documentation/lux/math/number/nat.lux
+++ b/stdlib/source/documentation/lux/math/number/nat.lux
@@ -10,7 +10,7 @@
[\\library
["[0]" /]])
-(template [<name> <documentation>]
+(with_template [<name> <documentation>]
[(documentation: <name>
<documentation>)]
@@ -27,7 +27,7 @@
[/.% "Nat(ural) remainder."]
)
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
diff --git a/stdlib/source/documentation/lux/math/number/rev.lux b/stdlib/source/documentation/lux/math/number/rev.lux
index 30bf3821b..39dc43660 100644
--- a/stdlib/source/documentation/lux/math/number/rev.lux
+++ b/stdlib/source/documentation/lux/math/number/rev.lux
@@ -30,7 +30,7 @@
"Rev(olution) greater-than or equal."
[(>= reference sample)])
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
@@ -38,7 +38,7 @@
[/.max "Rev(olution) maximum."]
)
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
diff --git a/stdlib/source/documentation/lux/static.lux b/stdlib/source/documentation/lux/static.lux
index 6b820161b..ab822cb92 100644
--- a/stdlib/source/documentation/lux/static.lux
+++ b/stdlib/source/documentation/lux/static.lux
@@ -10,7 +10,7 @@
[\\library
["[0]" /]])
-(template [<name> <type>]
+(with_template [<name> <type>]
[(documentation: <name>
(%.code (' (<name>
(is <type>
@@ -31,7 +31,7 @@
(is ???
(value generating expression)))])
-(template [<name> <type>]
+(with_template [<name> <type>]
[(documentation: <name>
(%.code (' (is <type>
(<name>)))))]
diff --git a/stdlib/source/documentation/lux/time.lux b/stdlib/source/documentation/lux/time.lux
index 6337f6e1b..9e460146c 100644
--- a/stdlib/source/documentation/lux/time.lux
+++ b/stdlib/source/documentation/lux/time.lux
@@ -20,7 +20,7 @@
["[1][0]" month]
["[1][0]" year]])
-(template [<name> <doc>]
+(with_template [<name> <doc>]
[(documentation: <name>
<doc>)]
diff --git a/stdlib/source/documentation/lux/type.lux b/stdlib/source/documentation/lux/type.lux
index d1aef3ff2..138986636 100644
--- a/stdlib/source/documentation/lux/type.lux
+++ b/stdlib/source/documentation/lux/type.lux
@@ -24,7 +24,7 @@
["[1][0]" unit]
["[1][0]" variance]])
-(template [<name>]
+(with_template [<name>]
[(documentation: <name>
"The number of parameters, and the body, of a quantified type.")]
@@ -40,7 +40,7 @@
"The quantified type, and its parameters, for a type-application."
[(flat_application type)])
-(template [<name>]
+(with_template [<name>]
[(documentation: <name>
"The members of a composite type.")]
@@ -69,7 +69,7 @@
"A type without any names covering it."
[(anonymous type)])
-(template [<name>]
+(with_template [<name>]
[(documentation: <name>
"A composite type, constituted by the given member types.")]
@@ -85,7 +85,7 @@
"An un-evaluated type application, with the given quantified type, and parameters."
[(application params quant)])
-(template [<name>]
+(with_template [<name>]
[(documentation: <name>
"A quantified type, with the given number of parameters, and body.")]
diff --git a/stdlib/source/documentation/lux/type/primitive.lux b/stdlib/source/documentation/lux/type/primitive.lux
index ea7ca95ea..6d9e20762 100644
--- a/stdlib/source/documentation/lux/type/primitive.lux
+++ b/stdlib/source/documentation/lux/type/primitive.lux
@@ -23,7 +23,7 @@
"A specific abstract/nominal type still being defined somewhere in the scope."
[(specific name)])
-(template [<name> <from> <$> <to>]
+(with_template [<name> <from> <$> <to>]
[(documentation: <name>
"Type-casting macro for abstract/nominal types."
[(|> value
diff --git a/stdlib/source/documentation/lux/type/resource.lux b/stdlib/source/documentation/lux/type/resource.lux
index bc3e8f0f0..a216b3082 100644
--- a/stdlib/source/documentation/lux/type/resource.lux
+++ b/stdlib/source/documentation/lux/type/resource.lux
@@ -51,7 +51,7 @@
(format "A resource locked by a key."
\n "The 'key' represents the right to access/consume a resource."))
-(template [<name>]
+(with_template [<name>]
[(documentation: <name>
"Makes a value into a resource and adds the key/access-right to it to the ambient keyring for future use.")]
@@ -75,7 +75,7 @@
right (read ! res|right)]
(in (format left right)))])
-(template [<name>]
+(with_template [<name>]
[(documentation: <name>
"Group/un-group keys in the keyring into/out-of tuples."
[(do (monad !)
diff --git a/stdlib/source/documentation/lux/type/unit.lux b/stdlib/source/documentation/lux/type/unit.lux
index 4a8dbd8b1..3a80b367c 100644
--- a/stdlib/source/documentation/lux/type/unit.lux
+++ b/stdlib/source/documentation/lux/type/unit.lux
@@ -42,7 +42,7 @@
""
[(re_scaled from to quantity)])
-(template [<type> <scale>]
+(with_template [<type> <scale>]
[(`` (documentation: <scale>
(let [numerator (the [/.ratio ratio.#numerator] <scale>)
denominator (the [/.ratio ratio.#denominator] <scale>)]
@@ -57,7 +57,7 @@
[/.Nano /.nano]
)
-(template [<unit>]
+(with_template [<unit>]
[(`` (documentation: <unit>
(format "The '" (~~ (template.text [<unit>])) "' unit of meaurement.")))]
diff --git a/stdlib/source/documentation/lux/world/net/http/client.lux b/stdlib/source/documentation/lux/world/net/http/client.lux
index 2f44944ca..0a779634d 100644
--- a/stdlib/source/documentation/lux/world/net/http/client.lux
+++ b/stdlib/source/documentation/lux/world/net/http/client.lux
@@ -17,7 +17,7 @@
(documentation: (/.Client !)
"A HTTP client capable of issuing requests to a HTTP server.")
-(template [<name>]
+(with_template [<name>]
[(documentation: <name>
(format "A " (text.upper_cased (template.text [<name>])) " request."))]
diff --git a/stdlib/source/documentation/lux/world/net/http/status.lux b/stdlib/source/documentation/lux/world/net/http/status.lux
index 2ccf8d681..9d34e7487 100644
--- a/stdlib/source/documentation/lux/world/net/http/status.lux
+++ b/stdlib/source/documentation/lux/world/net/http/status.lux
@@ -13,7 +13,7 @@
[\\library
["[0]" /]])
-(template [<name>]
+(with_template [<name>]
[(documentation: <name>
(|> (template.text [<name>])
(text.replaced "_" " ")
diff --git a/stdlib/source/documentation/lux/world/output/video/resolution.lux b/stdlib/source/documentation/lux/world/output/video/resolution.lux
index 65aa9d860..f6881ac34 100644
--- a/stdlib/source/documentation/lux/world/output/video/resolution.lux
+++ b/stdlib/source/documentation/lux/world/output/video/resolution.lux
@@ -16,7 +16,7 @@
(documentation: /.Resolution
"A screen resolution.")
-(template [<name>]
+(with_template [<name>]
[(documentation: <name>
(let [name (|> (template.text [<name>])
(text.replaced "_" " ")
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 0b45af385..1a35551fa 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -1940,7 +1940,7 @@
(-> ($' List ($' List a)) ($' List a)))
(list#mix list#composite {#End} (list#reversed xs)))
-(def:'' .public template
+(def:'' .public with_template
Macro
(macro (_ tokens)
({{#Item [[_ {#Tuple bindings}] {#Item [[_ {#Tuple templates}] data]}]}
@@ -1954,15 +1954,15 @@
(list#each (function#composite apply (replacement_environment bindings')))
list#conjoint
meta#in)
- (failure "Irregular arguments tuples for template.")))
+ (failure (..wrong_syntax_error [..prelude_module "with_template"]))))
_
- (failure "Wrong syntax for template")}
+ (failure (..wrong_syntax_error [..prelude_module "with_template"]))}
[(monad#each maybe_monad symbol_short bindings)
(monad#each maybe_monad tuple_list data)])
_
- (failure "Wrong syntax for template")}
+ (failure (..wrong_syntax_error [..prelude_module "with_template"]))}
tokens)))
(def:''' .private (n// param subject)
@@ -2415,7 +2415,7 @@
_ #0}
xs))
-(template [<name> <type> <value>]
+(with_template [<name> <type> <value>]
[(def:''' .private (<name> xy)
(All (_ a b)
(-> (Tuple a b) <type>))
@@ -2809,7 +2809,7 @@
_
{#None}))
-(template [<parser> <item_type> <item_parser>]
+(with_template [<parser> <item_type> <item_parser>]
[(def:' .private (<parser> tokens)
(-> (List Code) (Maybe (List <item_type>)))
(case tokens
@@ -2827,7 +2827,7 @@
[enhanced_parametersP Code anyP]
)
-(template [<parser> <parameter_type> <parameters_parser>]
+(with_template [<parser> <parameter_type> <parameters_parser>]
[(def:' .private (<parser> tokens)
(Parser [Text (List <parameter_type>)])
(case tokens
@@ -2868,7 +2868,7 @@
_
[tokens (` .private)]))
-(template [<parser> <parameter_type> <local>]
+(with_template [<parser> <parameter_type> <local>]
[(def:' .private (<parser> tokens)
(-> (List Code) (Maybe [(List Code) [Code Text (List <parameter_type>)]]))
(do maybe_monad
@@ -2956,7 +2956,7 @@
{#Some y}
{#Some y})))
-(template [<name> <form> <message>]
+(with_template [<name> <form> <message>]
[(def: .public <name>
(macro (_ tokens)
(case (list#reversed tokens)
@@ -3090,7 +3090,7 @@
_
{#None}))
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: (<name> type)
(-> Type (List Type))
(case type
@@ -4543,7 +4543,7 @@
_
(failure "Wrong syntax for pattern#template"))))
-(template [<name> <extension>]
+(with_template [<name> <extension>]
[(def: .public <name>
(All (_ s)
(-> (I64 s) (I64 s)))
@@ -4897,19 +4897,19 @@
(failure (..wrong_syntax_error (symbol ..type_of))))))
(def: (templateP tokens)
- (-> (List Code) (Maybe [Code Text (List Text) (List Code)]))
+ (-> (List Code) (Maybe [Text (List Text) (List Code)]))
(do maybe_monad
- [% (declarationP tokens)
- .let' [[tokens [export_policy name parameters]] %]
+ [% (local_declarationP tokens)
+ .let' [[tokens [name parameters]] %]
% (tupleP (someP anyP) tokens)
.let' [[tokens templates] %]
_ (endP tokens)]
- (in [export_policy name parameters templates])))
+ (in [name parameters templates])))
-(def: .public template:
+(def: .public template
(macro (_ tokens)
(case (templateP tokens)
- {#Some [export_policy name args input_templates]}
+ {#Some [name args input_templates]}
(do meta_monad
[g!tokens (..generated_symbol "tokens")
g!compiler (..generated_symbol "compiler")
@@ -4918,25 +4918,25 @@
[arg (` ((~' ~) (~ (local$ arg))))])
args)]
this_module current_module_name]
- (in (list (` (..def: (~ export_policy) (~ (local$ name))
- (..macro ((~ (local$ name)) (~ g!tokens) (~ g!compiler))
- (case (~ g!tokens)
- (pattern (list (~+ (list#each local$ args))))
- {.#Right [(~ g!compiler)
- (list (~+ (list#each (function (_ template)
- (` (`' (~ (with_replacements rep_env
- template)))))
- input_templates)))]}
-
- (~ g!_)
- {.#Left (~ (text$ (..wrong_syntax_error [this_module name])))})))))))
+ (in (list (` (..macro ((~ (local$ name)) (~ g!tokens) (~ g!compiler))
+ (case (~ g!tokens)
+ (pattern (list (~+ (list#each local$ args))))
+ {.#Right [(~ g!compiler)
+ (list (~+ (list#each (function (_ template)
+ (` (`' (~ (with_replacements rep_env
+ template)))))
+ input_templates)))]}
+
+ (~ g!_)
+ {.#Left "Invalid syntax."}))))))
{#None}
- (failure (..wrong_syntax_error (symbol ..template:))))))
+ (failure (..wrong_syntax_error (symbol ..template))))))
-(template [<name> <to>]
- [(template: .public (<name> it)
- [(..|> it (..is (..I64 ..Any)) (..as <to>))])]
+(with_template [<name> <to>]
+ [(def: .public <name>
+ (template (<name> it)
+ [(..|> it (..is (..I64 ..Any)) (..as <to>))]))]
[i64 ..I64]
[nat ..Nat]
diff --git a/stdlib/source/library/lux/abstract/interval.lux b/stdlib/source/library/lux/abstract/interval.lux
index c38e3a75b..2ec0a1fa5 100644
--- a/stdlib/source/library/lux/abstract/interval.lux
+++ b/stdlib/source/library/lux/abstract/interval.lux
@@ -32,7 +32,7 @@
(def: bottom elem)
(def: top elem)))
-(template [<name> <comp>]
+(with_template [<name> <comp>]
[(def: .public (<name> interval)
(All (_ a) (-> (Interval a) Bit))
(let [(open ",#[0]") interval]
@@ -58,7 +58,7 @@
(and (,#= ,#bottom elem)
(,#= ,#top elem)))))
-(template [<name> <limit>]
+(with_template [<name> <limit>]
[(def: .public (<name> elem interval)
(All (_ a) (-> a (Interval a) Bit))
(let [(open "[0]") interval]
@@ -105,7 +105,7 @@
(All (_ a) (-> (Interval a) (Interval a) Bit))
(precedes? sample reference))
-(template [<name> <comp>]
+(with_template [<name> <comp>]
[(def: .public (<name> reference sample)
(All (_ a) (-> a (Interval a) Bit))
(let [(open ",#[0]") sample]
@@ -128,7 +128,7 @@
(or (meets? reference sample)
(meets? sample reference)))
-(template [<name> <eq_side> <ineq> <ineq_side>]
+(with_template [<name> <eq_side> <ineq> <ineq_side>]
[(def: .public (<name> reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(let [(open ",#[0]") reference]
diff --git a/stdlib/source/library/lux/abstract/predicate.lux b/stdlib/source/library/lux/abstract/predicate.lux
index 590741de7..10efde28e 100644
--- a/stdlib/source/library/lux/abstract/predicate.lux
+++ b/stdlib/source/library/lux/abstract/predicate.lux
@@ -11,7 +11,7 @@
(type: .public (Predicate a)
(-> a Bit))
-(template [<identity_name> <identity_value> <composition_name> <composition>]
+(with_template [<identity_name> <identity_value> <composition_name> <composition>]
[(def: .public <identity_name>
Predicate
(function.constant <identity_value>))
@@ -26,7 +26,7 @@
[all #1 and .and]
)
-(template [<name> <identity> <composition>]
+(with_template [<name> <identity> <composition>]
[(implementation: .public <name>
(All (_ a) (Monoid (Predicate a)))
diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux
index 81a5af65d..344af48e8 100644
--- a/stdlib/source/library/lux/control/concatenative.lux
+++ b/stdlib/source/library/lux/control/concatenative.lux
@@ -144,7 +144,7 @@
(function ((~ g!_) (~ (stack_mix g!inputs g!stack)))
[(~ g!stack) ((~ g!func) (~+ g!inputs))]))))))))))
-(template [<arity>]
+(with_template [<arity>]
[(`` (def: .public (~~ (template.symbol ["apply_" <arity>]))
(..apply <arity>)))]
@@ -202,7 +202,7 @@
(function (_ [stack r])
[stack {0 #1 r}]))
-(template [<input> <output> <word> <func>]
+(with_template [<input> <output> <word> <func>]
[(`` (def: .public <word>
(=> [<input> <input>] [<output>])
(function (_ [[stack subject] param])
diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux
index b933ea350..8882fc928 100644
--- a/stdlib/source/library/lux/control/concurrency/async.lux
+++ b/stdlib/source/library/lux/control/concurrency/async.lux
@@ -172,7 +172,7 @@
[(Async (Or lr rr)) (Resolver (Or lr rr))]
(..async []))]
(with_expansions
- [<sides> (template [<async> <tag>]
+ [<sides> (with_template [<async> <tag>]
[(io.run! (upon! (|>> {<tag>} resolve) <async>))]
[left .#Left]
@@ -191,7 +191,7 @@
[(Async a) (Resolver a)]
(..async []))]
(`` (exec
- (~~ (template [<async>]
+ (~~ (with_template [<async>]
[(io.run! (upon! resolve <async>))]
[left]
diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux
index a9c93433a..20236531a 100644
--- a/stdlib/source/library/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux
@@ -147,7 +147,7 @@
(again (++ step)))
(at async.monad in []))))
- (template [<phase> <update> <goal> <turnstile>]
+ (with_template [<phase> <update> <goal> <turnstile>]
[(def: (<phase> barrier)
(-> Barrier (Async Any))
(do async.monad
diff --git a/stdlib/source/library/lux/control/function/contract.lux b/stdlib/source/library/lux/control/function/contract.lux
index b5de83e82..fbb5dc725 100644
--- a/stdlib/source/library/lux/control/function/contract.lux
+++ b/stdlib/source/library/lux/control/function/contract.lux
@@ -15,7 +15,7 @@
[number
["i" int]]]]])
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [condition Code])
(exception.report
"Condition" (%.code condition)))]
diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux
index ef5e9eecf..50ed5ca0c 100644
--- a/stdlib/source/library/lux/control/io.lux
+++ b/stdlib/source/library/lux/control/io.lux
@@ -21,15 +21,17 @@
(All (_ a) (-> (-> Any a) (IO a)))
(|>> abstraction))
- (template: (!io computation)
- [(abstraction
- (template.with_locals [g!func g!arg]
- (function (g!func g!arg)
- computation)))])
+ (def: !io
+ (template (!io computation)
+ [(abstraction
+ (template.with_locals [g!func g!arg]
+ (function (g!func g!arg)
+ computation)))]))
- (template: (run!' io)
- ... creatio ex nihilo
- [((representation io) [])])
+ (def: run!'
+ (template (run!' io)
+ ... creatio ex nihilo
+ [((representation io) [])]))
(def: .public io
(syntax (_ [computation <code>.any])
diff --git a/stdlib/source/library/lux/control/parser/analysis.lux b/stdlib/source/library/lux/control/parser/analysis.lux
index e23cc495e..ebf4f2ec6 100644
--- a/stdlib/source/library/lux/control/parser/analysis.lux
+++ b/stdlib/source/library/lux/control/parser/analysis.lux
@@ -88,7 +88,7 @@
{.#End} true
_ false)]}))
-(template [<query> <assertion> <tag> <type> <eq>]
+(with_template [<query> <assertion> <tag> <type> <eq>]
[(`` (these (def: .public <query>
(Parser <type>)
(function (_ input)
diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux
index 36f70c1e0..28f13e9b7 100644
--- a/stdlib/source/library/lux/control/parser/binary.lux
+++ b/stdlib/source/library/lux/control/parser/binary.lux
@@ -43,9 +43,10 @@
"Binary length" (%.nat binary_length)
"Bytes read" (%.nat bytes_read)))
-(template [<name> <extension>]
- [(template: (<name> <parameter> <subject>)
- [(<extension> <parameter> <subject>)])]
+(with_template [<name> <extension>]
+ [(def: <name>
+ (template (<name> <parameter> <subject>)
+ [(<extension> <parameter> <subject>)]))]
[n#= "lux i64 ="]
[n#+ "lux i64 +"]
@@ -95,7 +96,7 @@
"Range start" (%.nat start)
"Range end" (%.nat end)))
-(template [<name> <size> <read>]
+(with_template [<name> <size> <read>]
[(def: .public <name>
(Parser I64)
(function (_ [start binary])
@@ -112,7 +113,7 @@
[bits_64 ..size_64 /.bits_64]
)
-(template [<name> <type>]
+(with_template [<name> <type>]
[(def: .public <name> (Parser <type>) ..bits_64)]
[nat Nat]
@@ -130,17 +131,18 @@
"Tag range" (%.nat range)
"Tag value" (%.nat byte)))
-(template: (!variant <case>+)
- [(do [! //.monad]
- [flag (is (Parser Nat)
- ..bits_8)]
- (with_expansions [<case>+' (template.spliced <case>+)]
- (case flag
- (^.template [<number> <tag> <parser>]
- [<number> (`` (at ! each (|>> {(~~ (template.spliced <tag>))}) <parser>))])
- (<case>+')
-
- _ (//.lifted (exception.except ..invalid_tag [(template.amount [<case>+]) flag])))))])
+(def: !variant
+ (template (!variant <case>+)
+ [(do [! //.monad]
+ [flag (is (Parser Nat)
+ ..bits_8)]
+ (with_expansions [<case>+' (template.spliced <case>+)]
+ (case flag
+ (^.with_template [<number> <tag> <parser>]
+ [<number> (`` (at ! each (|>> {(~~ (template.spliced <tag>))}) <parser>))])
+ (<case>+')
+
+ _ (//.lifted (exception.except ..invalid_tag [(template.amount [<case>+]) flag])))))]))
(def: .public (or left right)
(All (_ l r) (-> (Parser l) (Parser r) (Parser (Or l r))))
@@ -185,7 +187,7 @@
[[end binary]]
{try.#Success}))))))
-(template [<size> <name> <bits>]
+(with_template [<size> <name> <bits>]
[(`` (def: .public <name>
(Parser Binary)
(do //.monad
@@ -198,7 +200,7 @@
[64 binary_64 ..bits_64]
)
-(template [<size> <name> <binary>]
+(with_template [<size> <name> <binary>]
[(`` (def: .public <name>
(Parser Text)
(do //.monad
@@ -213,7 +215,7 @@
(def: .public text ..utf8_64)
-(template [<size> <name> <bits>]
+(with_template [<size> <name> <bits>]
[(def: .public (<name> valueP)
(All (_ v) (-> (Parser v) (Parser (Sequence v))))
(do //.monad
diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux
index e2b1b9c9e..017895abf 100644
--- a/stdlib/source/library/lux/control/parser/code.lux
+++ b/stdlib/source/library/lux/control/parser/code.lux
@@ -57,7 +57,7 @@
{.#Item next _}
{try.#Success [tokens next]})))
-(template [<query> <check> <type> <tag> <eq> <desc>]
+(with_template [<query> <check> <type> <tag> <eq> <desc>]
[(with_expansions [<failure> (these {try.#Failure (all text#composite "Cannot parse " <desc> (remaining_inputs tokens))})]
(def: .public <query>
(Parser <type>)
@@ -155,7 +155,7 @@
_
<failure>))))
-(template [<name> <tag> <desc>]
+(with_template [<name> <tag> <desc>]
[(def: .public (<name> p)
(All (_ a)
(-> (Parser a) (Parser a)))
diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux
index 1887b387b..cf778566d 100644
--- a/stdlib/source/library/lux/control/parser/json.lux
+++ b/stdlib/source/library/lux/control/parser/json.lux
@@ -59,7 +59,7 @@
(exception.report
"Value" (/.format value)))
-(template [<name> <type> <tag>]
+(with_template [<name> <type> <tag>]
[(def: .public <name>
(Parser <type>)
(do //.monad
@@ -83,7 +83,7 @@
"Reference" (/.format reference)
"Sample" (/.format sample)))
-(template [<test> <check> <type> <equivalence> <tag>]
+(with_template [<test> <check> <type> <equivalence> <tag>]
[(def: .public (<test> test)
(-> <type> (Parser Bit))
(do //.monad
diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux
index 2fd9942fb..130b271ac 100644
--- a/stdlib/source/library/lux/control/parser/synthesis.lux
+++ b/stdlib/source/library/lux/control/parser/synthesis.lux
@@ -87,7 +87,7 @@
{.#End} true
_ false)]}))
-(template [<query> <assertion> <tag> <type> <eq>]
+(with_template [<query> <assertion> <tag> <type> <eq>]
[(`` (def: .public <query>
(Parser <type>)
(.function (_ input)
diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux
index c03a62dae..fbe318d12 100644
--- a/stdlib/source/library/lux/control/parser/text.lux
+++ b/stdlib/source/library/lux/control/parser/text.lux
@@ -118,7 +118,7 @@
_
(exception.except ..cannot_slice []))))
-(template [<name> <type> <any>]
+(with_template [<name> <type> <any>]
[(`` (def: .public (<name> parser)
(All (_ a) (-> (Parser a) (Parser <type>)))
(function (_ input)
@@ -193,7 +193,7 @@
(n.<= top char')))]
(in it)))
-(template [<bottom> <top> <text> <slice>]
+(with_template [<bottom> <top> <text> <slice>]
[(def: .public <text>
(Parser Text)
(..range (char <bottom>) (char <top>)))
@@ -228,7 +228,7 @@
(..range! (char "a") (char "f"))
(..range! (char "A") (char "F"))))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [options Text
character Char])
(exception.report
@@ -239,7 +239,7 @@
[character_should_not_be]
)
-(template [<name> <modifier> <exception>]
+(with_template [<name> <modifier> <exception>]
[(def: .public (<name> options)
(-> Text (Parser Text))
(function (_ [offset tape])
@@ -257,7 +257,7 @@
[none_of .not ..character_should_not_be]
)
-(template [<name> <modifier> <exception>]
+(with_template [<name> <modifier> <exception>]
[(def: .public (<name> options)
(-> Text (Parser Slice))
(function (_ [offset tape])
@@ -328,7 +328,7 @@
(open "right[0]") right]
(in [left#basis ("lux i64 +" left#distance right#distance)])))
-(template [<name> <base> <doc_modifier>]
+(with_template [<name> <base> <doc_modifier>]
[(def: .public (<name> parser)
(-> (Parser Text) (Parser Text))
(|> parser <base> (at //.monad each /.together)))]
@@ -337,7 +337,7 @@
[many //.many "many"]
)
-(template [<name> <base> <doc_modifier>]
+(with_template [<name> <base> <doc_modifier>]
[(def: .public (<name> parser)
(-> (Parser Slice) (Parser Slice))
(with_slices (<base> parser)))]
@@ -346,7 +346,7 @@
[many! //.many "many"]
)
-(template [<name> <base> <doc_modifier>]
+(with_template [<name> <base> <doc_modifier>]
[(def: .public (<name> amount parser)
(-> Nat (Parser Text) (Parser Text))
(|> parser
@@ -358,7 +358,7 @@
[at_least //.at_least "at least"]
)
-(template [<name> <base> <doc_modifier>]
+(with_template [<name> <base> <doc_modifier>]
[(def: .public (<name> amount parser)
(-> Nat (Parser Slice) (Parser Slice))
(with_slices
diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux
index b45e40449..751d370db 100644
--- a/stdlib/source/library/lux/control/parser/tree.lux
+++ b/stdlib/source/library/lux/control/parser/tree.lux
@@ -32,7 +32,7 @@
(exception: .public cannot_move_further)
-(template [<name> <direction>]
+(with_template [<name> <direction>]
[(def: .public <name>
(All (_ t) (Parser t []))
(function (_ zipper)
diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux
index 4b2e9cd90..b2dcbce6e 100644
--- a/stdlib/source/library/lux/control/parser/type.lux
+++ b/stdlib/source/library/lux/control/parser/type.lux
@@ -23,10 +23,11 @@
["[0]" check]]]]
["[0]" //])
-(template: (|recursion_dummy|)
- [{.#Primitive "" {.#End}}])
+(def: |recursion_dummy|
+ (template (|recursion_dummy|)
+ [{.#Primitive "" {.#End}}]))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [type Type])
(exception.report
"Type" (%.type type)))]
@@ -43,7 +44,7 @@
[not_tuple]
)
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [expected Type
actual Type])
(exception.report
@@ -153,7 +154,7 @@
{try.#Success [[_ inputs'] output]}
{try.#Success [[env inputs'] [g!var output]]}))))
-(template [<name> <flattener> <exception>]
+(with_template [<name> <flattener> <exception>]
[(`` (def: .public (<name> poly)
(All (_ a) (-> (Parser a) (Parser a)))
(do //.monad
@@ -232,7 +233,7 @@
(//.failure (exception.error ..not_application headT))
(..local {.#Item funcT paramsT} poly))))
-(template [<name> <test>]
+(with_template [<name> <test>]
[(def: .public (<name> expected)
(-> Type (Parser Any))
(do //.monad
diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux
index dd72e4d7a..372a217f3 100644
--- a/stdlib/source/library/lux/control/remember.lux
+++ b/stdlib/source/library/lux/control/remember.lux
@@ -65,7 +65,7 @@
(list)))
(meta.failure (exception.error ..must_remember [deadline today message focus]))))))
-(template [<name> <message>]
+(with_template [<name> <message>]
[(`` (def: .public <name>
(syntax (_ [deadline ..deadline
message <c>.text
diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux
index f01773f36..a41783bc9 100644
--- a/stdlib/source/library/lux/control/security/policy.lux
+++ b/stdlib/source/library/lux/control/security/policy.lux
@@ -76,7 +76,7 @@
(def: conjoint (|>> representation)))
)
-(template [<brand> <value> <upgrade> <downgrade>]
+(with_template [<brand> <value> <upgrade> <downgrade>]
[(primitive: .public <brand>
Any
diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux
index 2335c38a0..d39c1eff1 100644
--- a/stdlib/source/library/lux/data/binary.lux
+++ b/stdlib/source/library/lux/data/binary.lux
@@ -46,7 +46,7 @@
"Size" (%.nat size)
"Index" (%.nat index)))
-(template [<safe> <unsafe> <shift>]
+(with_template [<safe> <unsafe> <shift>]
[(def: .public (<safe> index it)
(-> Nat Binary (Try I64))
(if (n.< (/.size it) (|> index <shift>))
@@ -59,7 +59,7 @@
[bits_64 /.bits_64 (n.+ 7)]
)
-(template [<safe> <unsafe> <shift>]
+(with_template [<safe> <unsafe> <shift>]
[(def: .public (<safe> index value it)
(-> Nat (I64 Any) Binary (Try Binary))
(if (n.< (/.size it) (|> index <shift>))
diff --git a/stdlib/source/library/lux/data/bit.lux b/stdlib/source/library/lux/data/bit.lux
index db83b05a9..da276ed5a 100644
--- a/stdlib/source/library/lux/data/bit.lux
+++ b/stdlib/source/library/lux/data/bit.lux
@@ -9,7 +9,7 @@
[control
["[0]" function]]]])
-(template [<zero> <one>]
+(with_template [<zero> <one>]
[(def: .public <zero> Bit #0)
(def: .public <one> Bit #1)]
@@ -35,7 +35,7 @@
#0 2
#1 3)))
-(template [<name> <identity> <op>]
+(with_template [<name> <identity> <op>]
[(implementation: .public <name>
(Monoid Bit)
diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux
index 074e5e7f9..7d239d16a 100644
--- a/stdlib/source/library/lux/data/collection/array.lux
+++ b/stdlib/source/library/lux/data/collection/array.lux
@@ -139,7 +139,7 @@
(def: (each $ input)
(!.each $ input)))
-(template [<safe> <unsafe>]
+(with_template [<safe> <unsafe>]
[(def: .public (<safe> ? it)
(All (_ r w)
(-> (Predicate r) (Predicate (Array' r w))))
diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux
index e9b659d3a..1df1551e6 100644
--- a/stdlib/source/library/lux/data/collection/bits.lux
+++ b/stdlib/source/library/lux/data/collection/bits.lux
@@ -60,7 +60,7 @@
(|> bits (array.item idx) (maybe.else empty_chunk))
empty_chunk))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> index input)
(-> Nat Bits Bits)
(let [[chunk_index bit_index] (n./% chunk_size index)]
@@ -130,7 +130,7 @@
(again (-- size|output)))
output))))))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Bits Bits Bits)
(case (n.max (array.size param)
diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux
index a4b122919..ef8f4f75d 100644
--- a/stdlib/source/library/lux/data/collection/dictionary.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary.lux
@@ -638,7 +638,7 @@
(empty key_hash)
kvs))
-(template [<side> <name>]
+(with_template [<side> <name>]
[(def: .public <name>
(All (_ k v) (-> (Dictionary k v) (List <side>)))
(|>> (the #root)
diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
index 76e5939be..00c1cc840 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
@@ -33,7 +33,7 @@
#left (Maybe (Node k v))
#right (Maybe (Node k v))]))
-(template [<create> <color>]
+(with_template [<create> <color>]
[(def: (<create> key value left right)
(All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v)))
[#color {<color>}
@@ -101,7 +101,7 @@
(again (the #left node))
(again (the #right node)))))))))
-(template [<name> <side>]
+(with_template [<name> <side>]
[(def: .public (<name> dict)
(All (_ k v) (-> (Dictionary k v) (Maybe v)))
(case (the #root dict)
@@ -136,7 +136,7 @@
(All (_ k v) (-> (Dictionary k v) Bit))
(|>> ..size (n.= 0)))
-(template [<name> <other_color> <self_color> <no_change>]
+(with_template [<name> <other_color> <self_color> <no_change>]
[(def: (<name> self)
(All (_ k v) (-> (Node k v) (Node k v)))
(case (the #color self)
@@ -259,7 +259,7 @@
{.#Some root}
(let [reference (the #key root)]
- (`` (cond (~~ (template [<comp> <tag> <add>]
+ (`` (cond (~~ (with_template [<comp> <tag> <add>]
[(<comp> reference key)
(let [side_root (the <tag> root)
outcome (again side_root)]
@@ -543,7 +543,7 @@
(empty order)
list))
-(template [<name> <type> <output>]
+(with_template [<name> <type> <output>]
[(def: .public (<name> dict)
(All (_ k v) (-> (Dictionary k v) (List <type>)))
(loop (again [node (the #root dict)])
diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
index 1d7c385c2..4f91cfc6d 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
@@ -42,7 +42,7 @@
{.#Some v'}
(value key properties'))))
-(template [<name> <type> <access>]
+(with_template [<name> <type> <access>]
[(def: .public <name>
(All (_ a) (-> (PList a) (List <type>)))
(list#each <access>))]
diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux
index d29b0889a..64dbcb141 100644
--- a/stdlib/source/library/lux/data/collection/list.lux
+++ b/stdlib/source/library/lux/data/collection/list.lux
@@ -92,7 +92,7 @@
_
{.#None}))
-(template [<name> <then> <else>]
+(with_template [<name> <then> <else>]
[(def: .public (<name> n xs)
(All (_ a)
(-> Nat (List a) (List a)))
@@ -109,7 +109,7 @@
[after (after (-- n) xs') xs]
)
-(template [<name> <then> <else>]
+(with_template [<name> <then> <else>]
[(def: .public (<name> predicate xs)
(All (_ a)
(-> (Predicate a) (List a) (List a)))
@@ -261,7 +261,7 @@
(All (_ a) (-> (List a) Nat))
(mix (function (_ _ acc) (n.+ 1 acc)) 0 list))
-(template [<name> <init> <op>]
+(with_template [<name> <init> <op>]
[(def: .public (<name> predicate items)
(All (_ a)
(-> (Predicate a) (List a) Bit))
@@ -408,7 +408,7 @@
(or (at eq = x x')
(member? eq xs' x))))
-(template [<name> <output> <side>]
+(with_template [<name> <output> <side>]
[(def: .public (<name> xs)
(All (_ a) (-> (List a) (Maybe <output>)))
(case xs
diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux
index 39bce01ad..b6bdf698a 100644
--- a/stdlib/source/library/lux/data/collection/sequence.lux
+++ b/stdlib/source/library/lux/data/collection/sequence.lux
@@ -59,7 +59,7 @@
Level
0)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: <name>
(-> Level Level)
(<op> branching_exponent))]
@@ -482,7 +482,7 @@
list.reversed
(list#mix suffix ..empty)))
-(template [<name> <array> <init> <op>]
+(with_template [<name> <array> <init> <op>]
[(def: .public <name>
(All (_ a)
(-> (Predicate a) (Sequence 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 ac422fd99..9141df9b2 100644
--- a/stdlib/source/library/lux/data/collection/set/multi.lux
+++ b/stdlib/source/library/lux/data/collection/set/multi.lux
@@ -66,7 +66,7 @@
(list#composite (list.repeated multiplicity elem) output))
{.#End})))
- (template [<name> <composite>]
+ (with_template [<name> <composite>]
[(def: .public (<name> parameter subject)
(All (_ a) (-> (Set a) (Set a) (Set a)))
(abstraction (dictionary.composite_with <composite> (representation parameter) (representation subject))))]
diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux
index 9e83655b9..296e0aadc 100644
--- a/stdlib/source/library/lux/data/collection/set/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/set/ordered.lux
@@ -23,7 +23,7 @@
(All (_ a) (-> (Set a) a Bit))
(/.key? (representation set) elem))
- (template [<type> <name> <alias>]
+ (with_template [<type> <name> <alias>]
[(def: .public <name>
(All (_ a) (-> (Set a) <type>))
(|>> representation <alias>))]
diff --git a/stdlib/source/library/lux/data/collection/stream.lux b/stdlib/source/library/lux/data/collection/stream.lux
index 0c8ba2d85..a005782b4 100644
--- a/stdlib/source/library/lux/data/collection/stream.lux
+++ b/stdlib/source/library/lux/data/collection/stream.lux
@@ -45,7 +45,7 @@
{.#Item head' tail'}
(again head' tail'))])))
-(template [<name> <return>]
+(with_template [<name> <return>]
[(def: .public (<name> stream)
(All (_ a) (-> (Stream a) <return>))
(let [[head tail] (//.result stream)]
@@ -62,7 +62,7 @@
0 head
_ (item (-- idx) tail))))
-(template [<taker> <dropper> <pred_type> <pred_test> <pred_step> <post_test>]
+(with_template [<taker> <dropper> <pred_type> <pred_test> <pred_step> <post_test>]
[(def: .public (<taker> pred xs)
(All (_ a)
(-> <pred_type> (Stream a) (List a)))
@@ -83,7 +83,7 @@
[first after Nat (n.= 0 pred) (-- pred) not]
)
-(template [<splitter> <pred_type> <pred_test> <pred_step>]
+(with_template [<splitter> <pred_type> <pred_test> <pred_step>]
[(def: .public (<splitter> pred xs)
(All (_ a)
(-> <pred_type> (Stream a) [(List a) (Stream a)]))
diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux
index 1a559f2ef..74b2c633b 100644
--- a/stdlib/source/library/lux/data/collection/tree/finger.lux
+++ b/stdlib/source/library/lux/data/collection/tree/finger.lux
@@ -29,7 +29,7 @@
(Tree @ t v)))
branch)))
- (template [<name> <tag> <output>]
+ (with_template [<name> <tag> <output>]
[(def: .public <name>
(All (_ @ t v) (-> (Tree @ t v) <output>))
(|>> representation (the <tag>)))]
diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux
index 33bc9b1b6..861713b8c 100644
--- a/stdlib/source/library/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux
@@ -116,7 +116,7 @@
_#rights})
_#parent))))))
-(template [<one> <all> <side> <op_side>]
+(with_template [<one> <all> <side> <op_side>]
[(def: .public (<one> zipper)
(All (_ a) (-> (Zipper a) (Maybe (Zipper a))))
(case (the #family zipper)
@@ -215,7 +215,7 @@
{.#None}
backward)}))
-(template [<name> <move>]
+(with_template [<name> <move>]
[(def: .public (<name> zipper)
(All (_ a) (-> (Zipper a) (Maybe (Zipper a))))
(case (<move> zipper)
@@ -273,7 +273,7 @@
{.#Some}))
(has #node next))))))
-(template [<name> <side>]
+(with_template [<name> <side>]
[(def: .public (<name> value zipper)
(All (_ a) (-> a (Zipper a) (Maybe (Zipper a))))
(case (the #family zipper)
diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux
index ebc8f8371..40424f426 100644
--- a/stdlib/source/library/lux/data/color.lux
+++ b/stdlib/source/library/lux/data/color.lux
@@ -316,7 +316,7 @@
#green (interpolated' greenE greenS)
#blue (interpolated' blueE blueS)])))
-(template [<name> <target>]
+(with_template [<name> <target>]
[(def: .public (<name> ratio color)
(-> Frac Color Color)
(..interpolated ratio <target> color))]
@@ -325,7 +325,7 @@
[brighter ..white]
)
-(template [<op> <name>]
+(with_template [<op> <name>]
[(def: .public (<name> ratio color)
(-> Frac Color Color)
(let [[hue saturation luminance] (hsl color)]
@@ -346,7 +346,7 @@
+0.0
luminance])))
-(template [<name> <1> <2>]
+(with_template [<name> <1> <2>]
[(`` (def: .public (<name> color)
(-> Color [Color Color Color])
(let [[hue saturation luminance] (hsl color)]
@@ -363,7 +363,7 @@
[split_complement (|> +1.0 (f./ +5.0)) (|> +3.0 (f./ +5.0))]
)
-(template [<name> <1> <2> <3>]
+(with_template [<name> <1> <2> <3>]
[(`` (def: .public (<name> color)
(-> Color [Color Color Color Color])
(let [[hue saturation luminance] (hsb color)]
diff --git a/stdlib/source/library/lux/data/color/named.lux b/stdlib/source/library/lux/data/color/named.lux
index 4e7ab9c1a..99fae8434 100644
--- a/stdlib/source/library/lux/data/color/named.lux
+++ b/stdlib/source/library/lux/data/color/named.lux
@@ -6,7 +6,7 @@
["[0]" // (.only Color)])
... https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
-(template [<red> <green> <blue> <name>]
+(with_template [<red> <green> <blue> <name>]
[(`` (def: .public <name>
Color
(//.of_rgb [//.#red (hex <red>)
diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux
index 1f257ea7e..290996b4e 100644
--- a/stdlib/source/library/lux/data/format/binary.lux
+++ b/stdlib/source/library/lux/data/format/binary.lux
@@ -33,9 +33,10 @@
["[0]" i64]
["[0]" frac]]]]])
-(template [<name> <extension> <post>]
- [(template: (<name> <parameter> <subject>)
- [(<post> (<extension> (.int <parameter>) (.int <subject>)))])]
+(with_template [<name> <extension> <post>]
+ [(def: <name>
+ (template (<name> <parameter> <subject>)
+ [(<post> (<extension> (.int <parameter>) (.int <subject>)))]))]
[n#= "lux i64 =" .|>]
[n#+ "lux i64 +" .nat]
@@ -77,7 +78,7 @@
(All (_ a) (-> (Writer a) a Binary))
(..instance (writer value)))
-(template [<name> <size> <write>]
+(with_template [<name> <size> <write>]
[(def: .public <name>
(Writer (I64 Any))
(function (_ value)
@@ -96,7 +97,7 @@
(All (_ l r) (-> (Writer l) (Writer r) (Writer (Or l r))))
(function (_ altV)
(case altV
- (^.template [<number> <tag> <writer>]
+ (^.with_template [<number> <tag> <writer>]
[{<tag> caseV}
(let [[caseS caseT] (<writer> caseV)]
[(.++ caseS)
@@ -127,7 +128,7 @@
(Writer Bit)
(|>> (pipe.case #0 0 #1 1) ..bits_8))
-(template [<name> <type>]
+(with_template [<name> <type>]
[(def: .public <name> (Writer <type>) ..bits_64)]
[nat Nat]
@@ -151,7 +152,7 @@
offset
binary)])]))
-(template [<name> <bits> <size> <write>]
+(with_template [<name> <bits> <size> <write>]
[(def: .public <name>
(Writer Binary)
(let [mask (..mask <size>)]
@@ -171,7 +172,7 @@
[binary_64 ..bits_64 </>.size_64 /.has_64!]
)
-(template [<name> <binary>]
+(with_template [<name> <binary>]
[(def: .public <name>
(Writer Text)
(|>> (at utf8.codec encoded) <binary>))]
@@ -184,7 +185,7 @@
(def: .public text ..utf8_64)
-(template [<name> <size> <write>]
+(with_template [<name> <size> <write>]
[(def: .public (<name> valueW)
(All (_ v) (-> (Writer v) (Writer (Sequence v))))
(function (_ value)
@@ -241,7 +242,7 @@
quantified (..and (..list again) again)]
(function (_ altV)
(case altV
- (^.template [<number> <tag> <writer>]
+ (^.with_template [<number> <tag> <writer>]
[{<tag> caseV}
(let [[caseS caseT] (<writer> caseV)]
[(.++ caseS)
@@ -275,7 +276,7 @@
(..and ..location
(function (_ altV)
(case altV
- (^.template [<number> <tag> <writer>]
+ (^.with_template [<number> <tag> <writer>]
[{<tag> caseV}
(let [[caseS caseT] (<writer> caseV)]
[(.++ caseS)
diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux
index 75013483b..3bb1f1da5 100644
--- a/stdlib/source/library/lux/data/format/css.lux
+++ b/stdlib/source/library/lux/data/format/css.lux
@@ -105,11 +105,12 @@
(text.interposed ..separator))
"}")))
- (template: (!composite <pre> <post>)
- [(abstraction
- (format (representation <pre>)
- ..separator
- (representation <post>)))])
+ (def: !composite
+ (template (!composite <pre> <post>)
+ [(abstraction
+ (format (representation <pre>)
+ ..separator
+ (representation <post>)))]))
(def: .public (and pre post)
(All (_ kind) (-> (CSS kind) (CSS kind) (CSS kind)))
@@ -132,7 +133,7 @@
(!composite (..rule selector style)
(..in_context combinator selector inner)))
- (template [<name> <combinator>]
+ (with_template [<name> <combinator>]
[(def: .public <name>
(-> (Selector Any) Style (CSS Common) (CSS Common))
(..dependent <combinator>))]
@@ -160,7 +161,7 @@
(!composite (..rule selector style)
(..in_case combinator selector inner)))
- (template [<name> <combinator>]
+ (with_template [<name> <combinator>]
[(def: .public <name>
(-> (Selector (Generic Any)) Style (CSS Common) (CSS Common))
(..specialized <combinator>))]
diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux
index 3ee23b2b7..9361d2d4a 100644
--- a/stdlib/source/library/lux/data/format/css/property.lux
+++ b/stdlib/source/library/lux/data/format/css/property.lux
@@ -65,8 +65,8 @@
(-> (Property Any) Text)
(|>> representation))
- (template [<brand> <alias>+ <property>+]
- [(`` (template [<alias> <property>]
+ (with_template [<brand> <alias>+ <property>+]
+ [(`` (with_template [<alias> <property>]
[(def: .public <alias>
(Property <brand>)
(abstraction <property>))]
@@ -74,7 +74,7 @@
(~~ (template.spliced <alias>+))))
(with_expansions [<rows> (template.spliced <property>+)]
- (template [<property>]
+ (with_template [<property>]
[(`` (def: .public (~~ (text_symbol <property>))
(Property <brand>)
(abstraction <property>)))]
diff --git a/stdlib/source/library/lux/data/format/css/query.lux b/stdlib/source/library/lux/data/format/css/query.lux
index 7bd1c2c5d..ba0ee101f 100644
--- a/stdlib/source/library/lux/data/format/css/query.lux
+++ b/stdlib/source/library/lux/data/format/css/query.lux
@@ -32,7 +32,7 @@
(-> Media Text)
(|>> representation))
- (template [<media>]
+ (with_template [<media>]
[(`` (def: .public (~~ (text_symbol <media>))
Media
(abstraction <media>)))]
@@ -50,7 +50,7 @@
(-> Feature Text)
(|>> representation))
- (template [<feature> <brand>]
+ (with_template [<feature> <brand>]
[(`` (def: .public ((~~ (text_symbol <feature>)) input)
(-> (Value <brand>) Feature)
(abstraction (format "(" <feature> ": " (//value.value input) ")"))))]
@@ -110,7 +110,7 @@
(-> Query Text)
(|>> representation))
- (template [<name> <operator>]
+ (with_template [<name> <operator>]
[(def: .public <name>
(-> Media Query)
(|>> ..media (format <operator>) abstraction))]
@@ -123,7 +123,7 @@
(-> Feature Query)
(|>> ..feature (format "not ") abstraction))
- (template [<name> <operator>]
+ (with_template [<name> <operator>]
[(def: .public (<name> left right)
(-> Query Query Query)
(abstraction (format (representation left)
diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux
index 9f62dc879..d982cfd55 100644
--- a/stdlib/source/library/lux/data/format/css/selector.lux
+++ b/stdlib/source/library/lux/data/format/css/selector.lux
@@ -23,7 +23,7 @@
(primitive: .public (Generic brand) Any)
-(template [<generic> <brand>]
+(with_template [<generic> <brand>]
[(primitive: <brand> Any)
(type: .public <generic> (Generic <brand>))]
@@ -50,7 +50,7 @@
(-> Tag (Selector Cannot_Chain))
(|>> abstraction))
- (template [<name> <type> <prefix> <kind> <out>]
+ (with_template [<name> <type> <prefix> <kind> <out>]
[(def: .public <name>
(-> <type> (Selector <kind>))
(|>> <out> (format <prefix>) abstraction))]
@@ -59,8 +59,8 @@
[class Class "." Can_Chain //class.class]
)
- (template [<right> <left> <combinator>+]
- [(`` (template [<combinator> <name>]
+ (with_template [<right> <left> <combinator>+]
+ [(`` (with_template [<combinator> <name>]
[(def: .public (<name> right left)
(-> (Selector <right>) (Selector <left>) (Selector Composite))
(abstraction (format (representation left)
@@ -93,7 +93,7 @@
(-> Attribute (Selector Can_Chain))
(abstraction (format "[" attribute "]")))
- (template [<check> <name>]
+ (with_template [<check> <name>]
[(def: .public (<name> attribute value)
(-> Attribute Text (Selector Can_Chain))
(abstraction (format "[" attribute <check> value "]")))]
@@ -106,8 +106,8 @@
["*=" contains?]
)
- (template [<kind> <pseudo>+]
- [(`` (template [<name> <pseudo>]
+ (with_template [<kind> <pseudo>+]
+ [(`` (with_template [<name> <pseudo>]
[(def: .public <name>
(Selector <kind>)
(abstraction <pseudo>))]
@@ -174,7 +174,7 @@
(-> Nat Index)
(|>> %.nat abstraction))
- (template [<name> <index>]
+ (with_template [<name> <index>]
[(def: .public <name> Index (abstraction <index>))]
[odd "odd"]
@@ -194,7 +194,7 @@
(%.nat (.nat _#variable)))
(%.int _#constant)))))
- (template [<name> <pseudo>]
+ (with_template [<name> <pseudo>]
[(def: .public (<name> index)
(-> Index (Selector Can_Chain))
(|> (representation index)
diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux
index 743cd781b..61a8be4fb 100644
--- a/stdlib/source/library/lux/data/format/css/value.lux
+++ b/stdlib/source/library/lux/data/format/css/value.lux
@@ -33,28 +33,30 @@
(syntax (_ [symbol <code>.text])
(in (list (code.local (text.replaced "-" "_" symbol))))))
-(template: (enumeration: <abstraction> <representation> <out> <sample>+ <definition>+)
- [(primitive: .public <abstraction>
- <representation>
+(def: enumeration:
+ (template (enumeration: <abstraction> <representation> <out> <sample>+ <definition>+)
+ [(primitive: .public <abstraction>
+ <representation>
- (def: .public <out>
- (-> <abstraction> <representation>)
- (|>> representation))
+ (def: .public <out>
+ (-> <abstraction> <representation>)
+ (|>> representation))
- (`` (template [<name> <value>]
- [(def: .public <name> <abstraction> (abstraction <value>))]
+ (`` (with_template [<name> <value>]
+ [(def: .public <name> <abstraction> (abstraction <value>))]
- (~~ (template.spliced <sample>+))
- ))
+ (~~ (template.spliced <sample>+))
+ ))
- (template.spliced <definition>+))])
+ (template.spliced <definition>+))]))
-(template: (multi: <multi> <type> <separator>)
- [(def: .public (<multi> pre post)
- (-> (Value <type>) (Value <type>) (Value <type>))
- (abstraction (format (representation pre)
- <separator>
- (representation post))))])
+(def: multi:
+ (template (multi: <multi> <type> <separator>)
+ [(def: .public (<multi> pre post)
+ (-> (Value <type>) (Value <type>) (Value <type>))
+ (abstraction (format (representation pre)
+ <separator>
+ (representation post))))]))
(def: (%number value)
(Format Frac)
@@ -70,7 +72,7 @@
(-> (Value Any) Text)
(|>> representation))
- (template [<name> <value>]
+ (with_template [<name> <value>]
[(def: .public <name> Value (abstraction <value>))]
[initial "initial"]
@@ -80,7 +82,7 @@
(primitive: .public (Numeric kind) Any)
- (template [<name>]
+ (with_template [<name>]
[(with_expansions [<name>' (template.symbol [<name> "'"])]
(primitive: .public <name>' Any)
(type: .public <name>
@@ -92,10 +94,10 @@
[Percentage]
)
- (template [<brand> <alias>+ <value>+]
+ (with_template [<brand> <alias>+ <value>+]
[(primitive: .public <brand> Any)
- (`` (template [<name> <value>]
+ (`` (with_template [<name> <value>]
[(def: .public <name>
(Value <brand>)
(abstraction <value>))]
@@ -103,7 +105,7 @@
(~~ (template.spliced <alias>+))))
(with_expansions [<rows> (template.spliced <value>+)]
- (template [<value>]
+ (with_template [<value>]
[(`` (def: .public (~~ (..text_symbol <value>))
(Value <brand>)
(abstraction <value>)))]
@@ -807,7 +809,7 @@
(list#each %number)
(..apply "cubic-bezier")))
- (template [<name> <brand>]
+ (with_template [<name> <brand>]
[(def: .public <name>
(-> Nat (Value <brand>))
(|>> %.nat abstraction))]
@@ -840,7 +842,7 @@
"1.0"
(format "0" (%.rev _#alpha)))))))
- (template [<name> <suffix>]
+ (with_template [<name> <suffix>]
[(def: .public (<name> value)
(-> Frac (Value Length))
(abstraction (format (%number value) <suffix>)))]
@@ -869,7 +871,7 @@
(%.int value)
(%.nat (.nat value))))
- (template [<name> <suffix>]
+ (with_template [<name> <suffix>]
[(def: .public (<name> value)
(-> Int (Value Time))
(abstraction (format (if (i.< +0 value)
@@ -949,7 +951,7 @@
(-> Nat Angle)
(abstraction (format (%.nat (n.% ..degree_limit value)) "deg")))
- (template [<degree> <name>]
+ (with_template [<degree> <name>]
[(def: .public <name>
Angle
(..degree <degree>))]
@@ -960,7 +962,7 @@
[270 to_left]
)
- (template [<name> <function>]
+ (with_template [<name> <function>]
[(def: .public (<name> angle start next)
(-> Angle Stop (List/1 [(Maybe Hint) Stop]) (Value Image))
(let [[now after] next]
@@ -988,8 +990,8 @@
(abstraction (format (representation horizontal) ..slice_separator
(representation vertical))))
- (template [<input> <pre> <function>+]
- [(`` (template [<name> <function>]
+ (with_template [<input> <pre> <function>+]
+ [(`` (with_template [<name> <function>]
[(def: .public <name>
(-> <input> (Value Filter))
(|>> <pre> (list) (..apply <function>)))]
@@ -1032,7 +1034,7 @@
(def: length_separator " ")
- (template [<name> <type>]
+ (with_template [<name> <type>]
[(def: .public (<name> horizontal vertical)
(-> (Value Length) (Value Length) (Value <type>))
(abstraction (format (representation horizontal)
@@ -1067,7 +1069,7 @@
[farthest_corner "farthest-corner"]]
[])
- (template [<name> <function>]
+ (with_template [<name> <function>]
[(def: .public (<name> shape extent location start next)
(-> Shape (Maybe Extent) (Value Location)
Stop (List/1 [(Maybe Hint) Stop])
@@ -1115,7 +1117,7 @@
(def: .public (clip rectangle)
(-> Rectangle (Value Clip))
- (`` (..apply "rect" (list (~~ (template [<side>]
+ (`` (..apply "rect" (list (~~ (with_template [<side>]
[(representation (the <side> rectangle))]
[#top] [#right] [#bottom] [#left]))))))
@@ -1255,7 +1257,7 @@
(list#each %number)
(..apply "matrix3d")))
- (template [<name> <function> <input_types> <input_values>]
+ (with_template [<name> <function> <input_types> <input_values>]
[(`` (def: .public (<name> [(~~ (template.spliced <input_values>))])
(-> [(~~ (template.spliced <input_types>))] (Value Transform))
(|> (list (~~ (template.spliced <input_values>)))
@@ -1277,7 +1279,7 @@
[perspective "perspective" [Frac] [value]]
)
- (template [<name> <function> <input_types> <input_values>]
+ (with_template [<name> <function> <input_types> <input_values>]
[(`` (def: .public (<name> [(~~ (template.spliced <input_values>))])
(-> [(~~ (template.spliced <input_types>))] (Value Transform))
(|> (list (~~ (template.spliced <input_values>)))
@@ -1327,7 +1329,7 @@
(multi: multi_content Content " ")
... https://developer.mozilla.org/en-US/docs/Web/CSS/calc()
- (template [<name> <parameter>]
+ (with_template [<name> <parameter>]
[(def: .public (<name> parameter subject)
(.All (_ kind)
(-> (Value <parameter>) (Value (Numeric kind))
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 8a3a964c1..9d7821328 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -82,7 +82,7 @@
(primitive: .public (HTML brand)
Text
- (.template [<name> <brand>]
+ (.with_template [<name> <brand>]
[(primitive: <brand> Any)
(type: .public <name> (HTML <brand>))]
@@ -100,11 +100,11 @@
[Document Document']
)
- (.template [<super> <super_raw> <sub>+]
+ (.with_template [<super> <super_raw> <sub>+]
[(primitive: (<super_raw> brand) Any)
(type: .public <super> (HTML (<super_raw> Any)))
- (`` (.template [<sub> <sub_raw>]
+ (`` (.with_template [<sub> <sub_raw>]
[(primitive: <sub_raw> Any)
(type: .public <sub> (HTML (<super_raw> <sub_raw>)))]
@@ -159,7 +159,7 @@
content
(..close tag))))
- (.template [<name> <tag> <brand>]
+ (.with_template [<name> <tag> <brand>]
[(def: .public <name>
(-> Attributes <brand>)
(..simple <tag>))]
@@ -199,7 +199,7 @@
(|>> ..safe
abstraction))
- (.template [<tag> <alias> <name>]
+ (.with_template [<tag> <alias> <name>]
[(def: .public <name>
Element
(..simple <tag> (list)))
@@ -271,7 +271,7 @@
{#Circle Circle}
{#Polygon Polygon}))
- (.template [<name> <shape> <type> <format>]
+ (.with_template [<name> <shape> <type> <format>]
[(def: (<name> attributes shape)
(-> Attributes <type> (HTML Any))
(..simple "area" (partial_list ["shape" <shape>]
@@ -307,7 +307,7 @@
(..tag "map" attributes
(list#mix (function.flipped ..and) head tail)))))
- (.template [<name> <tag> <type>]
+ (.with_template [<name> <tag> <type>]
[(def: .public <name>
(-> Attributes <type>)
(..empty <tag>))]
@@ -319,7 +319,7 @@
[track "track" Track]
)
- (.template [<name> <tag>]
+ (.with_template [<name> <tag>]
[(def: .public (<name> attributes media on_unsupported)
(-> Attributes Media (Maybe Content) Element)
(..tag <tag> attributes
@@ -343,7 +343,7 @@
(-> ID Input)
(|>> ["for"] list (..empty "label")))
- (.template [<name> <container_tag> <description_tag> <type>]
+ (.with_template [<name> <container_tag> <description_tag> <type>]
[(def: .public (<name> description attributes content)
(-> (Maybe Content) Attributes <type> <type>)
(..tag <container_tag> attributes
@@ -361,7 +361,7 @@
[figure "figure" "figcaption" Element]
)
- (.template [<name> <tag> <type>]
+ (.with_template [<name> <tag> <type>]
[(def: .public (<name> attributes content)
(-> Attributes (Maybe Content) <type>)
(|> content
@@ -375,7 +375,7 @@
(type: .public Phrase
(-> Attributes Content Element))
- (.template [<name> <tag>]
+ (.with_template [<name> <tag>]
[(def: .public <name>
Phrase
(..tag <tag>))]
@@ -432,7 +432,7 @@
(type: .public Composite
(-> Attributes Element Element))
- (.template [<name> <tag>]
+ (.with_template [<name> <tag>]
[(def: .public <name>
Composite
(..tag <tag>))]
@@ -450,7 +450,7 @@
[span "span"]
)
- (.template [<tag> <name> <input>]
+ (.with_template [<tag> <name> <input>]
[(def: <name>
(-> <input> (HTML Any))
(..tag <tag> (list)))]
@@ -475,7 +475,7 @@
(def: .public p ..paragraph)
- (.template [<name> <tag> <input> <output>]
+ (.with_template [<name> <tag> <input> <output>]
[(def: .public <name>
(-> Attributes <input> <output>)
(..tag <tag>))]
@@ -494,7 +494,7 @@
[object "object" Parameter Element]
)
- (.template [<name> <tag> <input> <output>]
+ (.with_template [<name> <tag> <input> <output>]
[(def: .public <name>
(-> <input> <output>)
(..tag <tag> (list)))]
@@ -508,7 +508,7 @@
[body "body" Element Body]
)
- (.template [<name> <tag> <input> <output>]
+ (.with_template [<name> <tag> <input> <output>]
[(def: <name>
(-> <input> <output>)
(..tag <tag> (list)))]
@@ -555,7 +555,7 @@
(..tag "table" attributes
content)))
- (.template [<name> <doc_type>]
+ (.with_template [<name> <doc_type>]
[(def: .public <name>
(-> Head Body Document)
(let [doc_type <doc_type>]
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index 6e358ec80..4f95615ed 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -31,7 +31,7 @@
["n" nat]
["f" frac (.open: "[1]#[0]" decimal)]]]]])
-(template [<name> <type>]
+(with_template [<name> <type>]
[(type: .public <name>
<type>)]
@@ -51,7 +51,7 @@
{#Array (Sequence JSON)}
{#Object (Dictionary String JSON)})))
-(template [<name> <type>]
+(with_template [<name> <type>]
[(type: .public <name>
<type>)]
@@ -101,7 +101,7 @@
{#Null' _}
(` {..#Null})
- (^.template [<ctor> <input_tag> <output_tag>]
+ (^.with_template [<ctor> <input_tag> <output_tag>]
[{<input_tag> value}
(` {<output_tag> (~ (<ctor> value))})])
([code.bit ..#Boolean' ..#Boolean]
@@ -158,7 +158,7 @@
_
{try.#Failure (all text#composite "Cannot set field '" key "' on a non-object.")}))
-(template [<name> <tag> <type>]
+(with_template [<name> <tag> <type>]
[(def: .public (<name> key json)
(-> Text JSON (Try <type>))
(case (field key json)
@@ -186,7 +186,7 @@
[{#Null} {#Null}]
#1
- (^.template [<tag> <struct>]
+ (^.with_template [<tag> <struct>]
[[{<tag> x'} {<tag> y'}]
(at <struct> = x' y')])
([#Boolean bit.equivalence]
@@ -252,7 +252,7 @@
(|>> (text.replaced text.double_quote ..escaped_dq)
(text.enclosed [text.double_quote text.double_quote])))
-(template [<token> <name>]
+(with_template [<token> <name>]
[(def: <name>
Text
<token>)]
@@ -292,7 +292,7 @@
(def: .public (format json)
(-> JSON Text)
(case json
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> value}
(<format> value)])
([#Null ..null_format]
@@ -324,7 +324,7 @@
[_ (<text>.this "null")]
(in [])))
-(template [<name> <token> <value>]
+(with_template [<name> <token> <value>]
[(def: <name>
(Parser Boolean)
(do <>.monad
@@ -405,7 +405,7 @@
value json_parser]
(in [key value])))
-(template [<name> <type> <open> <close> <elem_parser> <prep>]
+(with_template [<name> <type> <open> <close> <elem_parser> <prep>]
[(def: (<name> json_parser)
(-> (Parser JSON) (Parser <type>))
(do <>.monad
diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux
index 4982a2b63..1ebea0782 100644
--- a/stdlib/source/library/lux/data/format/markdown.lux
+++ b/stdlib/source/library/lux/data/format/markdown.lux
@@ -48,7 +48,7 @@
(def: blank_line
(format text.new_line text.new_line))
- (template [<name> <prefix>]
+ (with_template [<name> <prefix>]
[(def: .public (<name> content)
(-> Text (Markdown Block))
(abstraction (format <prefix> " " (..safe content) ..blank_line)))]
@@ -73,7 +73,7 @@
(Markdown Span)
(abstraction (format " " text.new_line)))
- (template [<name> <wrapper>]
+ (with_template [<name> <wrapper>]
[(def: .public <name>
(-> (Markdown Span) (Markdown Span))
(|>> representation
@@ -176,7 +176,7 @@
(type: .public Email
Text)
- (template [<name> <type>]
+ (with_template [<name> <type>]
[(def: .public <name>
(-> <type> (Markdown Span))
(|>> (text.enclosed ["<" ">"]) abstraction))]
@@ -185,7 +185,7 @@
[email Email]
)
- (template [<name> <brand> <infix>]
+ (with_template [<name> <brand> <infix>]
[(def: .public (<name> pre post)
(-> (Markdown <brand>) (Markdown <brand>) (Markdown <brand>))
(abstraction (format (representation pre) <infix> (representation post))))]
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux
index 42088c430..c3644dcee 100644
--- a/stdlib/source/library/lux/data/format/tar.lux
+++ b/stdlib/source/library/lux/data/format/tar.lux
@@ -61,7 +61,7 @@
(def: small_size Size 6)
(def: big_size Size 11)
-(template [<exception> <limit> <size>
+(with_template [<exception> <limit> <size>
<type> <in> <out> <writer> <suffix>
<coercion>]
[(def: .public <limit>
@@ -249,7 +249,7 @@
_
(binary!.slice 0 (++ end) string))))))))
-(template [<type> <representation> <size> <exception> <in> <out> <writer> <parser> <none>]
+(with_template [<type> <representation> <size> <exception> <in> <out> <writer> <parser> <none>]
[(primitive: .public <type>
<representation>
@@ -415,7 +415,7 @@
[(char "5") directory]
[(char "6") fifo]
[(char "7") contiguous])]
- (template [<flag> <name>]
+ (with_template [<flag> <name>]
[(def: <name>
Link_Flag
(abstraction <flag>))]
@@ -432,7 +432,7 @@
(do <>.monad
[it <binary>.bits_8]
(case (.nat it)
- (^.template [<value> <link_flag>]
+ (^.with_template [<value> <link_flag>]
[(pattern <value>)
(in <link_flag>)])
(<options>)
@@ -483,7 +483,7 @@
["1000" save_text]
["2000" set_group_id_on_execution]
["4000" set_user_id_on_execution])]
- (template [<code> <name>]
+ (with_template [<code> <name>]
[(def: .public <name>
Mode
(abstraction (number.oct <code>)))]
diff --git a/stdlib/source/library/lux/data/product.lux b/stdlib/source/library/lux/data/product.lux
index 669f58e4f..c57ec6cfc 100644
--- a/stdlib/source/library/lux/data/product.lux
+++ b/stdlib/source/library/lux/data/product.lux
@@ -5,7 +5,7 @@
[equivalence (.only Equivalence)]
[hash (.only Hash)]]]])
-(template [<name>]
+(with_template [<name>]
[(def: .public (<name> [left right])
(All (_ left right)
(-> [left right] <name>))
diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux
index a021449c0..00dddc0e6 100644
--- a/stdlib/source/library/lux/data/sum.lux
+++ b/stdlib/source/library/lux/data/sum.lux
@@ -5,7 +5,7 @@
[equivalence (.only Equivalence)]
[hash (.only Hash)]]]])
-(template [<right?> <name>]
+(with_template [<right?> <name>]
[(def: .public (<name> value)
(All (_ left right)
(-> <name> (Or left right)))
@@ -32,7 +32,7 @@
{0 #0 l} {0 #0 (on_left l)}
{0 #1 r} {0 #1 (on_right r)})))
-(template [<name> <side> <right?>]
+(with_template [<name> <side> <right?>]
[(def: .public (<name> items)
(All (_ a b) (-> (List (Or a b)) (List <side>)))
(case items
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index 8e9eccac7..91c9cedf6 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -30,7 +30,7 @@
(-> Char Text)
(|>> .int "lux i64 char"))
-(template [<code> <short> <long>]
+(with_template [<code> <short> <long>]
[(def: .public <long> (..of_char <code>))
(def: .public <short> <long>)]
@@ -337,7 +337,7 @@
(def: .public (space? char)
(-> Char Bit)
- (with_expansions [<options> (template [<char>]
+ (with_expansions [<options> (with_template [<char>]
[(pattern (.char (~~ (static <char>))))]
[..tab]
diff --git a/stdlib/source/library/lux/data/text/encoding.lux b/stdlib/source/library/lux/data/text/encoding.lux
index 6eaf948d0..da140a7e1 100644
--- a/stdlib/source/library/lux/data/text/encoding.lux
+++ b/stdlib/source/library/lux/data/text/encoding.lux
@@ -10,7 +10,7 @@
(primitive: .public Encoding
Text
- (template [<name> <encoding>]
+ (with_template [<name> <encoding>]
[(`` (def: .public <name>
Encoding
(abstraction <encoding>)))]
diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux
index 7b9caa349..608737079 100644
--- a/stdlib/source/library/lux/data/text/escape.lux
+++ b/stdlib/source/library/lux/data/text/escape.lux
@@ -22,7 +22,7 @@
(def: sigil "\")
-(template [<char> <sigil>]
+(with_template [<char> <sigil>]
[(def: <char>
(|> <sigil> (//.char 0) maybe.trusted))]
@@ -30,7 +30,7 @@
[\u_sigil "u"]
)
-(template [<literal> <sigil> <escaped>]
+(with_template [<literal> <sigil> <escaped>]
[(def: <sigil>
(|> <literal> (//.char 0) maybe.trusted))
@@ -49,7 +49,7 @@
[..sigil \\_sigil escaped_\\]
)
-(template [<char> <text>]
+(with_template [<char> <text>]
[(def: <char>
(|> <text> (//.char 0) maybe.trusted))]
@@ -73,7 +73,7 @@
(or (n.< ..ascii_bottom char)
(n.> ..ascii_top char)
(case char
- (^.template [<char>]
+ (^.with_template [<char>]
[(pattern (static <char>))
true])
([..\0] [..\a] [..\b] [..\t]
@@ -118,7 +118,7 @@
limit ("lux text size" text)])
(if (n.< limit offset)
(case ("lux text char" offset current)
- (^.template [<char> <replacement>]
+ (^.with_template [<char> <replacement>]
[(pattern (static <char>))
(let [[previous' current' limit'] (ascii_escaped <replacement> offset limit previous current)]
(again 0 previous' current' limit'))])
@@ -206,7 +206,7 @@
(let [@sigil (++ offset)]
(if (n.< limit @sigil)
(case ("lux text char" @sigil current)
- (^.template [<sigil> <un_escaped>]
+ (^.with_template [<sigil> <un_escaped>]
[(pattern (static <sigil>))
(let [[previous' current' limit'] (..ascii_un_escaped <un_escaped> offset previous current limit)]
(again 0 previous' current' limit'))])
diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux
index 7c5483112..ce3642c9e 100644
--- a/stdlib/source/library/lux/data/text/format.lux
+++ b/stdlib/source/library/lux/data/text/format.lux
@@ -52,7 +52,7 @@
(syntax (_ [fragments (<>.many <code>.any)])
(in (.list (` (all "lux text concat" (~+ fragments)))))))
-(template [<name> <type> <formatter>]
+(with_template [<name> <type> <formatter>]
[(def: .public <name>
(Format <type>)
<formatter>)]
@@ -81,8 +81,8 @@
[json json.JSON (at json.codec encoded)]
)
-(template [<type> <format>,<codec>]
- [(`` (template [<format> <codec>]
+(with_template [<type> <format>,<codec>]
+ [(`` (with_template [<format> <codec>]
[(def: .public <format>
(Format <type>)
(at <codec> encoded))]
diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux
index e016e68bb..92398a955 100644
--- a/stdlib/source/library/lux/data/text/unicode/block.lux
+++ b/stdlib/source/library/lux/data/text/unicode/block.lux
@@ -38,7 +38,7 @@
(-> Char Nat Block)
(abstraction (interval.between n.enum start (n.+ additional start))))
- (template [<name> <slot>]
+ (with_template [<name> <slot>]
[(def: .public <name>
(-> Block Char)
(|>> representation (the <slot>)))]
@@ -73,7 +73,7 @@
(i64.or (i64.left_shifted 32 (..start value))
(..end value))))
-(template [<start> <end> <name>]
+(with_template [<start> <end> <name>]
[(def: .public <name>
Block
(let [start (hex <start>)
diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux
index 92f5d26c6..f7211bc8a 100644
--- a/stdlib/source/library/lux/data/text/unicode/set.lux
+++ b/stdlib/source/library/lux/data/text/unicode/set.lux
@@ -233,7 +233,7 @@
(set.of_list //block.hash (tree.tags (representation subject))))))
)
-(template [<name> <blocks>]
+(with_template [<name> <blocks>]
[(def: .public <name>
Set
(..set <blocks>))]
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux
index 64f1cb80f..942db335e 100644
--- a/stdlib/source/library/lux/debug.lux
+++ b/stdlib/source/library/lux/debug.lux
@@ -146,7 +146,7 @@
(def: .public (inspection value)
Inspector
(with_expansions [<jvm> (let [object (as java/lang/Object value)]
- (`` (<| (~~ (template [<class> <processing>]
+ (`` (<| (~~ (with_template [<class> <processing>]
[(case (ffi.as <class> object)
{.#Some value}
(`` (|> value (~~ (template.spliced <processing>))))
@@ -184,7 +184,7 @@
@.js
(case (ffi.type_of value)
- (^.template [<type_of> <then>]
+ (^.with_template [<type_of> <then>]
[<type_of>
(`` (|> value (~~ (template.spliced <then>))))])
(["boolean" [(as .Bit) %.bit]]
@@ -219,7 +219,7 @@
@.python
(case (..str (..type value))
- (^.template [<type_of> <class_of> <then>]
+ (^.with_template [<type_of> <class_of> <then>]
[(^.or <type_of> <class_of>)
(`` (|> value (~~ (template.spliced <then>))))])
(["<type 'bool'>" "<class 'bool'>" [(as .Bit) %.bit]]
@@ -251,7 +251,7 @@
@.lua
(case (..type value)
- (^.template [<type_of> <then>]
+ (^.with_template [<type_of> <then>]
[<type_of>
(`` (|> value (~~ (template.spliced <then>))))])
(["boolean" [(as .Bit) %.bit]]
@@ -292,7 +292,7 @@
(as ..Object)
Object::to_s)]]
(let [value_class (class_of value)]
- (`` (cond (~~ (template [<literal> <type> <format>]
+ (`` (cond (~~ (with_template [<literal> <type> <format>]
[(same? (class_of <literal>) value_class)
(|> value (as <type>) <format>)]
@@ -324,7 +324,7 @@
@.php
(case (..gettype value)
- (^.template [<type_of> <then>]
+ (^.with_template [<type_of> <then>]
[<type_of>
(`` (|> value (~~ (template.spliced <then>))))])
(["boolean" [(as .Bit) %.bit]]
@@ -350,7 +350,7 @@
(..strval value))
@.scheme
- (`` (cond (~~ (template [<when> <then>]
+ (`` (cond (~~ (with_template [<when> <then>]
[(<when> value)
(`` (|> value (~~ (template.spliced <then>))))]
@@ -394,7 +394,7 @@
[_ (<type>.exactly Any)]
(in (function.constant "[]")))
- (~~ (template [<type> <formatter>]
+ (~~ (with_template [<type> <formatter>]
[(do <>.monad
[_ (<type>.sub <type>)]
(in (|>> (as <type>) <formatter>)))]
@@ -410,7 +410,7 @@
(def: (special_representation representation)
(-> (Parser Representation) (Parser Representation))
(`` (all <>.either
- (~~ (template [<type> <formatter>]
+ (~~ (with_template [<type> <formatter>]
[(do <>.monad
[_ (<type>.sub <type>)]
(in (|>> (as <type>) <formatter>)))]
diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux
index 8a67b4805..7460eb2fd 100644
--- a/stdlib/source/library/lux/documentation.lux
+++ b/stdlib/source/library/lux/documentation.lux
@@ -35,8 +35,9 @@
[lux
["[0]" syntax]]]]]]])
-(template: (|recursion_dummy|)
- [{.#Primitive "" {.#End}}])
+(def: |recursion_dummy|
+ (template (_)
+ [{.#Primitive "" {.#End}}]))
(type: Fragment
(Variant
@@ -51,7 +52,7 @@
(def: (reference_column code)
(-> Code Nat)
(case code
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[[_ _ column] {<tag> _}]
column])
([.#Bit]
@@ -62,7 +63,7 @@
[.#Text]
[.#Symbol])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[[_ _ column] {<tag> members}]
(|> members
(list#each reference_column)
@@ -101,7 +102,7 @@
(format (padding reference_column old_location new_location)
documentation)])
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[[new_location {<tag> value}]
(let [documentation (`` (|> value (~~ (template.spliced <format>))))]
[(revised .#column (n.+ (text.size documentation)) new_location)
@@ -114,7 +115,7 @@
[.#Frac [%.frac]]
[.#Text [%.text]])
- (^.template [|<| |>| <tag>]
+ (^.with_template [|<| |>| <tag>]
[[group_location {<tag> members}]
(let [[group_location' members_documentation] (list#mix (function (_ part [last_location text_accum])
(let [[member_location member_documentation] (code_documentation expected_module last_location reference_column part)]
@@ -170,7 +171,7 @@
(stream.iterations (product.forked ++ parameter_type_name)
0))
-(template [<name> <partition>]
+(with_template [<name> <partition>]
[(def: (<name> id)
(-> Nat Bit)
(<partition> id))]
@@ -251,13 +252,13 @@
{.#Parameter idx}
(parameter_name [type_function_name (list)] level idx)
- (^.template [<tag> <pre> <post>]
+ (^.with_template [<tag> <pre> <post>]
[{<tag> id}
(format <pre> (%.nat id) <post>)])
([.#Var "⌈" "⌋"]
[.#Ex "⟨" "⟩"])
- (^.template [<tag> <name> <flat>]
+ (^.with_template [<tag> <name> <flat>]
[{<tag> _}
(let [[level' body] (<flat> type)
args (level_parameters level level')
@@ -382,13 +383,13 @@
{.#Parameter idx}
(parameter_name type_function_info level idx)
- (^.template [<tag> <pre>]
+ (^.with_template [<tag> <pre>]
[{<tag> id}
(format <pre> (%.nat id))])
([.#Var "-"]
[.#Ex "+"])
- (^.template [<tag> <name> <flat>]
+ (^.with_template [<tag> <name> <flat>]
[{<tag> _}
(let [[level' body] (<flat> type)
args (level_parameters (n.- arity level) level')
diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux
index fd4781f84..ffe7a4a78 100644
--- a/stdlib/source/library/lux/extension.lux
+++ b/stdlib/source/library/lux/extension.lux
@@ -36,7 +36,7 @@
<c>.local
(<c>.tuple (<>.some <c>.any)))))
-(template [<any> <end> <and> <result> <extension> <name>]
+(with_template [<any> <end> <and> <result> <extension> <name>]
[(def: .public <name>
(syntax (_ [[name extension phase archive inputs] (..declaration (` <any>))
body <c>.any])
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index ebf0a980e..dfc01098b 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -53,7 +53,7 @@
(-> (Type (<| Return' Value' category)) Text))
(|>> jvm.reflection reflection.reflection))
-(template [<name> <class>]
+(with_template [<name> <class>]
[(`` (def: .public <name>
.Type
{.#Primitive <class> {.#End}}))]
@@ -69,7 +69,7 @@
[String "java.lang.String"]
)
-(template [<name> <class>]
+(with_template [<name> <class>]
[(`` (def: .public <name>
.Type
{.#Primitive (reflection.reflection <class>) {.#End}}))]
@@ -110,7 +110,7 @@
[jvm.char box.char])
(dictionary.of_list jvm.hash)))
-(template [<name> <pre> <post>]
+(with_template [<name> <pre> <post>]
[(def: (<name> unboxed boxed raw)
(-> (Type Value) Text Code Code)
(let [unboxed (..reflection unboxed)]
@@ -123,14 +123,15 @@
[box unboxed boxed]
)
-(template [<name> <op> <from> <to>]
- [(template: .public (<name> value)
- [(|> value
- (.is <from>)
- "jvm object cast"
- <op>
- "jvm object cast"
- (.is <to>))])]
+(with_template [<name> <op> <from> <to>]
+ [(def: .public <name>
+ (template (<name> value)
+ [(|> value
+ (.is <from>)
+ "jvm object cast"
+ <op>
+ "jvm object cast"
+ (.is <to>))]))]
[byte_to_long "jvm conversion byte-to-long" ..Byte ..Long]
@@ -163,9 +164,10 @@
[char_to_long "jvm conversion char-to-long" ..Character ..Long]
)
-(template [<name> <from> <to> <0> <1>]
- [(template: .public (<name> value)
- [(|> value <0> <1>)])]
+(with_template [<name> <from> <to> <0> <1>]
+ [(def: .public <name>
+ (template (<name> value)
+ [(|> value <0> <1>)]))]
[long_to_char ..Long ..Character ..long_to_int ..int_to_char]
[byte_to_int ..Byte ..Integer ..byte_to_long ..long_to_int]
@@ -362,7 +364,7 @@
(def: (parameter_type value_type type)
(-> (-> (Type Value) Code)
(-> (Type Parameter) Code))
- (`` (<| (~~ (template [<when> <binding> <then>]
+ (`` (<| (~~ (with_template [<when> <binding> <then>]
[(case (<when> type)
{.#Some <binding>}
<then>
@@ -389,7 +391,7 @@
(def: (value_type mode type)
(-> Primitive_Mode (Type Value) Code)
- (`` (<| (~~ (template [<when> <binding> <then>]
+ (`` (<| (~~ (with_template [<when> <binding> <then>]
[(case (<when> type)
{.#Some <binding>}
<then>
@@ -434,7 +436,7 @@
(def: (replaced f input)
(-> (-> Code Code) Code Code)
(case (f input)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[meta {<tag> parts}]
[meta {<tag> (list#each (replaced f) parts)}]])
([.#Form]
@@ -491,7 +493,7 @@
(list.zipped_2 (list#each product.right arguments))
(list#each ..decorate_input))))))))
-(template [<name> <jvm_op>]
+(with_template [<name> <jvm_op>]
[(def: (<name> class_vars class_name type_vars method_name arguments self_name)
(-> (List (Type Var)) Text (List (Type Var)) Text (List Argument) Text (Parser Code))
(do <>.monad
@@ -607,7 +609,7 @@
[_ (<code>.this (' ?))]
(in jvm.wildcard)))
-(template [<name> <comparison> <constructor>]
+(with_template [<name> <comparison> <constructor>]
[(def: <name>
(-> (Parser (Type Class)) (Parser (Type Parameter)))
(|>> (<>.after (<code>.this (' <comparison>)))
@@ -1022,7 +1024,7 @@
(-> Annotation Code)
(` ((~ (code.text name)) (~+ (list#each annotation_parameter$ params)))))
-(template [<name> <category>]
+(with_template [<name> <category>]
[(def: <name>
(-> (Type <category>) Code)
(|>> ..signature code.text))]
@@ -1388,7 +1390,7 @@
_
return_term))
-(template [<name> <tag> <term_trans>]
+(with_template [<name> <tag> <term_trans>]
[(def: (<name> member return_term)
(-> Import_Member_Declaration Code Code)
(case member
@@ -1404,7 +1406,7 @@
[with_return_io #import_member_io? (` ((~! io.io) (~ return_term)))]
)
-(template [<input?> <name> <unbox/box> <special+>]
+(with_template [<input?> <name> <unbox/box> <special+>]
[(def: (<name> mode [unboxed raw])
(-> Primitive_Mode [(Type Value) Code] Code)
(let [[unboxed refined post] (.is [(Type Value) Code (List Code)]
@@ -1414,7 +1416,7 @@
{#AutoPrM}
(with_expansions [<special+>' (template.spliced <special+>)
- <cond_cases> (template [<primitive> <pre> <post>]
+ <cond_cases> (with_template [<primitive> <pre> <post>]
[(at jvm.equivalence = <primitive> unboxed)
(with_expansions [<post>' (template.spliced <post>)]
[<primitive>
@@ -1692,7 +1694,7 @@
(.as (.Primitive (~ (code.text box.long))))
"jvm object cast"
"jvm conversion long-to-int"))]
- (`` (cond (~~ (template [<primitive> <array_op>]
+ (`` (cond (~~ (with_template [<primitive> <array_op>]
[(at jvm.equivalence = <primitive> type)
(in (list (` (<array_op> (~ g!size)))))]
@@ -1720,7 +1722,7 @@
(at meta.monad in $Object)
(case type
{.#Primitive name params}
- (`` (cond (~~ (template [<type>]
+ (`` (cond (~~ (with_template [<type>]
[(text#= (..reflection <type>) name)
(case params
{.#End}
@@ -1738,7 +1740,7 @@
[jvm.double]
[jvm.char]))
- (~~ (template [<type>]
+ (~~ (with_template [<type>]
[(text#= (..reflection (jvm.array <type>)) name)
(case params
{.#End}
@@ -1820,7 +1822,7 @@
[array_type (meta.type array_name)
context meta.type_context
array_jvm_type (lux_type->jvm_type context array_type)
- .let [g!extension (code.text (`` (cond (~~ (template [<primitive> <extension>]
+ .let [g!extension (code.text (`` (cond (~~ (with_template [<primitive> <extension>]
[(at jvm.equivalence =
(jvm.array <primitive>)
array_jvm_type)
@@ -1862,7 +1864,7 @@
(.as (.Primitive (~ (code.text box.long))))
"jvm object cast"
"jvm conversion long-to-int"))]]
- (`` (cond (~~ (template [<primitive> <extension> <box>]
+ (`` (cond (~~ (with_template [<primitive> <extension> <box>]
[(at jvm.equivalence =
(jvm.array <primitive>)
array_jvm_type)
@@ -1902,7 +1904,7 @@
(.as (.Primitive (~ (code.text box.long))))
"jvm object cast"
"jvm conversion long-to-int"))]]
- (`` (cond (~~ (template [<primitive> <extension> <box>]
+ (`` (cond (~~ (with_template [<primitive> <extension> <box>]
[(at jvm.equivalence =
(jvm.array <primitive>)
array_jvm_type)
@@ -1953,12 +1955,14 @@
_
(meta.failure (exception.error ..cannot_cast_to_non_object [type])))))
-(template [<forward> <from> <to> <backward>]
- [(template: .public (<forward> it)
- [(|> it (.is <from>) (.as <to>))])
+(with_template [<forward> <from> <to> <backward>]
+ [(def: .public <forward>
+ (template (<forward> it)
+ [(|> it (.is <from>) (.as <to>))]))
- (template: .public (<backward> it)
- [(|> it (.is <to>) (.as <from>))])]
+ (def: .public <backward>
+ (template (<backward> it)
+ [(|> it (.is <to>) (.as <from>))]))]
[as_boolean .Bit ..Boolean of_boolean]
[as_long .Int ..Long of_long]
@@ -1966,12 +1970,14 @@
[as_string .Text ..String of_string]
)
-(template [<forward> <from> <$> <mid> <$'> <to> <backward>]
- [(template: .public (<forward> it)
- [(|> it (.is <from>) (.as <mid>) <$> (.is <to>))])
+(with_template [<forward> <from> <$> <mid> <$'> <to> <backward>]
+ [(def: .public <forward>
+ (template (<forward> it)
+ [(|> it (.is <from>) (.as <mid>) <$> (.is <to>))]))
- (template: .public (<backward> it)
- [(|> it (.is <to>) <$'> (.is <mid>) (.as <from>))])]
+ (def: .public <backward>
+ (template (<backward> it)
+ [(|> it (.is <to>) <$'> (.is <mid>) (.as <from>))]))]
[as_byte .Int ..long_to_byte ..Long ..byte_to_long ..Byte of_byte]
[as_short .Int ..long_to_short ..Long ..short_to_long ..Short of_short]
diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux
index 25d65c691..e9843701d 100644
--- a/stdlib/source/library/lux/ffi.lux
+++ b/stdlib/source/library/lux/ffi.lux
@@ -64,7 +64,7 @@
[Table])
@.ruby (these [Nil]))
<un_common> <un_common>]
- (template [<name>]
+ (with_template [<name>]
[(with_expansions [<brand> (template.symbol [<name> "'"])]
(primitive: <brand>
Any
@@ -84,7 +84,7 @@
@.ruby (these [Integer Int]
[Float Frac]))
<un_common> <un_common>]
- (template [<name> <type>]
+ (with_template [<name> <type>]
[(type: .public <name>
<type>)]
@@ -118,7 +118,7 @@
#alias Alias
#anonymous a]))
- (template [<case> <name>]
+ (with_template [<case> <name>]
[(def: <case>
(All (_ a) (-> (Parser a) (Parser (Named a))))
(|>> (all <>.and
@@ -262,8 +262,8 @@
(` (.Maybe (~ (the #mandatory it))))
(the #mandatory it)))
- (`` (template [<lux_it> <host_it>
- <lux_?> <host_?>]
+ (`` (with_template [<lux_it> <host_it>
+ <lux_?> <host_?>]
[(def: .public (<lux_it> _)
(-> Any Nothing)
(as_expected (<host_it>)))
@@ -622,8 +622,9 @@
(.function ((~ (code.local self)) [(~+ (list#each product.left inputs))])
(~ term)))))))))
- (for @.js (these (template: .public (type_of object)
- [("js type-of" object)])
+ (for @.js (these (def: .public type_of
+ (template (type_of object)
+ [("js type-of" object)]))
(def: .public global
(syntax (_ [type <code>.any
@@ -651,15 +652,16 @@
(..global (~ type) [(~ (code.local (%.format head "." next)))
(~+ (list#each code.local tail))]))))))))))))
- (template: (!defined? <global>)
- [(.case (..global Any <global>)
- {.#None}
- .false
+ (def: !defined?
+ (template (_ <global>)
+ [(.case (..global Any <global>)
+ {.#None}
+ .false
- {.#Some _}
- .true)])
+ {.#Some _}
+ .true)]))
- (template [<name> <global>]
+ (with_template [<name> <global>]
[(def: .public <name>
Bit
(!defined? <global>))]
@@ -690,36 +692,40 @@
(with_expansions [<undefined> (..extension_name)
<undefined?> (..extension_name)
<object> (..extension_name)]
- (these (template: (extension_analysis <name> <parameter>)
- [{5 #1 [<name> <parameter>]}])
-
- (template: (text_analysis <it>)
- [{0 #0 {5 #1 <it>}}])
-
- (template: (analysis <name> <bindings> <parser> <inputs> <body>)
- [("lux def analysis" <name>
- (.function (_ name phase archive inputs)
- (.function (_ state)
- (let [<bindings> [name phase archive state]]
- (case (<code>.result <parser> inputs)
- {try.#Failure error}
- {try.#Failure (%.format "Invalid inputs for extension: " (%.text name)
- text.\n error)}
-
- {try.#Success <inputs>}
- <body>)))))])
-
- (template: (generation <name> <bindings> <inputs> <body>)
- [("lux def generation" <name>
- (.function (_ name phase archive inputs)
- (.function (_ state)
- (let [<bindings> [name phase archive state]]
- (case inputs
- (pattern <inputs>)
- <body>
-
- _
- {try.#Failure (%.format "Invalid inputs for extension: " (%.text name))})))))])
+ (these (def: extension_analysis
+ (template (_ <name> <parameter>)
+ [{5 #1 [<name> <parameter>]}]))
+
+ (def: text_analysis
+ (template (_ <it>)
+ [{0 #0 {5 #1 <it>}}]))
+
+ (def: analysis
+ (template (_ <name> <bindings> <parser> <inputs> <body>)
+ [("lux def analysis" <name>
+ (.function (_ name phase archive inputs)
+ (.function (_ state)
+ (let [<bindings> [name phase archive state]]
+ (case (<code>.result <parser> inputs)
+ {try.#Failure error}
+ {try.#Failure (%.format "Invalid inputs for extension: " (%.text name)
+ text.\n error)}
+
+ {try.#Success <inputs>}
+ <body>)))))]))
+
+ (def: generation
+ (template (_ <name> <bindings> <inputs> <body>)
+ [("lux def generation" <name>
+ (.function (_ name phase archive inputs)
+ (.function (_ state)
+ (let [<bindings> [name phase archive state]]
+ (case inputs
+ (pattern <inputs>)
+ <body>
+
+ _
+ {try.#Failure (%.format "Invalid inputs for extension: " (%.text name))})))))]))
(analysis <undefined>
[name phase archive state]
@@ -732,8 +738,9 @@
(list)
{try.#Success [state js.undefined]})
- (template: .public (undefined)
- [(.is ..Undefined (<undefined>))])
+ (def: .public undefined
+ (template (undefined)
+ [(.is ..Undefined (<undefined>))]))
(analysis <undefined?>
[name phase archive state]
@@ -750,8 +757,9 @@
[[state it] (phase archive it state)]
(in [state (js.= js.undefined it)])))
- (template: .public (undefined? <it>)
- [(.as .Bit (.is .Any (<undefined?> <it>)))])
+ (def: .public undefined?
+ (template (undefined? <it>)
+ [(.as .Bit (.is .Any (<undefined?> <it>)))]))
(analysis <object>
[name phase archive state]
@@ -766,8 +774,9 @@
it)]
(in [state (extension_analysis name (list.reversed output))])))
- (template: (text_synthesis <it>)
- [{0 #0 {2 #1 <it>}}])
+ (def: text_synthesis
+ (template (_ <it>)
+ [{0 #0 {2 #1 <it>}}]))
(def: (pairs it)
(All (_ a) (-> (List a) (List [a a])))
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 8aa106b28..1e6d515dc 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -27,7 +27,7 @@
["[0]" template]]
["[0]" meta]]])
-(template [<name> <op> <from> <to>]
+(with_template [<name> <op> <from> <to>]
[(def: .public (<name> value)
(-> (Primitive <from>) (Primitive <to>))
(<op> value))]
@@ -63,12 +63,14 @@
[char_to_long "jvm convert char-to-long" "java.lang.Character" "java.lang.Long"]
)
-(template [<forward> <from> <to> <backward>]
- [(template: .public (<forward> it)
- [(|> it (.is <from>) (.as (Primitive <to>)))])
+(with_template [<forward> <from> <to> <backward>]
+ [(def: .public <forward>
+ (template (<forward> it)
+ [(|> it (.is <from>) (.as (Primitive <to>)))]))
- (template: .public (<backward> it)
- [(|> it (.is (Primitive <to>)) (.as <from>))])]
+ (def: .public <backward>
+ (template (<backward> it)
+ [(|> it (.is (Primitive <to>)) (.as <from>))]))]
[as_boolean .Bit "java.lang.Boolean" of_boolean]
[as_long .Int "java.lang.Long" of_long]
@@ -76,12 +78,14 @@
[as_string .Text "java.lang.String" of_string]
)
-(template [<forward> <from> <$> <mid> <$'> <to> <backward>]
- [(template: .public (<forward> it)
- [(|> it (.is <from>) (.as (Primitive <mid>)) <$> (.is (Primitive <to>)))])
+(with_template [<forward> <from> <$> <mid> <$'> <to> <backward>]
+ [(def: .public <forward>
+ (template (<forward> it)
+ [(|> it (.is <from>) (.as (Primitive <mid>)) <$> (.is (Primitive <to>)))]))
- (template: .public (<backward> it)
- [(|> it (.is (Primitive <to>)) <$'> (.is (Primitive <mid>)) (.as <from>))])]
+ (def: .public <backward>
+ (template (<backward> it)
+ [(|> it (.is (Primitive <to>)) <$'> (.is (Primitive <mid>)) (.as <from>))]))]
[as_byte .Int ..long_to_byte "java.lang.Long" ..byte_to_long "java.lang.Byte" of_byte]
[as_short .Int ..long_to_short "java.lang.Long" ..short_to_long "java.lang.Short" of_short]
@@ -281,7 +285,7 @@
(def: (manual_primitive_type class)
(-> Text (Maybe Code))
(case class
- (^.template [<prim> <type>]
+ (^.with_template [<prim> <type>]
[<prim>
{.#Some (' <type>)}])
(["boolean" (Primitive "java.lang.Boolean")]
@@ -300,7 +304,7 @@
(def: (auto_primitive_type class)
(-> Text (Maybe Code))
(case class
- (^.template [<prim> <type>]
+ (^.with_template [<prim> <type>]
[<prim>
{.#Some (' <type>)}])
(["boolean" .Bit]
@@ -423,7 +427,7 @@
{#GenericArray param}
(format "[" (simple_class$ env param))
- (^.template [<prim> <class>]
+ (^.with_template [<prim> <class>]
[{#GenericClass <prim> {.#End}}
<class>])
(["boolean" "[Z"]
@@ -464,7 +468,7 @@
(def: (pre_walk_replace f input)
(-> (-> Code Code) Code Code)
(case (f input)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[meta {<tag> parts}]
[meta {<tag> (list#each (pre_walk_replace f) parts)}]])
([.#Form]
@@ -515,7 +519,7 @@
(in (`' ((~ (code.text (format "jvm invokestatic" ":" class_name ":" method_name ":" (text.interposed "," arg_decls'))))
(~+ args))))))
-(template [<name> <jvm_op>]
+(with_template [<name> <jvm_op>]
[(def: (<name> params class_name method_name arg_decls)
(-> (List Type_Parameter) Text Text (List ArgDecl) (Parser Code))
(do <>.monad
@@ -600,7 +604,7 @@
(<code>.tuple (do <>.monad
[component again^]
(case component
- (^.template [<class> <name>]
+ (^.with_template [<class> <name>]
[{#GenericClass <name> {.#End}}
(in {#GenericClass <class> (list)})])
(["[Z" "boolean"]
@@ -1391,7 +1395,7 @@
_
return_term))
-(template [<name> <tag> <term_trans>]
+(with_template [<name> <tag> <term_trans>]
[(def: (<name> member return_term)
(-> Import_Member_Declaration Code Code)
(case member
@@ -1417,7 +1421,7 @@
(-> Type_Parameter Code)
(code.symbol ["" name]))
-(template [<name> <byte> <short> <int> <float>]
+(with_template [<name> <byte> <short> <int> <float>]
[(def: (<name> mode [class expression])
(-> Primitive_Mode [Text Code] Code)
(case mode
@@ -1639,7 +1643,7 @@
(syntax (_ [type (..generic_type^ (list))
size <code>.any])
(case type
- (^.template [<type> <array_op>]
+ (^.with_template [<type> <array_op>]
[(pattern {#GenericClass <type> (list)})
(in (list (` (<array_op> (~ size)))))])
(["boolean" "jvm znewarray"]
@@ -1689,7 +1693,7 @@
[array_type (meta.type array_name)
array_jvm_type (type_class_name array_type)]
(case array_jvm_type
- (^.template [<type> <array_op>]
+ (^.with_template [<type> <array_op>]
[<type>
(in (list (` (<array_op> (~ array) (~ idx)))))])
(["[Z" "jvm zaload"]
@@ -1719,7 +1723,7 @@
[array_type (meta.type array_name)
array_jvm_type (type_class_name array_type)]
(case array_jvm_type
- (^.template [<type> <array_op>]
+ (^.with_template [<type> <array_op>]
[<type>
(in (list (` (<array_op> (~ array) (~ idx) (~ value)))))])
(["[Z" "jvm zastore"]
@@ -1747,5 +1751,6 @@
(syntax (_ [type (..generic_type^ (list))])
(in (list (..class_type {#ManualPrM} (list) type)))))
-(template: .public (is type term)
- [(.as type term)])
+(def: .public is
+ (template (is type term)
+ [(.as type term)]))
diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux
index a387237db..037f713c4 100644
--- a/stdlib/source/library/lux/ffi.php.lux
+++ b/stdlib/source/library/lux/ffi.php.lux
@@ -25,7 +25,7 @@
(abstract: .public (Object brand) Any)
-(template [<name>]
+(with_template [<name>]
[(with_expansions [<brand> (template.symbol [<name> "'"])]
(abstract: .public <brand> Any)
(type: .public <name>
@@ -35,7 +35,7 @@
[Function]
)
-(template [<name> <type>]
+(with_template [<name> <type>]
[(type: .public <name>
<type>)]
diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux
index 8822efd3d..34a35a3c8 100644
--- a/stdlib/source/library/lux/ffi.scm.lux
+++ b/stdlib/source/library/lux/ffi.scm.lux
@@ -25,7 +25,7 @@
(abstract: .public (Object brand) Any)
-(template [<name>]
+(with_template [<name>]
[(with_expansions [<brand> (template.symbol [<name> "'"])]
(abstract: .public <brand> Any)
(type: .public <name>
@@ -35,7 +35,7 @@
[Function]
)
-(template [<name> <type>]
+(with_template [<name> <type>]
[(type: .public <name>
<type>)]
diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux
index e8cbc6f8b..46c259fbe 100644
--- a/stdlib/source/library/lux/ffi/export.rb.lux
+++ b/stdlib/source/library/lux/ffi/export.rb.lux
@@ -51,7 +51,7 @@
..sigil!
))
-(template [<name> <head>]
+(with_template [<name> <head>]
[(def: <name>
(Parser Text)
(<| <text>.slice
diff --git a/stdlib/source/library/lux/ffi/node_js.js.lux b/stdlib/source/library/lux/ffi/node_js.js.lux
index a31054f74..27d69787d 100644
--- a/stdlib/source/library/lux/ffi/node_js.js.lux
+++ b/stdlib/source/library/lux/ffi/node_js.js.lux
@@ -6,7 +6,7 @@
["[0]" function]
["[0]" maybe (.open: "[1]#[0]" monoid functor)]]]])
-(template [<name> <path>]
+(with_template [<name> <path>]
[(def: <name>
(Maybe (-> Text Any))
(ffi.global (-> Text Any) <path>))]
diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux
index cfc25fe7d..82b4ca4c2 100644
--- a/stdlib/source/library/lux/locale/language.lux
+++ b/stdlib/source/library/lux/locale/language.lux
@@ -17,7 +17,7 @@
[#name Text
#code Text])
- (template [<name> <tag>]
+ (with_template [<name> <tag>]
[(def: .public <name>
(-> Language Text)
(|>> representation (the <tag>)))]
@@ -26,14 +26,14 @@
[code #code]
)
- (template [<bundle>]
+ (with_template [<bundle>]
[(with_expansions [<bundle>' (template.spliced <bundle>)]
- (template [<code> <name> <definition> <alias>+]
+ (with_template [<code> <name> <definition> <alias>+]
[(def: .public <definition>
Language
(abstraction [#name <name>
#code <code>]))
- (`` (template [<alias>]
+ (`` (with_template [<alias>]
[(def: .public <alias>
Language
<definition>)]
diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux
index 06e1d3b4a..0d0bca38b 100644
--- a/stdlib/source/library/lux/locale/territory.lux
+++ b/stdlib/source/library/lux/locale/territory.lux
@@ -19,7 +19,7 @@
#long Text
#code Nat])
- (template [<name> <field> <type>]
+ (with_template [<name> <field> <type>]
[(def: .public <name>
(-> Territory <type>)
(|>> representation
@@ -31,7 +31,7 @@
[numeric_code #code Nat]
)
- (template [<short> <long> <number> <name> <main> <neighbor>+]
+ (with_template [<short> <long> <number> <name> <main> <neighbor>+]
[(def: .public <main>
Territory
(abstraction [#name <name>
@@ -39,7 +39,7 @@
#long <long>
#code <number>]))
- (`` (template [<neighbor>]
+ (`` (with_template [<neighbor>]
[(def: .public <neighbor> Territory <main>)]
(~~ (template.spliced <neighbor>+))))]
diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux
index a96545566..1aeadcd0c 100644
--- a/stdlib/source/library/lux/macro.lux
+++ b/stdlib/source/library/lux/macro.lux
@@ -142,7 +142,7 @@
_
(//.failure "Macro expanded to more than 1 element."))))
-(template [<macro> <func>]
+(with_template [<macro> <func>]
[(def: .public <macro>
(.macro (_ tokens)
(let [[module _] (.symbol .._)
diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux
index 6dc56c320..0131567c7 100644
--- a/stdlib/source/library/lux/macro/code.lux
+++ b/stdlib/source/library/lux/macro/code.lux
@@ -36,7 +36,7 @@
... (type: Code
... (Ann Location (Code' (Ann Location))))
-(template [<name> <type> <tag>]
+(with_template [<name> <type> <tag>]
[(def: .public (<name> x)
(-> <type> Code)
[location.dummy {<tag> x}])]
@@ -53,7 +53,7 @@
[tuple (List Code) .#Tuple]
)
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public (<name> name)
(-> Text Code)
[location.dummy {<tag> ["" name]}])]
@@ -65,7 +65,7 @@
(def: (= x y)
(case [x y]
- (^.template [<tag> <eq>]
+ (^.with_template [<tag> <eq>]
[[[_ {<tag> x'}] [_ {<tag> y'}]]
(at <eq> = x' y')])
([.#Bit bit.equivalence]
@@ -76,7 +76,7 @@
[.#Text text.equivalence]
[.#Symbol symbol.equivalence])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[[_ {<tag> xs'}] [_ {<tag> ys'}]]
(at (list.equivalence =) = xs' ys')])
([.#Form]
@@ -89,7 +89,7 @@
(def: .public (format ast)
(-> Code Text)
(case ast
- (^.template [<tag> <struct>]
+ (^.with_template [<tag> <struct>]
[[_ {<tag> value}]
(at <struct> encoded value)])
([.#Bit bit.codec]
@@ -102,7 +102,7 @@
[_ {.#Text value}]
(text.format value)
- (^.template [<tag> <open> <close>]
+ (^.with_template [<tag> <open> <close>]
[[_ {<tag> members}]
(all text#composite
<open>
@@ -124,7 +124,7 @@
(if (at ..equivalence = original ast)
substitute
(case ast
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[location {<tag> parts}]
[location {<tag> (list#each (replaced original substitute) parts)}]])
([.#Form]
diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux
index b564df336..a921afee1 100644
--- a/stdlib/source/library/lux/macro/local.lux
+++ b/stdlib/source/library/lux/macro/local.lux
@@ -21,7 +21,7 @@
(exception.report
"Module" (text.format module)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [module Text
definition Text])
(exception.report
diff --git a/stdlib/source/library/lux/macro/pattern.lux b/stdlib/source/library/lux/macro/pattern.lux
index 4e6811c93..ecad74d18 100644
--- a/stdlib/source/library/lux/macro/pattern.lux
+++ b/stdlib/source/library/lux/macro/pattern.lux
@@ -1,6 +1,6 @@
(.using
[library
- [lux (.except or template let |> `)]])
+ [lux (.except or let with_template |> `)]])
(def: locally
(macro (_ tokens lux)
@@ -13,7 +13,7 @@
_
{.#Left ""}))))
-(.template [<name>]
+(.with_template [<name>]
[(def: <name> (..locally <name>))]
[list#size]
@@ -85,7 +85,7 @@
_
(failure (..wrong_syntax_error (symbol ..or))))))
-(def: .public template
+(def: .public with_template
(macro (_ tokens)
(case tokens
(pattern (partial_list [_ {.#Form (list [_ {.#Tuple bindings}]
@@ -110,10 +110,10 @@
(meta#in (list#composite output branches))
{.#None}
- (failure (..wrong_syntax_error (symbol ..template))))
+ (failure (..wrong_syntax_error (symbol ..with_template))))
_
- (failure (..wrong_syntax_error (symbol ..template))))))
+ (failure (..wrong_syntax_error (symbol ..with_template))))))
(def: .public multi
(macro (_ tokens)
@@ -185,7 +185,7 @@
{.#Item [init inits']}
(.` {.#Item (~ init) (~ (untemplated_partial_list last inits'))})))
-(.template [<tag> <name>]
+(.with_template [<tag> <name>]
[(def: (<name> g!meta untemplated_pattern elems)
(-> Code (-> Code (Meta Code))
(-> (List Code) (Meta Code)))
@@ -211,7 +211,7 @@
(do meta_monad
[g!meta (..generated_symbol "g!meta")]
(case pattern
- (..template [<tag> <gen>]
+ (..with_template [<tag> <gen>]
[[_ {<tag> value}]
(in (.` [(~ g!meta) {<tag> (~ (<gen> value))}]))])
([.#Bit bit$]
@@ -228,7 +228,7 @@
[_ {.#Form {.#Item [[_ {.#Symbol ["" "~+"]}] {.#Item [spliced {.#End}]}]}}]
(failure "Cannot use (~+) inside of `code` unless it is the last element in a form or a tuple.")
- (template [<tag> <untemplated>]
+ (..with_template [<tag> <untemplated>]
[[_ {<tag> elems}]
(<untemplated> g!meta untemplated_pattern elems)])
([.#Form ..untemplated_form]
diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux
index a510cb759..e4ae7260f 100644
--- a/stdlib/source/library/lux/macro/syntax.lux
+++ b/stdlib/source/library/lux/macro/syntax.lux
@@ -85,8 +85,7 @@
{.#None}
(//.symbol "g!state"))
this_module meta.current_module_name
- .let [error_msg (code.text (//.wrong_syntax_error [this_module name]))
- g!name (code.symbol ["" name])]]
+ .let [g!name (code.symbol ["" name])]]
(in (list (` (.macro ((~ g!name) (~ g!tokens) (~ g!state))
(.case ((~! </>.result)
(is ((~! </>.Parser) (Meta (List Code)))
@@ -98,7 +97,7 @@
((~ g!body) (~ g!state))
{try.#Failure (~ g!error)}
- {try.#Failure ((~! text.interposed) (~! text.new_line) (list (~ error_msg) (~ g!error)))})))))))
+ {try.#Failure ((~! text.interposed) (~! text.new_line) (list "Invalid syntax:" (~ g!error)))})))))))
{try.#Failure error}
(meta.failure (//.wrong_syntax_error (symbol ..syntax))))))
diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux
index cec732f01..439c99a3a 100644
--- a/stdlib/source/library/lux/macro/template.lux
+++ b/stdlib/source/library/lux/macro/template.lux
@@ -83,7 +83,7 @@
(syntax (_ [simple (..part false)])
(in (list (|> simple (text.interposed "") code.text)))))
-(template [<name> <simple> <complex>]
+(with_template [<name> <simple> <complex>]
[(def: .public <name>
(syntax (_ [name (<>.or (<>.and (..part true) (..part false))
(..part false))])
@@ -112,7 +112,7 @@
{.#None}
template)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[meta {<tag> elems}]
[meta {<tag> (list#each (applied env) elems)}]])
([.#Form]
diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux
index 9a53b8f0e..01274b28c 100644
--- a/stdlib/source/library/lux/math.lux
+++ b/stdlib/source/library/lux/math.lux
@@ -68,7 +68,7 @@
<ratio/1> [ratio.#numerator 1 ratio.#denominator 1]
<complex/0> [complex.#real +0.0 complex.#imaginary +0.0]
<complex/1> [complex.#real +1.0 complex.#imaginary +0.0]]
- (these (template [<name> <scenarios>']
+ (these (with_template [<name> <scenarios>']
[(with_expansions [<extension> (static.seed)
<extension> (template.text [<@> " " <extension>])
<scenarios> (template.spliced <scenarios>')]
@@ -88,7 +88,7 @@
(`` (cond (check.subsumes? .I64 :it:)
(phase.except ..no_arithmetic_for [:it:])
- (~~ (template [<type> <0> <+>]
+ (~~ (with_template [<type> <0> <+>]
[(check.subsumes? <type> :it:)
<0>]
@@ -101,7 +101,7 @@
(`` (cond (check.subsumes? .I64 :it:)
(phase.except ..no_arithmetic_for [:it:])
- (~~ (template [<type> <0> <+>]
+ (~~ (with_template [<type> <0> <+>]
[(check.subsumes? <type> :it:)
(..composite phase archive (` <+>) last prevs)]
@@ -138,7 +138,7 @@
[Ratio (type.expecting Ratio (phase archive (` <ratio/1>))) ratio./]
[Complex (type.expecting Complex (phase archive (` <complex/1>))) complex./]]]
)
- (template [<name> <scenarios>']
+ (with_template [<name> <scenarios>']
[(with_expansions [<extension> (static.seed)
<extension> (template.text [<@> " " <extension>])
<scenarios> (template.spliced <scenarios>')]
@@ -154,7 +154,7 @@
(`` (cond (check.subsumes? .I64 :it:)
(phase.except ..no_arithmetic_for [:it:])
- (~~ (template [<type> <+>]
+ (~~ (with_template [<type> <+>]
[(check.subsumes? <type> :it:)
(..composite phase archive (` <+>) right (list left))]
@@ -194,7 +194,7 @@
[.Frac frac.>=]
[Ratio ratio.>=]]]
)
- (template [<name> <scenarios>']
+ (with_template [<name> <scenarios>']
[(with_expansions [<extension> (static.seed)
<extension> (template.text [<@> " " <extension>])
<scenarios> (template.spliced <scenarios>')]
@@ -210,7 +210,7 @@
(`` (cond (check.subsumes? .I64 :it:)
(phase.except ..no_arithmetic_for [:it:])
- (~~ (template [<type> <+>]
+ (~~ (with_template [<type> <+>]
[(check.subsumes? <type> :it:)
(..composite phase archive (` <+>) right (list left))]
diff --git a/stdlib/source/library/lux/math/logic/continuous.lux b/stdlib/source/library/lux/math/logic/continuous.lux
index eec2d573f..c72e296d1 100644
--- a/stdlib/source/library/lux/math/logic/continuous.lux
+++ b/stdlib/source/library/lux/math/logic/continuous.lux
@@ -11,7 +11,7 @@
(def: .public false Rev /#bottom)
(def: .public true Rev /#top)
-(template [<name> <chooser> <monoid> <identity>]
+(with_template [<name> <chooser> <monoid> <identity>]
[(def: .public <name>
(-> Rev Rev Rev)
<chooser>)
diff --git a/stdlib/source/library/lux/math/logic/fuzzy.lux b/stdlib/source/library/lux/math/logic/fuzzy.lux
index 679ebc4a7..79555e858 100644
--- a/stdlib/source/library/lux/math/logic/fuzzy.lux
+++ b/stdlib/source/library/lux/math/logic/fuzzy.lux
@@ -25,7 +25,7 @@
(def: (each f fb)
(|>> f fb)))
-(template [<name> <verdict>]
+(with_template [<name> <verdict>]
[(def: .public <name>
Fuzzy
(function (_ _)
@@ -39,7 +39,7 @@
(All (_ a) (-> (Fuzzy a) a Rev))
(set elem))
-(template [<set_composition> <membership_composition>]
+(with_template [<set_composition> <membership_composition>]
[(def: .public (<set_composition> left right)
(All (_ a) (-> (Fuzzy a) (Fuzzy a) (Fuzzy a)))
(function (_ elem)
@@ -101,10 +101,11 @@
(..ascending from to)
(..descending from to)))
-(template: (!sort_2 <low> <high>)
- [(if (/.> <low> <high>)
- [<low> <high>]
- [<high> <low>])])
+(def: !sort_2
+ (template (_ <low> <high>)
+ [(if (/.> <low> <high>)
+ [<low> <high>]
+ [<high> <low>])]))
(def: .public (triangle bottom middle top)
(-> Rev Rev Rev (Fuzzy Rev))
diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux
index 1af638ee7..09e1b6a31 100644
--- a/stdlib/source/library/lux/math/modular.lux
+++ b/stdlib/source/library/lux/math/modular.lux
@@ -36,7 +36,7 @@
(abstraction [#modulus modulus
#value (i.mod (//.divisor modulus) value)]))
- (template [<name> <type> <side>]
+ (with_template [<name> <type> <side>]
[(def: .public <name>
(All (_ %) (-> (Mod %) <type>))
(|>> representation <side>))]
@@ -77,7 +77,7 @@
(i.= (//.divisor expected) actual))]
(in (..modular expected value))))))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> reference subject)
(All (_ %) (-> (Mod %) (Mod %) Bit))
(let [[_ reference] (representation reference)
@@ -102,7 +102,7 @@
(def: equivalence ..equivalence)
(def: < ..<))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> param subject)
(All (_ %) (-> (Mod %) (Mod %) (Mod %)))
(let [[modulus param] (representation param)
@@ -117,7 +117,7 @@
[* i.*]
)
- (template [<composition> <identity> <monoid>]
+ (with_template [<composition> <identity> <monoid>]
[(implementation: .public (<monoid> modulus)
(All (_ %) (-> (Modulus %) (Monoid (Mod %))))
diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux
index 3f4fe8c9e..59310fc99 100644
--- a/stdlib/source/library/lux/math/number.lux
+++ b/stdlib/source/library/lux/math/number.lux
@@ -31,7 +31,7 @@
(-> Text Text)
(text.replaced ..separator ""))
-(template [<macro> <nat> <int> <rev> <frac> <error>]
+(with_template [<macro> <nat> <int> <rev> <frac> <error>]
[(def: .public <macro>
(macro (_ tokens state)
(case tokens
diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux
index 2965f2c12..56e2cefc7 100644
--- a/stdlib/source/library/lux/math/number/complex.lux
+++ b/stdlib/source/library/lux/math/number/complex.lux
@@ -56,7 +56,7 @@
(f.= (the #imaginary param)
(the #imaginary input))))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param input)
(-> Complex Complex Complex)
[#real (<op> (the #real param)
@@ -73,7 +73,7 @@
(def: = ..=))
-(template [<name> <transform>]
+(with_template [<name> <transform>]
[(def: .public <name>
(-> Complex Complex)
(|>> (revised #real <transform>)
@@ -213,7 +213,7 @@
[..#real (|> subject ..abs f.log)
..#imaginary (f.atan_2 #real #imaginary)]))
-(template [<name> <type> <op>]
+(with_template [<name> <type> <op>]
[(def: .public (<name> param input)
(-> <type> Complex Complex)
(|> input log (<op> param) exp))]
diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux
index aa58c684f..149ca8e50 100644
--- a/stdlib/source/library/lux/math/number/frac.lux
+++ b/stdlib/source/library/lux/math/number/frac.lux
@@ -23,7 +23,7 @@
["[1][0]" int]
["[1][0]" rev]])
-(template [<name> <value>]
+(with_template [<name> <value>]
[(def: .public <name>
<value>)]
@@ -35,7 +35,7 @@
)
(for @.old
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public (<name> it)
(-> Frac Frac)
(<method> it))]
@@ -62,18 +62,20 @@
("jvm invokestatic:java.lang.Math:pow:double,double" subject param)))
@.jvm
- (these (template: (!double value)
- [(|> value
- (as (Primitive "java.lang.Double"))
- "jvm object cast")])
+ (these (def: !double
+ (template (_ value)
+ [(|> value
+ (as (Primitive "java.lang.Double"))
+ "jvm object cast")]))
- (template: (!frac value)
- [(|> value
- "jvm object cast"
- (is (Primitive "java.lang.Double"))
- (as Frac))])
+ (def: !frac
+ (template (_ value)
+ [(|> value
+ "jvm object cast"
+ (is (Primitive "java.lang.Double"))
+ (as Frac))]))
- (template [<name> <method>]
+ (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> !double
@@ -106,7 +108,7 @@
!frac)))
@.js
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> []
@@ -136,7 +138,7 @@
(as Frac ("js apply" ("js constant" "Math.pow") [subject param]))))
@.python
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> []
@@ -175,7 +177,7 @@
(..pow ("lux f64 /" +3.0 +1.0))))))
@.lua
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> []
@@ -214,7 +216,7 @@
(..pow ("lux f64 /" +3.0 +1.0))))))
@.ruby
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> []
@@ -236,7 +238,7 @@
[root_3 "Math.cbrt"]
)
- (template [<name> <method>]
+ (with_template [<name> <method>]
[(def: .public (<name> it)
(-> Frac Frac)
(|> ("ruby object do" <method> it [])
@@ -252,7 +254,7 @@
(as Frac ("ruby object do" "**" subject [param]))))
@.php
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> ("php apply" ("php constant" <method>))
@@ -284,7 +286,7 @@
(..pow ("lux f64 /" +3.0 +1.0))))
@.scheme
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> ("scheme apply" ("scheme constant" <method>))
@@ -372,7 +374,7 @@
... Hyperbolic functions
... https://en.wikipedia.org/wiki/Hyperbolic_function#Definitions
-(template [<name> <comp> <inverse>]
+(with_template [<name> <comp> <inverse>]
[(def: .public (<name> it)
(-> Frac Frac)
(|> (..exp it) (<comp> (..exp ("lux f64 *" -1.0 it))) ("lux f64 /" +2.0)))
@@ -385,7 +387,7 @@
[cosh "lux f64 +" sech]
)
-(template [<name> <top> <bottom>]
+(with_template [<name> <top> <bottom>]
[(def: .public (<name> it)
(-> Frac Frac)
(let [e+ (exp it)
@@ -399,7 +401,7 @@
)
... https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions#Definitions_in_terms_of_logarithms
-(template [<name> <comp>]
+(with_template [<name> <comp>]
[(def: .public (<name> it)
(-> Frac Frac)
(|> it (pow +2.0) (<comp> +1.0) (pow +0.5) ("lux f64 +" it) log))]
@@ -408,7 +410,7 @@
[acosh "lux f64 -"]
)
-(template [<name> <base> <diff>]
+(with_template [<name> <base> <diff>]
[(def: .public (<name> it)
(-> Frac Frac)
(let [it+ (|> <base> ("lux f64 +" <diff>))
@@ -419,7 +421,7 @@
[acoth it +1.0]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> it)
(-> Frac Frac)
(let [it^2 (|> it (pow +2.0))]
@@ -429,7 +431,7 @@
[acsch "lux f64 +"]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Frac Frac Bit)
(<op> param subject))]
@@ -452,7 +454,7 @@
(or ("lux f64 <" sample reference)
("lux f64 =" sample reference)))
-(template [<comparison> <name>]
+(with_template [<comparison> <name>]
[(def: .public <name>
(Predicate Frac)
(<comparison> +0.0))]
@@ -462,7 +464,7 @@
[..= zero?]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Frac Frac Frac)
(<op> param subject))]
@@ -499,7 +501,7 @@
(def: min_exponent -1022)
(def: max_exponent (//int.frac +1023))
-(template [<name> <test>]
+(with_template [<name> <test>]
[(def: .public (<name> left right)
(-> Frac Frac Frac)
(if (<test> right left)
@@ -534,7 +536,7 @@
"lux f64 i64"
("lux i64 left-shift" ..exponent_size)))
-(template [<name> <numerator>]
+(with_template [<name> <numerator>]
[(def: .public <name>
Frac
(../ +0.0 <numerator>))]
@@ -584,7 +586,7 @@
(..- f2^-52)
(..* f2^+1023))))
-(template [<name> <composite> <identity>]
+(with_template [<name> <composite> <identity>]
[(implementation: .public <name>
(Monoid Frac)
@@ -630,7 +632,7 @@
(def: exponent_offset ..mantissa_size)
(def: sign_offset (//nat.+ ..exponent_size ..exponent_offset))
-(template [<cast> <hex> <name>]
+(with_template [<cast> <hex> <name>]
[(def: <name>
(|> <hex>
(at //nat.hex decoded)
@@ -700,7 +702,7 @@
(//i64.zero ..mantissa_size mantissa_bits)))
)))
-(template [<getter> <size> <offset>]
+(with_template [<getter> <size> <offset>]
[(def: <getter>
(-> (I64 Any) I64)
(let [mask (|> 1 (//i64.left_shifted <size>) -- (//i64.left_shifted <offset>))]
@@ -756,7 +758,7 @@
("lux text index" 0 "E+" representation)
("lux text index" 0 "e-" representation)
("lux text index" 0 "E-" representation)]
- (^.template [<factor> <patterns>]
+ (^.with_template [<factor> <patterns>]
[<patterns>
(do try.monad
[.let [after_offset (//nat.+ 2 split_index)
@@ -774,7 +776,7 @@
_
{try.#Success [representation +0]}))
-(template [<struct> <nat> <int> <error>]
+(with_template [<struct> <nat> <int> <error>]
[(implementation: .public <struct>
(Codec Text Frac)
diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux
index 36a50c5fe..81cea98f4 100644
--- a/stdlib/source/library/lux/math/number/i64.lux
+++ b/stdlib/source/library/lux/math/number/i64.lux
@@ -21,7 +21,7 @@
(n.* ..bits_per_byte
..bytes_per_i64))
-(template [<parameter_type> <name> <op>]
+(with_template [<parameter_type> <name> <op>]
[(def: .public (<name> parameter subject)
(All (_ s) (-> <parameter_type> (I64 s) (I64 s)))
(<op> parameter subject))]
@@ -86,7 +86,7 @@
(All (_ s) (-> Nat (I64 s) (I64 s)))
(|> index ..bit ..not (..and input)))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> index input)
(All (_ s) (-> Nat (I64 s) (I64 s)))
(|> index ..bit (<op> input)))]
@@ -103,7 +103,7 @@
(-> Nat (I64 Any) Bit)
(.not (..one? index input)))
-(template [<name> <forward> <backward>]
+(with_template [<name> <forward> <backward>]
[(def: .public (<name> distance input)
(All (_ s) (-> Nat (I64 s) (I64 s)))
(..or (<forward> distance input)
@@ -130,7 +130,7 @@
(def: hash (|>> .nat)))
-(template [<monoid> <identity> <composite>]
+(with_template [<monoid> <identity> <composite>]
[(implementation: .public <monoid>
(All (_ a) (Monoid (I64 a)))
diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux
index f4953d6b0..a59608af6 100644
--- a/stdlib/source/library/lux/math/number/int.lux
+++ b/stdlib/source/library/lux/math/number/int.lux
@@ -21,7 +21,7 @@
["[1][0]" nat]
["[1][0]" i64]])
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Int Int Bit)
(<op> param subject))]
@@ -46,7 +46,7 @@
#1
("lux i64 =" reference sample)))
-(template [<comparison> <name>]
+(with_template [<comparison> <name>]
[(def: .public <name>
(Predicate Int)
(<comparison> +0))]
@@ -56,7 +56,7 @@
[..= zero?]
)
-(template [<name> <test>]
+(with_template [<name> <test>]
[(def: .public (<name> left right)
(-> Int Int Int)
(if (<test> right left)
@@ -67,7 +67,7 @@
[max ..>]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Int Int Int)
(<op> param subject))]
@@ -190,7 +190,7 @@
... -9,223,372,036,854,775,808
(//i64.left_shifted 63 +1)))
-(template [<name> <composite> <identity>]
+(with_template [<name> <composite> <identity>]
[(implementation: .public <name>
(Monoid Int)
@@ -206,7 +206,7 @@
(def: -sign "-")
(def: +sign "+")
-(template [<struct> <codec> <error>]
+(with_template [<struct> <codec> <error>]
[(implementation: .public <struct>
(Codec Text Int)
diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux
index 0e5d5f6d4..988efc62b 100644
--- a/stdlib/source/library/lux/math/number/nat.lux
+++ b/stdlib/source/library/lux/math/number/nat.lux
@@ -16,7 +16,7 @@
[macro
["^" pattern]]]])
-(template [<extension> <output> <name>]
+(with_template [<extension> <output> <name>]
[(def: .public (<name> parameter subject)
(-> Nat Nat <output>)
(<extension> parameter subject))]
@@ -61,7 +61,7 @@
(or (..< sample reference)
("lux i64 =" reference sample)))
-(template [<name> <test>]
+(with_template [<name> <test>]
[(def: .public (<name> left right)
(-> Nat Nat Nat)
(if (<test> right left)
@@ -167,7 +167,7 @@
(def: top (-- 0))
(def: bottom 0))
-(template [<name> <composite> <identity>]
+(with_template [<name> <composite> <identity>]
[(implementation: .public <name>
(Monoid Nat)
@@ -274,18 +274,18 @@
(def: (hexadecimal_value digit)
(-> Nat (Maybe Nat))
(case digit
- (^.template [<character> <number>]
+ (^.with_template [<character> <number>]
[(pattern (char <character>)) {.#Some <number>}])
(["0" 0] ["1" 1] ["2" 2] ["3" 3] ["4" 4]
["5" 5] ["6" 6] ["7" 7] ["8" 8] ["9" 9])
- (^.template [<lower> <upper> <number>]
+ (^.with_template [<lower> <upper> <number>]
[(^.or (pattern (char <lower>)) (pattern (char <upper>))) {.#Some <number>}])
(["a" "A" 10] ["b" "B" 11] ["c" "C" 12]
["d" "D" 13] ["e" "E" 14] ["f" "F" 15])
_ {.#None}))
-(template [<shift> <struct> <to_character> <to_value> <error>]
+(with_template [<shift> <struct> <to_character> <to_value> <error>]
[(implementation: .public <struct>
(Codec Text Nat)
diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux
index 50ba795b2..df07ca898 100644
--- a/stdlib/source/library/lux/math/number/ratio.lux
+++ b/stdlib/source/library/lux/math/number/ratio.lux
@@ -149,7 +149,7 @@
{.#None}
{.#Left (text#composite "Invalid syntax for ratio: " input)})))
-(template [<identity> <composite> <name>]
+(with_template [<identity> <composite> <name>]
[(implementation: .public <name>
(Monoid Ratio)
diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux
index d919af0b4..7afe11894 100644
--- a/stdlib/source/library/lux/math/number/rev.lux
+++ b/stdlib/source/library/lux/math/number/rev.lux
@@ -24,7 +24,7 @@
Rev
(.rev -1))
-(template [<power> <name>]
+(with_template [<power> <name>]
[(def: .public <name>
Rev
(.rev (//i64.left_shifted (//nat.- <power> //i64.width) 1)))]
@@ -65,7 +65,7 @@
(or (..< sample reference)
("lux i64 =" reference sample)))
-(template [<name> <test>]
+(with_template [<name> <test>]
[(def: .public (<name> left right)
(-> Rev Rev Rev)
(if (<test> right left)
@@ -76,7 +76,7 @@
[max ..>]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Rev Rev Rev)
(<op> param subject))]
@@ -140,7 +140,7 @@
_ (..odd_reciprocal (.nat param)))]
(.rev (//nat.* reciprocal (.nat subject)))))))
-(template [<operator> <name> <output> <output_type>]
+(with_template [<operator> <name> <output> <output_type>]
[(def: .public (<name> param subject)
(-> Rev Rev <output_type>)
(<output> (<operator> (.nat param) (.nat subject))))]
@@ -149,7 +149,7 @@
[//nat./ ratio |> Nat]
)
-(template [<operator> <name>]
+(with_template [<operator> <name>]
[(def: .public (<name> scale subject)
(-> Nat Rev Rev)
(.rev (<operator> (.nat scale) (.nat subject))))]
@@ -206,7 +206,7 @@
(def: top (.rev -1))
(def: bottom (.rev 0)))
-(template [<name> <composite> <identity>]
+(with_template [<name> <composite> <identity>]
[(implementation: .public <name>
(Monoid Rev)
@@ -222,7 +222,7 @@
(-> Text Text)
("lux text clip" 1 (-- ("lux text size" input)) input))
-(template [<struct> <codec> <char_bit_size> <error>]
+(with_template [<struct> <codec> <char_bit_size> <error>]
[(with_expansions [<failure> (these {try.#Failure ("lux text concat" <error> repr)})]
(implementation: .public <struct>
(Codec Text Rev)
diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux
index f22cc5647..2a05eac36 100644
--- a/stdlib/source/library/lux/math/random.lux
+++ b/stdlib/source/library/lux/math/random.lux
@@ -123,7 +123,7 @@
(i64.left_shifted 32)
("lux i64 +" right))])))
-(template [<name> <type> <cast>]
+(with_template [<name> <type> <cast>]
[(def: .public <name>
(Random <type>)
(at ..functor each (|>> <cast>) ..i64))]
@@ -167,7 +167,7 @@
xs (text char_gen (-- size))]
(in (text#composite (text.of_char x) xs)))))
-(template [<name> <set>]
+(with_template [<name> <set>]
[(def: .public <name>
(-> Nat (Random Text))
(..text (..char <set>)))]
@@ -181,7 +181,7 @@
[lower_case unicode.lower_case]
)
-(template [<name> <type> <ctor> <gen>]
+(with_template [<name> <type> <ctor> <gen>]
[(def: .public <name>
(Random <type>)
(do ..monad
@@ -252,7 +252,7 @@
(in (sequence.suffix x xs)))
(at ..monad in sequence.empty)))
-(template [<name> <type> <ctor>]
+(with_template [<name> <type> <ctor>]
[(def: .public (<name> size value_gen)
(All (_ a) (-> Nat (Random a) (Random (<type> a))))
(do ..monad
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index 884945642..f056570b4 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -550,7 +550,7 @@
(|>> (the .#imports) (list.any? (text#= import)))
..current_module))
-(template [<name> <tag> <description>]
+(with_template [<name> <tag> <description>]
[(def: .public (<name> label_name)
(-> Symbol (Meta [Nat (List Symbol) Type]))
(do ..monad
@@ -666,7 +666,7 @@
{try.#Failure error}
{try.#Success [lux {try.#Failure error}]})))
-(template [<type> <name> <slot>]
+(with_template [<type> <name> <slot>]
[(def: .public <name>
(Meta <type>)
(function (_ lux)
diff --git a/stdlib/source/library/lux/meta/configuration.lux b/stdlib/source/library/lux/meta/configuration.lux
index 18464b10c..cf6675195 100644
--- a/stdlib/source/library/lux/meta/configuration.lux
+++ b/stdlib/source/library/lux/meta/configuration.lux
@@ -40,7 +40,7 @@
Configuration
/.empty)
-(template [<ascii> <name>]
+(with_template [<ascii> <name>]
[(def: <name>
Text
(text.of_char (hex <ascii>)))]
diff --git a/stdlib/source/library/lux/meta/symbol.lux b/stdlib/source/library/lux/meta/symbol.lux
index 43d2277af..a539acea7 100644
--- a/stdlib/source/library/lux/meta/symbol.lux
+++ b/stdlib/source/library/lux/meta/symbol.lux
@@ -13,7 +13,7 @@
... (type: Symbol
... [Text Text])
-(template [<name>]
+(with_template [<name>]
[(def: .public (<name> [module short])
(-> Symbol Text)
<name>)]
diff --git a/stdlib/source/library/lux/static.lux b/stdlib/source/library/lux/static.lux
index 21f749b1c..ea40d2733 100644
--- a/stdlib/source/library/lux/static.lux
+++ b/stdlib/source/library/lux/static.lux
@@ -17,7 +17,7 @@
[number (.only hex)]
["[0]" random (.only Random)]]]])
-(template [<name> <type> <format>]
+(with_template [<name> <type> <format>]
[(def: .public <name>
(syntax (_ [expression <code>.any])
(at meta.monad each
@@ -64,7 +64,7 @@
(syntax (_ [])
(meta#each (|>> code.nat list) meta.seed)))
-(template [<name> <random> <format>]
+(with_template [<name> <random> <format>]
[(def: .public <name>
(syntax (_ [])
(do meta.monad
diff --git a/stdlib/source/library/lux/target.lux b/stdlib/source/library/lux/target.lux
index 0f7d94d8f..66e8ea31b 100644
--- a/stdlib/source/library/lux/target.lux
+++ b/stdlib/source/library/lux/target.lux
@@ -5,7 +5,7 @@
(type: .public Target
Text)
-(template [<name> <value>]
+(with_template [<name> <value>]
[(def: .public <name>
Target
<value>)]
diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux
index ce523f4d4..ee50aee0c 100644
--- a/stdlib/source/library/lux/target/common_lisp.lux
+++ b/stdlib/source/library/lux/target/common_lisp.lux
@@ -31,7 +31,7 @@
(-> (Code Any) Text)
(|>> representation))
- (template [<type> <super>]
+ (with_template [<type> <super>]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(`` (primitive: .public (<brand> brand) Any))
(`` (type: .public (<type> brand)
@@ -45,7 +45,7 @@
[Input Code]
)
- (template [<type> <super>]
+ (with_template [<type> <super>]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(`` (primitive: .public <brand> Any))
(`` (type: .public <type> (<super> <brand>))))]
@@ -66,7 +66,7 @@
Literal
(abstraction "()"))
- (template [<prefix> <name>]
+ (with_template [<prefix> <name>]
[(def: .public <name>
(-> Text Literal)
(|>> (format <prefix>) abstraction))]
@@ -119,7 +119,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -177,7 +177,7 @@
(-> (Expression Any) (-> (List (Expression Any)) (Computation Any)))
(|>> {.#Item func} ..form))
- (template [<name> <function>]
+ (with_template [<name> <function>]
[(def: .public <name>
(-> (List (Expression Any)) (Computation Any))
(..call/* (..var <function>)))]
@@ -200,12 +200,12 @@
(transmutation bindings) expression
body)))
- (template [<call> <input_var>+ <input_type>+ <function>+]
+ (with_template [<call> <input_var>+ <input_type>+ <function>+]
[(`` (def: .public (<call> [(~~ (template.spliced <input_var>+))] function)
(-> [(~~ (template.spliced <input_type>+))] (Expression Any) (Computation Any))
(..call/* function (list (~~ (template.spliced <input_var>+))))))
- (`` (template [<lux_name> <host_name>]
+ (`` (with_template [<lux_name> <host_name>]
[(def: .public (<lux_name> args)
(-> [(~~ (template.spliced <input_type>+))] (Computation Any))
(<call> args (..var <host_name>)))]
@@ -262,8 +262,8 @@
[format/3 "format"]]]
)
- (template [<call> <input_type>+ <function>+]
- [(`` (template [<lux_name> <host_name>]
+ (with_template [<call> <input_type>+ <function>+]
+ [(`` (with_template [<lux_name> <host_name>]
[(def: .public (<lux_name> args)
(-> [(~~ (template.spliced <input_type>+))] (Access Any))
(transmutation (<call> args (..var <host_name>))))]
@@ -302,7 +302,7 @@
(-> [(Expression Any) (Expression Any)] (Computation Any))
(concatenate/3 [(..symbol "string") left right]))
- (template [<lux_name> <host_name>]
+ (with_template [<lux_name> <host_name>]
[(def: .public (<lux_name> left right)
(-> (Expression Any) (Expression Any) (Computation Any))
(..form (list (..var <host_name>) left right)))]
@@ -311,7 +311,7 @@
[and "and"]
)
- (template [<lux_name> <host_name>]
+ (with_template [<lux_name> <host_name>]
[(def: .public (<lux_name> [param subject])
(-> [(Expression Any) (Expression Any)] (Computation Any))
(..form (list (..var <host_name>) subject param)))]
@@ -344,7 +344,7 @@
(-> Var/* (Expression Any) Literal)
(..form (list (..var "lambda") (transmutation input) body)))
- (template [<lux_name> <host_name>]
+ (with_template [<lux_name> <host_name>]
[(def: .public (<lux_name> bindings body)
(-> (List [Var/1 (Expression Any)]) (List (Expression Any)) (Computation Any))
(..form (partial_list (..var <host_name>)
@@ -366,7 +366,7 @@
(-> Var/1 Var/* (Expression Any) (Expression Any))
(..form (list (..var "defun") name (transmutation inputs) body)))
- (template [<name> <symbol>]
+ (with_template [<name> <symbol>]
[(def: .public <name>
(-> (List (Expression Any)) (Computation Any))
(|>> (partial_list (..var <symbol>)) ..form))]
@@ -400,7 +400,7 @@
handler)))
handlers))))
- (template [<name> <prefix>]
+ (with_template [<name> <prefix>]
[(def: .public (<name> conditions expression)
(-> (List Text) (Expression Any) (Expression Any))
(case conditions
diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux
index e1d894f56..3ee9dbcfb 100644
--- a/stdlib/source/library/lux/target/js.lux
+++ b/stdlib/source/library/lux/target/js.lux
@@ -40,7 +40,7 @@
(-> (Code Any) Text)
(|>> representation))
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: (<brand> brand) Any)
(`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))]
@@ -51,7 +51,7 @@
[Statement [Code]]
)
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: <brand> Any)
(`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))]
@@ -63,7 +63,7 @@
[Label [Code]]
)
- (template [<name> <literal>]
+ (with_template [<name> <literal>]
[(def: .public <name> Literal (abstraction <literal>))]
[null "null"]
@@ -94,7 +94,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<replace> <find>]
+ (`` (|>> (~~ (with_template [<replace> <find>]
[(text.replaced <find> <replace>)]
["\\" "\"]
@@ -213,7 +213,7 @@
..expression
abstraction))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Expression Expression Computation)
(|> (format (representation subject) " " <op> " " (representation param))
@@ -243,7 +243,7 @@
[bit_and "&"]
)
- (template [<prefix> <name>]
+ (with_template [<prefix> <name>]
[(def: .public <name>
(-> Expression Computation)
(|>> representation (text.prefix <prefix>) ..expression abstraction))]
@@ -253,7 +253,7 @@
["-" opposite]
)
- (template [<name> <input> <format>]
+ (with_template [<name> <input> <format>]
[... A 32-bit integer expression.
(def: .public (<name> value)
(-> <input> Computation)
@@ -374,7 +374,7 @@
(-> Label Loop Statement)
(abstraction (format (representation label) ": " (representation loop))))
- (template [<keyword> <0> <1>]
+ (with_template [<keyword> <0> <1>]
[(def: .public <0>
Statement
(abstraction (format <keyword> ..statement_suffix)))
@@ -387,7 +387,7 @@
["continue" continue continue_at]
)
- (template [<name> <js>]
+ (with_template [<name> <js>]
[(def: .public <name>
(-> Location Expression)
(|>> representation
@@ -424,13 +424,13 @@
..block))))
)
-(template [<apply> <arg>+ <type>+ <function>+]
+(with_template [<apply> <arg>+ <type>+ <function>+]
[(`` (def: .public (<apply> function)
(-> Expression (~~ (template.spliced <type>+)) Computation)
(.function (_ (~~ (template.spliced <arg>+)))
(..apply function (list (~~ (template.spliced <arg>+)))))))
- (`` (template [<definition> <function>]
+ (`` (with_template [<definition> <function>]
[(def: .public <definition> (<apply> (..var <function>)))]
(~~ (template.spliced <function>+))))]
diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux
index 2d356943d..856bb7eac 100644
--- a/stdlib/source/library/lux/target/jvm/attribute.lux
+++ b/stdlib/source/library/lux/target/jvm/attribute.lux
@@ -88,7 +88,7 @@
(def: (length attribute)
(-> Attribute Nat)
(case attribute
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> [name length info]}
(|> length //unsigned.value (n.+ ..common_attribute_length))])
([#Constant]
diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux
index e9cf5735d..7925c5c24 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode.lux
@@ -82,16 +82,18 @@
(function (_ _)
{try.#Success [..no_exceptions _.empty]}))
-(template: (try|do <binding> <term> <then>)
- [(.case <term>
- {try.#Success <binding>}
- <then>
+(def: try|do
+ (template (_ <binding> <term> <then>)
+ [(.case <term>
+ {try.#Success <binding>}
+ <then>
- failure
- (as_expected failure))])
+ failure
+ (as_expected failure))]))
-(template: (try|in <it>)
- [{try.#Success <it>}])
+(def: try|in
+ (template (_ <it>)
+ [{try.#Success <it>}]))
(def: (relative#composite left right)
(-> Relative Relative Relative)
@@ -300,7 +302,7 @@
(try|in [..no_exceptions (bytecode input)]))
[]]]))))
-(template [<name> <frames>]
+(with_template [<name> <frames>]
[(def: <name> U2
(|> <frames> //unsigned.u2 try.trusted))]
@@ -313,7 +315,7 @@
[$6 6]
)
-(template [<name> <registry>]
+(with_template [<name> <registry>]
[(def: <name> Registry (|> <registry> //unsigned.u2 try.trusted /registry.registry))]
[@_ 0]
@@ -324,7 +326,7 @@
[@4 5]
)
-(template [<name> <consumption> <production> <registry> <instruction>]
+(with_template [<name> <consumption> <production> <registry> <instruction>]
[(def: .public <name>
(Bytecode Any)
(..bytecode <consumption>
@@ -518,7 +520,7 @@
[..relative#identity
[]]]))))
-(template [<name> <consumption> <instruction>]
+(with_template [<name> <consumption> <instruction>]
[(def: .public <name>
(Bytecode Any)
(do ..monad
@@ -568,11 +570,11 @@
"[1]::[0]"
("static" doubleToRawLongBits "manual" [double] long))
-(template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>]
+(with_template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>]
[(def: .public (<name> value)
(-> <type> (Bytecode Any))
(case (|> value <to_lux>)
- (^.template [<special> <instruction>]
+ (^.with_template [<special> <instruction>]
[<special> (..bytecode $0 $1 @_ <instruction> [])])
<specializations>
@@ -622,7 +624,7 @@
(..float_bits value))
(..arbitrary_float value)
(case (|> value ffi.float_to_double (as Frac))
- (^.template [<special> <instruction>]
+ (^.with_template [<special> <instruction>]
[<special> (..bytecode $0 $1 @_ <instruction> [])])
([+0.0 _.fconst_0]
[+1.0 _.fconst_1]
@@ -630,11 +632,11 @@
_ (..arbitrary_float value))))
-(template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>]
+(with_template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>]
[(def: .public (<name> value)
(-> <type> (Bytecode Any))
(case (|> value <to_lux>)
- (^.template [<special> <instruction>]
+ (^.with_template [<special> <instruction>]
[<special> (..bytecode $0 $2 @_ <instruction> [])])
<specializations>
@@ -668,7 +670,7 @@
(..double_bits value))
(..arbitrary_double value)
(case (as Frac value)
- (^.template [<special> <instruction>]
+ (^.with_template [<special> <instruction>]
[<special> (..bytecode $0 $2 @_ <instruction> [])])
([+0.0 _.dconst_0]
[+1.0 _.dconst_1])
@@ -688,12 +690,12 @@
{try.#Failure error}
(..except ..invalid_register [id])))
-(template [<for> <size> <name> <general> <specials>]
+(with_template [<for> <size> <name> <general> <specials>]
[(def: .public (<name> local)
(-> Nat (Bytecode Any))
(with_expansions [<specials>' (template.spliced <specials>)]
(`` (case local
- (~~ (template [<case> <instruction> <registry>]
+ (~~ (with_template [<case> <instruction> <registry>]
[<case> (..bytecode $0 <size> <registry> <instruction> [])]
<specials>'))
@@ -728,12 +730,12 @@
[3 _.aload_3 @3]]]
)
-(template [<for> <size> <name> <general> <specials>]
+(with_template [<for> <size> <name> <general> <specials>]
[(def: .public (<name> local)
(-> Nat (Bytecode Any))
(with_expansions [<specials>' (template.spliced <specials>)]
(`` (case local
- (~~ (template [<case> <instruction> <registry>]
+ (~~ (with_template [<case> <instruction> <registry>]
[<case> (..bytecode <size> $0 <registry> <instruction> [])]
<specials>'))
@@ -768,7 +770,7 @@
[3 _.astore_3 @3]]]
)
-(template [<consumption> <production> <name> <instruction> <input>]
+(with_template [<consumption> <production> <name> <instruction> <input>]
[(def: .public <name>
(-> <input> (Bytecode Any))
(..bytecode <consumption> <production> @_ <instruction>))]
@@ -832,7 +834,7 @@
_
(revised #known (dictionary.has label [stack {.#None}]) tracker)))
-(template [<consumption> <name> <instruction>]
+(with_template [<consumption> <name> <instruction>]
[(def: .public (<name> label)
(-> Label (Bytecode Any))
(let [[estimator bytecode] <instruction>]
@@ -882,7 +884,7 @@
[$2 if_acmpne _.if_acmpne]
)
-(template [<name> <instruction> <on_long_jump> <on_short_jump>]
+(with_template [<name> <instruction> <on_long_jump> <on_short_jump>]
[(def: .public (<name> label)
(-> Label (Bytecode Any))
(let [[estimator bytecode] <instruction>]
@@ -1018,7 +1020,7 @@
(-> (Type (<| Return' Value' category)) Text))
(|>> type.reflection reflection.reflection))
-(template [<consumption> <production> <name> <category> <instruction>]
+(with_template [<consumption> <production> <name> <category> <instruction>]
[(def: .public (<name> class)
(-> (Type <category>) (Bytecode Any))
(do ..monad
@@ -1064,7 +1066,7 @@
... else
1))
-(template [<static?> <name> <instruction> <method>]
+(with_template [<static?> <name> <instruction> <method>]
[(def: .public (<name> class method type)
(-> (Type Class) Text (Type Method) (Bytecode Any))
(let [[type_variables inputs output exceptions] (parser.method type)]
@@ -1090,7 +1092,7 @@
[#0 invokeinterface _.invokeinterface //constant/pool.interface_method]
)
-(template [<consumption> <name> <1> <2>]
+(with_template [<consumption> <name> <1> <2>]
[(def: .public (<name> class field type)
(-> (Type Class) Text (Type Value) (Bytecode Any))
(do ..monad
@@ -1107,7 +1109,7 @@
[$1 getfield _.getfield/1 _.getfield/2]
)
-(template [<name> <consumption/1> <1> <consumption/2> <2>]
+(with_template [<name> <consumption/1> <1> <consumption/2> <2>]
[(def: .public (<name> class field type)
(-> (Type Class) Text (Type Value) (Bytecode Any))
(do [! ..monad]
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux
index f2ff4b9f9..bcef16e3e 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux
@@ -22,7 +22,7 @@
[#limit Limit
#stack (Maybe Stack)]))
-(template [<name> <limit>]
+(with_template [<name> <limit>]
[(def: .public (<name> type)
(-> (Type Method) (Try Environment))
(do try.monad
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux
index a1c60d8d2..e859bb3af 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux
@@ -25,7 +25,7 @@
[#stack Stack
#registry Registry]))
-(template [<name> <registry>]
+(with_template [<name> <registry>]
[(def: .public (<name> type)
(-> (Type Method) (Try Limit))
(do try.monad
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 336ab6035..954c2d6fc 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
@@ -46,7 +46,7 @@
..normal)))
(list#mix n.+ 0))))
- (template [<start> <name>]
+ (with_template [<start> <name>]
[(def: .public <name>
(-> (Type Method) (Try Registry))
(|>> ..minimal
@@ -74,7 +74,7 @@
(/////unsigned.max/2 (representation needed))
abstraction))
- (template [<name> <extra>]
+ (with_template [<name> <extra>]
[(def: .public <name>
(-> Register Registry)
(let [extra (|> <extra> /////unsigned.u2 try.trusted)]
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux
index 3c8e419fb..89ea421a1 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux
@@ -20,7 +20,7 @@
(primitive: .public Stack
U2
- (template [<frames> <name>]
+ (with_template [<frames> <name>]
[(def: .public <name>
Stack
(|> <frames> /////unsigned.u2 maybe.trusted abstraction))]
@@ -43,7 +43,7 @@
(-> U2 Stack)
(|>> abstraction))
- (template [<op> <name>]
+ (with_template [<op> <name>]
[(def: .public (<name> amount)
(-> U2 (-> Stack (Try Stack)))
(|>> representation
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux
index 028a60f47..145fe13e0 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux
@@ -63,7 +63,7 @@
(type: Opcode
Nat)
-(template [<size> <name>]
+(with_template [<size> <name>]
[(def: <name> Size (|> <size> ///unsigned.u2 try.trusted))]
[1 opcode_size]
@@ -89,7 +89,7 @@
size)
(|>> mutation ((nullary' opcode)))])])
-(template [<name> <size>]
+(with_template [<name> <size>]
[(def: <name>
Size
(|> ..opcode_size
@@ -101,7 +101,7 @@
[size/4 ..big_jump_size]
)
-(template [<shift> <name> <inputT> <writer> <unwrap>]
+(with_template [<shift> <name> <inputT> <writer> <unwrap>]
[(with_expansions [<private> (template.symbol ["'" <name>])]
(def: (<private> opcode input0)
(-> Opcode <inputT> Mutation)
@@ -125,7 +125,7 @@
[..size/4 jump/4 Big_Jump binary.has_32! ///signed.value]
)
-(template [<shift> <name> <inputT> <writer>]
+(with_template [<shift> <name> <inputT> <writer>]
[(with_expansions [<private> (template.symbol ["'" <name>])]
(def: (<private> opcode input0)
(-> Opcode <inputT> Mutation)
@@ -229,7 +229,7 @@
(-> Primitive_Array_Type U1)
(|>> representation))
- (template [<code> <name>]
+ (with_template [<code> <name>]
[(def: .public <name>
(|> <code> ///unsigned.u1 try.trusted abstraction))]
@@ -244,7 +244,7 @@
))
... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5
-(with_expansions [<constants> (template [<code> <name>]
+(with_expansions [<constants> (with_template [<code> <name>]
[[<code> <name> [] []]]
["01" aconst_null]
@@ -266,7 +266,7 @@
["0E" dconst_0]
["0F" dconst_1])
- <register_loads> (template [<code> <name>]
+ <register_loads> (with_template [<code> <name>]
[[<code> <name> [[register Register]] [register]]]
["15" iload]
@@ -274,7 +274,7 @@
["17" fload]
["18" dload]
["19" aload])
- <simple_register_loads> (template [<code> <name>]
+ <simple_register_loads> (with_template [<code> <name>]
[[<code> <name> [] []]]
["1A" iload_0]
@@ -301,7 +301,7 @@
["2B" aload_1]
["2C" aload_2]
["2D" aload_3])
- <register_stores> (template [<code> <name>]
+ <register_stores> (with_template [<code> <name>]
[[<code> <name> [[register Register]] [register]]]
["36" istore]
@@ -309,7 +309,7 @@
["38" fstore]
["39" dstore]
["3A" astore])
- <simple_register_stores> (template [<code> <name>]
+ <simple_register_stores> (with_template [<code> <name>]
[[<code> <name> [] []]]
["3B" istore_0]
@@ -336,7 +336,7 @@
["4C" astore_1]
["4D" astore_2]
["4E" astore_3])
- <array_loads> (template [<code> <name>]
+ <array_loads> (with_template [<code> <name>]
[[<code> <name> [] []]]
["2E" iaload]
@@ -347,7 +347,7 @@
["33" baload]
["34" caload]
["35" saload])
- <array_stores> (template [<code> <name>]
+ <array_stores> (with_template [<code> <name>]
[[<code> <name> [] []]]
["4f" iastore]
@@ -358,7 +358,7 @@
["54" bastore]
["55" castore]
["56" sastore])
- <arithmetic> (template [<code> <name>]
+ <arithmetic> (with_template [<code> <name>]
[[<code> <name> [] []]]
["60" iadd]
@@ -397,7 +397,7 @@
["6F" ddiv]
["73" drem]
["77" dneg])
- <conversions> (template [<code> <name>]
+ <conversions> (with_template [<code> <name>]
[[<code> <name> [] []]]
["88" l2i]
@@ -418,7 +418,7 @@
["91" i2b]
["92" i2c]
["93" i2s])
- <comparisons> (template [<code> <name>]
+ <comparisons> (with_template [<code> <name>]
[[<code> <name> [] []]]
["94" lcmp]
@@ -428,7 +428,7 @@
["97" dcmpl]
["98" dcmpg])
- <returns> (template [<code> <name>]
+ <returns> (with_template [<code> <name>]
[[<code> <name> [] []]]
["AC" ireturn]
@@ -438,7 +438,7 @@
["B0" areturn]
["B1" return]
)
- <jumps> (template [<code> <name>]
+ <jumps> (with_template [<code> <name>]
[[<code> <name> [[jump Jump]] [jump]]]
["99" ifeq]
@@ -463,22 +463,22 @@
["C6" ifnull]
["C7" ifnonnull])
- <fields> (template [<code> <name>]
+ <fields> (with_template [<code> <name>]
[[<code> <name> [[index (Index (Reference Value))]] [(///index.value index)]]]
["B2" getstatic/1] ["B2" getstatic/2]
["B3" putstatic/1] ["B3" putstatic/2]
["B4" getfield/1] ["B4" getfield/2]
["B5" putfield/1] ["B5" putfield/2])]
- (template [<arity> <definitions>]
+ (with_template [<arity> <definitions>]
[(with_expansions [<definitions>' (template.spliced <definitions>)]
- (template [<code> <name> <instruction_inputs> <arity_inputs>]
+ (with_template [<code> <name> <instruction_inputs> <arity_inputs>]
[(with_expansions [<inputs>' (template.spliced <instruction_inputs>)
- <input_types> (template [<input_name> <input_type>]
+ <input_types> (with_template [<input_name> <input_type>]
[<input_type>]
<inputs>')
- <input_names> (template [<input_name> <input_type>]
+ <input_names> (with_template [<input_name> <input_type>]
[<input_name>]
<inputs>')]
diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux
index 9c224c715..f365b2391 100644
--- a/stdlib/source/library/lux/target/jvm/class.lux
+++ b/stdlib/source/library/lux/target/jvm/class.lux
@@ -129,7 +129,7 @@
(def: .public (writer class)
(Writer Class)
(`` (all binaryF#composite
- (~~ (template [<writer> <slot>]
+ (~~ (with_template [<writer> <slot>]
[(<writer> (the <slot> class))]
[//magic.writer #magic]
@@ -139,7 +139,7 @@
[//modifier.writer #modifier]
[//index.writer #this]
[//index.writer #super]))
- (~~ (template [<writer> <slot>]
+ (~~ (with_template [<writer> <slot>]
[((binaryF.sequence_16 <writer>) (the <slot> class))]
[//index.writer #interfaces]
diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux
index 93b959f5d..f8ca85cc0 100644
--- a/stdlib/source/library/lux/target/jvm/constant.lux
+++ b/stdlib/source/library/lux/target/jvm/constant.lux
@@ -97,7 +97,7 @@
(|>> representation)
Equivalence<kind>))
- (template [<constructor> <type> <marker>]
+ (with_template [<constructor> <type> <marker>]
[(type: .public <type>
(Value <marker>))
@@ -112,7 +112,7 @@
[string String (Index UTF8)]
)
- (template [<writer_name> <type> <write> <writer>]
+ (with_template [<writer_name> <type> <write> <writer>]
[(def: <writer_name>
(Writer <type>)
(`` (|>> representation
@@ -137,7 +137,7 @@
[#class (Index Class)
#name_and_type (Index (Name_And_Type of))]))
-(template [<type> <equivalence> <writer>]
+(with_template [<type> <equivalence> <writer>]
[(def: .public <equivalence>
(Equivalence (<type> Any))
(all product.equivalence
@@ -184,7 +184,7 @@
(implementation
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> reference} {<tag> sample}]
(at <equivalence> = reference sample)])
([#UTF8 text.equivalence]
@@ -242,7 +242,7 @@
)]
(function (_ value)
(case value
- (^.template [<case> <tag> <writer>]
+ (^.with_template [<case> <tag> <writer>]
[{<case> value}
(binaryF#composite (/tag.writer <tag>)
(<writer> value))])
diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux
index 129659e05..b69d7ef21 100644
--- a/stdlib/source/library/lux/target/jvm/constant/pool.lux
+++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux
@@ -76,64 +76,69 @@
failure
(as_expected failure)))))
-(template: (try|each <binding> <value> <body>)
- [(case <value>
- {try.#Success <binding>}
- <body>
-
- ... {try.#Failure error}
- failure
- (as_expected failure))])
-
-(template: (try|in <it>)
- [{try.#Success <it>}])
-
-(template: (!add <state> <tag> <equivalence> <value>)
- [(let [[current pool] <state>
- <value>' <value>]
- (with_expansions [<try_again> (these (again (.++ idx)))]
- (loop (again [idx 0])
- (case (sequence.item idx pool)
- {try.#Success entry}
- (case entry
- [index {<tag> reference}]
- (if (at <equivalence> = reference <value>')
- {try.#Success [[current pool]
- index]}
+(def: try|each
+ (template (_ <binding> <value> <body>)
+ [(case <value>
+ {try.#Success <binding>}
+ <body>
+
+ ... {try.#Failure error}
+ failure
+ (as_expected failure))]))
+
+(def: try|in
+ (template (_ <it>)
+ [{try.#Success <it>}]))
+
+(def: !add
+ (template (_ <state> <tag> <equivalence> <value>)
+ [(let [[current pool] <state>
+ <value>' <value>]
+ (with_expansions [<try_again> (these (again (.++ idx)))]
+ (loop (again [idx 0])
+ (case (sequence.item idx pool)
+ {try.#Success entry}
+ (case entry
+ [index {<tag> reference}]
+ (if (at <equivalence> = reference <value>')
+ {try.#Success [[current pool]
+ index]}
+ <try_again>)
+
+ _
<try_again>)
- _
- <try_again>)
-
- {try.#Failure _}
- (<| (let [new {<tag> <value>'}])
- (try|each @new (//unsigned.u2 (//.size new)))
- (try|each next (is (Try Index)
- (|> current
- //index.value
- (//unsigned.+/2 @new)
- (at try.monad each //index.index))))
- (try|in [[next
- (sequence.suffix [current new] pool)]
- current]))))))])
-
-(template: (/|do <state> <body>)
- [(function (_ <state>)
- <body>)])
-
-(template: (/|each <state> <binding> <value> <body>)
- [(case (<value> <state>)
- {try.#Success [<state> <binding>]}
- <body>
-
- ... {try.#Failure error}
- failure
- (as_expected failure))])
+ {try.#Failure _}
+ (<| (let [new {<tag> <value>'}])
+ (try|each @new (//unsigned.u2 (//.size new)))
+ (try|each next (is (Try Index)
+ (|> current
+ //index.value
+ (//unsigned.+/2 @new)
+ (at try.monad each //index.index))))
+ (try|in [[next
+ (sequence.suffix [current new] pool)]
+ current]))))))]))
+
+(def: /|do
+ (template (_ <state> <body>)
+ [(function (_ <state>)
+ <body>)]))
+
+(def: /|each
+ (template (_ <state> <binding> <value> <body>)
+ [(case (<value> <state>)
+ {try.#Success [<state> <binding>]}
+ <body>
+
+ ... {try.#Failure error}
+ failure
+ (as_expected failure))]))
(type: (Adder of)
(-> of (Resource (Index of))))
-(template [<name> <type> <tag> <equivalence>]
+(with_template [<name> <type> <tag> <equivalence>]
[(def: .public (<name> value)
(Adder <type>)
(<| (/|do %)
@@ -181,7 +186,7 @@
(/|each % @descriptor (..descriptor descriptor))
(!add % //.#Name_And_Type //.name_and_type_equivalence [//.#name @name //.#descriptor @descriptor])))
-(template [<name> <tag> <of>]
+(with_template [<name> <tag> <of>]
[(def: .public (<name> class member)
(-> External (Member <of>) (Resource (Index (Reference <of>))))
(<| (/|do %)
@@ -194,8 +199,9 @@
[interface_method //.#Interface_Method Method]
)
-(template: (!index <index>)
- [(|> <index> //index.value //unsigned.value)])
+(def: !index
+ (template (_ <index>)
+ [(|> <index> //index.value //unsigned.value)]))
(def: .public writer
(Writer Pool)
diff --git a/stdlib/source/library/lux/target/jvm/constant/tag.lux b/stdlib/source/library/lux/target/jvm/constant/tag.lux
index 7a859d75b..cf629c062 100644
--- a/stdlib/source/library/lux/target/jvm/constant/tag.lux
+++ b/stdlib/source/library/lux/target/jvm/constant/tag.lux
@@ -23,7 +23,7 @@
(u1//= (representation reference)
(representation sample))))
- (template [<code> <name>]
+ (with_template [<code> <name>]
[(def: .public <name>
Tag
(|> <code> ///unsigned.u1 try.trusted abstraction))]
diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux
index a70a557de..9f94e12c1 100644
--- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux
+++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux
@@ -47,7 +47,7 @@
"Value" (%.int value)
"Scope (in bytes)" (%.nat scope)))
- (template [<bytes> <name> <size> <constructor> <maximum> <minimum> <+> <->]
+ (with_template [<bytes> <name> <size> <constructor> <maximum> <minimum> <+> <->]
[(with_expansions [<raw> (template.symbol [<name> "'"])]
(primitive: <raw> Any)
(type: .public <name> (Signed <raw>)))
@@ -75,7 +75,7 @@
{try.#Success (abstraction value)}
(exception.except ..value_exceeds_the_scope [value <size>])))))
- (template [<abstract_operation> <concrete_operation>]
+ (with_template [<abstract_operation> <concrete_operation>]
[(def: .public (<abstract_operation> parameter subject)
(-> <name> <name> (Try <name>))
(<constructor>
@@ -91,7 +91,7 @@
[4 S4 bytes/4 s4 maximum/4 minimum/4 +/4 -/4]
)
- (template [<name> <from> <to>]
+ (with_template [<name> <from> <to>]
[(def: .public <name>
(-> <from> <to>)
(|>> transmutation))]
@@ -100,7 +100,7 @@
[lifted/4 S2 S4]
)
- (template [<writer_name> <type> <writer>]
+ (with_template [<writer_name> <type> <writer>]
[(def: .public <writer_name>
(Writer <type>)
(|>> representation <writer>))]
diff --git a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux
index 8bbc74213..6126469a4 100644
--- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux
+++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux
@@ -59,7 +59,7 @@
"Parameter" (%.nat (representation parameter))
"Subject" (%.nat (representation subject))))
- (template [<bytes> <name> <size> <constructor> <maximum> <+> <-> <max>]
+ (with_template [<bytes> <name> <size> <constructor> <maximum> <+> <-> <max>]
[(with_expansions [<raw> (template.symbol [<name> "'"])]
(primitive: .public <raw> Any)
(type: .public <name> (Unsigned <raw>)))
@@ -100,7 +100,7 @@
[4 U4 bytes/4 u4 maximum/4 +/4 -/4 max/4]
)
- (template [<name> <from> <to>]
+ (with_template [<name> <from> <to>]
[(def: .public <name>
(-> <from> <to>)
(|>> transmutation))]
@@ -109,7 +109,7 @@
[lifted/4 U2 U4]
)
- (template [<writer_name> <type> <writer>]
+ (with_template [<writer_name> <type> <writer>]
[(def: .public <writer_name>
(Writer <type>)
(|>> representation <writer>))]
diff --git a/stdlib/source/library/lux/target/jvm/field.lux b/stdlib/source/library/lux/target/jvm/field.lux
index 196bd76f2..32ef049e5 100644
--- a/stdlib/source/library/lux/target/jvm/field.lux
+++ b/stdlib/source/library/lux/target/jvm/field.lux
@@ -51,7 +51,7 @@
(def: .public (writer field)
(Writer Field)
(`` (all binaryF#composite
- (~~ (template [<writer> <slot>]
+ (~~ (with_template [<writer> <slot>]
[(<writer> (the <slot> field))]
[modifier.writer #modifier]
diff --git a/stdlib/source/library/lux/target/jvm/method.lux b/stdlib/source/library/lux/target/jvm/method.lux
index 261ae04f6..57cc56e41 100644
--- a/stdlib/source/library/lux/target/jvm/method.lux
+++ b/stdlib/source/library/lux/target/jvm/method.lux
@@ -99,7 +99,7 @@
(def: .public (writer field)
(Writer Method)
(`` (all format#composite
- (~~ (template [<writer> <slot>]
+ (~~ (with_template [<writer> <slot>]
[(<writer> (the <slot> field))]
[//modifier.writer #modifier]
diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux
index 68d8d8b7b..3900196fe 100644
--- a/stdlib/source/library/lux/target/jvm/modifier.lux
+++ b/stdlib/source/library/lux/target/jvm/modifier.lux
@@ -38,16 +38,18 @@
(representation reference)
(representation sample))))
- (template: (!wrap value)
- [(|> value
- //unsigned.u2
- try.trusted
- abstraction)])
+ (def: !wrap
+ (template (_ value)
+ [(|> value
+ //unsigned.u2
+ try.trusted
+ abstraction)]))
- (template: (!unwrap value)
- [(|> value
- representation
- //unsigned.value)])
+ (def: !unwrap
+ (template (_ value)
+ [(|> value
+ representation
+ //unsigned.value)]))
(def: .public (has? sub super)
(All (_ of) (-> (Modifier of) (Modifier of) Bit))
@@ -82,7 +84,7 @@
(syntax (_ [ofT <code>.any
options (<>.many <code>.any)])
(with_symbols [g!modifier g!code]
- (in (list (` (template [(~ g!code) (~ g!modifier)]
+ (in (list (` (with_template [(~ g!code) (~ g!modifier)]
[(def: (~' .public) (~ g!modifier)
(..Modifier (~ ofT))
((~! ..modifier) ((~! number.hex) (~ g!code))))]
diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux
index d903e9fa0..5a76db47d 100644
--- a/stdlib/source/library/lux/target/jvm/reflection.lux
+++ b/stdlib/source/library/lux/target/jvm/reflection.lux
@@ -100,7 +100,7 @@
(exception.report
"Class" (%.text class)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [jvm_type java/lang/reflect/Type])
(exception.report
"Type" (java/lang/reflect/Type::getTypeName jvm_type)
@@ -135,7 +135,7 @@
(let [class_name (|> class
(as (java/lang/Class java/lang/Object))
java/lang/Class::getName)]
- (`` (if (or (~~ (template [<reflection>]
+ (`` (if (or (~~ (with_template [<reflection>]
[(text#= (/reflection.reflection <reflection>)
class_name)]
@@ -185,7 +185,7 @@
... allow for multiple ones.
(case [(array.item 0 (java/lang/reflect/WildcardType::getLowerBounds reflection))
(array.item 0 (java/lang/reflect/WildcardType::getUpperBounds reflection))]
- (^.template [<pattern> <kind>]
+ (^.with_template [<pattern> <kind>]
[<pattern>
(case (ffi.as java/lang/reflect/GenericArrayType bound)
{.#Some it}
@@ -226,7 +226,7 @@
(let [class_name (|> reflection
(as (java/lang/Class java/lang/Object))
java/lang/Class::getName)]
- (`` (cond (~~ (template [<reflection> <type>]
+ (`` (cond (~~ (with_template [<reflection> <type>]
[(text#= (/reflection.reflection <reflection>)
class_name)
{try.#Success <type>}]
@@ -335,7 +335,7 @@
"Owner" (java/lang/Object::toString owner)
"Target" (java/lang/Object::toString target)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [field Text
class (java/lang/Class java/lang/Object)])
(exception.report
@@ -366,7 +366,7 @@
list.empty?
not))
-(template [<name> <exception> <then?> <else?>]
+(with_template [<name> <exception> <then?> <else?>]
[(def: .public (<name> field class)
(-> Text (java/lang/Class java/lang/Object) (Try [Bit Bit (/.Type Value)]))
(do [! try.monad]
diff --git a/stdlib/source/library/lux/target/jvm/type.lux b/stdlib/source/library/lux/target/jvm/type.lux
index cdf8690e9..268743ce0 100644
--- a/stdlib/source/library/lux/target/jvm/type.lux
+++ b/stdlib/source/library/lux/target/jvm/type.lux
@@ -42,7 +42,7 @@
#super_class (Type Class)
#super_interfaces (List (Type Class))]))
- (template [<name> <style>]
+ (with_template [<name> <style>]
[(def: .public (<name> type)
(All (_ category) (-> (Type category) (<style> category)))
(let [[signature descriptor reflection] (representation type)]
@@ -59,7 +59,7 @@
(let [[signature descriptor reflection] (representation type)]
reflection))
- (template [<category> <name> <signature> <descriptor> <reflection>]
+ (with_template [<category> <name> <signature> <descriptor> <reflection>]
[(def: .public <name>
(Type <category>)
(abstraction [<signature> <descriptor> <reflection>]))]
@@ -166,7 +166,7 @@
(def: .public (primitive? type)
(-> (Type Value) (Either (Type Object)
(Type Primitive)))
- (if (`` (or (~~ (template [<type>]
+ (if (`` (or (~~ (with_template [<type>]
[(at ..equivalence = (is (Type Value) <type>) type)]
[..boolean]
@@ -183,7 +183,7 @@
(def: .public (void? type)
(-> (Type Return) (Either (Type Value)
(Type Void)))
- (if (`` (or (~~ (template [<type>]
+ (if (`` (or (~~ (with_template [<type>]
[(at ..equivalence = (is (Type Return) <type>) type)]
[..void]))))
diff --git a/stdlib/source/library/lux/target/jvm/type/alias.lux b/stdlib/source/library/lux/target/jvm/type/alias.lux
index 26462ac28..2d6cb7c49 100644
--- a/stdlib/source/library/lux/target/jvm/type/alias.lux
+++ b/stdlib/source/library/lux/target/jvm/type/alias.lux
@@ -52,7 +52,7 @@
(<>.after (<text>.this //descriptor.class_prefix))
(<>.before (<text>.this //descriptor.class_suffix))))
-(template [<name> <prefix> <bound> <constructor>]
+(with_template [<name> <prefix> <bound> <constructor>]
[(def: <name>
(-> (Parser (Type Class)) (Parser (Type Parameter)))
(|>> (<>.after (<text>.this <prefix>))
diff --git a/stdlib/source/library/lux/target/jvm/type/box.lux b/stdlib/source/library/lux/target/jvm/type/box.lux
index b50bffce2..08a6e1213 100644
--- a/stdlib/source/library/lux/target/jvm/type/box.lux
+++ b/stdlib/source/library/lux/target/jvm/type/box.lux
@@ -5,7 +5,7 @@
[encoding
[name (.only External)]]])
-(template [<name> <box>]
+(with_template [<name> <box>]
[(def: .public <name> External <box>)]
[boolean "java.lang.Boolean"]
diff --git a/stdlib/source/library/lux/target/jvm/type/category.lux b/stdlib/source/library/lux/target/jvm/type/category.lux
index e70d645d6..03e389d2a 100644
--- a/stdlib/source/library/lux/target/jvm/type/category.lux
+++ b/stdlib/source/library/lux/target/jvm/type/category.lux
@@ -21,7 +21,7 @@
(primitive: (Parameter' brand) Any)
(type: .public Parameter (<| Return' Value' Object' Parameter' Any))
-(template [<parents> <child>]
+(with_template [<parents> <child>]
[(with_expansions [<raw> (template.symbol [<child> "'"])]
(primitive: <raw> Any)
(type: .public <child>
diff --git a/stdlib/source/library/lux/target/jvm/type/descriptor.lux b/stdlib/source/library/lux/target/jvm/type/descriptor.lux
index ba72068a8..d063eecb7 100644
--- a/stdlib/source/library/lux/target/jvm/type/descriptor.lux
+++ b/stdlib/source/library/lux/target/jvm/type/descriptor.lux
@@ -28,7 +28,7 @@
(-> (Descriptor Any) Text)
(|>> representation))
- (template [<sigil> <category> <name>]
+ (with_template [<sigil> <category> <name>]
[(def: .public <name>
(Descriptor <category>)
(abstraction <sigil>))]
@@ -62,7 +62,7 @@
(-> (Descriptor Declaration) (Descriptor Class))
(|>> transmutation))
- (template [<name> <category>]
+ (with_template [<name> <category>]
[(def: .public <name>
(Descriptor <category>)
(transmutation
diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux
index b63cafeab..96fa31b11 100644
--- a/stdlib/source/library/lux/target/jvm/type/lux.lux
+++ b/stdlib/source/library/lux/target/jvm/type/lux.lux
@@ -29,7 +29,7 @@
[encoding
["[1][0]" name]]]])
-(template [<name>]
+(with_template [<name>]
[(primitive: .public (<name> class) Any)]
[Lower] [Upper]
@@ -51,7 +51,7 @@
(<>.after //parser.void
(<>#in (check#in .Any))))
-(template [<name> <parser> <reflection>]
+(with_template [<name> <parser> <reflection>]
[(def: <name>
(Parser (Check Type))
(<>.after <parser>
@@ -67,7 +67,7 @@
[char //parser.char //reflection.char]
)
-(template [<name> <parser> <box>]
+(with_template [<name> <parser> <box>]
[(def: <name>
(Parser (Check Type))
(<>.after <parser>
@@ -140,7 +140,7 @@
(<>.after (<text>.this //descriptor.class_prefix))
(<>.before (<text>.this //descriptor.class_suffix))))
-(template [<name> <prefix> <constructor>]
+(with_template [<name> <prefix> <constructor>]
[(def: <name>
(-> (Parser (Check Type)) (Parser (Check Type)))
(|> (<>.after (<text>.this <prefix>))
@@ -174,7 +174,7 @@
(|>> (<>#each (check#each (function (_ elementT)
(case elementT
{.#Primitive name {.#End}}
- (if (`` (or (~~ (template [<reflection>]
+ (if (`` (or (~~ (with_template [<reflection>]
[(text#= (//reflection.reflection <reflection>) name)]
[//reflection.boolean]
diff --git a/stdlib/source/library/lux/target/jvm/type/parser.lux b/stdlib/source/library/lux/target/jvm/type/parser.lux
index 54be9b30b..166b2d984 100644
--- a/stdlib/source/library/lux/target/jvm/type/parser.lux
+++ b/stdlib/source/library/lux/target/jvm/type/parser.lux
@@ -22,7 +22,7 @@
[encoding
["[1][0]" name (.only External)]]]])
-(template [<category> <name> <signature> <type>]
+(with_template [<category> <name> <signature> <type>]
[(def: .public <name>
(Parser (Type <category>))
(<>.after (<text>.this (//signature.signature <signature>))
@@ -65,7 +65,7 @@
(def: class/set
(format var/tail //name.internal_separator))
-(template [<type> <name> <head> <tail> <adapter>]
+(with_template [<type> <name> <head> <tail> <adapter>]
[(def: .public <name>
(Parser <type>)
(at <>.functor each <adapter>
@@ -100,7 +100,7 @@
(<text>.result ..var')
try.trusted))
-(template [<name> <prefix> <constructor>]
+(with_template [<name> <prefix> <constructor>]
[(def: <name>
(-> (Parser (Type Parameter)) (Parser (Type Parameter)))
(|>> (<>.after (<text>.this <prefix>))
@@ -163,7 +163,7 @@
(Parser (Type Class))
(..class' ..parameter))
-(template [<name> <prefix> <constructor>]
+(with_template [<name> <prefix> <constructor>]
[(def: .public <name>
(-> (Type Value) (Maybe (Type Parameter)))
(|>> //.signature
@@ -238,7 +238,7 @@
(<text>.result parser)
try.trusted)))
-(template [<name> <category> <parser>]
+(with_template [<name> <category> <parser>]
[(def: .public <name>
(-> (Type Value) (Maybe <category>))
(|>> //.signature
diff --git a/stdlib/source/library/lux/target/jvm/type/reflection.lux b/stdlib/source/library/lux/target/jvm/type/reflection.lux
index de9afb234..37f1a7eab 100644
--- a/stdlib/source/library/lux/target/jvm/type/reflection.lux
+++ b/stdlib/source/library/lux/target/jvm/type/reflection.lux
@@ -28,7 +28,7 @@
(def: (= parameter subject)
(text#= (representation parameter) (representation subject))))
- (template [<category> <name> <reflection>]
+ (with_template [<category> <name> <reflection>]
[(def: .public <name>
(Reflection <category>)
(abstraction <reflection>))]
@@ -62,7 +62,7 @@
elementR (`` (cond (text.starts_with? //descriptor.array_prefix element')
element'
- (~~ (template [<primitive> <descriptor>]
+ (~~ (with_template [<primitive> <descriptor>]
[(at ..equivalence = <primitive> element)
(//descriptor.descriptor <descriptor>)]
@@ -84,7 +84,7 @@
(format //descriptor.array_prefix)
abstraction)))
- (template [<name> <category>]
+ (with_template [<name> <category>]
[(def: .public <name>
(Reflection <category>)
(transmutation
diff --git a/stdlib/source/library/lux/target/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux
index f66989972..1c35b96f7 100644
--- a/stdlib/source/library/lux/target/jvm/type/signature.lux
+++ b/stdlib/source/library/lux/target/jvm/type/signature.lux
@@ -27,7 +27,7 @@
(-> (Signature Any) Text)
(|>> representation))
- (template [<category> <name> <descriptor>]
+ (with_template [<category> <name> <descriptor>]
[(def: .public <name>
(Signature <category>)
(abstraction (//descriptor.descriptor <descriptor>)))]
@@ -53,7 +53,7 @@
(Signature Parameter)
(abstraction "*"))
- (template [<char> <name>]
+ (with_template [<char> <name>]
[(def: .public <name> <char>)]
["T" var_prefix]
@@ -69,7 +69,7 @@
["^" exception_prefix]
)
- (template [<name> <prefix>]
+ (with_template [<name> <prefix>]
[(def: .public <name>
(-> (Signature Parameter) (Signature Parameter))
(|>> representation (format <prefix>) abstraction))]
diff --git a/stdlib/source/library/lux/target/jvm/version.lux b/stdlib/source/library/lux/target/jvm/version.lux
index 9e3d7a33b..60778c7f7 100644
--- a/stdlib/source/library/lux/target/jvm/version.lux
+++ b/stdlib/source/library/lux/target/jvm/version.lux
@@ -17,7 +17,7 @@
//unsigned.u2
try.trusted))
-(template [<number> <name>]
+(with_template [<number> <name>]
[(def: .public <name>
Major
(|> <number>
diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux
index 51c4ac911..2c92e2c18 100644
--- a/stdlib/source/library/lux/target/lua.lux
+++ b/stdlib/source/library/lux/target/lua.lux
@@ -63,7 +63,7 @@
(-> (Code Any) Text)
(|>> representation))
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: (<brand> brand) Any)
(`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))]
@@ -74,7 +74,7 @@
[Statement [Code]]
)
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: <brand> Any)
(`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))]
@@ -123,7 +123,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -195,7 +195,7 @@
(format (representation table) ":" method)
abstraction))
- (template [<op> <name>]
+ (with_template [<op> <name>]
[(def: .public (<name> parameter subject)
(-> Expression Expression Expression)
(abstraction (format "("
@@ -228,7 +228,7 @@
[">>" bit_shr]
)
- (template [<name> <unary>]
+ (with_template [<name> <unary>]
[(def: .public (<name> subject)
(-> Expression Expression)
(abstraction (format "(" <unary> " " (representation subject) ")")))]
@@ -237,7 +237,7 @@
[opposite "-"]
)
- (template [<name> <type>]
+ (with_template [<name> <type>]
[(def: .public <name>
(-> Text <type>)
(|>> abstraction))]
@@ -340,7 +340,7 @@
(text.enclosed ["(" ")"])
abstraction))
- (template [<name> <code> <binding>]
+ (with_template [<name> <code> <binding>]
[(def: .public (<name> name args body!)
(-> <binding> (List Var) Statement Statement)
(abstraction
@@ -385,11 +385,11 @@
(syntax (_ [arity <code>.nat])
(in (list.repeated arity (` ..Expression)))))
-(template [<arity> <function>+]
+(with_template [<arity> <function>+]
[(with_expansions [<inputs> (arity_inputs <arity>)
<types> (arity_types <arity>)
<definitions> (template.spliced <function>+)]
- (template [<function>]
+ (with_template [<function>]
[(`` (def: .public ((~~ (template.symbol [<function> "/" <arity>])) <inputs>)
(-> <types> Computation)
(..apply (.list <inputs>) (..var <function>))))]
diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux
index 73581a5e0..a100adb9f 100644
--- a/stdlib/source/library/lux/target/php.lux
+++ b/stdlib/source/library/lux/target/php.lux
@@ -71,7 +71,7 @@
(-> (Code Any) Text)
(|>> representation))
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: (<brand> brand) Any)
(`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))]
@@ -82,7 +82,7 @@
[Statement [Code]]
)
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: .public <brand> Any)
(`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))]
@@ -110,7 +110,7 @@
(-> Text Var)
(|>> (format "$") abstraction))
- (template [<name> <type>]
+ (with_template [<name> <type>]
[(def: .public <name>
(-> Text <type>)
(|>> abstraction))]
@@ -164,7 +164,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -209,7 +209,7 @@
(text.interposed ..input_separator)
..group))
- (template [<name> <reference?>]
+ (with_template [<name> <reference?>]
[(def: .public <name>
(-> Var Argument)
(|>> [<reference?>]))]
@@ -244,7 +244,7 @@
(syntax (_ [arity <code>.nat])
(in (list.repeated arity (` ..Expression)))))
- (template [<arity> <function>+]
+ (with_template [<arity> <function>+]
[(with_expansions [<apply> (template.symbol ["apply/" <arity>])
<inputs> (arity_inputs <arity>)
<types> (arity_types <arity>)
@@ -253,7 +253,7 @@
(-> Expression [<types>] Computation)
(..apply (.list <inputs>) function))
- (template [<function>]
+ (with_template [<function>]
[(`` (def: .public (~~ (template.symbol [<function> "/" <arity>]))
(<apply> (..constant <function>))))]
@@ -369,7 +369,7 @@
..group
abstraction))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> parameter subject)
(-> Expression Expression Computation)
(|> (format (representation subject) " " <op> " " (representation parameter))
@@ -397,7 +397,7 @@
[concat "."]
)
- (template [<unary> <name>]
+ (with_template [<unary> <name>]
[(def: .public <name>
(-> Computation Computation)
(|>> representation (format <unary>) abstraction))]
@@ -421,7 +421,7 @@
(-> Var Computation)
(..apply/1 [var] (..constant "isset")))
- (template [<name> <modifier>]
+ (with_template [<name> <modifier>]
[(def: .public <name>
(-> Var Statement)
(|>> representation (format <modifier> " ") (text.suffix ..statement_suffix) abstraction))]
@@ -429,7 +429,7 @@
[define_global "global"]
)
- (template [<name> <modifier> <location>]
+ (with_template [<name> <modifier> <location>]
[(def: .public (<name> location value)
(-> <location> Expression Statement)
(abstraction (format <modifier> " " (representation location)
@@ -503,7 +503,7 @@
(list#each catch)
(text.interposed \n+)))))
- (template [<name> <keyword>]
+ (with_template [<name> <keyword>]
[(def: .public <name>
(-> Expression Statement)
(|>> representation (format <keyword> " ") (text.suffix ..statement_suffix) abstraction))]
@@ -527,7 +527,7 @@
" "
(..block (representation body!)))))
- (template [<name> <keyword>]
+ (with_template [<name> <keyword>]
[(def: .public <name>
Statement
(|> <keyword>
diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux
index 03033e4be..1d9f93737 100644
--- a/stdlib/source/library/lux/target/python.lux
+++ b/stdlib/source/library/lux/target/python.lux
@@ -80,7 +80,7 @@
(-> (Code Any) Text)
(|>> representation))
- (template [<type> <super>]
+ (with_template [<type> <super>]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(`` (primitive: (<brand> brand) Any))
(`` (type: .public (<type> brand)
@@ -93,7 +93,7 @@
[Statement Code]
)
- (template [<type> <super>]
+ (with_template [<type> <super>]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(`` (primitive: <brand> Any))
(`` (type: .public <type> (<super> <brand>))))]
@@ -103,7 +103,7 @@
[Loop Statement]
)
- (template [<var> <brand>]
+ (with_template [<var> <brand>]
[(primitive: .public <brand> Any)
(type: .public <var> (Var <brand>))]
@@ -117,7 +117,7 @@
(-> Text SVar)
(|>> abstraction))
- (template [<name> <brand> <prefix>]
+ (with_template [<name> <brand> <prefix>]
[(def: .public <name>
(-> SVar (Var <brand>))
(|>> representation (format <prefix>) abstraction))]
@@ -147,7 +147,7 @@
(def: .public float
(-> Frac Literal)
- (`` (|>> (pipe.cond (~~ (template [<test> <python>]
+ (`` (|>> (pipe.cond (~~ (with_template [<test> <python>]
[[<test>]
[(pipe.new (format "float(" text.double_quote <python> text.double_quote ")") [])]]
@@ -162,7 +162,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -203,7 +203,7 @@
text.together)
right_delimiter))))
- (template [<name> <pre> <post>]
+ (with_template [<name> <pre> <post>]
[(def: .public <name>
(-> (List (Expression Any)) Literal)
(composite_literal <pre> <post> ..code))]
@@ -237,7 +237,7 @@
(|> args (list#each ..code) (text.interposed ..input_separator))
")")))
- (template [<name> <brand> <prefix>]
+ (with_template [<name> <brand> <prefix>]
[(def: .public <name>
(-> (Expression Any) (Expression Any))
(|>> representation
@@ -268,7 +268,7 @@
..expression
(format (representation then) " if " (representation test) " else " (representation else))))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> (Expression Any) (Expression Any) (Computation Any))
(<| abstraction
@@ -300,7 +300,7 @@
[in? "in"]
)
- (template [<name> <unary>]
+ (with_template [<name> <unary>]
[(def: .public (<name> subject)
(-> (Expression Any) (Computation Any))
(<| abstraction
@@ -356,7 +356,7 @@
\n+
(representation post!))))
- (template [<keyword> <0>]
+ (with_template [<keyword> <0>]
[(def: .public <0>
(Statement Any)
(abstraction <keyword>))]
@@ -410,7 +410,7 @@
(..nested (representation catch!)))))
text.together))))
- (template [<name> <keyword> <pre>]
+ (with_template [<name> <keyword> <pre>]
[(def: .public (<name> value)
(-> (Expression Any) (Statement Any))
(abstraction
@@ -463,10 +463,10 @@
(syntax (_ [arity <code>.nat])
(in (list.repeated arity (` (Expression Any))))))
-(template [<arity> <function>+]
+(with_template [<arity> <function>+]
[(with_expansions [<inputs> (arity_inputs <arity>)
<definitions> (template.spliced <function>+)]
- (template [<function>]
+ (with_template [<function>]
[(`` (def: .public ((~~ (template.symbol [<function> "/" <arity>])) <inputs>)
(-> (~~ (arity_types <arity>)) (Computation Any))
(..apply (.list <inputs>) (..var <function>))))]
diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux
index 15cf46b21..0a4a61863 100644
--- a/stdlib/source/library/lux/target/r.lux
+++ b/stdlib/source/library/lux/target/r.lux
@@ -25,7 +25,7 @@
(primitive: .public (Code kind)
Text
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<kind> (template.symbol [<type> "'"])]
(primitive: .public (<kind> kind) Any)
(`` (type: .public <type> (|> Any <kind> (~~ (template.spliced <super>+))))))]
@@ -33,7 +33,7 @@
[Expression [Code]]
)
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<kind> (template.symbol [<type> "'"])]
(primitive: .public (<kind> kind) Any)
(`` (type: .public (<type> <brand>) (|> <brand> <kind> (~~ (template.spliced <super>+))))))]
@@ -41,7 +41,7 @@
[Var [Expression' Code]]
)
- (template [<var> <kind>]
+ (with_template [<var> <kind>]
[(primitive: .public <kind> Any)
(type: .public <var> (Var <kind>))]
@@ -94,7 +94,7 @@
(..nested (representation expression))
\n+ "}")))
- (template [<name> <r>]
+ (with_template [<name> <r>]
[(def: .public <name>
Expression
(abstraction <r>))]
@@ -103,7 +103,7 @@
[n/a "NA"]
)
- (template [<name>]
+ (with_template [<name>]
[(def: .public <name> Expression n/a)]
[not_available]
@@ -139,7 +139,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -183,7 +183,7 @@
..nested)
")"))))
- (template [<name> <function>]
+ (with_template [<name> <function>]
[(def: .public (<name> members)
(-> (List Expression) Expression)
(..apply members (..var <function>)))]
@@ -221,7 +221,7 @@
(syntax (_ [arity <code>.nat])
(in (list.repeated arity (` ..Expression)))))
- (template [<arity> <function>+]
+ (with_template [<arity> <function>+]
[(with_expansions [<apply> (template.symbol ["apply/" <arity>])
<inputs> (arity_inputs <arity>)
<types> (arity_types <arity>)
@@ -230,7 +230,7 @@
(-> Expression [<types>] Expression)
(..apply (.list <inputs>) function))
- (template [<function>]
+ (with_template [<function>]
[(`` (def: .public (~~ (template.symbol [<function> "/" <arity>]))
(-> [<types>] Expression)
(<apply> (..var <function>))))]
@@ -275,7 +275,7 @@
else
(list.reversed clauses)))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Expression Expression Expression)
(..self_contained
@@ -298,7 +298,7 @@
[and "&&"]
)
- (template [<name> <func>]
+ (with_template [<name> <func>]
[(def: .public (<name> param subject)
(-> Expression Expression Expression)
(..apply (.list subject param) (..var <func>)))]
@@ -314,7 +314,7 @@
(-> Expression Expression)
(..apply (.list subject) (..var "bitwNot")))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public <name>
(-> Expression Expression)
(|>> representation (format <op>) ..self_contained))]
@@ -366,7 +366,7 @@
(format "for (" (representation var) " in " (representation inputs) ")"
(.._block (representation body)))))
- (template [<name> <keyword>]
+ (with_template [<name> <keyword>]
[(def: .public (<name> message)
(-> Expression Expression)
(..apply (.list message) (..var <keyword>)))]
diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux
index 3942e8af0..238bc052f 100644
--- a/stdlib/source/library/lux/target/ruby.lux
+++ b/stdlib/source/library/lux/target/ruby.lux
@@ -57,7 +57,7 @@
(-> (Code Any) Text)
(|>> representation))
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: (<brand> brand) Any)
(`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))]
@@ -70,7 +70,7 @@
[Statement [Code]]
)
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: <brand> Any)
(`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))]
@@ -85,7 +85,7 @@
[LVar** [LVar' Var' Location' Computation' Expression' Code]]
)
- (template [<var> <prefix> <constructor>]
+ (with_template [<var> <prefix> <constructor>]
[(def: .public <constructor>
(-> Text <var>)
(|>> (format <prefix>) abstraction))]
@@ -97,8 +97,8 @@
[SVar "@@" static]
)
- (template [<var> <prefix> <modifier> <unpacker>]
- [(template [<name> <input> <output>]
+ (with_template [<var> <prefix> <modifier> <unpacker>]
+ [(with_template [<name> <input> <output>]
[(def: .public <name>
(-> <input> <output>)
(|>> representation (format <prefix>) abstraction))]
@@ -111,7 +111,7 @@
[LVar** "**" variadic_kv double_splat]
)
- (template [<ruby_name> <lux_name>]
+ (with_template [<ruby_name> <lux_name>]
[(def: .public <lux_name>
GVar
(..global <ruby_name>))]
@@ -133,7 +133,7 @@
["stdin" stdin]
)
- (template [<ruby_name> <lux_name>]
+ (with_template [<ruby_name> <lux_name>]
[(def: .public <lux_name>
CVar
(..manual <ruby_name>))]
@@ -160,7 +160,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -175,7 +175,7 @@
))
)))
- (template [<format> <name> <type> <prep>]
+ (with_template [<format> <name> <type> <prep>]
[(def: .public <name>
(-> <type> Literal)
(|>> <prep> <format> abstraction))]
@@ -312,7 +312,7 @@
\n+ "else"
(..nested (representation else!)))))
- (template [<name> <control_structure>]
+ (with_template [<name> <control_structure>]
[(def: .public (<name> test then!)
(-> Expression Statement Statement)
(<| abstraction
@@ -365,7 +365,7 @@
(-> Expression Expression)
(abstraction (format "raise " (representation message))))
- (template [<name> <keyword>]
+ (with_template [<name> <keyword>]
[(def: .public <name>
Statement
(|> <keyword>
@@ -404,7 +404,7 @@
(text.enclosed ["(" ")"])
abstraction)))
- (template [<op> <name>]
+ (with_template [<op> <name>]
[(def: .public (<name> parameter subject)
(-> Expression Expression Computation)
(abstraction (format "(" (representation subject) " " <op> " " (representation parameter) ")")))]
@@ -432,7 +432,7 @@
[">>" bit_shr]
)
- (template [<unary> <name>]
+ (with_template [<unary> <name>]
[(def: .public (<name> subject)
(-> Expression Computation)
(abstraction (format "(" <unary> (representation subject) ")")))]
@@ -447,7 +447,7 @@
(abstraction (format "# " (..safe commentary) \n+
(representation on))))
- (template [<name>]
+ (with_template [<name>]
[(`` (def: .public ((~~ (template.symbol [<name> "/*"])) attributes)
(-> (List Text) Statement)
(..statement
@@ -493,12 +493,12 @@
(syntax (_ [arity <code>.nat])
(in (list.repeated arity (` ..Expression)))))
-(template [<arity> <function>+]
+(with_template [<arity> <function>+]
[(with_expansions [<apply> (template.symbol ["apply/" <arity>])
<inputs> (arity_inputs <arity>)
<types> (arity_types <arity>)
<definitions> (template.spliced <function>+)]
- (template [<function>]
+ (with_template [<function>]
[(`` (def: .public ((~~ (template.symbol [<function> "/" <arity>])) <inputs>)
(-> <types> Computation)
(..apply (.list <inputs>) {.#None} (..manual <function>))))]
diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux
index 09d717980..52e8862fc 100644
--- a/stdlib/source/library/lux/target/scheme.lux
+++ b/stdlib/source/library/lux/target/scheme.lux
@@ -46,14 +46,14 @@
(def: equivalence ..equivalence)
(def: hash (|>> representation (at text.hash hash))))
- (template [<type> <brand> <super>+]
+ (with_template [<type> <brand> <super>+]
[(primitive: .public (<brand> brand) Any)
(`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+)))))]
[Expression Expression' [Code]]
)
- (template [<type> <brand> <super>+]
+ (with_template [<type> <brand> <super>+]
[(primitive: .public <brand> Any)
(`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+)))))]
@@ -137,7 +137,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -178,7 +178,7 @@
(-> (List Expression) Expression Computation)
(..form {.#Item func args}))
- (template [<name> <function>]
+ (with_template [<name> <function>]
[(def: .public (<name> members)
(-> (List Expression) Computation)
(..apply members (..var <function>)))]
@@ -191,20 +191,20 @@
(-> Expression Computation)
(..apply (list)))
- (template [<lux_name> <scheme_name>]
+ (with_template [<lux_name> <scheme_name>]
[(def: .public <lux_name>
(apply/0 (..var <scheme_name>)))]
[newline/0 "newline"]
)
- (template [<apply> <arg>+ <type>+ <function>+]
+ (with_template [<apply> <arg>+ <type>+ <function>+]
[(`` (def: .public (<apply> procedure)
(-> Expression (~~ (template.spliced <type>+)) Computation)
(function (_ (~~ (template.spliced <arg>+)))
(..apply (list (~~ (template.spliced <arg>+))) procedure))))
- (`` (template [<definition> <function>]
+ (`` (with_template [<definition> <function>]
[(def: .public <definition> (<apply> (..var <function>)))]
(~~ (template.spliced <function>+))))]
@@ -273,7 +273,7 @@
(-> Expression Expression Computation)
(..form (list (..var "invoke") vector (..symbol "getRaw") index)))
- (template [<lux_name> <scheme_name>]
+ (with_template [<lux_name> <scheme_name>]
[(def: .public (<lux_name> param subject)
(-> Expression Expression Computation)
(..apply/2 (..var <scheme_name>) subject param))]
@@ -301,7 +301,7 @@
[bitwise_xor/2 "bitwise-xor"]
)
- (template [<lux_name> <scheme_name>]
+ (with_template [<lux_name> <scheme_name>]
[(def: .public <lux_name>
(-> (List Expression) Computation)
(|>> (partial_list (..var <scheme_name>)) ..form))]
@@ -310,7 +310,7 @@
[and "and"]
)
- (template [<lux_name> <scheme_name> <var> <pre>]
+ (with_template [<lux_name> <scheme_name> <var> <pre>]
[(def: .public (<lux_name> bindings body)
(-> (List [<var> Expression]) Expression Computation)
(..form (list (..var <scheme_name>)
diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux
index b3ec2b657..9e0244547 100644
--- a/stdlib/source/library/lux/test.lux
+++ b/stdlib/source/library/lux/test.lux
@@ -65,7 +65,7 @@
#expected_coverage (set.empty symbol.hash)
#actual_coverage (set.empty symbol.hash)])
-(template [<name> <category>]
+(with_template [<name> <category>]
[(def: <name>
Tally
(revised <category> .++ ..start))]
@@ -333,7 +333,7 @@
{.#None}
(set.has [module remaining] output))))
-(template [<macro> <function>]
+(with_template [<macro> <function>]
[(def: .public <macro>
(syntax (_ [coverage (<code>.tuple (<>.many <code>.any))
condition <code>.any])
diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux
index 8ccbec9dc..532961dcb 100644
--- a/stdlib/source/library/lux/time.lux
+++ b/stdlib/source/library/lux/time.lux
@@ -23,7 +23,7 @@
[/
["[0]" duration (.only Duration)]])
-(template [<name> <singular> <plural>]
+(with_template [<name> <singular> <plural>]
[(def: .public <name>
Nat
(.nat (duration.ticks <singular> <plural>)))]
@@ -56,7 +56,7 @@
(<>.after (<text>.this ".")))
(at <>.monad in 0)))
-(template [<maximum> <parser> <exception> <sub_parser>]
+(with_template [<maximum> <parser> <exception> <sub_parser>]
[(exception: .public (<exception> [value Nat])
(exception.report
"Value" (n#encoded value)
diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux
index 52ac839bd..54d7a90ff 100644
--- a/stdlib/source/library/lux/time/date.lux
+++ b/stdlib/source/library/lux/time/date.lux
@@ -92,7 +92,7 @@
{//month.#January}
..minimum_day)))
- (template [<name> <type> <field>]
+ (with_template [<name> <type> <field>]
[(def: .public <name>
(-> Date <type>)
(|>> representation (the <field>)))]
@@ -152,7 +152,7 @@
(<>.after (<text>.this ".")))
(at <>.monad in 0)))
-(template [<minimum> <maximum> <parser> <exception>]
+(with_template [<minimum> <maximum> <parser> <exception>]
[(exception: .public (<exception> [value Nat])
(exception.report
"Value" (n#encoded value)
diff --git a/stdlib/source/library/lux/time/day.lux b/stdlib/source/library/lux/time/day.lux
index 38d71e7fd..0d8b6a369 100644
--- a/stdlib/source/library/lux/time/day.lux
+++ b/stdlib/source/library/lux/time/day.lux
@@ -34,7 +34,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag>} {<tag>}]
#1])
([#Sunday]
@@ -101,7 +101,7 @@
(def: (encoded value)
(case value
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag>}
(text.replaced "#" "" (template.text [<tag>]))])
([..#Monday]
@@ -113,7 +113,7 @@
[..#Sunday])))
(def: (decoded value)
(case (text#composite "#" value)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (template.text [<tag>]))
{try.#Success {<tag>}}])
([..#Monday]
@@ -145,7 +145,7 @@
(def: .public (number day)
(-> Day Nat)
(case day
- (^.template [<number> <day>]
+ (^.with_template [<number> <day>]
[{<day>}
<number>])
(<pairs>)))
@@ -161,7 +161,7 @@
(def: .public (by_number number)
(-> Nat (Try Day))
(case number
- (^.template [<number> <day>]
+ (^.with_template [<number> <day>]
[<number>
{try.#Success {<day>}}])
(<pairs>)
@@ -176,7 +176,7 @@
(def: equivalence ..equivalence)
(def: (hash day)
(case day
- (^.template [<prime> <day>]
+ (^.with_template [<prime> <day>]
[{<day>}
<prime>])
([02 #Sunday]
diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux
index e2ba78067..c9869c08c 100644
--- a/stdlib/source/library/lux/time/duration.lux
+++ b/stdlib/source/library/lux/time/duration.lux
@@ -34,7 +34,7 @@
(-> Duration Int)
(|>> representation))
- (template [<op> <name>]
+ (with_template [<op> <name>]
[(def: .public (<name> param subject)
(-> Duration Duration Duration)
(abstraction (<op> (representation param) (representation subject))))]
@@ -43,7 +43,7 @@
[i.% framed]
)
- (template [<op> <name>]
+ (with_template [<op> <name>]
[(def: .public (<name> scalar)
(-> Nat Duration Duration)
(|>> representation (<op> (.int scalar)) abstraction))]
@@ -73,7 +73,7 @@
(def: (< param subject)
(i.< (representation param) (representation subject))))
- (template [<op> <name>]
+ (with_template [<op> <name>]
[(def: .public <name>
(-> Duration Bit)
(|>> representation (<op> +0)))]
@@ -90,7 +90,7 @@
(def: .public milli_second
(..of_millis +1))
-(template [<name> <scale> <base>]
+(with_template [<name> <scale> <base>]
[(def: .public <name>
(..up <scale> <base>))]
@@ -112,7 +112,7 @@
(def: identity ..empty)
(def: composite ..composite))
-(template [<value> <definition>]
+(with_template [<value> <definition>]
[(def: <definition> <value>)]
["D" day_suffix]
diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux
index 1c6ea5458..366bfe020 100644
--- a/stdlib/source/library/lux/time/instant.lux
+++ b/stdlib/source/library/lux/time/instant.lux
@@ -74,7 +74,7 @@
(Enum Instant)
(def: order ..order)
- (~~ (template [<name>]
+ (~~ (with_template [<name>]
[(def: <name>
(|>> representation (at i.enum <name>) abstraction))]
@@ -102,7 +102,7 @@
[(date.of_days days)
(duration.of_millis day_time)]))
-(template [<value> <definition>]
+(with_template [<value> <definition>]
[(def: <definition> Text <value>)]
["T" date_suffix]
@@ -188,7 +188,7 @@
(i.* +1,000))
))))
-(template [<field> <type> <post_processing>]
+(with_template [<field> <type> <post_processing>]
[(def: .public (<field> instant)
(-> Instant <type>)
(let [[date time] (..date_time instant)]
diff --git a/stdlib/source/library/lux/time/month.lux b/stdlib/source/library/lux/time/month.lux
index 99d5ae4bc..7e7ddc447 100644
--- a/stdlib/source/library/lux/time/month.lux
+++ b/stdlib/source/library/lux/time/month.lux
@@ -39,7 +39,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag>} {<tag>}]
true])
([#January]
@@ -73,7 +73,7 @@
(def: .public (number month)
(-> Month Nat)
(case month
- (^.template [<number> <month>]
+ (^.with_template [<number> <month>]
[{<month>}
<number>])
(<pairs>)))
@@ -89,7 +89,7 @@
(def: .public (by_number number)
(-> Nat (Try Month))
(case number
- (^.template [<number> <month>]
+ (^.with_template [<number> <month>]
[<number>
{try.#Success {<month>}}])
(<pairs>)
@@ -104,7 +104,7 @@
(def: equivalence ..equivalence)
(def: (hash month)
(case month
- (^.template [<prime> <month>]
+ (^.with_template [<prime> <month>]
[{<month>}
<prime>])
([02 #January]
@@ -167,7 +167,7 @@
(def: .public (days month)
(-> Month Nat)
(case month
- (^.template [<days> <month>]
+ (^.with_template [<days> <month>]
[{<month>}
<days>])
([31 #January]
@@ -216,7 +216,7 @@
(def: (encoded value)
(case value
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag>}
(text.replaced "#" "" (template.text [<tag>]))])
([..#January]
@@ -233,7 +233,7 @@
[..#December])))
(def: (decoded value)
(case (text#composite "#" value)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (template.text [<tag>]))
{try.#Success {<tag>}}])
([..#January]
diff --git a/stdlib/source/library/lux/time/year.lux b/stdlib/source/library/lux/time/year.lux
index d10df7456..135607980 100644
--- a/stdlib/source/library/lux/time/year.lux
+++ b/stdlib/source/library/lux/time/year.lux
@@ -60,7 +60,7 @@
(type: .public Period
Nat)
-(template [<period> <name>]
+(with_template [<period> <name>]
[(def: .public <name>
Period
<period>)]
@@ -95,7 +95,7 @@
(-- year)
(++ year))]
(`` (|> +0
- (~~ (template [<polarity> <years>]
+ (~~ (with_template [<polarity> <years>]
[(<polarity> (i./ (.int <years>) limit))]
[i.+ ..leap]
diff --git a/stdlib/source/library/lux/tool/compiler/arity.lux b/stdlib/source/library/lux/tool/compiler/arity.lux
index 055f46a63..c1e2796c3 100644
--- a/stdlib/source/library/lux/tool/compiler/arity.lux
+++ b/stdlib/source/library/lux/tool/compiler/arity.lux
@@ -8,7 +8,7 @@
(type: .public Arity
Nat)
-(template [<comparison> <name>]
+(with_template [<comparison> <name>]
[(def: .public <name> (-> Arity Bit) (<comparison> 1))]
[n.< nullary?]
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index 81653a205..f25ade369 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -441,7 +441,7 @@
(list.only (|>> product.left (dictionary.key? to) not)
(dictionary.entries from))))
- (template [<name> <path>]
+ (with_template [<name> <path>]
[(def: (<name> from state)
(All (_ <type_vars>)
(-> <State+> <State+> (Try <State+>)))
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 b3c99bdbf..7563bce90 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
@@ -114,19 +114,22 @@
_
false)))
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [{<tag> content}])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [{<tag> content}]))]
[case ..#Case]
)
-(template: .public (unit)
- [{..#Simple {/simple.#Unit}}])
+(def: .public unit
+ (template (unit)
+ [{..#Simple {/simple.#Unit}}]))
-(template [<name> <tag>]
- [(template: .public (<name> value)
- [{..#Simple {<tag> value}}])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> value)
+ [{..#Simple {<tag> value}}]))]
[bit /simple.#Bit]
[nat /simple.#Nat]
@@ -142,13 +145,14 @@
(type: .public (Reification c)
[c (List c)])
-(template: .public (no_op value)
- [(|> 1
- {variable.#Local}
- {reference.#Variable}
- {..#Reference}
- {..#Function (list)}
- {..#Apply value})])
+(def: .public no_op
+ (template (no_op value)
+ [(|> 1
+ {variable.#Local}
+ {reference.#Variable}
+ {..#Reference}
+ {..#Function (list)}
+ {..#Apply value})]))
(def: .public (reified [abstraction inputs])
(-> (Reification Analysis) Analysis)
@@ -169,7 +173,7 @@
_
[abstraction inputs])))
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public <name>
(syntax (_ [content <code>.any])
(in (list (` (.<| {..#Reference}
@@ -183,11 +187,12 @@
[foreign ((~! reference.foreign))]
)
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [(.<| {..#Structure}
- {<tag>}
- content)])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(.<| {..#Structure}
+ {<tag>}
+ content)]))]
[variant /complex.#Variant]
[tuple /complex.#Tuple]
@@ -239,7 +244,7 @@
(%.format (%.text name) " ")
(text.enclosed ["(" ")"]))))
-(template [<special> <general>]
+(with_template [<special> <general>]
[(type: .public <special>
(<general> .Lux Code Analysis))]
@@ -330,7 +335,7 @@
{try.#Success [[bundle state]
[]]}))
-(template [<name> <type> <field> <value>]
+(with_template [<name> <type> <field> <value>]
[(def: .public (<name> value)
(-> <type> (Operation Any))
(extension.update (has <field> <value>)))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux
index b4b554a4f..cbb1e7ea4 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux
@@ -90,7 +90,7 @@
[{#Bit sideR} {#Bit sideS}]
(bit#= sideR sideS)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> partialR} {<tag> partialS}]
(set#= partialR partialS)])
([#Nat]
@@ -126,7 +126,7 @@
{#Bit it}
(%.bit it)
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> it}
(|> it
set.list
@@ -171,7 +171,7 @@
... Simple patterns (other than unit/[]) always have partial coverage because there
... are too many possibilities as far as values go.
- (^.template [<from> <to> <hash>]
+ (^.with_template [<from> <to> <hash>]
[{//pattern.#Simple {<from> it}}
{try.#Success {<to> (set.of_list <hash> (list it))}}])
([//simple.#Nat #Nat n.hash]
@@ -274,7 +274,7 @@
{try.#Success {#Exhaustive}}
<redundancy>)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> partialA} {<tag> partialSF}]
(if (set.empty? (set.intersection partialA partialSF))
{try.#Success {<tag> (set.union partialA partialSF)}}
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux
index 1baaf5e1d..fb8f92d44 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux
@@ -44,7 +44,7 @@
"Type" (%.type type)
"Argument" (%.code argument)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [type Type])
(exception.report
"Type" (%.type type)))]
@@ -60,7 +60,7 @@
{.#Primitive name co_variant}
{.#Primitive name (list#each (quantified @var @parameter) co_variant)}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
{<tag> (quantified @var @parameter left)
(quantified @var @parameter right)}])
@@ -74,7 +74,7 @@
{.#Parameter @parameter}
:it:)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env body}
{<tag> (list#each (quantified @var @parameter) env)
(quantified @var (n.+ 2 @parameter) body)}])
@@ -199,12 +199,12 @@
recursion
it)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
{<tag> (again left) (again right)}])
([.#Sum] [.#Product] [.#Function] [.#Apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> environment quantified}
{<tag> (list#each again environment)
(with_recursion (n.+ 2 @self) recursion quantified)}])
@@ -222,7 +222,7 @@
(list#each (|>> (n.* 2) ++ {.#Parameter}))
list.reversed))
-(template [<name> <types> <inputs> <exception> <when> <then>]
+(with_template [<name> <types> <inputs> <exception> <when> <then>]
[(`` (def: .public (<name> (~~ (template.spliced <inputs>)) complex)
(-> (~~ (template.spliced <types>)) Type (Operation Type))
(loop (again [depth 0
@@ -231,7 +231,7 @@
{.#Named name it}
(again depth it)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env it}
(phase#each (|>> {<tag> env})
(again (++ depth) it))])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux
index 1a897fb6c..086419cf3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux
@@ -29,7 +29,7 @@
(exception.report
"Module" module))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [labels (List Label)
owner Type])
(exception.report
@@ -155,7 +155,7 @@
module (///extension.lifted (meta.module name))]
(in [module output])))
-(template [<setter> <asker> <tag>]
+(with_template [<setter> <asker> <tag>]
[(def: .public (<setter> module_name)
(-> Text (Operation Any))
(///extension.lifted
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/pattern.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/pattern.lux
index a462e62d1..23f8796db 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/pattern.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/pattern.lux
@@ -52,22 +52,25 @@
{#Bind it}
(//variable.format {//variable.#Local it})))
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [(.<| {..#Complex}
- <tag>
- content)])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(.<| {..#Complex}
+ <tag>
+ content)]))]
[variant {//complex.#Variant}]
[tuple {//complex.#Tuple}]
)
-(template: .public (unit)
- [{..#Simple {//simple.#Unit}}])
+(def: .public unit
+ (template (unit)
+ [{..#Simple {//simple.#Unit}}]))
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [{..#Simple {<tag> content}}])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [{..#Simple {<tag> content}}]))]
[bit //simple.#Bit]
[nat //simple.#Nat]
@@ -77,5 +80,6 @@
[text //simple.#Text]
)
-(template: .public (bind register)
- [{..#Bind register}])
+(def: .public bind
+ (template (bind register)
+ [{..#Bind register}]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux
index 4907be964..e9d2d8b87 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux
@@ -34,7 +34,7 @@
[{#Unit} {#Unit}]
true
- (^.template [<tag> <=>]
+ (^.with_template [<tag> <=>]
[[{<tag> reference} {<tag> sample}]
(<=> reference sample)])
([#Bit bit#=]
@@ -53,7 +53,7 @@
{#Unit}
"[]"
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> value}
(<format> value)])
([#Bit %.bit]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux
index 7f1c5d418..afe5c1aa8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux
@@ -55,7 +55,7 @@
[#imports (list#composite (the #imports left) (the #imports right))
#referrals (list#composite (the #referrals left) (the #referrals right))])
-(template [<special> <general>]
+(with_template [<special> <general>]
[(type: .public (<special> anchor expression directive)
(<general> (..State anchor expression directive) Code Requirements))]
@@ -66,7 +66,7 @@
[Bundle extension.Bundle]
)
-(template [<name> <component> <phase>]
+(with_template [<name> <component> <phase>]
[(def: .public <name>
(All (_ anchor expression directive)
(Operation anchor expression directive <phase>))
@@ -78,7 +78,7 @@
[generation ..#generation (generation.Phase anchor expression directive)]
)
-(template [<name> <component> <operation>]
+(with_template [<name> <component> <operation>]
[(def: .public <name>
(All (_ anchor expression directive output)
(-> (<operation> output)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux
index 42ad80162..695920880 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux
@@ -46,7 +46,7 @@
(exception.report
"Error" error))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [it artifact.ID])
(exception.report
"Artifact ID" (%.nat it)))]
@@ -84,7 +84,7 @@
#log (Sequence Text)
#interim_artifacts (List artifact.ID)]))
-(template [<special> <general>]
+(with_template [<special> <general>]
[(type: .public (<special> anchor expression directive)
(<general> (State anchor expression directive) Synthesis expression))]
@@ -116,7 +116,7 @@
Buffer
sequence.empty)
-(template [<tag>
+(with_template [<tag>
<with_declaration> <with_type> <with_value>
<set> <get> <get_type> <exception>]
[(exception: .public <exception>)
@@ -250,7 +250,7 @@
{.#None}
(phase.except ..no_buffer_for_saving_code [artifact_id]))))
-(template [<type> <mandatory?> <inputs> <input_types> <name> <artifact>]
+(with_template [<type> <mandatory?> <inputs> <input_types> <name> <artifact>]
[(`` (def: .public (<name> it (~~ (template.spliced <inputs>)) dependencies)
(All (_ anchor expression directive)
(-> <type> (~~ (template.spliced <input_types>)) (Set unit.ID) (Operation anchor expression directive artifact.ID)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux
index 0033addf3..55aa12407 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux
@@ -40,53 +40,57 @@
(exception.report
"Syntax" (%.code syntax)))
-(template: (variant_analysis analysis archive tag values)
- ... (-> Phase Archive Symbol (List Code) (Operation Analysis))
- [(case values
- (pattern (list value))
- (/complex.variant analysis tag archive value)
-
- _
- (/complex.variant analysis tag archive (code.tuple values)))])
-
-(template: (sum_analysis analysis archive lefts right? values)
- ... (-> Phase Archive Nat Bit (List Code) (Operation Analysis))
- [(case values
- (pattern (list value))
- (/complex.sum analysis lefts right? archive value)
-
- _
- (/complex.sum analysis lefts right? archive (code.tuple values)))])
-
-(template: (case_analysis analysis archive input branches code)
- ... (-> Phase Archive Code (List Code) Code (Operation Analysis))
- [(case (list.pairs branches)
- {.#Some branches}
- (/case.case analysis branches archive input)
-
- {.#None}
- (//.except ..invalid [code]))])
-
-(template: (apply_analysis expander analysis archive functionC argsC+)
- ... (-> Expander Phase Archive Code (List Code) (Operation Analysis))
- [(do [! //.monad]
- [[functionT functionA] (/type.inferring
- (analysis archive functionC))]
- (case functionA
- (pattern (/.constant def_name))
- (do !
- [?macro (//extension.lifted (meta.macro def_name))]
- (case ?macro
- {.#Some macro}
- (do !
- [expansion (//extension.lifted (/macro.single_expansion expander def_name macro argsC+))]
- (analysis archive expansion))
-
- _
- (/function.apply analysis argsC+ functionT functionA archive functionC)))
+(def: variant_analysis
+ (template (_ analysis archive tag values)
+ ... (-> Phase Archive Symbol (List Code) (Operation Analysis))
+ [(case values
+ (pattern (list value))
+ (/complex.variant analysis tag archive value)
_
- (/function.apply analysis argsC+ functionT functionA archive functionC)))])
+ (/complex.variant analysis tag archive (code.tuple values)))]))
+
+(def: sum_analysis
+ (template (_ analysis archive lefts right? values)
+ ... (-> Phase Archive Nat Bit (List Code) (Operation Analysis))
+ [(case values
+ (pattern (list value))
+ (/complex.sum analysis lefts right? archive value)
+
+ _
+ (/complex.sum analysis lefts right? archive (code.tuple values)))]))
+
+(def: case_analysis
+ (template (_ analysis archive input branches code)
+ ... (-> Phase Archive Code (List Code) Code (Operation Analysis))
+ [(case (list.pairs branches)
+ {.#Some branches}
+ (/case.case analysis branches archive input)
+
+ {.#None}
+ (//.except ..invalid [code]))]))
+
+(def: apply_analysis
+ (template (_ expander analysis archive functionC argsC+)
+ ... (-> Expander Phase Archive Code (List Code) (Operation Analysis))
+ [(do [! //.monad]
+ [[functionT functionA] (/type.inferring
+ (analysis archive functionC))]
+ (case functionA
+ (pattern (/.constant def_name))
+ (do !
+ [?macro (//extension.lifted (meta.macro def_name))]
+ (case ?macro
+ {.#Some macro}
+ (do !
+ [expansion (//extension.lifted (/macro.single_expansion expander def_name macro argsC+))]
+ (analysis archive expansion))
+
+ _
+ (/function.apply analysis argsC+ functionT functionA archive functionC)))
+
+ _
+ (/function.apply analysis argsC+ functionT functionA archive functionC)))]))
(def: .public (phase expander)
(-> Expander Phase)
@@ -96,7 +100,7 @@
... of having useful error messages.
(/.with_location location)
(case code
- (^.template [<tag> <analyser>]
+ (^.with_template [<tag> <analyser>]
[[_ {<tag> value}]
(<analyser> value)])
([.#Symbol /reference.reference]
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 bb9d617f6..0bb0f208d 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
@@ -235,7 +235,7 @@
idx /scope.next]
(in [{/pattern.#Bind idx} outputA])))
- (^.template [<type> <input> <output>]
+ (^.with_template [<type> <input> <output>]
[[location <input>]
(simple_pattern_analysis <type> :input: location {/pattern.#Simple <output>} next)])
([Bit {.#Bit pattern_value} {/simple.#Bit pattern_value}]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux
index 7e33dfdd9..0c16d0bc9 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux
@@ -43,7 +43,7 @@
(exception.report
"Type" (%.type type)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [type Type
members (List Code)])
(exception.report
@@ -54,7 +54,7 @@
[cannot_analyse_tuple]
)
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [type Type
lefts Nat
right? Bit
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/simple.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/simple.lux
index 5a0806d79..a5e7a9d08 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/simple.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/simple.lux
@@ -11,7 +11,7 @@
[///
["[1]" phase]]]])
-(template [<name> <type> <tag>]
+(with_template [<name> <type> <tag>]
[(def: .public (<name> value)
(-> <type> (Operation Analysis))
(do ///.monad
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 2b779791f..c5044dba6 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
@@ -152,7 +152,7 @@
(getSuperclass [] "?" (java/lang/Class java/lang/Object))
(getInterfaces [] [(java/lang/Class java/lang/Object)]))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [class External
field Text])
(exception.report
@@ -195,9 +195,9 @@
External
"java.lang.Object")
-... TODO: Get rid of this template block and use the definition in
+... TODO: Get rid of this with_template block and use the definition in
... lux/ffi.jvm.lux ASAP
-(template [<name> <class>]
+(with_template [<name> <class>]
[(def: .public <name>
.Type
{.#Primitive <class> {.#End}})]
@@ -239,7 +239,7 @@
#deprecated? Bit
#throws (List .Type)]))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [type .Type])
(exception.report
"Type" (%.type type)))]
@@ -250,7 +250,7 @@
[non_jvm_type]
)
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [class External])
(exception.report
"Class/type" (%.text class)))]
@@ -260,7 +260,7 @@
[primitives_are_not_objects]
)
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [class_variables (List (Type Var))
class External
method Text
@@ -287,7 +287,7 @@
"To" (%.type to)
"Value" (%.code value)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [message Text])
message)]
@@ -327,7 +327,7 @@
(///bundle.install "short-to-long" (//lux.unary ..short ..long))
)))
-(template [<name> <prefix> <type>]
+(with_template [<name> <prefix> <type>]
[(def: <name>
Bundle
(<| (///bundle.prefix (reflection.reflection <prefix>))
@@ -351,7 +351,7 @@
[bundle::long reflection.long ..long]
)
-(template [<name> <prefix> <type>]
+(with_template [<name> <prefix> <type>]
[(def: <name>
Bundle
(<| (///bundle.prefix (reflection.reflection <prefix>))
@@ -389,8 +389,9 @@
[(reflection.reflection reflection.char) [box.char jvm.char]])
(dictionary.of_list text.hash)))
-(template: (lux_array_type :read: :write:)
- [{.#Primitive (static array.type_name) (list {.#Apply :write: {.#Apply :read: _Mutable}})}])
+(def: lux_array_type
+ (template (_ :read: :write:)
+ [{.#Primitive (static array.type_name) (list {.#Apply :write: {.#Apply :read: _Mutable}})}]))
(def: (jvm_type luxT)
(-> .Type (Operation (Type Value)))
@@ -535,7 +536,7 @@
(/////analysis.except ..non_parameter objectT)
{.#Primitive name parameters}
- (`` (cond (or (~~ (template [<type>]
+ (`` (cond (or (~~ (with_template [<type>]
[(text#= (..reflection <type>) name)]
[jvm.boolean]
@@ -569,7 +570,7 @@
{.#Parameter id})
(phase#in (jvm.class ..object_class (list)))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env unquantified}
(check_parameter unquantified)])
([.#UnivQ]
@@ -593,7 +594,7 @@
(-> .Type (Operation (Type Value)))
(case objectT
{.#Primitive name {.#End}}
- (`` (cond (~~ (template [<type>]
+ (`` (cond (~~ (with_template [<type>]
[(text#= (..reflection <type>) name)
(phase#in <type>)]
@@ -606,7 +607,7 @@
[jvm.double]
[jvm.char]))
- (~~ (template [<type>]
+ (~~ (with_template [<type>]
[(text#= (..reflection (jvm.array <type>)) name)
(phase#in (jvm.array <type>))]
@@ -640,7 +641,7 @@
{.#Named name anonymous}
(check_jvm anonymous)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env unquantified}
(check_jvm unquantified)])
([.#UnivQ]
@@ -657,7 +658,7 @@
_
(check_parameter objectT)))
-(template [<name> <category> <parser>]
+(with_template [<name> <category> <parser>]
[(def: .public (<name> mapping typeJ)
(-> Mapping (Type <category>) (Operation .Type))
(case (|> typeJ ..signature (<text>.result (<parser> mapping)))
@@ -982,7 +983,7 @@
(analyse archive fromC))
source_name (at ! each ..reflection (check_jvm fromT))
can_cast? (is (Operation Bit)
- (`` (cond (~~ (template [<primitive> <object>]
+ (`` (cond (~~ (with_template [<primitive> <object>]
[(let [=primitive (reflection.reflection <primitive>)]
(or (and (text#= =primitive source_name)
(or (text#= <object> target_name)
@@ -1171,7 +1172,7 @@
(list#each (|>> again (as (Type Parameter))))
(jvm.class name))
{.#None})
- (~~ (template [<read> <as> <write>]
+ (~~ (with_template [<read> <as> <write>]
[(case (<read> it)
{.#Some :sub:}
(<write> (as (Type <as>) (again :sub:)))
@@ -1252,7 +1253,7 @@
(-> (java/lang/Class java/lang/Object) (Type Class))
(jvm.class (java/lang/Class::getName it) (list)))
-(template [<name> <type> <params>]
+(with_template [<name> <type> <params>]
[(`` (def: <name>
(-> (<type> (~~ (template.spliced <params>))) (List (Type Class)))
(|>> (~~ (template.symbol [<type> "::getExceptionTypes"]))
@@ -1359,7 +1360,7 @@
{#Pass Method_Signature}
{#Hint Method_Signature}))
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: <name>
(-> Evaluation (Maybe Method_Signature))
(|>> (pipe.case
@@ -1373,7 +1374,7 @@
[hint #Hint]
)
-(template [<name> <type> <method>]
+(with_template [<name> <type> <method>]
[(def: <name>
(-> <type> (List (Type Var)))
(|>> <method>
@@ -1488,7 +1489,7 @@
candidates
(/////analysis.except ..too_many_candidates [actual_class_tvars class_name ..constructor_method actual_method_tvars inputsJT candidates]))))
-(template [<name> <category> <parser>]
+(with_template [<name> <category> <parser>]
[(def: .public <name>
(Parser (Type <category>))
(<text>.then <parser> <code>.text))]
@@ -1674,7 +1675,7 @@
(/////analysis.tuple (partial_list (/////analysis.text name)
(list#each annotation_parameter_analysis parameters))))
-(template [<name> <category>]
+(with_template [<name> <category>]
[(def: <name>
(-> (Type <category>) Analysis)
(|>> ..signature /////analysis.text))]
@@ -1695,7 +1696,7 @@
(list (/////analysis.text argument)
(value_analysis argumentJT))))
-(template [<name> <only> <methods>]
+(with_template [<name> <only> <methods>]
[(def: (<name> [type class])
(-> [(Type Class) (java/lang/Class java/lang/Object)]
(Try (List [(Type Class) Text (Type Method)])))
@@ -1734,7 +1735,7 @@
(def: jvm_package_separator ".")
-(template [<name> <methods>]
+(with_template [<name> <methods>]
[(def: (<name> class_loader)
(-> java/lang/ClassLoader (List (Type Class)) (Try (List [(Type Class) Text (Type Method)])))
(|>> (monad.each try.monad (function (_ type)
@@ -1750,7 +1751,7 @@
[all_methods ..methods]
)
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [expected (List [(Type Class) Text (Type Method)])
actual (List [(Type Class) Text (Type Method)])])
(let [%method (is (%.Format [(Type Class) Text (Type Method)])
@@ -2421,7 +2422,7 @@
... TODO: Handle annotations.
{#Constant [name annotations type value]}
(case value
- (^.template [<tag> <type> <constant>]
+ (^.with_template [<tag> <type> <constant>]
[[_ {<tag> value}]
(do pool.monad
[constant (`` (|> value (~~ (template.spliced <constant>))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux
index 90ed93d25..39606222f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux
@@ -168,7 +168,7 @@
(bundle.install "nil?" (/.unary Any Bit))
)))
-(template [<name> <fromT> <toT>]
+(with_template [<name> <fromT> <toT>]
[(def: <name>
Handler
(custom
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 c4392ff2a..e6c308b21 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
@@ -112,7 +112,7 @@
(def: visibility'
(<text>.Parser (Modifier field.Field))
(`` (all <>.either
- (~~ (template [<label> <modifier>]
+ (~~ (with_template [<label> <modifier>]
[(<>.after (<text>.this <label>) (<>#in <modifier>))]
["public" field.public]
@@ -127,7 +127,7 @@
(def: inheritance
(Parser (Modifier class.Class))
(`` (all <>.either
- (~~ (template [<label> <modifier>]
+ (~~ (with_template [<label> <modifier>]
[(<>.after (<code>.this_text <label>) (<>#in <modifier>))]
["final" class.final]
@@ -137,7 +137,7 @@
(def: state
(Parser (Modifier field.Field))
(`` (all <>.either
- (~~ (template [<label> <modifier>]
+ (~~ (with_template [<label> <modifier>]
[(<>.after (<code>.this_text <label>) (<>#in <modifier>))]
["volatile" field.volatile]
@@ -231,7 +231,7 @@
... TODO: Handle annotations.
{#Constant [name annotations type value]}
(case value
- (^.template [<tag> <type> <constant>]
+ (^.with_template [<tag> <type> <constant>]
[[_ {<tag> value}]
(do pool.monad
[constant (`` (|> value (~~ (template.spliced <constant>))))
@@ -270,7 +270,7 @@
(<synthesis>.Parser (jvm.Annotation Synthesis))
(<synthesis>.tuple (<>.and <synthesis>.text (<>.some ..annotation_parameter_synthesis))))
-(template [<name> <type> <text>]
+(with_template [<name> <type> <text>]
[(def: <name>
(<synthesis>.Parser (Type <type>))
(<text>.then <text> <synthesis>.text))]
@@ -430,7 +430,7 @@
(<load> jvm_register)
(value.wrap <type>)
(_.astore lux_register))]]]
- (`` (cond (~~ (template [<shift> <load> <type>]
+ (`` (cond (~~ (with_template [<shift> <load> <type>]
[(at type.equivalence = <type> argumentT)
(wrap_primitive <shift> <load> <type>)]
@@ -513,7 +513,7 @@
[(all _.composite
(value.unwrap <type>)
<return>)]]
- (`` (cond (~~ (template [<return> <type>]
+ (`` (cond (~~ (with_template [<return> <type>]
[(at type.equivalence = <type> returnT)
(unwrap_primitive <return> <type>)]
@@ -831,7 +831,7 @@
(list#each (..mock_method super) methods)
inheritance))
-(template [<name> <type> <parser>]
+(with_template [<name> <type> <parser>]
[(def: <name>
(Parser <type>)
(do [! <>.monad]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
index b66e2cc05..2072d1a8e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
@@ -169,7 +169,7 @@
(synthesize archive codeA))]
(definition' archive generate name code//type codeS)))
-(template [<full> <partial> <learn>]
+(with_template [<full> <partial> <learn>]
[... TODO: Inline "<partial>" into "<full>" ASAP
(def: (<partial> archive generate extension codeT codeS)
(All (_ anchor expression directive)
@@ -376,7 +376,7 @@
(in /////directive.no_requirements)))]))
... TODO: Stop requiring these types and the "swapped" function below to make types line-up.
-(template [<name> <anonymous>]
+(with_template [<name> <anonymous>]
[(def: <name>
Type
(with_expansions [<original> binary.Binary]
@@ -397,7 +397,7 @@
{.#Primitive name parameters}
{.#Primitive name (list#each again parameters)}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
{<tag> (again left) (again right)}])
([.#Sum]
@@ -410,7 +410,7 @@
{.#Ex _})
type
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> closure body}
{<tag> closure (again body)}])
([.#UnivQ]
@@ -419,7 +419,7 @@
{.#Named name anonymous}
{.#Named name (again anonymous)}))))
-(template [<description> <mame> <def_type> <type> <scope> <definer>]
+(with_template [<description> <mame> <def_type> <type> <scope> <definer>]
[(def: (<mame> [anchorT expressionT directiveT] extender)
(All (_ anchor expression directive)
(-> [Type Type Type] Extender
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 111d1d4aa..1eeb12ede 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
@@ -51,8 +51,9 @@
{try.#Failure error}
(/////.except extension.invalid_syntax [extension_name %synthesis input]))))
-(template: (!unary function)
- (|>> list _.apply (|> (_.constant function))))
+(def: !unary
+ (template (_ function)
+ (|>> list _.apply (|> (_.constant function)))))
... ... TODO: Get rid of this ASAP
... (def: lux::syntax_char_case!
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
index db527fbd2..0b40aa0d3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
@@ -54,7 +54,7 @@
... [Procedures]
... [[Bits]]
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [paramG subjectG])
(Binary Expression)
(<op> subjectG (//runtime.i64::number paramG)))]
@@ -107,7 +107,7 @@
[body (expression archive synthesis)]
(in (as Statement body)))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (<tag> value))
(/////#each _.return (expression archive synthesis))])
([synthesis.bit]
@@ -119,7 +119,7 @@
[synthesis.branch/get]
[synthesis.function/apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern {<tag> value})
(/////#each _.return (expression archive synthesis))])
([synthesis.#Reference]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux
index 44674faf0..da40355f3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux
@@ -90,7 +90,7 @@
inputsG (monad.each ! (phase archive) inputsS)]
(in (_.do methodS inputsG objectG))))]))
-(template [<!> <?> <unit>]
+(with_template [<!> <?> <unit>]
[(def: <!> (Nullary Expression) (function.constant <unit>))
(def: <?> (Unary Expression) (_.= <unit>))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux
index cbae57e3c..7d035fe2f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux
@@ -159,7 +159,7 @@
(/////bundle.install "is" (binary ..lux::is))
(/////bundle.install "try" (unary ..lux::try))))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [maskG inputG])
(Binary (Bytecode Any))
(all _.composite
@@ -172,7 +172,7 @@
[i64::xor _.lxor]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [shiftG inputG])
(Binary (Bytecode Any))
(all _.composite
@@ -184,7 +184,7 @@
[i64::right_shifted _.lushr]
)
-(template [<name> <type> <op>]
+(with_template [<name> <type> <op>]
[(def: (<name> [paramG subjectG])
(Binary (Bytecode Any))
(all _.composite
@@ -205,8 +205,8 @@
[f64::% type.double _.drem]
)
-(template [<eq> <lt> <type> <cmp>]
- [(template [<name> <reference>]
+(with_template [<eq> <lt> <type> <cmp>]
+ [(with_template [<name> <reference>]
[(def: (<name> [paramG subjectG])
(Binary (Bytecode Any))
(all _.composite
@@ -227,7 +227,7 @@
(-> (Type Class) (Type Primitive) (Bytecode Any))
(_.invokestatic class "toString" (type.method [(list) (list from) ..$String (list)])))
-(template [<name> <prepare> <transform>]
+(with_template [<name> <prepare> <transform>]
[(def: (<name> inputG)
(Unary (Bytecode Any))
(all _.composite
@@ -307,7 +307,7 @@
(def: no_op (Bytecode Any) (_#in []))
-(template [<name> <pre_subject> <pre_param> <op> <post>]
+(with_template [<name> <pre_subject> <pre_param> <op> <post>]
[(def: (<name> [paramG subjectG])
(Binary (Bytecode Any))
(all _.composite
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
index d9b809f6c..202f4b5e0 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
@@ -79,7 +79,7 @@
[dependency
["[1]/[0]" artifact]]]]]]]])
-(template [<name> <0>]
+(with_template [<name> <0>]
[(def: <name>
(Bytecode Any)
(all _.composite
@@ -91,7 +91,7 @@
[l2c _.i2c]
)
-(template [<conversion> <name>]
+(with_template [<conversion> <name>]
[(def: (<name> inputG)
(Unary (Bytecode Any))
(if (same? _.nop <conversion>)
@@ -168,7 +168,7 @@
(/////bundle.install "short-to-long" (unary conversion::short_to_long))
)))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [parameter! subject!])
(Binary (Bytecode Any))
(all _.composite
@@ -217,7 +217,7 @@
(def: falseG (_.getstatic ..$Boolean "FALSE" ..$Boolean))
(def: trueG (_.getstatic ..$Boolean "TRUE" ..$Boolean))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [reference subject])
(Binary (Bytecode Any))
(do _.monad
@@ -240,7 +240,7 @@
[char::< _.if_icmplt]
)
-(template [<name> <op> <reference>]
+(with_template [<name> <op> <reference>]
[(def: (<name> [reference subject])
(Binary (Bytecode Any))
(do _.monad
@@ -340,7 +340,7 @@
(/////bundle.install "<" (binary char::<))
)))
-(template [<name> <category> <parser>]
+(with_template [<name> <category> <parser>]
[(def: .public <name>
(Parser (Type <category>))
(<text>.then <parser> <synthesis>.text))]
@@ -607,7 +607,7 @@
(function (_ extension_name generate archive [from to valueS])
(do //////.monad
[valueG (generate archive valueS)]
- (in (`` (cond (~~ (template [<object> <type>]
+ (in (`` (cond (~~ (with_template [<object> <type>]
[(and (text#= (..reflection <type>) from)
(text#= <object> to))
(all _.composite
@@ -751,7 +751,7 @@
(_.invokestatic class method (type.method [(list) (list#each product.left inputsTG) outputT (list)]))
(prepare_output outputT)))))]))
-(template [<check_cast?> <name> <invoke>]
+(with_template [<check_cast?> <name> <invoke>]
[(def: <name>
Handler
(..custom
@@ -878,13 +878,13 @@
(pattern (//////synthesis.path/then bodyS))
(//////synthesis.path/then (normalize bodyS))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern {<tag> leftP rightP})
{<tag> (again leftP) (again rightP)}])
([//////synthesis.#Alt]
[//////synthesis.#Seq])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> _}
path])
([//////synthesis.#Pop]
@@ -894,7 +894,7 @@
{//////synthesis.#Bit_Fork when then else}
{//////synthesis.#Bit_Fork when (again then) (maybe#each again else)}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> [[exampleH nextH] tail]}
{<tag> [[exampleH (again nextH)]
(list#each (function (_ [example next])
@@ -911,7 +911,7 @@
(-> Mapping Synthesis Synthesis)
(function (again body)
(case body
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern <tag>)
body])
([{//////synthesis.#Simple _}]
@@ -1053,7 +1053,7 @@
[(all _.composite
(///value.unwrap <type>)
<return>)]]
- (`` (cond (~~ (template [<return> <type>]
+ (`` (cond (~~ (with_template [<return> <type>]
[(at type.equivalence = <type> returnT)
(unwrap_primitive <return> <type>)]
@@ -1108,7 +1108,7 @@
(<load> jvm_register)
(///value.wrap <type>)
(_.astore lux_register))]]]
- (`` (cond (~~ (template [<shift> <load> <type>]
+ (`` (cond (~~ (with_template [<shift> <load> <type>]
[(at type.equivalence = <type> argumentT)
(wrap_primitive <shift> <load> <type>)]
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 5d9753b87..334e7a924 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
@@ -56,8 +56,9 @@
{try.#Failure error}
(/////.except extension.invalid_syntax [extension_name %synthesis input]))))
-(template: (!unary function)
- [(|>> list _.apply (|> (_.var function)))])
+(def: !unary
+ (template (_ function)
+ [(|>> list _.apply (|> (_.var function)))]))
(def: .public (statement expression archive synthesis)
Phase!
@@ -68,7 +69,7 @@
[body (expression archive synthesis)]
(in (as Statement body)))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (<tag> value))
(/////#each _.return (expression archive synthesis))])
([synthesis.bit]
@@ -80,7 +81,7 @@
[synthesis.branch/get]
[synthesis.function/apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern {<tag> value})
(/////#each _.return (expression archive synthesis))])
([synthesis.#Reference]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux
index 365fbe663..9b292c7e7 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux
@@ -83,7 +83,7 @@
inputsG (monad.each ! (phase archive) inputsS)]
(in (_.do methodS inputsG objectG))))]))
-(template [<!> <?> <unit>]
+(with_template [<!> <?> <unit>]
[(def: <!> (Nullary Expression) (function.constant <unit>))
(def: <?> (Unary Expression) (_.= <unit>))]
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 911e63531..422f9cd4d 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
@@ -51,8 +51,9 @@
{try.#Failure error}
(/////.except extension.invalid_syntax [extension_name %synthesis input]))))
-(template: (!unary function)
- (|>> list _.apply (|> (_.constant function))))
+(def: !unary
+ (template (_ function)
+ (|>> list _.apply (|> (_.constant function)))))
... TODO: Get rid of this ASAP
(def: lux::syntax_char_case!
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux
index 073c49818..e6bfc780f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux
@@ -87,7 +87,7 @@
inputsG (monad.each ! (phase archive) inputsS)]
(in (_.do methodS inputsG objectG))))]))
-(template [<!> <?> <unit>]
+(with_template [<!> <?> <unit>]
[(def: <!> (Nullary Expression) (function.constant <unit>))
(def: <?> (Unary Expression) (_.=== <unit>))]
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 e48f139a3..adc889695 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
@@ -54,7 +54,7 @@
[body (expression archive synthesis)]
(in (as (Statement Any) body)))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (<tag> value))
(/////#each _.return (expression archive synthesis))])
([synthesis.bit]
@@ -66,7 +66,7 @@
[synthesis.branch/get]
[synthesis.function/apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern {<tag> value})
(/////#each _.return (expression archive synthesis))])
([synthesis.#Reference]
@@ -75,7 +75,7 @@
(pattern (synthesis.branch/case case))
(//case.case! false statement expression archive case)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> statement expression archive value)])
([synthesis.branch/exec //case.exec!]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux
index 0b00fd778..ba6885829 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux
@@ -84,7 +84,7 @@
inputsG (monad.each ! (phase archive) inputsS)]
(in (_.do methodS inputsG objectG))))]))
-(template [<!> <?> <unit>]
+(with_template [<!> <?> <unit>]
[(def: <!> (Nullary (Expression Any)) (function.constant <unit>))
(def: <?> (Unary (Expression Any)) (_.= <unit>))]
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 8f1a0c53e..345d82477 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
@@ -51,8 +51,9 @@
{try.#Failure error}
(/////.except extension.invalid_syntax [extension_name %synthesis input]))))
-... (template: (!unary function)
-... (|>> list _.apply (|> (_.constant function))))
+... (def: !unary
+... (template (_ function)
+... (|>> list _.apply (|> (_.constant function)))))
... ... ... TODO: Get rid of this ASAP
... ... (def: lux::syntax_char_case!
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 bee06eb6a..695b5e1e7 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
@@ -66,7 +66,7 @@
(in (as Statement
body)))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (<tag> value))
(/////#each _.return (expression archive synthesis))])
([synthesis.bit]
@@ -78,7 +78,7 @@
[synthesis.branch/get]
[synthesis.function/apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern {<tag> value})
(/////#each _.return (expression archive synthesis))])
([synthesis.#Reference]
@@ -87,7 +87,7 @@
(pattern (synthesis.branch/case case))
(//case.case! false statement expression archive case)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> statement expression archive value)])
([synthesis.branch/exec //case.exec!]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux
index 4895535d5..6decb3fcf 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux
@@ -83,7 +83,7 @@
inputsG (monad.each ! (phase archive) inputsS)]
(in (_.do methodS inputsG {.#None} objectG))))]))
-(template [<!> <?> <unit>]
+(with_template [<!> <?> <unit>]
[(def: <!> (Nullary Expression) (function.constant <unit>))
(def: <?> (Unary Expression) (_.= <unit>))]
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 a3235673f..18f902d29 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
@@ -51,8 +51,9 @@
{try.#Failure error}
(/////.except extension.invalid_syntax [extension_name %synthesis input]))))
-(template: (!unary function)
- (|>> list _.apply (|> (_.constant function))))
+(def: !unary
+ (template (_ function)
+ (|>> list _.apply (|> (_.constant function)))))
... TODO: Get rid of this ASAP
(def: lux::syntax_char_case!
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux
index 8a1f1d824..bbec22567 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux
@@ -64,7 +64,7 @@
(/.install "delete" (binary array::delete))
)))
-(template [<!> <?> <unit>]
+(with_template [<!> <?> <unit>]
[(def: <!> (Nullary Expression) (function.constant <unit>))
(def: <?> (Unary Expression) (_.eq?/2 <unit>))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux
index 33572414f..e016f9109 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux
@@ -28,7 +28,7 @@
(def: .public (generate archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([////synthesis.bit /primitive.bit]
@@ -39,7 +39,7 @@
{////synthesis.#Reference value}
(//reference.reference /reference.system archive value)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> generate archive value)])
([////synthesis.variant /structure.variant]
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 3a94f56d6..3e0aabf99 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
@@ -67,7 +67,7 @@
[valueG (expression archive valueS)]
(in (list#mix (function (_ side source)
(.let [method (.case side
- (^.template [<side> <accessor>]
+ (^.with_template [<side> <accessor>]
[(<side> lefts)
(<accessor> (_.int (.int lefts)))])
([.#Left //runtime.tuple//left]
@@ -106,7 +106,7 @@
(-> Nat (Expression Any))
(_.setq @cursor (_.nthcdr/2 [(_.int (.int pops)) @cursor])))
-(template [<name> <flag> <prep>]
+(with_template [<name> <flag> <prep>]
[(def: (<name> @fail simple? idx next!)
(-> _.Tag Bit Nat (Maybe (Expression Any)) (Expression Any))
(.let [<failure_condition> (_.eq/2 [@variant @temp])]
@@ -172,7 +172,7 @@
else!
then!))))
- (^.template [<tag> <format> <=>]
+ (^.with_template [<tag> <format> <=>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -190,7 +190,7 @@
[/////synthesis.#F64_Fork //primitive.f64 _.=/2]
[/////synthesis.#Text_Fork //primitive.text _.string=/2])
- (^.template [<complex> <simple> <choice>]
+ (^.with_template [<complex> <simple> <choice>]
[(pattern (<complex> idx))
(///////phase#in (<choice> @fail false idx {.#None}))
@@ -204,7 +204,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (..push! (_.elt/2 [..peek (_.int +0)])))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))])
([/////synthesis.member/left //runtime.tuple//left]
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 bb9c5681f..6c484b274 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
@@ -41,7 +41,7 @@
(def: module_id
0)
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> [_.Tag Register] (Expression Any) (Expression Any)))]
@@ -170,9 +170,10 @@
(with_expansions [<recur> (these (all _.then
(_.; (_.set lefts (_.-/2 [last_index_right lefts])))
(_.; (_.set tuple (_.nth last_index_right tuple)))))]
- (template: (!recur <side>)
- (<side> (_.-/2 [last_index_right lefts])
- (_.elt/2 [tuple last_index_right])))
+ (def: !recur
+ (template (_ <side>)
+ (<side> (_.-/2 [last_index_right lefts])
+ (_.elt/2 [tuple last_index_right]))))
(runtime: (tuple//left lefts tuple)
(with_vars [last_index_right]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux
index fa1cabf00..a5471f9b6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux
@@ -37,7 +37,7 @@
(def: (expression archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([synthesis.bit /primitive.bit]
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 963d0574b..aa18b4348 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
@@ -149,7 +149,7 @@
(_.statement (|> @cursor (_.do "splice" (list (|> @cursor ..length (_.- popsJS))
popsJS))))))
-(template [<name> <flag>]
+(with_template [<name> <flag>]
[(def: (<name> simple? idx)
(-> Bit Nat Statement)
(all _.then
@@ -181,7 +181,7 @@
(-> (-> Path (Operation Statement))
(-> Path (Operation (Maybe Statement))))
(.case pathP
- (^.template [<simple> <choice>]
+ (^.with_template [<simple> <choice>]
[(pattern (<simple> idx nextP))
(|> nextP
again
@@ -203,7 +203,7 @@
then!)}))
... Extra optimization
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (/////synthesis.path/seq
(<pm> lefts)
(/////synthesis.!bind_top register thenP)))
@@ -285,7 +285,7 @@
..fail_pm!
clauses)))
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(do [! ///////phase.monad]
[cases (monad.each ! (function (_ [match then])
@@ -297,19 +297,19 @@
([/////synthesis.#F64_Fork //primitive.f64]
[/////synthesis.#Text_Fork //primitive.text])
- (^.template [<complex> <choice>]
+ (^.with_template [<complex> <choice>]
[(pattern (<complex> idx))
(///////phase#in (<choice> false idx))])
([/////synthesis.side/left ..left_choice]
[/////synthesis.side/right ..right_choice])
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (push_cursor! (<getter> (_.i32 (.int lefts)) ..peek_cursor)))])
([/////synthesis.member/left //runtime.tuple//left]
[/////synthesis.member/right //runtime.tuple//right])
- (^.template [<tag> <combinator>]
+ (^.with_template [<tag> <combinator>]
[(pattern (<tag> leftP rightP))
(do ///////phase.monad
[left! (again leftP)
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 444254018..b51c272d6 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
@@ -39,7 +39,7 @@
["[0]" registry (.only Registry)]
["[0]" unit]]]]]])
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> [Register Text] Expression Statement))]
@@ -281,7 +281,7 @@
(-> Expression Expression Computation)
(_.new ..i64::new (list high low)))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(runtime: (<name> subject parameter)
(_.return (..i64 (<op> (_.the ..i64_high_field subject)
(_.the ..i64_high_field parameter))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux
index c4b026541..a23f31e36 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux
@@ -24,7 +24,7 @@
(def: .public (generate archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(///#in (<generator> value))])
([synthesis.bit /primitive.bit]
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 6857dae20..e96a88889 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
@@ -123,7 +123,7 @@
(_.set_label @else)
else!)))))
-(template [<name> <type> <unwrap> <dup> <pop> <test> <comparison> <if>]
+(with_template [<name> <type> <unwrap> <dup> <pop> <test> <comparison> <if>]
[(def: (<name> again @else cons)
(-> (-> Path (Operation (Bytecode Any)))
Label (Fork <type> Path)
@@ -167,7 +167,7 @@
{synthesis.#Bind register}
(..path|bind register)
- (^.template [<tag> <path>]
+ (^.with_template [<tag> <path>]
[{<tag> it}
(<path> again @else it)])
([synthesis.#Bit_Fork ..path|bit_fork]
@@ -200,7 +200,7 @@
(_.set_label @success)
//runtime.push)))
- (^.template [<pattern> <projection>]
+ (^.with_template [<pattern> <projection>]
[(pattern (<pattern> lefts))
(operation#in (all _.composite
..peek
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux
index 21c740700..90c3044ae 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux
@@ -34,7 +34,7 @@
(def: .public (i64 value)
(-> (I64 Any) (Bytecode Any))
(case (.int value)
- (^.template [<int> <instruction>]
+ (^.with_template [<int> <instruction>]
[<int>
(do _.monad
[_ <instruction>]
@@ -42,7 +42,7 @@
([+0 _.lconst_0]
[+1 _.lconst_1])
- (^.template [<int> <instruction>]
+ (^.with_template [<int> <instruction>]
[<int>
(do _.monad
[_ <instruction>
@@ -91,14 +91,14 @@
(def: .public (f64 value)
(-> Frac (Bytecode Any))
(case value
- (^.template [<int> <instruction>]
+ (^.with_template [<int> <instruction>]
[<int>
(do _.monad
[_ <instruction>]
..wrap_f64)])
([+1.0 _.dconst_1])
- (^.template [<int> <instruction>]
+ (^.with_template [<int> <instruction>]
[<int>
(do _.monad
[_ <instruction>
@@ -106,7 +106,7 @@
..wrap_f64)])
([+2.0 _.fconst_2])
- (^.template [<int> <instruction>]
+ (^.with_template [<int> <instruction>]
[<int>
(do _.monad
[_ <instruction>
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux
index 11db49aed..7f6ade8c6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux
@@ -30,7 +30,7 @@
(Bytecode Any)
_.aload_0)
-(template [<name> <prefix>]
+(with_template [<name> <prefix>]
[(def: .public <name>
(-> Register Text)
(|>> %.nat (format <prefix>)))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
index 4c6a232f9..13f09e66e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
@@ -73,7 +73,7 @@
(type: .public Anchor
[Label Register])
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> Anchor (Bytecode Any) Definition))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux
index a415f60fa..9cd5f6d93 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux
@@ -10,10 +10,10 @@
(def: .public field "value")
-(template [<name> <boolean> <byte> <short> <int> <long> <float> <double> <char>]
+(with_template [<name> <boolean> <byte> <short> <int> <long> <float> <double> <char>]
[(def: (<name> type)
(-> (Type Primitive) Text)
- (`` (cond (~~ (template [<type> <output>]
+ (`` (cond (~~ (with_template [<type> <output>]
[(type#= <type> type) <output>]
[type.boolean <boolean>]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux
index 8d861e382..e14772296 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux
@@ -37,7 +37,7 @@
(def: (expression archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([synthesis.bit /primitive.bit]
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 fd878a2b7..725a1f82b 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
@@ -151,7 +151,7 @@
(def: fail! _.break)
-(template [<name> <flag>]
+(with_template [<name> <flag>]
[(def: (<name> simple? idx)
(-> Bit Nat Statement)
(all _.then
@@ -209,7 +209,7 @@
else!
then!))))
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -227,7 +227,7 @@
[/////synthesis.#F64_Fork _.float]
[/////synthesis.#Text_Fork _.string])
- (^.template [<complex> <simple> <choice>]
+ (^.with_template [<complex> <simple> <choice>]
[(pattern (<complex> idx))
(///////phase#in (<choice> false idx))
@@ -239,7 +239,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (|> ..peek (_.item (_.int +1)) ..push!))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))])
([/////synthesis.member/left //runtime.tuple//left]
@@ -252,7 +252,7 @@
(_.local/1 (..register register) ..peek_and_pop)
then!)))
- (^.template [<tag> <combinator>]
+ (^.with_template [<tag> <combinator>]
[(pattern (<tag> preP postP))
(do ///////phase.monad
[pre! (again preP)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux
index 736dbb450..ff40f0f26 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux
@@ -4,7 +4,7 @@
[target
["_" lua (.only Literal)]]]])
-(template [<name> <type> <implementation>]
+(with_template [<name> <type> <implementation>]
[(def: .public <name>
(-> <type> Literal)
<implementation>)]
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 93f3cb980..503638aeb 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
@@ -39,7 +39,7 @@
["[0]" registry (.only Registry)]
["[0]" unit]]]]]])
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> [Register Label] Expression Statement))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux
index 3d2107867..dea69708f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux
@@ -32,7 +32,7 @@
(def: (statement expression archive synthesis)
Phase!
(case synthesis
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (<tag> value))
(//////phase#each _.return (expression archive synthesis))])
([////synthesis.bit]
@@ -44,7 +44,7 @@
[////synthesis.branch/get]
[////synthesis.function/apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern {<tag> value})
(//////phase#each _.return (expression archive synthesis))])
([////synthesis.#Reference]
@@ -53,7 +53,7 @@
(pattern (////synthesis.branch/case case))
(/case.case! statement expression archive case)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> statement expression archive value)])
([////synthesis.branch/let /case.let!]
@@ -70,7 +70,7 @@
(def: .public (expression archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([////synthesis.bit /primitive.bit]
@@ -81,7 +81,7 @@
{////synthesis.#Reference value}
(//reference.reference /reference.system archive value)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> expression archive value)])
([////synthesis.variant /structure.variant]
@@ -91,7 +91,7 @@
[////synthesis.branch/get /case.get]
[////synthesis.function/apply /function.apply])
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> statement expression archive value)])
([////synthesis.branch/case /case.case]
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 c05a3813d..c4f5534ac 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
@@ -87,7 +87,7 @@
[valueG (expression archive valueS)]
(in (list#mix (function (_ side source)
(.let [method (.case side
- (^.template [<side> <accessor>]
+ (^.with_template [<side> <accessor>]
[(<side> lefts)
(<accessor> (_.int (.int lefts)))])
([.#Left //runtime.tuple//left]
@@ -134,7 +134,7 @@
(_.int +0)
(_.int (i.* -1 (.int pops)))])))
-(template [<name> <flag> <prep>]
+(with_template [<name> <flag> <prep>]
[(def: (<name> simple? idx)
(-> Bit Nat Statement)
(all _.then
@@ -191,7 +191,7 @@
else!
then!))))
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -206,7 +206,7 @@
[/////synthesis.#F64_Fork //primitive.f64]
[/////synthesis.#Text_Fork //primitive.text])
- (^.template [<complex> <simple> <choice>]
+ (^.with_template [<complex> <simple> <choice>]
[(pattern (<complex> idx))
(///////phase#in (<choice> false idx))
@@ -220,7 +220,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (|> ..peek (_.item (_.int +0)) ..push!))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))])
([/////synthesis.member/left //runtime.tuple//left]
@@ -241,7 +241,7 @@
... (..multi_pop! (n.+ 2 extra_pops))
... next!))))
- (^.template [<tag> <combinator>]
+ (^.with_template [<tag> <combinator>]
[(pattern (<tag> preP postP))
(do ///////phase.monad
[pre! (again preP)
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 5c22acced..501c2ac3d 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
@@ -38,7 +38,7 @@
[archive (.only Output Archive)
["[0]" artifact (.only Registry)]]]]]])
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> [Nat Label] Expression Statement))]
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 f3e8d85b8..054e84344 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
@@ -37,7 +37,7 @@
(def: .public (expression archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([////synthesis.bit /primitive.bit]
@@ -45,7 +45,7 @@
[////synthesis.f64 /primitive.f64]
[////synthesis.text /primitive.text])
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> expression archive value)])
([////synthesis.variant /structure.variant]
@@ -58,7 +58,7 @@
[////synthesis.function/apply /function.apply])
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> ///extension/common.statement expression archive value)])
([////synthesis.branch/case /case.case]
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 d05828a5f..0997c9a9b 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
@@ -155,7 +155,7 @@
(-> Nat (Statement Any))
(_.delete (_.slice_from (_.int (i.* -1 (.int pops))) @cursor)))
-(template [<name> <flag>]
+(with_template [<name> <flag>]
[(def: (<name> simple? idx)
(-> Bit Nat (Statement Any))
(all _.then
@@ -218,7 +218,7 @@
else!
then!))}))
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -258,7 +258,7 @@
{/////synthesis.#Bind register}
(///////phase#in (_.set (list (..register register)) ..peek))
- (^.template [<complex> <simple> <choice>]
+ (^.with_template [<complex> <simple> <choice>]
[(pattern (<complex> idx))
(///////phase#in (<choice> false idx))
@@ -272,7 +272,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (|> ..peek (_.item (_.int +0)) ..push!))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))])
([/////synthesis.member/left //runtime.tuple::left]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux
index c9ff8d221..7afebeba8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux
@@ -6,7 +6,7 @@
["[0]" //
["[1][0]" runtime]])
-(template [<type> <name> <implementation>]
+(with_template [<type> <name> <implementation>]
[(def: .public <name>
(-> <type> (Expression Any))
<implementation>)]
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 8ed7f8bb8..12d1f65c7 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
@@ -41,7 +41,7 @@
["[0]" registry (.only Registry)]
["[0]" unit]]]]]])
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> Register (Expression Any) (Statement Any)))]
@@ -283,7 +283,7 @@
(runtime: (i64::64 input)
(with_vars [temp]
- (`` (<| (~~ (template [<scenario> <iteration> <cap> <entrance>]
+ (`` (<| (~~ (with_template [<scenario> <iteration> <cap> <entrance>]
[(_.if (|> input <scenario>)
(all _.then
(_.set (list temp) (_.% <iteration> input))
@@ -336,7 +336,7 @@
(_.return (_.- (|> subject (..i64#/ param) (_.* param))
subject)))
-(template [<runtime> <host>]
+(with_template [<runtime> <host>]
[(runtime: (<runtime> left right)
(_.return (..i64::64 (<host> (..as_nat left) (..as_nat right)))))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux
index 3e4cf4f0e..582d8dd42 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux
@@ -30,7 +30,7 @@
(def: .public (generate archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([////synthesis.bit /primitive.bit]
@@ -41,7 +41,7 @@
{////synthesis.#Reference value}
(//reference.reference /reference.system archive value)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> generate archive value)])
([////synthesis.variant /structure.variant]
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 52626fefb..a587c3883 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
@@ -69,7 +69,7 @@
[valueO (expression archive valueS)]
(in (list#mix (function (_ side source)
(.let [method (.case side
- (^.template [<side> <accessor>]
+ (^.with_template [<side> <accessor>]
[(<side> lefts)
(<accessor> (_.int (.int lefts)))])
([.#Left //runtime.tuple::left]
@@ -162,7 +162,7 @@
else!
then!))))
- (^.template [<tag> <format> <=>]
+ (^.with_template [<tag> <format> <=>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -180,7 +180,7 @@
[/////synthesis.#F64_Fork //primitive.f64 _.=]
[/////synthesis.#Text_Fork //primitive.text _.=])
- (^.template [<pm> <flag> <prep>]
+ (^.with_template [<pm> <flag> <prep>]
[(pattern (<pm> idx))
(///////phase#in (all _.then
(_.set! $temp (|> idx <prep> .int _.int (//runtime.sum::get ..peek (//runtime.flag <flag>))))
@@ -193,7 +193,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (_.item (_.int +1) ..peek))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push_cursor!))])
([/////synthesis.member/left //runtime.tuple::left]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux
index c377bbcc0..ca30d7b84 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux
@@ -6,7 +6,7 @@
["[0]" //
["[1][0]" runtime]])
-(template [<name> <type> <code>]
+(with_template [<name> <type> <code>]
[(def: .public <name>
(-> <type> Expression)
<code>)]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux
index 025abf8f6..85f63171f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux
@@ -152,7 +152,7 @@
))
... [[Bits]]
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(<op> paramO subjectO))]
@@ -162,7 +162,7 @@
[bit//xor runtimeT.bit//xor]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(<op> (runtimeT.int64_low paramO) subjectO))]
@@ -189,7 +189,7 @@
("static" MIN_VALUE Double)
("static" MAX_VALUE Double))
-(template [<name> <const> <encode>]
+(with_template [<name> <const> <encode>]
[(def: (<name> _)
Nullary
(<encode> <const>))]
@@ -199,7 +199,7 @@
[frac//max Double::MAX_VALUE r.float]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(|> subjectO (<op> paramO)))]
@@ -211,7 +211,7 @@
[int//rem runtimeT.int//%]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(<op> paramO subjectO))]
@@ -228,7 +228,7 @@
[text//< r.<]
)
-(template [<name> <cmp>]
+(with_template [<name> <cmp>]
[(def: (<name> [subjectO paramO])
Binary
(<cmp> paramO subjectO))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux
index ece7d2035..1f79ef1d6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux
@@ -15,7 +15,7 @@
(/// ["[0]T" runtime])
(// ["@" common]))
-... (template [<name> <lua>]
+... (with_template [<name> <lua>]
... [(def: (<name> _) @.Nullary <lua>)]
... [lua//nil "nil"]
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 e44c646d7..fbd61560c 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
@@ -44,7 +44,7 @@
(def: module_id
0)
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> _.SVar _.Expression _.Expression))]
@@ -165,7 +165,7 @@
(def: high_shift (_.bit_shl (_.int +32)))
-(template [<name> <power>]
+(with_template [<name> <power>]
[(runtime: <name> (|> (_.as::integer (_.int +2)) (_.** (_.as::integer (_.int <power>)))))]
[f2^32 +32]
@@ -219,7 +219,7 @@
(i64.left_shifted 32)
(i64.or low)))
-(template [<name> <value>]
+(with_template [<name> <value>]
[(runtime: <name>
(..i64 <value>))]
@@ -638,7 +638,7 @@
@adt::variant
))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(runtime: (<name> mask input)
(i64::new (<op> (i64_high mask)
(i64_high input))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux
index 94f243273..ef188574b 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux
@@ -67,7 +67,7 @@
(phase#each (|>> ..artifact (at system constant'))
(////generation.remember archive name)))
-(template [<sigil> <name>]
+(with_template [<sigil> <name>]
[(def: .public (<name> system)
(All (_ expression)
(-> (System expression)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux
index f0e8638e4..6a11d8996 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux
@@ -37,7 +37,7 @@
(def: (expression archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([////synthesis.bit /primitive.bit]
@@ -45,7 +45,7 @@
[////synthesis.f64 /primitive.f64]
[////synthesis.text /primitive.text])
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> expression archive value)])
([////synthesis.variant /structure.variant]
@@ -58,7 +58,7 @@
[////synthesis.function/apply /function.apply])
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> ///extension/common.statement expression archive value)])
([////synthesis.branch/case /case.case]
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 56b9b11f6..4c9de660a 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
@@ -159,7 +159,7 @@
{.#None}
@cursor)))
-(template [<name> <flag>]
+(with_template [<name> <flag>]
[(def: (<name> simple? idx)
(-> Bit Nat Statement)
(all _.then
@@ -227,7 +227,7 @@
else!
then!))}))
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -284,7 +284,7 @@
else!
then!))))
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -301,7 +301,7 @@
[/////synthesis.#F64_Fork (<| //primitive.f64)]
[/////synthesis.#Text_Fork (<| //primitive.text)])
- (^.template [<complex> <simple> <choice>]
+ (^.with_template [<complex> <simple> <choice>]
[(pattern (<complex> idx))
(///////phase#in (<choice> false idx))
@@ -315,7 +315,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (|> ..peek (_.item (_.int +0)) ..push!))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))])
([/////synthesis.member/left //runtime.tuple//left]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux
index c717441cb..162936972 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux
@@ -4,7 +4,7 @@
[target
["_" ruby (.only Literal)]]]])
-(template [<type> <name> <implementation>]
+(with_template [<type> <name> <implementation>]
[(def: .public <name>
(-> <type> Literal)
<implementation>)]
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 85a7286c1..ca2346d95 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
@@ -40,7 +40,7 @@
["[0]" unit]
["[0]" registry (.only Registry)]]]]]])
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> Register Expression Statement))]
@@ -286,7 +286,7 @@
(runtime: (i64::i64 input)
[..mruby? (_.return input)]
(with_vars [temp]
- (`` (<| (~~ (template [<scenario> <iteration> <cap> <entrance>]
+ (`` (<| (~~ (with_template [<scenario> <iteration> <cap> <entrance>]
[(_.if (|> input <scenario>)
(all _.then
(_.set (list temp) (_.% <iteration> input))
@@ -313,19 +313,20 @@
(def: i32::up
(_.bit_shl (_.int +32)))
-(template: (i64 @high @low)
- [(|> (_.? (i32::positive? @high)
- @high
- (|> (_.manual "+0xFFFFFFFF")
- (_.- @high)
- _.bit_not))
- i32::up
- (_.bit_or @low))])
+(def: i64
+ (template (_ @high @low)
+ [(|> (_.? (i32::positive? @high)
+ @high
+ (|> (_.manual "+0xFFFFFFFF")
+ (_.- @high)
+ _.bit_not))
+ i32::up
+ (_.bit_or @low))]))
(def: as_nat
(_.% ..i64::+iteration))
-(template [<runtime> <host>]
+(with_template [<runtime> <host>]
[(runtime: (<runtime> left right)
[..normal_ruby? (_.return (..i64::i64 (<host> (..as_nat left) (..as_nat right))))]
(with_vars [high low]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux
index 061a5c26c..2702efa5e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux
@@ -30,7 +30,7 @@
(def: .public (generate archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([////synthesis.bit /primitive.bit]
@@ -41,7 +41,7 @@
{////synthesis.#Reference value}
(//reference.reference /reference.system archive value)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> generate archive value)])
([////synthesis.variant /structure.variant]
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 9a7db7f48..bcaf13e2f 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
@@ -67,7 +67,7 @@
[valueO (expression archive valueS)]
(in (list#mix (function (_ side source)
(.let [method (.case side
- (^.template [<side> <accessor>]
+ (^.with_template [<side> <accessor>]
[(<side> lefts)
(<accessor> (_.int (.int lefts)))])
([.#Left //runtime.tuple//left]
@@ -156,7 +156,7 @@
else!
then!))))
- (^.template [<tag> <format> <=>]
+ (^.with_template [<tag> <format> <=>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -174,7 +174,7 @@
[/////synthesis.#F64_Fork //primitive.f64 _.=/2]
[/////synthesis.#Text_Fork //primitive.text _.string=?/2])
- (^.template [<pm> <flag> <prep>]
+ (^.with_template [<pm> <flag> <prep>]
[(pattern (<pm> idx))
(///////phase#in (_.let (list [@temp (|> idx <prep> .int _.int (//runtime.sum//get ..peek (_.bool <flag>)))])
(_.if (_.null?/1 @temp)
@@ -186,7 +186,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (..push_cursor! (_.vector_ref/2 ..peek (_.int +0))))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push_cursor!))])
([/////synthesis.member/left //runtime.tuple//left]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux
index 0de2a275a..3bf0659ba 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux
@@ -80,7 +80,7 @@
(bundle.install "is?" (binary (product.uncurried _.eq?/2)))
(bundle.install "try" (unary ///runtime.lux//try))))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(<op> paramO subjectO))]
@@ -104,7 +104,7 @@
Binary
(///runtime.i64//logical_right_shifted (_.remainder/2 (_.int +64) paramO) subjectO))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(|> subjectO (<op> paramO)))]
@@ -116,7 +116,7 @@
[i64::% _.remainder/2]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(<op> paramO subjectO))]
@@ -133,7 +133,7 @@
[text::< _.string<?/2]
)
-(template [<name> <cmp>]
+(with_template [<name> <cmp>]
[(def: (<name> [subjectO paramO])
Binary
(<cmp> paramO subjectO))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux
index 5cebadb2b..0772c64bc 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux
@@ -4,7 +4,7 @@
[target
["_" scheme (.only Expression)]]]])
-(template [<name> <type> <code>]
+(with_template [<name> <type> <code>]
[(def: .public <name>
(-> <type> Expression)
<code>)]
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 63c9ae0ab..ab4177125 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
@@ -42,7 +42,7 @@
(def: module_id
0)
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> Var Expression Expression))]
@@ -255,7 +255,7 @@
(runtime: (i64//64 input)
(with_vars [temp]
- (`` (<| (~~ (template [<scenario> <iteration> <cap> <entrance>]
+ (`` (<| (~~ (with_template [<scenario> <iteration> <cap> <entrance>]
[(_.if (|> input <scenario>)
(_.let (list [temp (_.remainder/2 <iteration> input)])
(_.if (|> temp <scenario>)
@@ -283,7 +283,7 @@
..as_nat
(_.arithmetic_shift/2 (_.-/2 shift (_.int +0)))))))
-(template [<runtime> <host>]
+(with_template [<runtime> <host>]
[(runtime: (<runtime> left right)
(..i64//64 (<host> (..as_nat left) (..as_nat right))))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux
index 99db4589b..de5d4c9e4 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux
@@ -35,14 +35,14 @@
{///simple.#Unit}
{/simple.#Text /.unit}
- (^.template [<analysis> <synthesis>]
+ (^.with_template [<analysis> <synthesis>]
[{<analysis> value}
{<synthesis> value}])
([///simple.#Bit /simple.#Bit]
[///simple.#Frac /simple.#F64]
[///simple.#Text /simple.#Text])
- (^.template [<analysis> <synthesis>]
+ (^.with_template [<analysis> <synthesis>]
[{<analysis> value}
{<synthesis> (.i64 value)}])
([///simple.#Nat /simple.#I64]
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 a24d6f7d4..fcd14c576 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
@@ -54,7 +54,7 @@
{/.#Bit_Fork when then {.#None}})
thenC)
- (^.template [<from> <to> <conversion>]
+ (^.with_template [<from> <to> <conversion>]
[{<from> test}
(///#each (function (_ then)
{<to> [(<conversion> test) then] (list)})
@@ -172,14 +172,14 @@
{.#Some old_else}
(weave new_then old_else))}})
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> new_fork} {<tag> old_fork}]
{<tag> (..weave_fork weave <equivalence> new_fork old_fork)}])
([/.#I64_Fork i64.equivalence]
[/.#F64_Fork frac.equivalence]
[/.#Text_Fork text.equivalence])
- (^.template [<access> <side> <lefts> <right?>]
+ (^.with_template [<access> <side> <lefts> <right?>]
[[{/.#Access {<access> [<lefts> newL <right?> <side>]}}
{/.#Access {<access> [<lefts> oldL <right?> <side>]}}]
(if (n.= newL oldL)
@@ -243,10 +243,11 @@
tailSP+ (monad.each ! (product.uncurried (path archive synthesize)) tailPA+)]
(in (/.branch/case [input (list#mix weave headSP tailSP+)]))))
-(template: (!masking <variable> <output>)
- [[[{///pattern.#Bind <variable>}
- {///analysis.#Reference (///reference.local <output>)}]
- (list)]])
+(def: !masking
+ (template (_ <variable> <output>)
+ [[[{///pattern.#Bind <variable>}
+ {///analysis.#Reference (///reference.local <output>)}]
+ (list)]]))
(def: .public (synthesize_exec synthesize archive before after)
(-> Phase Archive Synthesis Analysis (Operation Synthesis))
@@ -274,10 +275,11 @@
else (synthesize archive else)]
(in (/.branch/if [test then else]))))
-(template: (!get <patterns> <output>)
- [[[(///pattern.tuple <patterns>)
- {///analysis.#Reference (///reference.local <output>)}]
- (.list)]])
+(def: !get
+ (template (_ <patterns> <output>)
+ [[[(///pattern.tuple <patterns>)
+ {///analysis.#Reference (///reference.local <output>)}]
+ (.list)]]))
(def: .public (synthesize_get synthesize archive input patterns @member)
(-> Phase Archive Synthesis (///complex.Tuple Pattern) Register (Operation Synthesis))
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 ac7a81a73..81e10d318 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
@@ -42,8 +42,9 @@
(enum.range n.enum 1)
(list#each (|>> /.variable/local))))
-(template: .public (self_reference)
- [(/.variable/local 0)])
+(def: .public self_reference
+ (template (self_reference)
+ [(/.variable/local 0)]))
(def: (expanded_nested_self_reference arity)
(-> Arity Synthesis)
@@ -100,7 +101,7 @@
{/.#Bind register}
(phase#in {/.#Bind (++ register)})
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
(do phase.monad
[left' (grow_path grow left)
@@ -119,7 +120,7 @@
(in {.#None}))]
(in {/.#Bit_Fork when then else}))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> [[test then] elses]}
(do [! phase.monad]
[then (grow_path grow then)
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 d57b85be1..eeb412da4 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
@@ -36,7 +36,7 @@
{/.#Bind register}
{.#Some {/.#Bind (register_optimization offset register)}}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
(do maybe.monad
[left' (again left)
@@ -55,7 +55,7 @@
(in {.#None}))]
(in {/.#Bit_Fork when then else}))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> [[test then] elses]}
(do [! maybe.monad]
[then (again then)
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 1ea006203..6cd117d2d 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
@@ -68,7 +68,7 @@
register)}
(again post)}})
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
{<tag> (again left) (again right)}])
([/.#Seq]
@@ -77,7 +77,7 @@
{/.#Bit_Fork when then else}
{/.#Bit_Fork when (again then) (maybe#each again else)}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> [[test then] tail]}
{<tag> [[test (again then)]
(list#each (function (_ [test' then'])
@@ -216,7 +216,7 @@
(in [redundancy
{.#Item head tail}])))))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [register Register])
(exception.report
"Register" (%.nat register)))]
@@ -274,7 +274,7 @@
(in [redundancy {.#None}]))]
(in [redundancy {/.#Bit_Fork when then else}]))
- (^.template [<tag> <type>]
+ (^.with_template [<tag> <type>]
[{<tag> [[test then] elses]}
(do [! try.monad]
[[redundancy then] (again [redundancy then])
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 3b7d560b4..d0bc4dbdc 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
@@ -33,8 +33,9 @@
[control
["[0]" maybe]
["[0]" exception (.only exception:)]
- [parser
- [text (.only Offset)]]]
+ ["<>" parser (.only)
+ [text (.only Offset)]
+ ["<[0]>" code]]]
[data
["[0]" text (.only)
["%" format (.only format)]]
@@ -42,6 +43,7 @@
["[0]" list]
["[0]" dictionary (.only Dictionary)]]]
[macro
+ [syntax (.only syntax)]
["[0]" template]]
[meta
["[0]" symbol]]
@@ -52,11 +54,18 @@
["[0]" rev]
["[0]" frac]]]]])
-(template: (inline: <declaration> <type> <body>)
- [(for @.python (def: <declaration> <type> <body>)
- ... TODO: No longer skip inlining Lua after Rembulan isn't being used anymore.
- @.lua (def: <declaration> <type> <body>)
- (template: <declaration> [<body>]))])
+(def: declaration_name
+ (syntax (_ [[name parameters] (<code>.form (<>.and <code>.any (<>.some <code>.any)))])
+ (in (list name))))
+
+(def: inline:
+ (template (_ <declaration> <type> <body>)
+ [(for @.python (def: <declaration> <type> <body>)
+ ... TODO: No longer skip inlining Lua after Rembulan isn't being used anymore.
+ @.lua (def: <declaration> <type> <body>)
+ (`` (def: (~~ (..declaration_name <declaration>))
+ (template <declaration>
+ [<body>]))))]))
... TODO: Implement "lux syntax char case!" as a custom extension.
... That way, it should be possible to obtain the char without wrapping
@@ -74,29 +83,33 @@
(type: Char
Nat)
-(template [<extension> <diff> <name>]
- [(template: (<name> value)
- [(<extension> <diff> value)])]
+(with_template [<extension> <diff> <name>]
+ [(def: <name>
+ (template (_ value)
+ [(<extension> <diff> value)]))]
["lux i64 +" 1 !++]
["lux i64 +" 2 !++/2]
["lux i64 -" 1 !--]
)
-(template: (!clip from to text)
- [("lux text clip" from (n.- from to) text)])
+(def: !clip
+ (template (_ from to text)
+ [("lux text clip" from (n.- from to) text)]))
-(template [<name> <extension>]
- [(template: (<name> reference subject)
- [(<extension> reference subject)])]
+(with_template [<name> <extension>]
+ [(def: <name>
+ (template (_ reference subject)
+ [(<extension> reference subject)]))]
[!n/= "lux i64 ="]
[!i/< "lux i64 <"]
)
-(template [<name> <extension>]
- [(template: (<name> param subject)
- [(<extension> param subject)])]
+(with_template [<name> <extension>]
+ [(def: <name>
+ (template (_ param subject)
+ [(<extension> param subject)]))]
[!n/+ "lux i64 +"]
[!n/- "lux i64 -"]
@@ -114,7 +127,7 @@
(def: .public text_delimiter text.double_quote)
-(template [<char> <definition>]
+(with_template [<char> <definition>]
[(def: .public <definition> <char>)]
... Form delimiters
@@ -174,40 +187,46 @@
(exception.report
"Text" (%.text text)))
-(template: (!failure parser where offset source_code)
- [{.#Left [[where offset source_code]
- (exception.error ..unrecognized_input [where (%.symbol (symbol parser)) source_code offset])]}])
+(def: !failure
+ (template (_ parser where offset source_code)
+ [{.#Left [[where offset source_code]
+ (exception.error ..unrecognized_input [where (%.symbol (symbol parser)) source_code offset])]}]))
-(template: (!end_of_file where offset source_code current_module)
- [{.#Left [[where offset source_code]
- (exception.error ..end_of_file current_module)]}])
+(def: !end_of_file
+ (template (_ where offset source_code current_module)
+ [{.#Left [[where offset source_code]
+ (exception.error ..end_of_file current_module)]}]))
(type: (Parser a)
(-> Source (Either [Source Text] [Source a])))
-(template: (!with_char+ @source_code_size @source_code @offset @char @else @body)
- [(if (!i/< (as Int @source_code_size)
- (as Int @offset))
- (let [@char ("lux text char" @offset @source_code)]
- @body)
- @else)])
-
-(template: (!with_char @source_code @offset @char @else @body)
- [(!with_char+ ("lux text size" @source_code) @source_code @offset @char @else @body)])
-
-(template: (!letE <binding> <computation> <body>)
- [(case <computation>
- {.#Right <binding>}
- <body>
-
- ... {.#Left error}
- <<otherwise>>
- (as_expected <<otherwise>>))])
-
-(template: (!horizontal where offset source_code)
- [[(revised .#column ++ where)
- (!++ offset)
- source_code]])
+(def: !with_char+
+ (template (_ @source_code_size @source_code @offset @char @else @body)
+ [(if (!i/< (as Int @source_code_size)
+ (as Int @offset))
+ (let [@char ("lux text char" @offset @source_code)]
+ @body)
+ @else)]))
+
+(def: !with_char
+ (template (_ @source_code @offset @char @else @body)
+ [(!with_char+ ("lux text size" @source_code) @source_code @offset @char @else @body)]))
+
+(def: !letE
+ (template (_ <binding> <computation> <body>)
+ [(case <computation>
+ {.#Right <binding>}
+ <body>
+
+ ... {.#Left error}
+ <<otherwise>>
+ (as_expected <<otherwise>>))]))
+
+(def: !horizontal
+ (template (_ where offset source_code)
+ [[(revised .#column ++ where)
+ (!++ offset)
+ source_code]]))
(inline: (!new_line where)
(-> Location Location)
@@ -219,12 +238,13 @@
(let [[where::file where::line where::column] where]
[where::file where::line (!n/+ length where::column)]))
-(template: (!vertical where offset source_code)
- [[(!new_line where)
- (!++ offset)
- source_code]])
+(def: !vertical
+ (template (_ where offset source_code)
+ [[(!new_line where)
+ (!++ offset)
+ source_code]]))
-(template [<name> <close> <tag>]
+(with_template [<name> <close> <tag>]
[(inline: (<name> parse where offset source_code)
(-> (Parser Code) Location Offset Text
(Either [Source Text] [Source Code]))
@@ -248,14 +268,15 @@
[tuple_parser ..close_tuple .#Tuple]
)
-(template: (!guarantee_no_new_lines where offset source_code content body)
- [(case ("lux text index" 0 (static text.new_line) content)
- {.#None}
- body
+(def: !guarantee_no_new_lines
+ (template (_ where offset source_code content body)
+ [(case ("lux text index" 0 (static text.new_line) content)
+ {.#None}
+ body
- g!_
- {.#Left [[where offset source_code]
- (exception.error ..text_cannot_contain_new_lines content)]})])
+ g!_
+ {.#Left [[where offset source_code]
+ (exception.error ..text_cannot_contain_new_lines content)]})]))
(def: (text_parser where offset source_code)
(-> Location Offset Text (Either [Source Text] [Source Code]))
@@ -274,7 +295,7 @@
(!failure ..text_parser where offset source_code)))
(with_expansions [<digits> (these "0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
- <non_symbol_chars> (template [<char>]
+ <non_symbol_chars> (with_template [<char>]
[(~~ (static <char>))]
[text.space]
@@ -285,56 +306,61 @@
[..open_tuple] [..close_tuple]
[..text_delimiter])
<digit_separator> (static ..digit_separator)]
- (template: (!if_digit? @char @then @else)
- [("lux syntax char case!" @char
- [[<digits>]
- @then]
-
- ... else
- @else)])
-
- (template: (!if_digit?+ @char @then @else_options @else)
- [(`` ("lux syntax char case!" @char
- [[<digits> <digit_separator>]
- @then
-
- (~~ (template.spliced @else_options))]
-
- ... else
- @else))])
-
- (`` (template: (!if_symbol_char?|tail @char @then @else)
- [("lux syntax char case!" @char
- [[<non_symbol_chars>]
- @else]
-
- ... else
- @then)]))
-
- (`` (template: (!if_symbol_char?|head @char @then @else)
- [("lux syntax char case!" @char
- [[<non_symbol_chars> <digits>]
- @else]
-
- ... else
- @then)]))
+ (def: !if_digit?
+ (template (_ @char @then @else)
+ [("lux syntax char case!" @char
+ [[<digits>]
+ @then]
+
+ ... else
+ @else)]))
+
+ (def: !if_digit?+
+ (template (_ @char @then @else_options @else)
+ [(`` ("lux syntax char case!" @char
+ [[<digits> <digit_separator>]
+ @then
+
+ (~~ (template.spliced @else_options))]
+
+ ... else
+ @else))]))
+
+ (`` (def: !if_symbol_char?|tail
+ (template (_ @char @then @else)
+ [("lux syntax char case!" @char
+ [[<non_symbol_chars>]
+ @else]
+
+ ... else
+ @then)])))
+
+ (`` (def: !if_symbol_char?|head
+ (template (_ @char @then @else)
+ [("lux syntax char case!" @char
+ [[<non_symbol_chars> <digits>]
+ @else]
+
+ ... else
+ @then)])))
)
-(template: (!number_output <source_code> <start> <end> <codec> <tag>)
- [(case (|> <source_code>
- (!clip <start> <end>)
- (text.replaced ..digit_separator "")
- (at <codec> decoded))
- {.#Right output}
- {.#Right [[(let [[where::file where::line where::column] where]
- [where::file where::line (!n/+ (!n/- <start> <end>) where::column)])
- <end>
- <source_code>]
- [where {<tag> output}]]}
-
- {.#Left error}
- {.#Left [[where <start> <source_code>]
- error]})])
+(def: !number_output
+ (template (_ <source_code> <start> <end> <codec> <tag>)
+ [(case (|> <source_code>
+ (!clip <start> <end>)
+ (text.replaced ..digit_separator "")
+ (at <codec> decoded))
+ {.#Right output}
+ {.#Right [[(let [[where::file where::line where::column] where]
+ [where::file where::line (!n/+ (!n/- <start> <end>) where::column)])
+ <end>
+ <source_code>]
+ [where {<tag> output}]]}
+
+ {.#Left error}
+ {.#Left [[where <start> <source_code>]
+ error]})]))
(def: no_exponent
Offset
@@ -344,7 +370,7 @@
<frac_output> (these (!number_output source_code start end frac.decimal .#Frac))
<failure> (!failure ..frac_parser where offset source_code)
<frac_separator> (static ..frac_separator)
- <signs> (template [<sign>]
+ <signs> (with_template [<sign>]
[(~~ (static <sign>))]
[..positive_sign]
@@ -388,7 +414,7 @@
<int_output>))))
)
-(template [<parser> <codec> <tag>]
+(with_template [<parser> <codec> <tag>]
[(inline: (<parser> source_code//size start where offset source_code)
(-> Nat Nat Location Offset Text
(Either [Source Text] [Source Code]))
@@ -403,12 +429,13 @@
[rev_parser rev.decimal .#Rev]
)
-(template: (!signed_parser source_code//size offset where source_code @aliases @end)
- [(<| (let [g!offset/1 (!++ offset)])
- (!with_char+ source_code//size source_code g!offset/1 g!char/1 @end)
- (!if_digit? g!char/1
- (signed_parser source_code//size offset where (!++/2 offset) source_code)
- (!full_symbol_parser offset [where (!++ offset) source_code] where @aliases .#Symbol)))])
+(def: !signed_parser
+ (template (_ source_code//size offset where source_code @aliases @end)
+ [(<| (let [g!offset/1 (!++ offset)])
+ (!with_char+ source_code//size source_code g!offset/1 g!char/1 @end)
+ (!if_digit? g!char/1
+ (signed_parser source_code//size offset where (!++/2 offset) source_code)
+ (!full_symbol_parser offset [where (!++ offset) source_code] where @aliases .#Symbol)))]))
(with_expansions [<output> {.#Right [[(revised .#column (|>> (!n/+ (!n/- start end))) where)
end
@@ -424,11 +451,12 @@
(again (!++ end))
<output>))))))
-(template: (!half_symbol_parser @offset @char @module)
- [(!if_symbol_char?|head @char
- (!letE [source' symbol] (..symbol_part_parser @offset (!forward 1 where) (!++ @offset) source_code)
- {.#Right [source' [@module symbol]]})
- (!failure ..!half_symbol_parser where @offset source_code))])
+(def: !half_symbol_parser
+ (template (_ @offset @char @module)
+ [(!if_symbol_char?|head @char
+ (!letE [source' symbol] (..symbol_part_parser @offset (!forward 1 where) (!++ @offset) source_code)
+ {.#Right [source' [@module symbol]]})
+ (!failure ..!half_symbol_parser where @offset source_code))]))
(`` (def: (short_symbol_parser source_code//size current_module [where offset/0 source_code])
(-> Nat Text (Parser Symbol))
@@ -441,9 +469,10 @@
(!half_symbol_parser offset/1 char/1 current_module))
(!half_symbol_parser offset/0 char/0 (static ..prelude))))))
-(template: (!short_symbol_parser source_code//size @current_module @source @where @tag)
- [(!letE [source' symbol] (..short_symbol_parser source_code//size @current_module @source)
- {.#Right [source' [@where {@tag symbol}]]})])
+(def: !short_symbol_parser
+ (template (_ source_code//size @current_module @source @where @tag)
+ [(!letE [source' symbol] (..short_symbol_parser source_code//size @current_module @source)
+ {.#Right [source' [@where {@tag symbol}]]})]))
(with_expansions [<simple> (these {.#Right [source' ["" simple]]})]
(`` (def: (full_symbol_parser aliases start source)
@@ -464,9 +493,10 @@
complex]]}))
<simple>)))))
-(template: (!full_symbol_parser @offset @source @where @aliases @tag)
- [(!letE [source' full_symbol] (..full_symbol_parser @aliases @offset @source)
- {.#Right [source' [@where {@tag full_symbol}]]})])
+(def: !full_symbol_parser
+ (template (_ @offset @source @where @aliases @tag)
+ [(!letE [source' full_symbol] (..full_symbol_parser @aliases @offset @source)
+ {.#Right [source' [@where {@tag full_symbol}]]})]))
... TODO: Grammar macro for specifying syntax.
... (grammar: lux_grammar
@@ -478,8 +508,9 @@
<move_2> (these [(!forward 1 where) (!++/2 offset/0) source_code])
<again> (these (parse current_module aliases source_code//size))]
- (template: (!close closer)
- [{.#Left [<move_1> closer]}])
+ (def: !close
+ (template (_ closer)
+ [{.#Left [<move_1> closer]}]))
(def: (bit_syntax value [where offset/0 source_code])
(-> Bit (Parser Code))
@@ -497,7 +528,7 @@
(function (again [where offset/0 source_code])
(<| (!with_char+ source_code//size source_code offset/0 char/0
(!end_of_file where offset/0 source_code current_module))
- (with_expansions [<composites> (template [<open> <close> <parser>]
+ (with_expansions [<composites> (with_template [<open> <close> <parser>]
[[(~~ (static <open>))]
(<parser> <again> <consume_1>)
@@ -568,7 +599,7 @@
(!with_char+ source_code//size source_code offset/1 char/1
(!end_of_file where offset/1 source_code current_module))
("lux syntax char case!" char/1
- [(~~ (template [<char> <bit>]
+ [(~~ (with_template [<char> <bit>]
[[<char>]
(..bit_syntax <bit> [where offset/0 source_code])]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
index 2f9b007dd..831374079 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
@@ -125,7 +125,7 @@
{#Control (Control Synthesis)}
{#Extension (Extension Synthesis)})))
-(template [<special> <general>]
+(with_template [<special> <general>]
[(type: .public <special>
(<general> ..State Analysis Synthesis))]
@@ -143,30 +143,33 @@
Path
{#Pop})
-(template [<name> <kind>]
- [(template: .public (<name> content)
- [(.<| {..#Access}
- {<kind>}
- content)])]
+(with_template [<name> <kind>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(.<| {..#Access}
+ {<kind>}
+ content)]))]
[path/side /access.#Side]
[path/member /access.#Member]
)
-(template [<name> <access> <lefts> <right?>]
- [(template: .public (<name> lefts right?)
- [(.<| {..#Access}
- {<access>}
- [<lefts> lefts
- <right?> right?])])]
+(with_template [<name> <access> <lefts> <right?>]
+ [(def: .public <name>
+ (template (<name> lefts right?)
+ [(.<| {..#Access}
+ {<access>}
+ [<lefts> lefts
+ <right?> right?])]))]
[side /access.#Side /side.#lefts /side.#right?]
[member /access.#Member /member.#lefts /member.#right?]
)
-(template [<access> <side> <name>]
- [(template: .public (<name> lefts)
- [(<access> lefts <side>)])]
+(with_template [<access> <side> <name>]
+ [(def: .public <name>
+ (template (<name> lefts)
+ [(<access> lefts <side>)]))]
[..side #0 side/left]
[..side #1 side/right]
@@ -175,17 +178,19 @@
[..member #1 member/right]
)
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [{<tag> content}])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [{<tag> content}]))]
[path/bind ..#Bind]
[path/then ..#Then]
)
-(template [<name> <tag>]
- [(template: .public (<name> left right)
- [{<tag> left right}])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> left right)
+ [{<tag> left right}]))]
[path/alt ..#Alt]
[path/seq ..#Seq]
@@ -201,7 +206,7 @@
Text
"")
-(template [<with> <query> <tag> <type>]
+(with_template [<with> <query> <tag> <type>]
[(def: .public (<with> value)
(-> <type> (All (_ a) (-> (Operation a) (Operation a))))
(extension.temporary (has <tag> value)))
@@ -220,9 +225,10 @@
[locals ..locals])
(..with_locals (++ locals))))
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [{..#Simple {<tag> content}}])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [{..#Simple {<tag> content}}]))]
[bit /simple.#Bit]
[i64 /simple.#I64]
@@ -230,21 +236,23 @@
[text /simple.#Text]
)
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [(.<| {..#Structure}
- {<tag>}
- content)])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(.<| {..#Structure}
+ {<tag>}
+ content)]))]
[variant analysis/complex.#Variant]
[tuple analysis/complex.#Tuple]
)
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [(.<| {..#Reference}
- <tag>
- content)])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(.<| {..#Reference}
+ <tag>
+ content)]))]
[variable reference.variable]
[constant reference.constant]
@@ -252,12 +260,13 @@
[variable/foreign reference.foreign]
)
-(template [<name> <family> <tag>]
- [(template: .public (<name> content)
- [(.<| {..#Control}
- {<family>}
- {<tag>}
- content)])]
+(with_template [<name> <family> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(.<| {..#Control}
+ {<family>}
+ {<tag>}
+ content)]))]
[branch/case ..#Branch ..#Case]
[branch/exec ..#Branch ..#Exec]
@@ -289,7 +298,7 @@
"")
")")
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(|> {.#Item item}
(list#each (function (_ [test then])
@@ -422,7 +431,7 @@
(= reference_then sample_then)
(at (maybe.equivalence =) = reference_else sample_else))
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> reference_item}
{<tag> sample_item}]
(at (list.equivalence (product.equivalence <equivalence> =)) =
@@ -432,7 +441,7 @@
[#F64_Fork f.equivalence]
[#Text_Fork text.equivalence])
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> reference'} {<tag> sample'}]
(at <equivalence> = reference' sample')])
([#Access /access.equivalence]
@@ -441,7 +450,7 @@
[{#Bind reference'} {#Bind sample'}]
(n.= reference' sample')
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> leftR rightR} {<tag> leftS rightS}]
(and (= leftR leftS)
(= rightR rightS))])
@@ -474,7 +483,7 @@
(hash then)
(at (maybe.hash (path'_hash super)) hash else))
- (^.template [<factor> <tag> <hash>]
+ (^.with_template [<factor> <tag> <hash>]
[{<tag> item}
(let [case_hash (product.hash <hash>
(path'_hash super))
@@ -484,7 +493,7 @@
[13 #F64_Fork f.hash]
[17 #Text_Fork text.hash])
- (^.template [<factor> <tag>]
+ (^.with_template [<factor> <tag>]
[{<tag> fork}
(let [again_hash (path'_hash super)
fork_hash (product.hash again_hash again_hash)]
@@ -642,7 +651,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> reference} {<tag> sample}]
(at (<equivalence> #=) = reference sample)])
([#Branch ..branch_equivalence]
@@ -660,7 +669,7 @@
(def: (hash value)
(case value
- (^.template [<factor> <tag> <hash>]
+ (^.with_template [<factor> <tag> <hash>]
[{<tag> value}
(n.* <factor> (at (<hash> super) hash value))])
([2 #Branch ..branch_hash]
@@ -673,7 +682,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> reference'} {<tag> sample'}]
(at <equivalence> = reference' sample')])
([#Simple /simple.equivalence]
@@ -697,7 +706,7 @@
(def: (hash value)
(let [again_hash [..equivalence hash]]
(case value
- (^.template [<tag> <hash>]
+ (^.with_template [<tag> <hash>]
[{<tag> value}
(at <hash> hash value)])
([#Simple /simple.hash]
@@ -706,17 +715,19 @@
[#Control (..control_hash again_hash)]
[#Extension (extension.hash again_hash)])))))
-(template: .public (!bind_top register thenP)
- [(all ..path/seq
- {..#Bind register}
- {..#Pop}
- thenP)])
+(def: .public !bind_top
+ (template (!bind_top register thenP)
+ [(all ..path/seq
+ {..#Bind register}
+ {..#Pop}
+ thenP)]))
-(template: .public (!multi_pop nextP)
- [(all ..path/seq
- {..#Pop}
- {..#Pop}
- nextP)])
+(def: .public !multi_pop
+ (template (!multi_pop nextP)
+ [(all ..path/seq
+ {..#Pop}
+ {..#Pop}
+ nextP)]))
... TODO: There are sister patterns to the simple side checks for tuples.
... These correspond to the situation where tuple members are accessed
@@ -725,12 +736,13 @@
... After re-implementing unused-variable-elimination, must add those
... pattern-optimizations again, since a lot of BINDs will become POPs
... and thus will result in useless code being generated.
-(template [<name> <side>]
- [(template: .public (<name> idx nextP)
- [(all ..path/seq
- (<side> idx)
- {..#Pop}
- nextP)])]
+(with_template [<name> <side>]
+ [(def: .public <name>
+ (template (<name> idx nextP)
+ [(all ..path/seq
+ (<side> idx)
+ {..#Pop}
+ nextP)]))]
[simple_left_side ..side/left]
[simple_right_side ..side/right]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux
index a0fdb6e67..6a6e4b3b0 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux
@@ -29,7 +29,7 @@
(def: .public (format it)
(%.Format Simple)
(case it
- (^.template [<pattern> <format>]
+ (^.with_template [<pattern> <format>]
[{<pattern> value}
(<format> value)])
([#Bit %.bit]
@@ -44,7 +44,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag> <eq> <format>]
+ (^.with_template [<tag> <eq> <format>]
[[{<tag> reference'} {<tag> sample'}]
(<eq> reference' sample')])
([#Bit bit#= %.bit]
@@ -64,7 +64,7 @@
(def: hash
(|>> (pipe.case
- (^.template [<factor> <tag> <hash>]
+ (^.with_template [<factor> <tag> <hash>]
[{<tag> value'}
(n.* <factor> (at <hash> hash value'))])
([2 #Bit bit.hash]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
index cf56ab7f3..1f12940df 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
@@ -56,7 +56,7 @@
"Old key" (signature.description (document.signature old))
"New key" (signature.description (document.signature new))))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [it descriptor.Module])
(exception.report
"Module" (%.text it)))]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux
index d6dc3c74f..a3780a1b8 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux
@@ -51,7 +51,7 @@
[{#Definition left} {#Definition right}]
(at definition_equivalence = left right)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> left} {<tag> right}]
(text#= left right)])
([#Analyser]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux
index dade0e5d8..bc35ee361 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux
@@ -41,7 +41,7 @@
(def: (= left right)
(case [left right]
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag>} {<tag>}]
true])
([.#Active]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux
index 7206a2f6c..dc0ed11fc 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux
@@ -59,7 +59,7 @@
dependencies]))
abstraction)]))
- (template [<tag> <create> <fetch> <type> <name> <+resolver>]
+ (with_template [<tag> <create> <fetch> <type> <name> <+resolver>]
[(def: .public (<create> it mandatory? dependencies registry)
(-> <type> Bit (Set unit.ID) Registry [ID Registry])
(let [id (..next registry)]
@@ -119,7 +119,7 @@
category (is (Writer Category)
(function (_ value)
(case value
- (^.template [<nat> <tag> <writer>]
+ (^.with_template [<nat> <tag> <writer>]
[{<tag> value}
((binary.and binary.nat <writer>) [<nat> value])])
([0 //category.#Anonymous binary.any]
@@ -164,7 +164,7 @@
(do [! <>.monad]
[tag <binary>.nat]
(case tag
- (^.template [<nat> <tag> <parser>]
+ (^.with_template [<nat> <tag> <parser>]
[<nat>
(at ! each (|>> {<tag>}) <parser>)])
([0 //category.#Anonymous <binary>.any]
@@ -188,7 +188,7 @@
{//category.#Anonymous}
(..resource mandatory? dependencies registry)
- (^.template [<tag> <create>]
+ (^.with_template [<tag> <create>]
[{<tag> name}
(<create> name mandatory? dependencies registry)])
([//category.#Definition ..definition]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux
index 6e5f46df9..160c23890 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux
@@ -45,7 +45,7 @@
{synthesis.#Bind _})
(list)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
(.all list#composite
(again left)
@@ -63,7 +63,7 @@
{.#None}
(again then))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> fork}
(|> {.#Item fork}
(list#each (|>> product.right again))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli.lux b/stdlib/source/library/lux/tool/compiler/meta/cli.lux
index d611dde33..40ae2eb84 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/cli.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/cli.lux
@@ -70,7 +70,7 @@
{#Interpretation Interpretation}
{#Export Export}))
-(template [<name> <long> <type> <parser>]
+(with_template [<name> <long> <type> <parser>]
[(def: <name>
(Parser <type>)
(<cli>.named <long> <parser>))]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux b/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux
index 1d37314b6..84107e91d 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux
@@ -30,7 +30,7 @@
(list.equivalence text.equivalence)
))
-(template [<ascii> <name>]
+(with_template [<ascii> <name>]
[(def: <name>
Text
(text.of_char (hex <ascii>)))]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/context.lux b/stdlib/source/library/lux/tool/compiler/meta/context.lux
index b65bfc16e..cfacb3fe9 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/context.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/context.lux
@@ -15,7 +15,7 @@
#target Path
#artifact_extension Extension]))
-(template [<name> <host> <host_module_extension> <artifact_extension>]
+(with_template [<name> <host> <host_module_extension> <artifact_extension>]
[(def: .public (<name> target)
(-> Path Context)
[#host <host>
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 ff44f3258..4935aae78 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
@@ -221,7 +221,7 @@
content (document.content $.key document)
definitions (monad.each ! (function (_ [def_name def_global])
(case def_global
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> payload}
(in [def_name {<tag> payload}])])
([.#Alias]
diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux
index 480ad7380..48b08b54b 100644
--- a/stdlib/source/library/lux/tool/compiler/phase.lux
+++ b/stdlib/source/library/lux/tool/compiler/phase.lux
@@ -106,10 +106,11 @@
(function (_ state)
(try#each (|>> [state]) error)))
-(template: .public (assertion exception message test)
- [(if test
- (at ..monad in [])
- (..except exception message))])
+(def: .public assertion
+ (template (assertion exception message test)
+ [(if test
+ (at ..monad in [])
+ (..except exception message))]))
(def: .public identity
(All (_ s a) (Phase s a a))
diff --git a/stdlib/source/library/lux/tool/compiler/reference.lux b/stdlib/source/library/lux/tool/compiler/reference.lux
index c20c13688..cd028073c 100644
--- a/stdlib/source/library/lux/tool/compiler/reference.lux
+++ b/stdlib/source/library/lux/tool/compiler/reference.lux
@@ -32,7 +32,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> reference} {<tag> sample}]
(at <equivalence> = reference sample)])
([#Variable /variable.equivalence]
@@ -49,7 +49,7 @@
(def: (hash value)
(case value
- (^.template [<factor> <tag> <hash>]
+ (^.with_template [<factor> <tag> <hash>]
[{<tag> value}
(|> value
(at <hash> hash)
@@ -58,27 +58,30 @@
[3 #Constant symbol.hash])
)))
-(template [<name> <family> <tag>]
- [(template: .public (<name> content)
- [(<| {<family>}
- {<tag>}
- content)])]
+(with_template [<name> <family> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(<| {<family>}
+ {<tag>}
+ content)]))]
[local ..#Variable /variable.#Local]
[foreign ..#Variable /variable.#Foreign]
)
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [(<| {<tag>}
- content)])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(<| {<tag>}
+ content)]))]
[variable ..#Variable]
[constant ..#Constant]
)
-(`` (template: .public self
- [(..variable (~~ (/variable.self)))]))
+(`` (def: .public self
+ (template (self)
+ [(..variable (~~ (/variable.self)))])))
(def: .public format
(Format Reference)
diff --git a/stdlib/source/library/lux/tool/compiler/reference/variable.lux b/stdlib/source/library/lux/tool/compiler/reference/variable.lux
index 488901fff..ad3be0e06 100644
--- a/stdlib/source/library/lux/tool/compiler/reference/variable.lux
+++ b/stdlib/source/library/lux/tool/compiler/reference/variable.lux
@@ -29,7 +29,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> reference'} {<tag> sample'}]
(n.= reference' sample')])
([#Local] [#Foreign])
@@ -45,7 +45,7 @@
(def: hash
(|>> (pipe.case
- (^.template [<factor> <tag>]
+ (^.with_template [<factor> <tag>]
[{<tag> register}
(|> register
(at n.hash hash)
@@ -53,8 +53,9 @@
([2 #Local]
[3 #Foreign])))))
-(template: .public (self)
- [{..#Local 0}])
+(def: .public self
+ (template (self)
+ [{..#Local 0}]))
(def: .public self?
(-> Variable Bit)
diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux
index 643b86923..fd506820d 100644
--- a/stdlib/source/library/lux/type.lux
+++ b/stdlib/source/library/lux/type.lux
@@ -28,7 +28,7 @@
["[0]" location]
["[0]" symbol (.open: "[1]#[0]" equivalence codec)]]]])
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public (<name> type)
(-> Type [Nat Type])
(loop (again [num_args 0
@@ -64,7 +64,7 @@
_
[type (list)]))
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public (<name> type)
(-> Type (List Type))
(case type
@@ -90,7 +90,7 @@
(list#mix (function.flipped text#composite) ""))
")")
- (^.template [<tag> <open> <close> <flat>]
+ (^.with_template [<tag> <open> <close> <flat>]
[{<tag> _}
(all text#composite <open>
(|> (<flat> type)
@@ -125,7 +125,7 @@
(.let [[type_func type_args] (flat_application type)]
(all text#composite "(" (format type_func) " " (|> type_args (list#each format) list.reversed (list.interposed " ") (list#mix text#composite "")) ")"))
- (^.template [<tag> <desc>]
+ (^.with_template [<tag> <desc>]
[{<tag> env body}
(all text#composite "(" <desc> " {" (|> env (list#each format) (text.interposed " ")) "} " (format body) ")")])
([.#UnivQ "All"]
@@ -142,13 +142,13 @@
{.#Primitive name params}
{.#Primitive name (list#each (reduced env) params)}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
{<tag> (reduced env left) (reduced env right)}])
([.#Sum] [.#Product]
[.#Function] [.#Apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> old_env def}
(case old_env
{.#End}
@@ -192,7 +192,7 @@
#1
(list.zipped_2 xparams yparams)))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> xid} {<tag> yid}]
(n.= yid xid)])
([.#Var] [.#Ex] [.#Parameter])
@@ -206,7 +206,7 @@
(and (symbol#= xname yname)
(= xtype ytype))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> xL xR} {<tag> yL yR}]
(and (= xL yL) (= xR yR))])
([.#Sum] [.#Product])
@@ -231,7 +231,7 @@
{.#Item param params'}
(case func
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env body}
(|> body
(reduced (partial_list func param env))
@@ -254,12 +254,12 @@
(` {.#Primitive (~ (code.text name))
(.list (~+ (list#each code params)))})
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> idx}
(` {<tag> (~ (code.nat idx))})])
([.#Var] [.#Ex] [.#Parameter])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
(` {<tag> (~ (code left))
(~ (code right))})])
@@ -268,7 +268,7 @@
{.#Named name sub_type}
(code.symbol name)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env body}
(` {<tag> (.list (~+ (list#each code env)))
(~ (code body))})])
@@ -293,7 +293,7 @@
_
type))
-(template [<name> <base> <ctor>]
+(with_template [<name> <base> <ctor>]
[(def: .public (<name> types)
(-> (List Type) Type)
(case types
@@ -328,7 +328,7 @@
{.#Item param params'}
(application params' {.#Apply param quant})))
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public (<name> size body)
(-> Nat Type Type)
(case size
@@ -483,7 +483,7 @@
{.#Primitive name co_variant}
{.#Primitive name (list#each again co_variant)}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
{<tag> (again left) (again right)}])
([.#Sum]
@@ -491,7 +491,7 @@
[.#Function]
[.#Apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env body}
{<tag> (list#each again env) (again body)}])
([.#UnivQ]
diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux
index 4e9a81e48..f494749f2 100644
--- a/stdlib/source/library/lux/type/check.lux
+++ b/stdlib/source/library/lux/type/check.lux
@@ -23,11 +23,13 @@
["n" nat (.open: "[1]#[0]" decimal)]]]]]
["[0]" // (.open: "[1]#[0]" equivalence)])
-(template: (!n#= reference subject)
- [("lux i64 =" reference subject)])
+(def: !n#=
+ (template (_ reference subject)
+ [("lux i64 =" reference subject)]))
-(template: (!text#= reference subject)
- [("lux text =" reference subject)])
+(def: !text#=
+ (template (_ reference subject)
+ [("lux text =" reference subject)]))
(exception: .public (unknown_type_var [id Nat])
(exception.report
@@ -194,7 +196,7 @@
{try.#Success [(revised .#ex_counter ++ context)
[id {.#Ex id}]]})))
-(template [<name> <outputT> <fail> <succeed>]
+(with_template [<name> <outputT> <fail> <succeed>]
[(def: .public (<name> id)
(-> Var (Check <outputT>))
(function (_ context)
@@ -527,7 +529,7 @@
(set.list ringA))]
(in assumptions))))
- (^.template [<pattern> <id> <type>]
+ (^.with_template [<pattern> <id> <type>]
[<pattern>
(do !
[ring (..ring <id>)
@@ -661,7 +663,7 @@
(function (_ bound)
(check' assumptions expected bound)))
- (^.template [<fE> <fA>]
+ (^.with_template [<fE> <fA>]
[[{.#Apply aE <fE>} {.#Apply aA <fA>}]
(check_apply check' assumptions [aE <fE>] [aA <fA>])])
([F1 {.#Ex ex}]
@@ -683,7 +685,7 @@
(check' assumptions expected actual'))
... TODO: Refactor-away as cold-code
- (^.template [<tag> <instancer>]
+ (^.with_template [<tag> <instancer>]
[[{<tag> _} _]
(do ..monad
[[_ paramT] <instancer>
@@ -693,7 +695,7 @@
[.#ExQ ..var])
... TODO: Refactor-away as cold-code
- (^.template [<tag> <instancer>]
+ (^.with_template [<tag> <instancer>]
[[_ {<tag> _}]
(do ..monad
[[_ paramT] <instancer>
@@ -720,7 +722,7 @@
..silent_failure!))
..silent_failure!)
- (^.template [<composite>]
+ (^.with_template [<composite>]
[[{<composite> eL eR} {<composite> aL aR}]
(do ..monad
[assumptions (check' assumptions eL aL)]
@@ -782,7 +784,7 @@
(^.or {.#Parameter _} {.#Ex _} {.#Named _})
(check#in inputT)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> leftT rightT}
(do ..monad
[leftT' (clean aliases leftT)]
@@ -817,7 +819,7 @@
failure
(in inputT))))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> envT+ unquantifiedT}
(do [! ..monad]
[envT+' (monad.each ! (clean aliases) envT+)
diff --git a/stdlib/source/library/lux/type/poly.lux b/stdlib/source/library/lux/type/poly.lux
index 59d94e85f..fa27e032b 100644
--- a/stdlib/source/library/lux/type/poly.lux
+++ b/stdlib/source/library/lux/type/poly.lux
@@ -58,7 +58,7 @@
(` {.#Primitive (~ (code.text name))
(.list (~+ (list#each (code env) params)))})
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> idx}
(` {<tag> (~ (code.nat idx))})])
([.#Var] [.#Ex])
@@ -75,13 +75,13 @@
0 (|> env (dictionary.value 0) maybe.trusted product.left (code env))
idx (undefined))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
(` {<tag> (~ (code env left))
(~ (code env right))})])
([.#Function] [.#Apply])
- (^.template [<macro> <tag> <flattener>]
+ (^.with_template [<macro> <tag> <flattener>]
[{<tag> left right}
(` (<macro> (~+ (list#each (code env) (<flattener> type)))))])
([.Union .#Sum type.flat_variant]
@@ -90,7 +90,7 @@
{.#Named name sub_type}
(code.symbol name)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> scope body}
(` {<tag> (.list (~+ (list#each (code env) scope)))
(~ (code env body))})])
diff --git a/stdlib/source/library/lux/type/primitive.lux b/stdlib/source/library/lux/type/primitive.lux
index 739afa0cd..5825cdf92 100644
--- a/stdlib/source/library/lux/type/primitive.lux
+++ b/stdlib/source/library/lux/type/primitive.lux
@@ -47,16 +47,17 @@
(Stack Frame)
{.#End})
-(template: (!peek <source> <reference> <then>)
- [(loop (again [entries <source>])
- (case entries
- {.#Item [head_name head] tail}
- (if (text#= <reference> head_name)
- <then>
- (again tail))
-
- {.#End}
- (undefined)))])
+(def: !peek
+ (template (_ <source> <reference> <then>)
+ [(loop (again [entries <source>])
+ (case entries
+ {.#Item [head_name head] tail}
+ (if (text#= <reference> head_name)
+ <then>
+ (again tail))
+
+ {.#End}
+ (undefined)))]))
(def: (peek_frames_definition reference source)
(-> Text (List [Text Global]) (Stack Frame))
@@ -105,18 +106,19 @@
(-> Text (Meta Frame))
(..peek! {.#Some name}))
-(template: (!push <source> <reference> <then>)
- [(loop (again [entries <source>])
- (case entries
- {.#Item [head_name head] tail}
- (if (text#= <reference> head_name)
- {.#Item [head_name <then>]
- tail}
- {.#Item [head_name head]
- (again tail)})
+(def: !push
+ (template (_ <source> <reference> <then>)
+ [(loop (again [entries <source>])
+ (case entries
+ {.#Item [head_name head] tail}
+ (if (text#= <reference> head_name)
+ {.#Item [head_name <then>]
+ tail}
+ {.#Item [head_name head]
+ (again tail)})
- {.#End}
- (undefined)))])
+ {.#End}
+ (undefined)))]))
(def: (push_frame_definition reference frame source)
(-> Text Frame (List [Text Global]) (List [Text Global]))
@@ -185,7 +187,7 @@
(<>.either (<>.and (<>.maybe <code>.local) <code>.any)
(<>.and (<>#in {.#None}) <code>.any)))
-(template [<name> <from> <to>]
+(with_template [<name> <from> <to>]
[(def: .public <name>
(syntax (_ [[frame value] ..cast])
(do meta.monad
diff --git a/stdlib/source/library/lux/type/quotient.lux b/stdlib/source/library/lux/type/quotient.lux
index c9e37a60d..0382c5e1f 100644
--- a/stdlib/source/library/lux/type/quotient.lux
+++ b/stdlib/source/library/lux/type/quotient.lux
@@ -32,7 +32,7 @@
(abstraction [#value value
#label ((representation Class class) value)]))
- (template [<name> <output> <slot>]
+ (with_template [<name> <output> <slot>]
[(def: .public <name>
(All (_ t c %) (-> (Quotient t c %) <output>))
(|>> representation (the <slot>)))]
diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux
index fd571bc68..6eefbe2fb 100644
--- a/stdlib/source/library/lux/type/refinement.lux
+++ b/stdlib/source/library/lux/type/refinement.lux
@@ -29,7 +29,7 @@
#predicate predicate])}
{.#None})))
- (template [<name> <output> <slot>]
+ (with_template [<name> <output> <slot>]
[(def: .public <name>
(All (_ t %) (-> (Refined t %) <output>))
(|>> representation (the <slot>)))]
diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux
index 66556b724..d6150bdf6 100644
--- a/stdlib/source/library/lux/type/resource.lux
+++ b/stdlib/source/library/lux/type/resource.lux
@@ -72,7 +72,7 @@
(primitive: .public (Key mode key)
Any
- (template [<name> <mode>]
+ (with_template [<name> <mode>]
[(def: <name>
(Ex (_ k) (-> Any (Key <mode> k)))
(|>> abstraction))]
@@ -84,7 +84,7 @@
(primitive: .public (Res key value)
value
- (template [<name> <mode> <key>]
+ (with_template [<name> <mode> <key>]
[(def: .public (<name> monad value)
(All (_ ! v) (Ex (_ k) (-> (Monad !) v (Affine ! (Key <mode> k) (Res k v)))))
(function (_ keys)
@@ -165,7 +165,7 @@
(n.> 0 raw))]
(in raw)))
-(template [<name> <from> <to>]
+(with_template [<name> <from> <to>]
[(def: .public <name>
(syntax (_ [amount ..amount])
(macro.with_symbols [g!_ g!context g!!]
diff --git a/stdlib/source/library/lux/type/unit.lux b/stdlib/source/library/lux/type/unit.lux
index 2b31de229..8dbda8dd2 100644
--- a/stdlib/source/library/lux/type/unit.lux
+++ b/stdlib/source/library/lux/type/unit.lux
@@ -37,7 +37,7 @@
(All (_ unit) (-> (Qty unit) Int))
(|>> representation))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> param subject)
(All (_ unit) (-> (Qty unit) (Qty unit) (Qty unit)))
(abstraction (<op> (representation param)
@@ -47,7 +47,7 @@
[- i.-]
)
- (template [<name> <op> <p> <s> <p*s>]
+ (with_template [<name> <op> <p> <s> <p*s>]
[(def: .public (<name> param subject)
(All (_ p s) (-> (Qty <p>) (Qty <s>) (Qty <p*s>)))
(abstraction (<op> (representation param)
@@ -161,7 +161,7 @@
(syntax (_ [type_name <code>.local])
(in (list (code.local (text.lower_cased type_name))))))
-(template [<type> <from> <to>]
+(with_template [<type> <from> <to>]
[(`` (scale: .public <type>
(~~ (implementation_name <type>))
[<from> <to>]))]
@@ -175,7 +175,7 @@
[Nano 1,000,000,000 1]
)
-(template [<type>]
+(with_template [<type>]
[(`` (unit: .public <type>
(~~ (implementation_name <type>))))]
diff --git a/stdlib/source/library/lux/type/variance.lux b/stdlib/source/library/lux/type/variance.lux
index b4fe87431..49563c465 100644
--- a/stdlib/source/library/lux/type/variance.lux
+++ b/stdlib/source/library/lux/type/variance.lux
@@ -16,11 +16,12 @@
(type: .public (Mutable r w)
(Primitive "#Mutable" [(-> w r)]))
-(template [<name> <type>]
- [(template: .public (<name> it)
- [((.is (.All (_ r w) <type>)
- (.|>> .as_expected))
- it)])]
+(with_template [<name> <type>]
+ [(def: .public <name>
+ (template (<name> it)
+ [((.is (.All (_ r w) <type>)
+ (.|>> .as_expected))
+ it)]))]
[read (.-> (..Mutable r w) r)]
[write (.-> w (..Mutable r w))]
@@ -32,11 +33,12 @@
(type: .public (Write_Only a)
(Mutable Any a))
-(template [<name> <type>]
- [(template: .public (<name> it)
- [((.is (.All (_ r w) <type>)
- (.|>>))
- it)])]
+(with_template [<name> <type>]
+ [(def: .public <name>
+ (template (<name> it)
+ [((.is (.All (_ r w) <type>)
+ (.|>>))
+ it)]))]
[read_only (.-> (..Mutable r w) (..Read_Only r))]
[write_only (.-> (..Mutable r w) (..Write_Only w))]
diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux
index a996fc3ea..ab9149b92 100644
--- a/stdlib/source/library/lux/world/console.lux
+++ b/stdlib/source/library/lux/world/console.lux
@@ -31,7 +31,7 @@
(def: .public (async console)
(-> (Console IO) (Console Async))
(`` (implementation
- (~~ (template [<capability>]
+ (~~ (with_template [<capability>]
[(def: <capability>
(|>> (at console <capability>) async.future))]
@@ -118,25 +118,26 @@
(exception: .public cannot_read)
- (template: (!read <type> <query>)
- [(let [it (process::stdin)]
- (case (Readable_Stream::read it)
- {.#Some buffer}
- (let [input (Buffer::toString buffer)]
- (case (is (Maybe [<type> Text])
- <query>)
- {.#Some [head tail]}
- (exec
- (Readable_Stream::unshift|String tail it)
- (async#in {try.#Success head}))
-
- {.#None}
- (exec
- (Readable_Stream::unshift|Buffer buffer it)
- (async#in (exception.except ..cannot_read [])))))
-
- {.#None}
- (async#in (exception.except ..cannot_read []))))])
+ (def: !read
+ (template (_ <type> <query>)
+ [(let [it (process::stdin)]
+ (case (Readable_Stream::read it)
+ {.#Some buffer}
+ (let [input (Buffer::toString buffer)]
+ (case (is (Maybe [<type> Text])
+ <query>)
+ {.#Some [head tail]}
+ (exec
+ (Readable_Stream::unshift|String tail it)
+ (async#in {try.#Success head}))
+
+ {.#None}
+ (exec
+ (Readable_Stream::unshift|Buffer buffer it)
+ (async#in (exception.except ..cannot_read [])))))
+
+ {.#None}
+ (async#in (exception.except ..cannot_read []))))]))
(def: .public default
(Maybe (Console Async))
@@ -183,7 +184,7 @@
(All (_ s) (-> (Mock s) s (Console IO)))
(let [state (atom.atom init)]
(`` (implementation
- (~~ (template [<method> <mock>]
+ (~~ (with_template [<method> <mock>]
[(def: (<method> _)
(do [! io.monad]
[|state| (atom.read! state)]
diff --git a/stdlib/source/library/lux/world/db/jdbc.lux b/stdlib/source/library/lux/world/db/jdbc.lux
index 9c64494ad..e051f65bb 100644
--- a/stdlib/source/library/lux/world/db/jdbc.lux
+++ b/stdlib/source/library/lux/world/db/jdbc.lux
@@ -65,7 +65,7 @@
#input (Input input)
#value input]))
-(template [<name> <forge> <output>]
+(with_template [<name> <forge> <output>]
[(capability: .public (<name> ! i)
(<forge> (Statement i) (! (Try <output>))))]
@@ -107,7 +107,7 @@
(def: .public (async db)
(-> (DB IO) (DB Async))
(`` (implementation
- (~~ (template [<name> <forge>]
+ (~~ (with_template [<name> <forge>]
[(def: <name> (<forge> (|>> (!.use (at db <name>)) async.future)))]
[execute can_execute]
diff --git a/stdlib/source/library/lux/world/db/jdbc/input.lux b/stdlib/source/library/lux/world/db/jdbc/input.lux
index cf29414bd..19272665f 100644
--- a/stdlib/source/library/lux/world/db/jdbc/input.lux
+++ b/stdlib/source/library/lux/world/db/jdbc/input.lux
@@ -14,7 +14,7 @@
(import java/lang/String)
-(template [<class>]
+(with_template [<class>]
[(import <class>
(new [long]))]
@@ -22,7 +22,7 @@
)
(`` (import java/sql/PreparedStatement
- (~~ (template [<name> <type>]
+ (~~ (with_template [<name> <type>]
[(<name> [int <type>] "try" void)]
[setBoolean boolean]
@@ -71,7 +71,7 @@
(function (_ value context)
{try.#Success context}))
-(template [<function> <type> <setter>]
+(with_template [<function> <type> <setter>]
[(def: .public <function>
(Input <type>)
(function (_ value [idx statement])
@@ -93,7 +93,7 @@
[bytes Binary java/sql/PreparedStatement::setBytes]
)
-(template [<function> <setter> <constructor>]
+(with_template [<function> <setter> <constructor>]
[(def: .public <function>
(Input Instant)
(function (_ value [idx statement])
diff --git a/stdlib/source/library/lux/world/db/jdbc/output.lux b/stdlib/source/library/lux/world/db/jdbc/output.lux
index 73d96d9f3..65feaba99 100644
--- a/stdlib/source/library/lux/world/db/jdbc/output.lux
+++ b/stdlib/source/library/lux/world/db/jdbc/output.lux
@@ -24,7 +24,7 @@
(import java/sql/Timestamp)
(`` (import java/sql/ResultSet
- (~~ (template [<method_name> <return_class>]
+ (~~ (with_template [<method_name> <return_class>]
[(<method_name> [int] "try" <return_class>)]
[getBoolean boolean]
@@ -112,7 +112,7 @@
=right right]
(in [=left =right])))
-(template [<func_name> <method_name> <type>]
+(with_template [<func_name> <method_name> <type>]
[(def: .public <func_name>
(Output <type>)
(function (_ [idx result_set])
@@ -137,7 +137,7 @@
[bytes java/sql/ResultSet::getBytes Binary]
)
-(template [<func_name> <method_name>]
+(with_template [<func_name> <method_name>]
[(def: .public <func_name>
(Output Instant)
(function (_ [idx result_set])
diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux
index 084ef671f..dba1f3c1a 100644
--- a/stdlib/source/library/lux/world/db/sql.lux
+++ b/stdlib/source/library/lux/world/db/sql.lux
@@ -20,7 +20,7 @@
(text.enclosed ["(" ")"]))
... Kind
-(template [<declaration>]
+(with_template [<declaration>]
[(primitive: .public <declaration> Any)]
[Literal']
@@ -66,7 +66,7 @@
Text
... SQL
- (template [<declaration> <kind>]
+ (with_template [<declaration> <kind>]
[(type: .public <declaration>
(SQL <kind>))]
@@ -140,7 +140,7 @@
(..parenthesize (..listing parameters)))))
... Condition
- (template [<name> <sql_op>]
+ (with_template [<name> <sql_op>]
[(def: .public (<name> reference sample)
(-> Value Value Condition)
(abstraction
@@ -175,7 +175,7 @@
" IN "
(..parenthesize (listing options)))))
- (template [<func_name> <sql_op>]
+ (with_template [<func_name> <sql_op>]
[(def: .public (<func_name> left right)
(-> Condition Condition Condition)
(abstraction
@@ -187,7 +187,7 @@
[or "OR"]
)
- (template [<name> <type> <sql>]
+ (with_template [<name> <type> <sql>]
[(def: .public <name>
(-> <type> Condition)
(|>> representation ..parenthesize (format <sql> " ") abstraction))]
@@ -197,7 +197,7 @@
)
... Query
- (template [<name> <type> <decoration>]
+ (with_template [<name> <type> <decoration>]
[(def: .public <name>
(-> <type> Source)
(|>> representation <decoration> abstraction))]
@@ -207,7 +207,7 @@
[from_query Any_Query ..parenthesize]
)
- (template [<func_name> <op>]
+ (with_template [<func_name> <op>]
[(def: .public (<func_name> columns source)
(-> (List [Column Alias]) Source Base_Query)
(abstraction
@@ -231,7 +231,7 @@
[select_distinct "SELECT DISTINCT"]
)
- (template [<name> <join_text>]
+ (with_template [<name> <join_text>]
[(def: .public (<name> table condition prev)
(-> Table Condition Base_Query Base_Query)
(abstraction
@@ -246,7 +246,7 @@
[full_outer_join "FULL OUTER JOIN"]
)
- (template [<function> <sql_op>]
+ (with_template [<function> <sql_op>]
[(def: .public (<function> left right)
(-> Any_Query Any_Query (Query Without_Where Without_Having No_Order No_Group No_Limit No_Offset))
(abstraction
@@ -259,7 +259,7 @@
[intersect "INTERSECT"]
)
- (template [<name> <sql> <variables> <input> <output>]
+ (with_template [<name> <sql> <variables> <input> <output>]
[(`` (def: .public (<name> value query)
(All (_ (~~ (template.spliced <variables>)))
(-> Nat <input> <output>))
@@ -277,7 +277,7 @@
(Query where having order group limit With_Offset)]
)
- (template [<name> <sql>]
+ (with_template [<name> <sql>]
[(def: .public <name>
Order
(abstraction <sql>))]
@@ -370,7 +370,7 @@
(-> Text (Schema Value))
(|>> abstraction))
- (template [<name> <attr>]
+ (with_template [<name> <attr>]
[(def: .public (<name> attr)
(-> (Schema Value) (Schema Value))
(abstraction
@@ -410,7 +410,7 @@
(abstraction
(format "CREATE TABLE " (representation table) " AS " (representation query))))
- (template [<name> <sql>]
+ (with_template [<name> <sql>]
[(def: .public (<name> table)
(-> Table Definition)
(abstraction
@@ -430,7 +430,7 @@
(abstraction
(format "ALTER TABLE " (representation table) " DROP COLUMN " (representation column))))
- (template [<name> <type>]
+ (with_template [<name> <type>]
[(def: .public (<name> name)
(-> Text <type>)
(abstraction name))]
@@ -442,7 +442,7 @@
[db DB]
)
- (template [<name> <type> <sql>]
+ (with_template [<name> <type> <sql>]
[(def: .public <name>
(-> <type> Definition)
(|>> representation (format <sql> " ") abstraction))]
@@ -452,7 +452,7 @@
[drop_view View "DROP VIEW"]
)
- (template [<name> <sql>]
+ (with_template [<name> <sql>]
[(def: .public (<name> view query)
(-> View Any_Query Definition)
(abstraction
diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux
index e88322775..697621578 100644
--- a/stdlib/source/library/lux/world/file.lux
+++ b/stdlib/source/library/lux/world/file.lux
@@ -46,7 +46,7 @@
(is Text
separator)
- (~~ (template [<name> <output>]
+ (~~ (with_template [<name> <output>]
[(is (-> Path (! <output>))
<name>)]
@@ -54,7 +54,7 @@
[directory? Bit]
))
- (~~ (template [<name> <output>]
+ (~~ (with_template [<name> <output>]
[(is (-> Path (! (Try <output>)))
<name>)]
@@ -69,7 +69,7 @@
[delete Any]
))
- (~~ (template [<name> <input>]
+ (~~ (with_template [<name> <input>]
[(is (-> Path <input> (! (Try Any)))
<name>)]
@@ -112,7 +112,7 @@
(def: separator
(at fs separator))
- (~~ (template [<name>]
+ (~~ (with_template [<name>]
[(def: <name>
(|>> (at fs <name>)
async.future))]
@@ -130,7 +130,7 @@
[read]
[delete]))
- (~~ (template [<name>]
+ (~~ (with_template [<name>]
[(def: (<name> path input)
(async.future (at fs <name> path input)))]
@@ -144,7 +144,7 @@
(All (_ !) (-> (System !) Path Text Path))
(format parent (at fs separator) child))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [file Path])
(exception.report
"Path" file))]
@@ -163,7 +163,7 @@
(`` (ffi.import java/io/File
"[1]::[0]"
(new [java/lang/String])
- (~~ (template [<name>]
+ (~~ (with_template [<name>]
[(<name> [] "io" "try" boolean)]
[createNewFile] [mkdir]
@@ -206,7 +206,7 @@
(def: separator
(ffi.of_string (java/io/File::separator)))
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: <name>
(|>> ffi.as_string
java/io/File::new
@@ -222,7 +222,7 @@
java/io/File::new
java/io/File::mkdir))
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: (<name> path)
(do [! (try.with io.monad)]
[?children (java/io/File::listFiles (java/io/File::new (ffi.as_string path)))]
@@ -281,7 +281,7 @@
java/io/File::new
(java/io/File::setLastModified (|> time_stamp instant.relative duration.millis ffi.as_long))))
- (~~ (template [<flag> <name>]
+ (~~ (with_template [<flag> <name>]
[(def: (<name> path data)
(do (try.with io.monad)
[stream (java/io/FileOutputStream::new (java/io/File::new (ffi.as_string path)) (ffi.as_boolean <flag>))
@@ -328,13 +328,14 @@
"[1]::[0]"
(toString [] ffi.String))
- (template: (with_async <write> <type> <body>)
- [(template.with_locals [<read>]
- (let [[<read> <write>] (is [(Async <type>) (async.Resolver <type>)]
- (async.async []))]
- (exec
- <body>
- <read>)))])
+ (def: with_async
+ (template (_ <write> <type> <body>)
+ [(template.with_locals [<read>]
+ (let [[<read> <write>] (is [(Async <type>) (async.Resolver <type>)]
+ (async.async []))]
+ (exec
+ <body>
+ <read>)))]))
(ffi.import Fs
"[1]::[0]"
@@ -387,7 +388,7 @@
(def: separator
js_separator)
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: (<name> path)
(do async.monad
[?stats (with_async write! (Try Stats)
@@ -419,7 +420,7 @@
(with_async write! (Try Any)
(Fs::mkdir path (..any_callback write!) node_fs)))))
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: (<name> path)
(do [! (try.with async.monad)]
[subs (with_async write! (Try (Array ffi.String))
@@ -493,7 +494,7 @@
(Fs::utimes path when when (..any_callback write!)
node_fs))))
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: (<name> path data)
(with_async write! (Try Any)
(<method> path (Buffer::from data) (..any_callback write!)
@@ -553,7 +554,7 @@
(def: separator
..python_separator)
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: <name>
(|>> <method>
(io#each (|>> (try.else false)))))]
@@ -565,7 +566,7 @@
(def: make_directory
os::mkdir)
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: (<name> path)
(let [! (try.with io.monad)]
(|> path
@@ -614,7 +615,7 @@
(let [when (|> time_stamp instant.relative duration.millis (i./ +1,000))]
(os::utime path (..tuple [when when]))))
- (~~ (template [<name> <mode>]
+ (~~ (with_template [<name> <mode>]
[(def: (<name> path data)
(do (try.with io.monad)
[file (..open path <mode>)
@@ -679,7 +680,7 @@
(def: separator
..ruby_separator)
- (~~ (template [<name> <test>]
+ (~~ (with_template [<name> <test>]
[(def: <name>
(|>> <test>
(io#each (|>> (try.else false)))))]
@@ -691,7 +692,7 @@
(def: make_directory
FileUtils::mkdir)
- (~~ (template [<name> <test>]
+ (~~ (with_template [<name> <test>]
[(def: (<name> path)
(do [! (try.with io.monad)]
[self (Dir::open path)
@@ -718,7 +719,7 @@
[sub_directories RubyFile::directory?]
))
- (~~ (template [<name> <pipeline>]
+ (~~ (with_template [<name> <pipeline>]
[(def: <name>
(let [! (try.with io.monad)]
(|>> RubyFile::stat
@@ -757,7 +758,7 @@
Time::at)]
(RubyFile::utime moment moment path)))
- (~~ (template [<mode> <name>]
+ (~~ (with_template [<mode> <name>]
[(def: (<name> path data)
(do [! (try.with io.monad)]
[file (RubyFile::open path <mode>)
@@ -809,7 +810,7 @@
... (def: byte_array_format "C*")
... (def: default_separator (..DIRECTORY_SEPARATOR))
- ... (template [<name>]
+ ... (with_template [<name>]
... [(exception: .public (<name> [file Path])
... (exception.report
... "Path" file))]
@@ -820,7 +821,7 @@
... (`` (implementation: (file path)
... (-> Path (File IO))
- ... (~~ (template [<name> <mode>]
+ ... (~~ (with_template [<name> <mode>]
... [(def: (<name> data)
... (do [! (try.with io.monad)]
... [outcome (..file_put_contents [path ("php pack" ..byte_array_format data) <mode>])]
@@ -842,7 +843,7 @@
... (def: path
... path)
- ... (~~ (template [<name> <ffi> <pipeline>]
+ ... (~~ (with_template [<name> <ffi> <pipeline>]
... [(def: (<name> _)
... (do [! (try.with io.monad)]
... [value (<ffi> [path])]
@@ -885,7 +886,7 @@
... (def: scope
... path)
- ... (~~ (template [<name> <test> <constructor> <capability>]
+ ... (~~ (with_template [<name> <test> <constructor> <capability>]
... [(def: (<name> _)
... (do [! (try.with io.monad)]
... [children (..scandir [path])]
@@ -922,7 +923,7 @@
... (`` (implementation: .public default
... (System IO)
- ... (~~ (template [<name> <test> <constructor> <exception>]
+ ... (~~ (with_template [<name> <test> <constructor> <exception>]
... [(def: (<name> path)
... (do [! (try.with io.monad)]
... [verdict (<test> path)]
@@ -1152,7 +1153,7 @@
(def: separator
separator)
- (~~ (template [<method> <retrieve>]
+ (~~ (with_template [<method> <retrieve>]
[(def: (<method> path)
(|> store
stm.read
@@ -1178,7 +1179,7 @@
{try.#Failure error}
(in {try.#Failure error})))))
- (~~ (template [<method> <tag>]
+ (~~ (with_template [<method> <tag>]
[(def: (<method> path)
(stm.commit!
(do stm.monad
diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux
index 5b23bf373..9ae49eb74 100644
--- a/stdlib/source/library/lux/world/file/watch.lux
+++ b/stdlib/source/library/lux/world/file/watch.lux
@@ -45,7 +45,7 @@
#modification false
#deletion false]))
- (template [<concern> <predicate> <event> <create> <modify> <delete>]
+ (with_template [<concern> <predicate> <event> <create> <modify> <delete>]
[(def: .public <concern>
Concern
(abstraction
@@ -92,7 +92,7 @@
(is (-> [] (! (Try (List [Concern //.Path]))))
poll)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [path //.Path])
(exception.report
"Path" (%.text path)))]
diff --git a/stdlib/source/library/lux/world/input/keyboard.lux b/stdlib/source/library/lux/world/input/keyboard.lux
index 87aee8ece..79685c797 100644
--- a/stdlib/source/library/lux/world/input/keyboard.lux
+++ b/stdlib/source/library/lux/world/input/keyboard.lux
@@ -5,7 +5,7 @@
(type: .public Key
Nat)
-(template [<code> <name>]
+(with_template [<code> <name>]
[(def: .public <name> Key <code>)]
[00008 back_space]
@@ -102,7 +102,7 @@
[#pressed? Bit
#input Key]))
-(template [<bit> <name>]
+(with_template [<bit> <name>]
[(def: .public (<name> key)
(-> Key Press)
[#pressed? <bit>
diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux
index b424265f2..b7fd25d65 100644
--- a/stdlib/source/library/lux/world/net/http/client.lux
+++ b/stdlib/source/library/lux/world/net/http/client.lux
@@ -40,7 +40,7 @@
(syntax (_ [[_ name] <code>.symbol])
(in (list (code.local (text.replaced "#" "" (text.lower_cased name)))))))
-(template [<method>]
+(with_template [<method>]
[(with_expansions [<name> (method_function <method>)]
(def: .public (<name> url headers data client)
(All (_ !)
diff --git a/stdlib/source/library/lux/world/net/http/cookie.lux b/stdlib/source/library/lux/world/net/http/cookie.lux
index bb09b61ee..f35f4fa36 100644
--- a/stdlib/source/library/lux/world/net/http/cookie.lux
+++ b/stdlib/source/library/lux/world/net/http/cookie.lux
@@ -39,7 +39,7 @@
(%.int seconds)
(%.nat (.nat seconds)))))))
-(template [<name> <prefix>]
+(with_template [<name> <prefix>]
[(def: .public (<name> value)
(-> Text Directive)
(..directive (format <prefix> "=" value)))]
@@ -48,7 +48,7 @@
[path "Path"]
)
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public <name>
Directive
(..directive <tag>))]
diff --git a/stdlib/source/library/lux/world/net/http/mime.lux b/stdlib/source/library/lux/world/net/http/mime.lux
index fc62a7723..372a19b8f 100644
--- a/stdlib/source/library/lux/world/net/http/mime.lux
+++ b/stdlib/source/library/lux/world/net/http/mime.lux
@@ -21,7 +21,7 @@
)
... https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types
-(template [<name> <type>]
+(with_template [<name> <type>]
[(def: .public <name> MIME (..mime <type>))]
[aac_audio "audio/aac"]
diff --git a/stdlib/source/library/lux/world/net/http/response.lux b/stdlib/source/library/lux/world/net/http/response.lux
index 04cd4a695..db54411cc 100644
--- a/stdlib/source/library/lux/world/net/http/response.lux
+++ b/stdlib/source/library/lux/world/net/http/response.lux
@@ -62,7 +62,7 @@
(-> MIME Binary Response)
(content status.ok))
-(template [<name> <type> <mime> <pre>]
+(with_template [<name> <type> <mime> <pre>]
[(def: .public <name>
(-> <type> Response)
(|>> <pre> (at encoding.utf8 encoded) (..ok <mime>)))]
diff --git a/stdlib/source/library/lux/world/net/http/route.lux b/stdlib/source/library/lux/world/net/http/route.lux
index ec935d71e..b4f31b525 100644
--- a/stdlib/source/library/lux/world/net/http/route.lux
+++ b/stdlib/source/library/lux/world/net/http/route.lux
@@ -16,7 +16,7 @@
["[1][0]" status]
["[1][0]" response]])
-(template [<scheme> <name>]
+(with_template [<scheme> <name>]
[(def: .public (<name> server)
(-> Server Server)
(function (_ (^.let request [identification protocol resource message]))
@@ -31,7 +31,7 @@
[//.#HTTPS https]
)
-(template [<method> <name>]
+(with_template [<method> <name>]
[(def: .public (<name> server)
(-> Server Server)
(function (_ (^.let request [identification protocol resource message]))
diff --git a/stdlib/source/library/lux/world/net/http/status.lux b/stdlib/source/library/lux/world/net/http/status.lux
index 3c3966a33..2752b8651 100644
--- a/stdlib/source/library/lux/world/net/http/status.lux
+++ b/stdlib/source/library/lux/world/net/http/status.lux
@@ -4,7 +4,7 @@
[// (.only Status)])
... https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
-(template [<status> <name>]
+(with_template [<status> <name>]
[(def: .public <name>
Status
<status>)]
diff --git a/stdlib/source/library/lux/world/net/http/version.lux b/stdlib/source/library/lux/world/net/http/version.lux
index abfc20a0e..b56ddf052 100644
--- a/stdlib/source/library/lux/world/net/http/version.lux
+++ b/stdlib/source/library/lux/world/net/http/version.lux
@@ -3,7 +3,7 @@
[lux (.except)]]
[// (.only Version)])
-(template [<name> <version>]
+(with_template [<name> <version>]
[(def: .public <name> Version <version>)]
[v0_9 "0.9"]
diff --git a/stdlib/source/library/lux/world/output/video/resolution.lux b/stdlib/source/library/lux/world/output/video/resolution.lux
index 08b1c9939..fd6a1a9de 100644
--- a/stdlib/source/library/lux/world/output/video/resolution.lux
+++ b/stdlib/source/library/lux/world/output/video/resolution.lux
@@ -24,7 +24,7 @@
(at ..hash equivalence))
... https://en.wikipedia.org/wiki/Display_resolution#Common_display_resolutions
-(template [<name> <width> <height>]
+(with_template [<name> <width> <height>]
[(def: .public <name>
Resolution
[#width <width>
diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux
index 9afde4c87..4c2a210b8 100644
--- a/stdlib/source/library/lux/world/program.lux
+++ b/stdlib/source/library/lux/world/program.lux
@@ -73,7 +73,7 @@
(`` (implementation: .public (async program)
(-> (Program IO) (Program Async))
- (~~ (template [<method>]
+ (~~ (with_template [<method>]
[(def: <method>
(at program <method>))]
@@ -81,7 +81,7 @@
[directory]
))
- (~~ (template [<method>]
+ (~~ (with_template [<method>]
[(def: <method>
(|>> (at program <method>) async.future))]
diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux
index f65320c2d..0c648c17d 100644
--- a/stdlib/source/library/lux/world/shell.lux
+++ b/stdlib/source/library/lux/world/shell.lux
@@ -36,7 +36,7 @@
(type: .public Exit
Int)
-(template [<code> <name>]
+(with_template [<code> <name>]
[(def: .public <name>
Exit
<code>)]
@@ -61,7 +61,7 @@
(def: (async_process process)
(-> (Process IO) (Process Async))
(`` (implementation
- (~~ (template [<method>]
+ (~~ (with_template [<method>]
[(def: <method>
(|>> (at process <method>)
async.future))]
@@ -245,7 +245,7 @@
java/io/BufferedReader::new)]]
(in (is (Process IO)
(`` (implementation
- (~~ (template [<name> <stream>]
+ (~~ (with_template [<name> <stream>]
[(def: (<name> _)
(do !
[output (java/io/BufferedReader::readLine <stream>)]
@@ -261,7 +261,7 @@
))
(def: (write message)
(java/io/OutputStream::write (at utf8.codec encoded message) jvm_output))
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: (<name> _)
(|> process <method>))]
@@ -327,7 +327,7 @@
(`` (implementation: (mock_process state mock)
(All (_ s) (-> (Atom s) (Mock s) (Process IO)))
- (~~ (template [<name> <mock>]
+ (~~ (with_template [<name> <mock>]
[(def: (<name> _)
(do [! io.monad]
[|state| (atom.read! state)]
diff --git a/stdlib/source/poly/lux/abstract/equivalence.lux b/stdlib/source/poly/lux/abstract/equivalence.lux
index 97a89845e..1e882e32d 100644
--- a/stdlib/source/poly/lux/abstract/equivalence.lux
+++ b/stdlib/source/poly/lux/abstract/equivalence.lux
@@ -50,7 +50,7 @@
(` ((~! /.Equivalence) (~ (poly.code *env* type))))))]]
(all <>.either
... Basic types
- (~~ (template [<matcher> <eq>]
+ (~~ (with_template [<matcher> <eq>]
[(do !
[_ <matcher>]
(in (` (is (~ (@Equivalence inputT))
@@ -64,7 +64,7 @@
[(<type>.sub Frac) (~! frac.equivalence)]
[(<type>.sub Text) (~! text.equivalence)]))
... Composite types
- (~~ (template [<name> <eq>]
+ (~~ (with_template [<name> <eq>]
[(do !
[[_ argC] (<type>.applied (<>.and (<type>.exactly <name>)
equivalence))]
@@ -87,7 +87,7 @@
(in (` (is (~ (@Equivalence inputT))
((~! dictionary.equivalence) (~ valC))))))
... Models
- (~~ (template [<type> <eq>]
+ (~~ (with_template [<type> <eq>]
[(do !
[_ (<type>.exactly <type>)]
(in (` (is (~ (@Equivalence inputT))
diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux
index 71bd8cea4..391556a50 100644
--- a/stdlib/source/poly/lux/data/format/json.lux
+++ b/stdlib/source/poly/lux/data/format/json.lux
@@ -98,7 +98,7 @@
(poly: encoded
(with_expansions
- [<basic> (template [<matcher> <encoder>]
+ [<basic> (with_template [<matcher> <encoder>]
[(do !
[.let [g!_ (code.local "_______")]
_ <matcher>]
@@ -111,7 +111,7 @@
[(<type>.sub Int) (at (~! ..int_codec) (~' encoded))]
[(<type>.sub Frac) (|>> {/.#Number})]
[(<type>.sub Text) (|>> {/.#String})])
- <time> (template [<type> <codec>]
+ <time> (with_template [<type> <codec>]
[(do !
[_ (<type>.exactly <type>)]
(in (` (is (~ (@JSON#encoded inputT))
@@ -223,7 +223,7 @@
(poly: decoded
(with_expansions
- [<basic> (template [<matcher> <decoder>]
+ [<basic> (with_template [<matcher> <decoder>]
[(do !
[_ <matcher>]
(in (` (is (~ (@JSON#decoded inputT))
@@ -235,7 +235,7 @@
[(<type>.sub Int) (<>.codec ..int_codec </>.any)]
[(<type>.sub Frac) </>.number]
[(<type>.sub Text) </>.string])
- <time> (template [<type> <codec>]
+ <time> (with_template [<type> <codec>]
[(do !
[_ (<type>.exactly <type>)]
(in (` (is (~ (@JSON#decoded inputT))
diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux
index 1de6b7d30..d338fe439 100644
--- a/stdlib/source/program/aedifex.lux
+++ b/stdlib/source/program/aedifex.lux
@@ -133,7 +133,7 @@
(`` (implementation: write_only
(Console IO)
- (~~ (template [<name>]
+ (~~ (with_template [<name>]
[(def: (<name> _)
(io.io (exception.except ..invalid_operation [])))]
diff --git a/stdlib/source/program/aedifex/artifact.lux b/stdlib/source/program/aedifex/artifact.lux
index 35c7bddb3..a6824828a 100644
--- a/stdlib/source/program/aedifex/artifact.lux
+++ b/stdlib/source/program/aedifex/artifact.lux
@@ -63,7 +63,7 @@
(text#< (the #version reference)
(the #version subject)))))
-(template [<separator> <definition>]
+(with_template [<separator> <definition>]
[(def: <definition>
Text
<separator>)]
diff --git a/stdlib/source/program/aedifex/artifact/extension.lux b/stdlib/source/program/aedifex/artifact/extension.lux
index 744731370..797f0390f 100644
--- a/stdlib/source/program/aedifex/artifact/extension.lux
+++ b/stdlib/source/program/aedifex/artifact/extension.lux
@@ -23,7 +23,7 @@
(-> Extension //.Type)
(text.replaced ..separator ""))
-(template [<name>]
+(with_template [<name>]
[(def: .public <name>
Extension
(..extension (template.symbol [//._] [<name>])))]
diff --git a/stdlib/source/program/aedifex/artifact/snapshot.lux b/stdlib/source/program/aedifex/artifact/snapshot.lux
index b8c0f8db4..59053e368 100644
--- a/stdlib/source/program/aedifex/artifact/snapshot.lux
+++ b/stdlib/source/program/aedifex/artifact/snapshot.lux
@@ -33,7 +33,7 @@
/stamp.equivalence
))
-(template [<definition> <tag>]
+(with_template [<definition> <tag>]
[(def: <definition> xml.Tag ["" <tag>])]
[<local_copy> "localCopy"]
diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version.lux b/stdlib/source/program/aedifex/artifact/snapshot/version.lux
index a1afbd888..a8ee8cbef 100644
--- a/stdlib/source/program/aedifex/artifact/snapshot/version.lux
+++ b/stdlib/source/program/aedifex/artifact/snapshot/version.lux
@@ -31,7 +31,7 @@
///time.equivalence
))
-(template [<definition> <tag>]
+(with_template [<definition> <tag>]
[(def: <definition> xml.Tag ["" <tag>])]
[<extension> "extension"]
diff --git a/stdlib/source/program/aedifex/artifact/type.lux b/stdlib/source/program/aedifex/artifact/type.lux
index 21acc64c3..53242c437 100644
--- a/stdlib/source/program/aedifex/artifact/type.lux
+++ b/stdlib/source/program/aedifex/artifact/type.lux
@@ -6,7 +6,7 @@
(type: .public Type
Text)
-(template [<type> <name>]
+(with_template [<type> <name>]
[(def: .public <name>
Type
<type>)]
diff --git a/stdlib/source/program/aedifex/artifact/versioning.lux b/stdlib/source/program/aedifex/artifact/versioning.lux
index 9c7dab3c6..fb641b897 100644
--- a/stdlib/source/program/aedifex/artifact/versioning.lux
+++ b/stdlib/source/program/aedifex/artifact/versioning.lux
@@ -48,7 +48,7 @@
(list.equivalence //snapshot/version.equivalence)
))
-(template [<definition> <tag>]
+(with_template [<definition> <tag>]
[(def: <definition> xml.Tag ["" <tag>])]
[<last_updated> "lastUpdated"]
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux
index 363391949..98fa73d75 100644
--- a/stdlib/source/program/aedifex/command/build.lux
+++ b/stdlib/source/program/aedifex/command/build.lux
@@ -69,7 +69,7 @@
Group
"com.github.luxlang")
-(template [<dependency> <definition>]
+(with_template [<dependency> <definition>]
[(def: .public <definition>
Name
<dependency>)]
@@ -104,7 +104,7 @@
(case (..dependency_finder lux_group lux_name resolution)
{.#Some dependency}
(case lux_name
- (^.template [<tag> <name>]
+ (^.with_template [<tag> <name>]
[(pattern (static <name>))
{try.#Success [(..remove_dependency dependency resolution)
{<tag> dependency}]}])
@@ -201,7 +201,7 @@
(def: .public success "[BUILD ENDED]")
(def: .public failure "[BUILD FAILED]")
-(template [<name> <capability>]
+(with_template [<name> <capability>]
[(def: .public (<name> console process)
(-> (Console Async) (Process Async) (Async (Try Any)))
... This is a very odd way of implementing this function.
@@ -300,7 +300,7 @@
(with_jvm_class_path {.#Item (..path fs home dependency) host_dependencies}))
"program.jar"]
- (^.template [<tag> <runtime> <program>]
+ (^.with_template [<tag> <runtime> <program>]
[{<tag> dependency}
[(|> dependency
(..path fs home)
diff --git a/stdlib/source/program/aedifex/command/deploy/release.lux b/stdlib/source/program/aedifex/command/deploy/release.lux
index dcb37ef59..30cc226a4 100644
--- a/stdlib/source/program/aedifex/command/deploy/release.lux
+++ b/stdlib/source/program/aedifex/command/deploy/release.lux
@@ -88,7 +88,7 @@
{.#Right _}
(undefined))))
-(template [<name> <extension>]
+(with_template [<name> <extension>]
[(def: <name>
(-> Text Text)
(text.suffix <extension>))]
@@ -100,7 +100,7 @@
[md5 ////artifact/extension.md5]
)
-(template [<name> <suffix>]
+(with_template [<name> <suffix>]
[(def: <name>
(-> Text Text)
(|>> (text.suffix <suffix>) ..jar))]
diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux
index 0c6c03db9..2e9e69ef8 100644
--- a/stdlib/source/program/aedifex/command/test.lux
+++ b/stdlib/source/program/aedifex/command/test.lux
@@ -54,7 +54,7 @@
(///runtime.for (the ///.#java profile))
(//build.with_jvm_class_path host_dependencies))
- (^.template [<tag> <runtime>]
+ (^.with_template [<tag> <runtime>]
[{<tag> artifact}
(///runtime.for (the <runtime> profile)
program)])
diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux
index cec50d015..f04a95105 100644
--- a/stdlib/source/program/aedifex/dependency/resolution.lux
+++ b/stdlib/source/program/aedifex/dependency/resolution.lux
@@ -58,7 +58,7 @@
["[1][0]" metadata
["[1]/[0]" snapshot]]]])
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [artifact Artifact
extension Extension
hash Text])
@@ -160,7 +160,7 @@
"Artifact" (%.text (///artifact.format (the //.#artifact dependency)))
"Type" (%.text (the //.#type dependency))))
-(template [<sigil> <name> <doing> <at>]
+(with_template [<sigil> <name> <doing> <at>]
[(def: (<name> console repository artifact)
(-> (Console Async) (Repository Async) Artifact (Async (Try Any)))
(at console write (format "[" <sigil> "]"
diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux
index 456f621e7..6316e6287 100644
--- a/stdlib/source/program/aedifex/format.lux
+++ b/stdlib/source/program/aedifex/format.lux
@@ -174,7 +174,7 @@
(..on_maybe "program" (the /.#program value) code.text)
(..on_maybe "test" (the /.#test value) code.text)
(..on_dictionary "deploy_repositories" (the /.#deploy_repositories value) code.text code.text)
- (~~ (template [<tag>]
+ (~~ (with_template [<tag>]
[(dictionary.has (template.text [<tag>]) (..runtime (the <tag> value)))]
[/.#java]
diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux
index 43017034e..8a22579b2 100644
--- a/stdlib/source/program/aedifex/hash.lux
+++ b/stdlib/source/program/aedifex/hash.lux
@@ -44,7 +44,7 @@
(All (_ h) (-> (Hash h) Binary))
(|>> representation))
- (template [<name> <kind> <algorithm>]
+ (with_template [<name> <kind> <algorithm>]
[(def: .public (<name> value)
(-> Binary (Hash <kind>))
(|> (java/security/MessageDigest::getInstance [(ffi.as_string <algorithm>)])
@@ -65,7 +65,7 @@
(format representation hex)))
""))
- (template [<factor> <name>]
+ (with_template [<factor> <name>]
[(def: <name>
Nat
<factor>)]
@@ -87,7 +87,7 @@
"Expected size" (%.nat size)
"Actual size" (%.nat (text.size value))))
- (template [<name> <size>]
+ (with_template [<name> <size>]
[(exception: .public (<name> [data Binary])
(exception.report
"Pseudo hash" (%.text (..encoded data))
@@ -98,7 +98,7 @@
[not_a_md5 ..md5::size]
)
- (template [<name> <kind> <size> <exception>]
+ (with_template [<name> <kind> <size> <exception>]
[(def: .public (<name> data)
(-> Binary (Try (Hash <kind>)))
(if (n.= <size> (binary.size data))
@@ -137,7 +137,7 @@
{.#None}
(case (..hash_size input)
0 (constructor output)
- (^.template [<size> <write>]
+ (^.with_template [<size> <write>]
[<size>
(do try.monad
[head (at n.hex decoded input)
@@ -149,7 +149,7 @@
_ (exception.except ..not_a_hash [(..encoding_size size) encoded])))))
(exception.except ..not_a_hash [(..encoding_size size) encoded]))))
- (template [<codec> <hash> <nat> <constructor>]
+ (with_template [<codec> <hash> <nat> <constructor>]
[(implementation: .public <codec>
(Codec Text (Hash <hash>))
diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux
index e2e363c16..7f491f3fd 100644
--- a/stdlib/source/program/aedifex/metadata/artifact.lux
+++ b/stdlib/source/program/aedifex/metadata/artifact.lux
@@ -69,7 +69,7 @@
(%.format (..date_format (instant.date value))
(..time_format (instant.time value))))
-(template [<definition> <tag>]
+(with_template [<definition> <tag>]
[(def: <definition> xml.Tag ["" <tag>])]
[<group> "groupId"]
@@ -81,7 +81,7 @@
[<metadata> "metadata"]
)
-(template [<name> <type> <tag> <pre>]
+(with_template [<name> <type> <tag> <pre>]
[(def: <name>
(-> <type> XML)
(|>> <pre> {xml.#Text} list {xml.#Node <tag> xml.attributes}))]
diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux
index caf25a787..2d68d194b 100644
--- a/stdlib/source/program/aedifex/metadata/snapshot.lux
+++ b/stdlib/source/program/aedifex/metadata/snapshot.lux
@@ -50,7 +50,7 @@
[#artifact Artifact
#versioning Versioning]))
-(template [<definition> <tag>]
+(with_template [<definition> <tag>]
[(def: <definition> xml.Tag ["" <tag>])]
[<group> "groupId"]
@@ -59,7 +59,7 @@
[<metadata> "metadata"]
)
-(template [<name> <type> <tag> <pre>]
+(with_template [<name> <type> <tag> <pre>]
[(def: <name>
(-> <type> XML)
(|>> <pre> {xml.#Text} list {xml.#Node <tag> xml.attributes}))]
diff --git a/stdlib/source/program/aedifex/package.lux b/stdlib/source/program/aedifex/package.lux
index a08033b88..3dc430c9c 100644
--- a/stdlib/source/program/aedifex/package.lux
+++ b/stdlib/source/program/aedifex/package.lux
@@ -34,7 +34,7 @@
#library [Binary Status]
#pom [XML Binary Status]]))
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public (<name> package)
(-> Package Bit)
(case (the #origin package)
diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux
index 9b9cfd998..f22f80763 100644
--- a/stdlib/source/program/aedifex/pom.lux
+++ b/stdlib/source/program/aedifex/pom.lux
@@ -117,7 +117,7 @@
(..property "email" email)
(|> organization (maybe#each ..developer_organization) (maybe.else (list)))))
-(template [<name> <type> <tag>]
+(with_template [<name> <type> <tag>]
[(def: <name>
(-> <type> XML)
(|>> ..developer' {_.#Node ["" <tag>] _.attributes}))]
diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux
index 5ed623591..6420d69ac 100644
--- a/stdlib/source/program/aedifex/profile.lux
+++ b/stdlib/source/program/aedifex/profile.lux
@@ -54,7 +54,7 @@
(def: (= reference subject)
(case [reference subject]
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag>} {<tag>}]
true])
([#Repo]
diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux
index 8a93e4cfd..29bcbad84 100644
--- a/stdlib/source/program/aedifex/repository/remote.lux
+++ b/stdlib/source/program/aedifex/repository/remote.lux
@@ -32,7 +32,7 @@
(type: .public Address
URL)
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [url URL
status Nat])
(exception.report
diff --git a/stdlib/source/program/aedifex/runtime.lux b/stdlib/source/program/aedifex/runtime.lux
index 7d49725df..b738d220c 100644
--- a/stdlib/source/program/aedifex/runtime.lux
+++ b/stdlib/source/program/aedifex/runtime.lux
@@ -29,7 +29,7 @@
(list.equivalence text.equivalence)
))
-(template [<name> <command> <environment> <parameters>]
+(with_template [<name> <command> <environment> <parameters>]
[(def: .public <name>
Runtime
[#environment (dictionary.of_list text.hash (`` (list (~~ (template.spliced <environment>)))))
diff --git a/stdlib/source/specification/compositor/analysis/type.lux b/stdlib/source/specification/compositor/analysis/type.lux
index 6a0a3acf0..d1115fbfa 100644
--- a/stdlib/source/specification/compositor/analysis/type.lux
+++ b/stdlib/source/specification/compositor/analysis/type.lux
@@ -36,7 +36,7 @@
(def: check
(Random [Code Type Code])
(`` (all r.either
- (~~ (template [<random> <type> <code>]
+ (~~ (with_template [<random> <type> <code>]
[(do r.monad
[value <random>]
(in [(` <type>)
diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux
index 05e58e21f..a6d57034f 100644
--- a/stdlib/source/specification/compositor/generation/case.lux
+++ b/stdlib/source/specification/compositor/generation/case.lux
@@ -55,7 +55,7 @@
[value r.i64]
(in [(synthesis.i64 value)
synthesis.path/pop]))
- (~~ (template [<gen> <synth> <path>]
+ (~~ (with_template [<gen> <synth> <path>]
[(do r.monad
[value <gen>]
(in [(<synth> value)
diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux
index 8012798f8..4aefbce72 100644
--- a/stdlib/source/specification/compositor/generation/common.lux
+++ b/stdlib/source/specification/compositor/generation/common.lux
@@ -39,7 +39,7 @@
(do r.monad
[param r.i64
subject r.i64]
- (with_expansions [<binary> (template [<extension> <reference> <param_expr>]
+ (with_expansions [<binary> (with_template [<extension> <reference> <param_expr>]
[(_.property <extension>
(|> {synthesis.#Extension <extension> (list (synthesis.i64 param)
(synthesis.i64 subject))}
@@ -82,7 +82,7 @@
[param (|> r.i64 (r.only (|>> ("lux i64 =" 0) not)))
subject r.i64]
(`` (all _.and
- (~~ (template [<extension> <type> <prepare> <comp> <subject_expr>]
+ (~~ (with_template [<extension> <type> <prepare> <comp> <subject_expr>]
[(_.property <extension>
(|> {synthesis.#Extension <extension> (list (synthesis.i64 subject))}
(run (..safe <extension>))
@@ -100,7 +100,7 @@
(n.% (i64.left_shifted 8 1))
(as Int))]
))
- (~~ (template [<extension> <reference> <outputT> <comp>]
+ (~~ (with_template [<extension> <reference> <outputT> <comp>]
[(_.property <extension>
(|> {synthesis.#Extension <extension> (list (synthesis.i64 param)
(synthesis.i64 subject))}
@@ -132,7 +132,7 @@
[param (|> ..simple_frac (r.only (|>> (f.= +0.0) not)))
subject ..simple_frac]
(`` (all _.and
- (~~ (template [<extension> <reference> <comp>]
+ (~~ (with_template [<extension> <reference> <comp>]
[(_.property <extension>
(|> {synthesis.#Extension <extension> (list (synthesis.f64 param)
(synthesis.f64 subject))}
@@ -145,7 +145,7 @@
["lux f64 /" f./ f.=]
["lux f64 %" f.% f.=]
))
- (~~ (template [<extension> <text>]
+ (~~ (with_template [<extension> <text>]
[(_.property <extension>
(|> {synthesis.#Extension <extension> (list (synthesis.f64 param)
(synthesis.f64 subject))}
@@ -161,7 +161,7 @@
["lux f64 =" f.=]
["lux f64 <" f.<]
))
- (~~ (template [<extension> <reference>]
+ (~~ (with_template [<extension> <reference>]
[(_.property <extension>
(|> {synthesis.#Extension <extension> (list)}
(run (..safe <extension>))
diff --git a/stdlib/source/specification/compositor/generation/primitive.lux b/stdlib/source/specification/compositor/generation/primitive.lux
index d76f98f0a..226d0c25e 100644
--- a/stdlib/source/specification/compositor/generation/primitive.lux
+++ b/stdlib/source/specification/compositor/generation/primitive.lux
@@ -29,7 +29,7 @@
(def: .public (spec run)
(-> Runner Test)
(`` (all _.and
- (~~ (template [<evaluation_name> <synthesis> <gen> <test>]
+ (~~ (with_template [<evaluation_name> <synthesis> <gen> <test>]
[(do r.monad
[expected <gen>]
(_.property (%.symbol (symbol <synthesis>))
diff --git a/stdlib/source/specification/lux/world/shell.lux b/stdlib/source/specification/lux/world/shell.lux
index 702d29d97..90b3925f9 100644
--- a/stdlib/source/specification/lux/world/shell.lux
+++ b/stdlib/source/specification/lux/world/shell.lux
@@ -24,7 +24,7 @@
[//
[file (.only Path)]]]])
-(template [<name> <command> <type> <prep>]
+(with_template [<name> <command> <type> <prep>]
[(def: <name>
(-> <type> [Environment Path /.Command (List /.Argument)])
(|>> <prep> list [environment.empty "~" <command>]))]
diff --git a/stdlib/source/test/aedifex/artifact/extension.lux b/stdlib/source/test/aedifex/artifact/extension.lux
index d8bfd8267..7ca90b6a6 100644
--- a/stdlib/source/test/aedifex/artifact/extension.lux
+++ b/stdlib/source/test/aedifex/artifact/extension.lux
@@ -30,7 +30,7 @@
(n.= (list.size options)
(set.size uniques))))
(_.coverage [/.extension /.type]
- (`` (and (~~ (template [<type> <extension>]
+ (`` (and (~~ (with_template [<type> <extension>]
[(and (text#= <extension>
(/.extension <type>))
(text#= <type>
diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux
index 25302fa71..c740ad48f 100644
--- a/stdlib/source/test/aedifex/command/build.lux
+++ b/stdlib/source/test/aedifex/command/build.lux
@@ -115,7 +115,7 @@
///dependency.#type ///artifact/type.js_library]]]
(`` (all random.either
(in js_compiler)
- (~~ (template [<compiler>]
+ (~~ (with_template [<compiler>]
[(in [///dependency.#artifact [///artifact.#group /.lux_group
///artifact.#name <compiler>
///artifact.#version lux_version]
@@ -219,7 +219,7 @@
expected/1 (random.alphabetic 5)
expected/2 (random.alphabetic 5)]
(`` (all _.and
- (~~ (template [<error?> <log!>]
+ (~~ (with_template [<error?> <log!>]
[(let [console (@version.echo "")
shell (|> (list expected/0 expected/1 expected/2)
(..reader_shell <error?>)
diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux
index aeeb49cb2..31cd54fad 100644
--- a/stdlib/source/test/aedifex/dependency/resolution.lux
+++ b/stdlib/source/test/aedifex/dependency/resolution.lux
@@ -271,7 +271,7 @@
{try.#Failure _}
false))))
- (~~ (template [<exception> <bad>]
+ (~~ (with_template [<exception> <bad>]
[(in (do async.monad
[actual_package (/.one (///repository.mock <bad> [])
[///dependency.#artifact expected_artifact
diff --git a/stdlib/source/test/aedifex/hash.lux b/stdlib/source/test/aedifex/hash.lux
index dfa36217b..921461cf8 100644
--- a/stdlib/source/test/aedifex/hash.lux
+++ b/stdlib/source/test/aedifex/hash.lux
@@ -45,7 +45,7 @@
))
(_.for [/.data]
(all _.and
- (~~ (template [<hash> <constructor> <exception>]
+ (~~ (with_template [<hash> <constructor> <exception>]
[(do random.monad
[expected (..random <hash>)]
(_.coverage [<hash> <constructor> <exception>]
@@ -67,7 +67,7 @@
[/.sha-1 /.as_sha-1 /.not_a_sha-1]
[/.md5 /.as_md5 /.not_a_md5]
))))
- (~~ (template [<codec> <hash>]
+ (~~ (with_template [<codec> <hash>]
[(_.for [<codec>]
($codec.spec /.equivalence <codec> (..random <hash>)))]
@@ -76,7 +76,7 @@
))
(_.for [/.not_a_hash]
(all _.and
- (~~ (template [<codec> <hash>]
+ (~~ (with_template [<codec> <hash>]
[(do random.monad
[expected (..random <hash>)]
(_.coverage [<codec>]
diff --git a/stdlib/source/test/aedifex/runtime.lux b/stdlib/source/test/aedifex/runtime.lux
index a1ba22588..58d539584 100644
--- a/stdlib/source/test/aedifex/runtime.lux
+++ b/stdlib/source/test/aedifex/runtime.lux
@@ -41,7 +41,7 @@
(_.for [/.equivalence]
($equivalence.spec /.equivalence ..random))
- (~~ (template [<command>]
+ (~~ (with_template [<command>]
[(_.coverage [/.default_java /.default_js /.default_python /.default_lua /.default_ruby]
(let [listing (|> (list /.default_java /.default_js /.default_python /.default_lua /.default_ruby)
(list#each (the /.#program)))
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index 056d93079..0d393c2c2 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -429,7 +429,7 @@
<m2/1> (template.text [<module/2> "/" <module/1>])
<m0/1/2> (template.text [<module/0> "/" <module/1> "/" <module/2>])
<open/0> (template.text [<module/0> "#[0]"])]
- (and (~~ (template [<input> <module> <referrals>]
+ (and (~~ (with_template [<input> <module> <referrals>]
[(with_expansions [<input>' (macro.final <input>)]
(let [scenario (is (-> Any Bit)
(function (_ _)
@@ -657,14 +657,15 @@
(n.= (n.* (++ expected_left) (-- expected_right))
(actual [expected_left expected_right])))))))
-(/.template: (!n/+ <left> <right>)
- [(n.+ <left> <right>)])
+(def: !n/+
+ (/.template (_ <left> <right>)
+ [(n.+ <left> <right>)]))
(def: for_template
Test
(`` (all _.and
- (_.coverage [/.template]
- (let [bits (list (~~ (/.template [_]
+ (_.coverage [/.with_template]
+ (let [bits (list (~~ (/.with_template [_]
[true]
[0] [1] [2]
@@ -674,7 +675,7 @@
(do random.monad
[left random.nat
right random.nat]
- (_.coverage [/.template:]
+ (_.coverage [/.template]
(n.= (n.+ left right)
(!n/+ left right))))
)))
@@ -943,9 +944,10 @@
[#left l
#right r]))
-(template: (!pair <left> <right>)
- [[..#left <left>
- ..#right <right>]])
+(def: !pair
+ (template (_ <left> <right>)
+ [[..#left <left>
+ ..#right <right>]]))
(def: for_case
Test
diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux
index 18387288e..9917756e8 100644
--- a/stdlib/source/test/lux/abstract/interval.lux
+++ b/stdlib/source/test/lux/abstract/interval.lux
@@ -20,7 +20,7 @@
[\\library
["[0]" / (.only Interval) (.open: "[1]#[0]" equivalence)]])
-(template [<name> <cmp>]
+(with_template [<name> <cmp>]
[(def: .public <name>
(Random (Interval Nat))
(do random.monad
diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux
index 825228c31..354cc744a 100644
--- a/stdlib/source/test/lux/control/concatenative.lux
+++ b/stdlib/source/test/lux/control/concatenative.lux
@@ -65,7 +65,7 @@
/.&&)]
(and (n.= sample left)
(n.= dummy right))))
- (~~ (template [<function> <tag>]
+ (~~ (with_template [<function> <tag>]
[(_.coverage [<function>]
((sum.equivalence n.= n.=)
{<tag> sample}
@@ -91,31 +91,32 @@
/.drop /.drop)))
))))
-(template: (!numerical <=> <generator> <only> <arithmetic> <order>)
- [(is Test
- (with_expansions [<arithmetic>' (template.spliced <arithmetic>)
- <order>' (template.spliced <order>)]
- (do random.monad
- [parameter (|> <generator> (random.only <only>))
- subject <generator>]
- (`` (all _.and
- (~~ (template [<concatenative> <functional>]
- [(_.coverage [<concatenative>]
- (<=> (<functional> parameter subject)
- (||> (/.push subject)
- (/.push parameter)
- <concatenative>)))]
-
- <arithmetic>'))
- (~~ (template [<concatenative> <functional>]
- [(_.coverage [<concatenative>]
- (bit#= (<functional> parameter subject)
+(def: !numerical
+ (template (_ <=> <generator> <only> <arithmetic> <order>)
+ [(is Test
+ (with_expansions [<arithmetic>' (template.spliced <arithmetic>)
+ <order>' (template.spliced <order>)]
+ (do random.monad
+ [parameter (|> <generator> (random.only <only>))
+ subject <generator>]
+ (`` (all _.and
+ (~~ (with_template [<concatenative> <functional>]
+ [(_.coverage [<concatenative>]
+ (<=> (<functional> parameter subject)
(||> (/.push subject)
(/.push parameter)
<concatenative>)))]
- <order>'))
- )))))])
+ <arithmetic>'))
+ (~~ (with_template [<concatenative> <functional>]
+ [(_.coverage [<concatenative>]
+ (bit#= (<functional> parameter subject)
+ (||> (/.push subject)
+ (/.push parameter)
+ <concatenative>)))]
+
+ <order>'))
+ )))))]))
(def: numerical
Test
diff --git a/stdlib/source/test/lux/control/function/inline.lux b/stdlib/source/test/lux/control/function/inline.lux
index 54cbeabc7..6bd4eee3e 100644
--- a/stdlib/source/test/lux/control/function/inline.lux
+++ b/stdlib/source/test/lux/control/function/inline.lux
@@ -11,8 +11,9 @@
[\\library
["[0]" /]])
-(template: (!quadrance/2 m0 m1)
- [(i.+ (i.* m0 m0) (i.* m1 m1))])
+(def: !quadrance/2
+ (template (_ m0 m1)
+ [(i.+ (i.* m0 m0) (i.* m1 m1))]))
(/.inline: .public (quadrance/2 m0 m1)
(-> Int Int Int)
diff --git a/stdlib/source/test/lux/control/parser/analysis.lux b/stdlib/source/test/lux/control/parser/analysis.lux
index 6f79c1dcb..41b24f031 100644
--- a/stdlib/source/test/lux/control/parser/analysis.lux
+++ b/stdlib/source/test/lux/control/parser/analysis.lux
@@ -33,13 +33,14 @@
[\\library
["[0]" /]])
-(template: (!expect <expectation> <computation>)
- [(case <computation>
- <expectation>
- true
+(def: !expect
+ (template (_ <expectation> <computation>)
+ [(case <computation>
+ <expectation>
+ true
- _
- false)])
+ _
+ false)]))
(def: constant
(Random Constant)
@@ -64,7 +65,7 @@
{try.#Failure _}
false))))
- (~~ (template [<query> <check> <random> <analysis> <=>]
+ (~~ (with_template [<query> <check> <random> <analysis> <=>]
[(do [! random.monad]
[expected <random>]
(_.coverage [<query>]
diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux
index f2198c2d5..7debf57b5 100644
--- a/stdlib/source/test/lux/control/parser/binary.lux
+++ b/stdlib/source/test/lux/control/parser/binary.lux
@@ -43,13 +43,14 @@
[\\library
["[0]" /]])
-(template: (!expect <expectation> <computation>)
- [(case <computation>
- <expectation>
- true
+(def: !expect
+ (template (_ <expectation> <computation>)
+ [(case <computation>
+ <expectation>
+ true
- _
- false)])
+ _
+ false)]))
(def: segment_size 10)
@@ -126,7 +127,7 @@
Test
(<| (_.for [/.Size])
(`` (all _.and
- (~~ (template [<size> <parser> <format>]
+ (~~ (with_template [<size> <parser> <format>]
[(do [! random.monad]
[expected (at ! each (i64.and (i64.mask <size>))
random.nat)]
@@ -146,7 +147,7 @@
(def: binary
Test
(`` (all _.and
- (~~ (template [<parser> <format>]
+ (~~ (with_template [<parser> <format>]
[(do [! random.monad]
[expected (at ! each (at utf8.codec encoded) (random.ascii ..segment_size))]
(_.coverage [<parser> <format>]
@@ -164,7 +165,7 @@
(def: utf8
Test
(`` (all _.and
- (~~ (template [<parser> <format>]
+ (~~ (with_template [<parser> <format>]
[(do [! random.monad]
[expected (random.ascii ..segment_size)]
(_.coverage [<parser> <format>]
@@ -183,7 +184,7 @@
(def: sequence
Test
(`` (all _.and
- (~~ (template [<parser> <format>]
+ (~~ (with_template [<parser> <format>]
[(do [! random.monad]
[expected (random.sequence ..segment_size random.nat)]
(_.coverage [<parser> <format>]
@@ -202,7 +203,7 @@
(def: simple
Test
(`` (all _.and
- (~~ (template [<parser> <format> <random> <equivalence>]
+ (~~ (with_template [<parser> <format> <random> <equivalence>]
[(do [! random.monad]
[expected <random>]
(_.coverage [<parser> <format>]
@@ -241,7 +242,7 @@
(def: complex
Test
(`` (all _.and
- (~~ (template [<parser> <format> <random> <equivalence>]
+ (~~ (with_template [<parser> <format> <random> <equivalence>]
[(do [! random.monad]
[expected <random>]
(_.coverage [<parser> <format>]
@@ -255,7 +256,7 @@
[/.code format.code random_code code.equivalence]
[/.type format.type random_type type.equivalence]
))
- (~~ (template [<parser_coverage> <parser> <coverage_format> <format> <random> <equivalence>]
+ (~~ (with_template [<parser_coverage> <parser> <coverage_format> <format> <random> <equivalence>]
[(do [! random.monad]
[expected <random>]
(_.coverage [<parser_coverage> <coverage_format>]
diff --git a/stdlib/source/test/lux/control/parser/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux
index 9e12a51aa..686207191 100644
--- a/stdlib/source/test/lux/control/parser/cli.lux
+++ b/stdlib/source/test/lux/control/parser/cli.lux
@@ -20,13 +20,14 @@
[\\library
["[0]" /]])
-(template: (!expect <pattern> <value>)
- [(case <value>
- <pattern>
- true
-
- _
- false)])
+(def: !expect
+ (template (_ <pattern> <value>)
+ [(case <value>
+ <pattern>
+ true
+
+ _
+ false)]))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/control/parser/code.lux b/stdlib/source/test/lux/control/parser/code.lux
index 01837874f..c0fecf490 100644
--- a/stdlib/source/test/lux/control/parser/code.lux
+++ b/stdlib/source/test/lux/control/parser/code.lux
@@ -28,13 +28,14 @@
[\\library
["[0]" /]])
-(template: (!expect <pattern> <value>)
- [(case <value>
- <pattern>
- true
-
- _
- false)])
+(def: !expect
+ (template (_ <pattern> <value>)
+ [(case <value>
+ <pattern>
+ true
+
+ _
+ false)]))
(def: local
(Random Text)
@@ -67,7 +68,7 @@
(!expect {try.#Success _}))
(|> (/.result /.any (list))
(!expect {try.#Failure _})))))
- (~~ (template [<query> <check> <random> <code> <equivalence>]
+ (~~ (with_template [<query> <check> <random> <code> <equivalence>]
[(do [! random.monad]
[expected <random>
dummy (|> <random> (random.only (|>> (at <equivalence> = expected) not)))]
@@ -94,7 +95,7 @@
[/.global /.this_global ..global code.symbol symbol.equivalence]
[/.symbol /.this_symbol ..any_symbol code.symbol symbol.equivalence]
))
- (~~ (template [<query> <code>]
+ (~~ (with_template [<query> <code>]
[(do [! random.monad]
[expected_left random.nat
expected_right random.int]
diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux
index 6c2a0753a..15b110eed 100644
--- a/stdlib/source/test/lux/control/parser/json.lux
+++ b/stdlib/source/test/lux/control/parser/json.lux
@@ -30,13 +30,14 @@
[\\library
["[0]" /]])
-(template: (!expect <pattern> <value>)
- [(case <value>
- <pattern>
- true
-
- _
- false)])
+(def: !expect
+ (template (_ <pattern> <value>)
+ [(case <value>
+ <pattern>
+ true
+
+ _
+ false)]))
(def: safe_frac
(Random Frac)
@@ -56,7 +57,7 @@
(_.coverage [/.null]
(|> (/.result /.null {json.#Null})
(!expect {try.#Success _})))
- (~~ (template [<query> <test> <check> <random> <json> <equivalence>]
+ (~~ (with_template [<query> <test> <check> <random> <json> <equivalence>]
[(do [! random.monad]
[expected <random>
dummy (|> <random> (random.only (|>> (at <equivalence> = expected) not)))]
diff --git a/stdlib/source/test/lux/control/parser/synthesis.lux b/stdlib/source/test/lux/control/parser/synthesis.lux
index 7046d5d1d..9f765d0a5 100644
--- a/stdlib/source/test/lux/control/parser/synthesis.lux
+++ b/stdlib/source/test/lux/control/parser/synthesis.lux
@@ -34,13 +34,14 @@
[\\library
["[0]" /]])
-(template: (!expect <pattern> <value>)
- [(case <value>
- <pattern>
- true
-
- _
- false)])
+(def: !expect
+ (template (_ <pattern> <value>)
+ [(case <value>
+ <pattern>
+ true
+
+ _
+ false)]))
(def: random_constant
(Random Symbol)
@@ -63,7 +64,7 @@
(def: simple
Test
(`` (all _.and
- (~~ (template [<query> <check> <random> <synthesis> <equivalence>]
+ (~~ (with_template [<query> <check> <random> <synthesis> <equivalence>]
[(do [! random.monad]
[expected <random>
dummy (|> <random> (random.only (|>> (at <equivalence> = expected) not)))]
diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux
index 55a334421..1c8390cfc 100644
--- a/stdlib/source/test/lux/control/parser/text.lux
+++ b/stdlib/source/test/lux/control/parser/text.lux
@@ -32,13 +32,14 @@
["<>" // (.only)
["<c>" code]]]])
-(template: (!expect <pattern> <value>)
- [(case <value>
- <pattern>
- true
-
- _
- false)])
+(def: !expect
+ (template (_ <pattern> <value>)
+ [(case <value>
+ <pattern>
+ true
+
+ _
+ false)]))
(def: (should_fail' sample parser exception)
(All (_ a e) (-> Text (/.Parser a) (Exception e) Bit))
diff --git a/stdlib/source/test/lux/control/parser/tree.lux b/stdlib/source/test/lux/control/parser/tree.lux
index 91b023b6a..f10b11b26 100644
--- a/stdlib/source/test/lux/control/parser/tree.lux
+++ b/stdlib/source/test/lux/control/parser/tree.lux
@@ -21,35 +21,38 @@
["[0]" / (.only)
["/[1]" //]]])
-(template: (!expect <pattern> <value>)
- [(case <value>
- <pattern>
- true
-
- _
- false)])
+(def: !expect
+ (template (_ <pattern> <value>)
+ [(case <value>
+ <pattern>
+ true
+
+ _
+ false)]))
-(template: (!cover <coverage> <parser> <sample>)
- [(do [! random.monad]
- [dummy random.nat
- expected (|> random.nat (random.only (|>> (n.= dummy) not)))]
- (_.coverage <coverage>
- (|> (/.result <parser>
- <sample>)
- (!expect (^.multi {try.#Success actual}
- (n.= expected actual))))))])
+(def: !cover
+ (template (_ <coverage> <parser> <sample>)
+ [(do [! random.monad]
+ [dummy random.nat
+ expected (|> random.nat (random.only (|>> (n.= dummy) not)))]
+ (_.coverage <coverage>
+ (|> (/.result <parser>
+ <sample>)
+ (!expect (^.multi {try.#Success actual}
+ (n.= expected actual))))))]))
-(template: (!cover/2 <coverage> <parser> <sample0> <sample1>)
- [(do [! random.monad]
- [dummy random.nat
- expected (|> random.nat (random.only (|>> (n.= dummy) not)))]
- (_.coverage <coverage>
- (and (|> (/.result <parser> <sample0>)
- (!expect (^.multi {try.#Success actual}
- (n.= expected actual))))
- (|> (/.result <parser> <sample1>)
- (!expect (^.multi {try.#Success actual}
- (n.= expected actual)))))))])
+(def: !cover/2
+ (template (_ <coverage> <parser> <sample0> <sample1>)
+ [(do [! random.monad]
+ [dummy random.nat
+ expected (|> random.nat (random.only (|>> (n.= dummy) not)))]
+ (_.coverage <coverage>
+ (and (|> (/.result <parser> <sample0>)
+ (!expect (^.multi {try.#Success actual}
+ (n.= expected actual))))
+ (|> (/.result <parser> <sample1>)
+ (!expect (^.multi {try.#Success actual}
+ (n.= expected actual)))))))]))
(def: .public test
Test
@@ -162,7 +165,7 @@
(do [! random.monad]
[dummy random.nat]
(_.coverage [/.cannot_move_further]
- (`` (and (~~ (template [<parser>]
+ (`` (and (~~ (with_template [<parser>]
[(|> (/.result <parser>
(tree.leaf dummy))
(!expect (^.multi {try.#Failure error}
diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux
index 2d871bdef..e928d3903 100644
--- a/stdlib/source/test/lux/control/parser/type.lux
+++ b/stdlib/source/test/lux/control/parser/type.lux
@@ -25,13 +25,14 @@
["[0]" / (.only)
["/[1]" //]]])
-(template: (!expect <pattern> <value>)
- [(case <value>
- <pattern>
- true
-
- _
- false)])
+(def: !expect
+ (template (_ <pattern> <value>)
+ [(case <value>
+ <pattern>
+ true
+
+ _
+ false)]))
(def: primitive
(Random Type)
@@ -82,7 +83,7 @@
expected_middle ..primitive
expected_right ..primitive]
(`` (all _.and
- (~~ (template [<parser> <exception> <good_constructor> <bad_constructor>]
+ (~~ (with_template [<parser> <exception> <good_constructor> <bad_constructor>]
[(_.coverage [<parser> <exception>]
(and (|> (/.result (<parser> (all //.and /.any /.any /.any))
(<good_constructor> (list expected_left expected_middle expected_right)))
@@ -264,7 +265,7 @@
(do [! random.monad]
[expected ..primitive]
(_.coverage [/.empty_input]
- (`` (and (~~ (template [<parser>]
+ (`` (and (~~ (with_template [<parser>]
[(|> (/.result (do //.monad
[_ /.any]
<parser>)
diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux
index 57833948e..818f48a14 100644
--- a/stdlib/source/test/lux/control/parser/xml.lux
+++ b/stdlib/source/test/lux/control/parser/xml.lux
@@ -28,25 +28,27 @@
["[0]" / (.only)
["/[1]" // (.open: "[1]#[0]" monad)]]])
-(template: (!expect <pattern> <value>)
- [(case <value>
- <pattern>
- true
-
- _
- false)])
+(def: !expect
+ (template (_ <pattern> <value>)
+ [(case <value>
+ <pattern>
+ true
+
+ _
+ false)]))
-(template: (!failure <exception> <cases>)
- [(with_expansions [<<cases>> (template.spliced <cases>)]
- (do [! random.monad]
- [expected (random.alphabetic 1)]
- (_.coverage [<exception>]
- (`` (and (~~ (template [<parser> <input>]
- [(|> (/.result <parser> (list <input>))
- (!expect (^.multi {try.#Failure error}
- (exception.match? <exception> error))))]
+(def: !failure
+ (template (_ <exception> <cases>)
+ [(with_expansions [<<cases>> (template.spliced <cases>)]
+ (do [! random.monad]
+ [expected (random.alphabetic 1)]
+ (_.coverage [<exception>]
+ (`` (and (~~ (with_template [<parser> <input>]
+ [(|> (/.result <parser> (list <input>))
+ (!expect (^.multi {try.#Failure error}
+ (exception.match? <exception> error))))]
- <<cases>>)))))))])
+ <<cases>>)))))))]))
(def: random_label
(Random Symbol)
diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux
index 25b679962..30ffac578 100644
--- a/stdlib/source/test/lux/data.lux
+++ b/stdlib/source/test/lux/data.lux
@@ -23,11 +23,12 @@
["[1][0]" collection]])
... TODO: Get rid of this ASAP
-(template: (!bundle body)
- [(is Test
- (do random.monad
- [_ (in [])]
- body))])
+(def: !bundle
+ (template (_ body)
+ [(is Test
+ (do random.monad
+ [_ (in [])]
+ body))]))
(def: format
Test
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux
index b0eea56fa..dd5949cab 100644
--- a/stdlib/source/test/lux/data/binary.lux
+++ b/stdlib/source/test/lux/data/binary.lux
@@ -100,7 +100,7 @@
(!.= (!.empty size) (!.empty size)))
(_.coverage [!.size]
(|> (!.empty size) !.size (n.= size)))
- (~~ (template [<power> <bytes/?> <has/?>]
+ (~~ (with_template [<power> <bytes/?> <has/?>]
[(_.coverage [<bytes/?> <has/?>]
(let [bytes (i64.left_shifted <power> 1)
binary (!.empty bytes)
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux
index 3e05ec3f4..f82ac2f35 100644
--- a/stdlib/source/test/lux/data/collection/list.lux
+++ b/stdlib/source/test/lux/data/collection/list.lux
@@ -246,7 +246,7 @@
(_.coverage [/.member?]
(/.every? (/.member? n.equivalence sample)
sample))
- (~~ (template [<head> <tail> <pre>]
+ (~~ (with_template [<head> <tail> <pre>]
[(all _.and
(_.coverage [<head>]
(case [(<pre> sample) (<head> sample)]
diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux
index 8e68d0a63..0cabf93c6 100644
--- a/stdlib/source/test/lux/data/collection/set/multi.lux
+++ b/stdlib/source/test/lux/data/collection/set/multi.lux
@@ -57,7 +57,7 @@
sample (..random diversity n.hash ..count random.nat)
another (..random diversity n.hash ..count random.nat)]
(`` (all _.and
- (~~ (template [<name> <composition>]
+ (~~ (with_template [<name> <composition>]
[(_.coverage [<name>]
(let [|sample| (/.support sample)
|another| (/.support another)
diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux
index d35037fd9..95f1644a1 100644
--- a/stdlib/source/test/lux/data/collection/set/ordered.lux
+++ b/stdlib/source/test/lux/data/collection/set/ordered.lux
@@ -71,7 +71,7 @@
(|> setL
/.list (/.of_list n.order)
(/#= setL)))
- (~~ (template [<coverage> <comparison>]
+ (~~ (with_template [<coverage> <comparison>]
[(_.coverage [<coverage>]
(case (<coverage> setL)
{.#Some value}
@@ -123,7 +123,7 @@
(and self!
empty!
symmetry!)))
- (~~ (template [<coverage> <relation> <empty?>]
+ (~~ (with_template [<coverage> <relation> <empty?>]
[(_.coverage [<coverage>]
(let [self!
(at /.equivalence =
diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux
index 9f2534c83..e1d06c542 100644
--- a/stdlib/source/test/lux/data/color.lux
+++ b/stdlib/source/test/lux/data/color.lux
@@ -56,7 +56,7 @@
(def: rgb_error_margin +1.8)
-(template [<field>]
+(with_template [<field>]
[(def: (<field> color)
(-> /.Color Frac)
(let [[hue saturation luminance] (/.hsl color)]
@@ -140,7 +140,7 @@
spread (at ! each (|>> f.abs (f.% spread_space) (f.+ min_spread))
random.safe_frac)]
(`` (all _.and
- (~~ (template [<brightness> <palette>]
+ (~~ (with_template [<brightness> <palette>]
[(_.coverage [<palette>]
(let [eB <brightness>
expected (/.of_hsb [eH eS eB])
@@ -150,7 +150,7 @@
[+1.0 /.analogous]
[+0.5 /.monochromatic]
))
- (~~ (template [<palette>]
+ (~~ (with_template [<palette>]
[(_.coverage [<palette>]
(let [expected (/.of_hsb [eH eS +0.5])
[c0 c1 c2] (<palette> expected)]
@@ -161,7 +161,7 @@
[/.triad]
[/.clash]
[/.split_complement]))
- (~~ (template [<palette>]
+ (~~ (with_template [<palette>]
[(_.coverage [<palette>]
(let [expected (/.of_hsb [eH eS +0.5])
[c0 c1 c2 c3] (<palette> expected)]
diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux
index ce902b16b..7034f41d1 100644
--- a/stdlib/source/test/lux/data/color/named.lux
+++ b/stdlib/source/test/lux/data/color/named.lux
@@ -201,7 +201,7 @@
/.yellow_green]]
)]
(def: all_colors
- (list.together (`` (list (~~ (template [<definition> <by_letter>]
+ (list.together (`` (list (~~ (with_template [<definition> <by_letter>]
[((is (-> Any (List //.Color))
(function (_ _)
(`` (list (~~ (template.spliced <by_letter>))))))
@@ -216,7 +216,7 @@
(n.= (list.size ..all_colors)
(set.size ..unique_colors)))
- (template [<definition> <by_letter>]
+ (with_template [<definition> <by_letter>]
[(def: <definition>
Test
(_.coverage <by_letter>
@@ -228,7 +228,7 @@
Test
(<| (_.covering /._)
(`` (all _.and
- (~~ (template [<definition> <by_letter>]
+ (~~ (with_template [<definition> <by_letter>]
[<definition>]
<colors>))
diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux
index a4874021b..394c9f1c1 100644
--- a/stdlib/source/test/lux/data/format/json.lux
+++ b/stdlib/source/test/lux/data/format/json.lux
@@ -137,7 +137,7 @@
true)]]
(in (and can_find_known_key!
cannot_find_unknown_key!))))))
- (~~ (template [<type> <field> <tag> <random> <equivalence>]
+ (~~ (with_template [<type> <field> <tag> <random> <equivalence>]
[(do random.monad
[key (random.alphabetic 1)
value <random>]
@@ -169,7 +169,7 @@
<key6> (string)]
(_.coverage [/.json]
(and (/#= {/.#Null} (/.json ()))
- (~~ (template [<tag> <value>]
+ (~~ (with_template [<tag> <value>]
[(/#= {<tag> <value>} (/.json <value>))]
[/.#Boolean <boolean>]
diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux
index 4681f3822..33487622a 100644
--- a/stdlib/source/test/lux/data/format/tar.lux
+++ b/stdlib/source/test/lux/data/format/tar.lux
@@ -167,7 +167,7 @@
text.together
(at utf8.codec encoded))]]
(`` (all _.and
- (~~ (template [<type> <tag>]
+ (~~ (with_template [<type> <tag>]
[(_.coverage [<type>]
(|> (do try.monad
[expected_path (/.path expected_path)
@@ -188,7 +188,7 @@
))
(_.for [/.File /.Content /.content /.data]
(all _.and
- (~~ (template [<type> <tag>]
+ (~~ (with_template [<type> <tag>]
[(_.coverage [<type>]
(|> (do try.monad
[expected_path (/.path expected_path)
@@ -269,7 +269,7 @@
_
false)))
(try.else false)))
- (~~ (template [<expected_mode>]
+ (~~ (with_template [<expected_mode>]
[(_.coverage [<expected_mode>]
(|> (do try.monad
[path (/.path path)
diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux
index fffae6ba2..d792a8f87 100644
--- a/stdlib/source/test/lux/data/format/xml.lux
+++ b/stdlib/source/test/lux/data/format/xml.lux
@@ -81,7 +81,7 @@
(do [! random.monad]
[(^.let symbol [namespace name]) ..symbol]
(`` (all _.and
- (~~ (template [<type> <format>]
+ (~~ (with_template [<type> <format>]
[(_.coverage [<type> <format>]
(and (text#= name (<format> ["" name]))
(let [symbol (<format> symbol)]
diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux
index 3e1889c04..ebda04668 100644
--- a/stdlib/source/test/lux/data/text.lux
+++ b/stdlib/source/test/lux/data/text.lux
@@ -59,7 +59,7 @@
.let [full (at /.monoid composite inner outer)
fake_index (-- 0)]]
(`` (all _.and
- (~~ (template [<affix> <predicate>]
+ (~~ (with_template [<affix> <predicate>]
[(_.coverage [<affix> <predicate>]
(<predicate> outer (<affix> outer inner)))]
@@ -129,7 +129,7 @@
(all _.and
(_.for [/.Char /.of_char]
(`` (all _.and
- (~~ (template [<short> <long>]
+ (~~ (with_template [<short> <long>]
[(_.coverage [<short> <long>]
(at /.equivalence = <short> <long>))]
@@ -163,7 +163,7 @@
{.#None}
false)))
(_.coverage [/.space /.space?]
- (`` (and (~~ (template [<char>]
+ (`` (and (~~ (with_template [<char>]
[(/.space? (`` (.char (~~ (static <char>)))))]
[/.tab]
diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux
index 4e30d8797..12be514b8 100644
--- a/stdlib/source/test/lux/data/text/encoding.lux
+++ b/stdlib/source/test/lux/data/text/encoding.lux
@@ -182,7 +182,7 @@
/.koi8_r
/.koi8_u]]
)
- <named> (template [<definition> <by_letter>]
+ <named> (with_template [<definition> <by_letter>]
[((is (-> Any (List /.Encoding))
(function (_ _)
(`` (list (~~ (template.spliced <by_letter>))))))
@@ -202,7 +202,7 @@
(n.= (list.size ..all_encodings)
(set.size ..unique_encodings)))
- (template [<definition> <by_letter>]
+ (with_template [<definition> <by_letter>]
[(def: <definition>
Test
(`` (_.coverage [/.name (~~ (template.spliced <by_letter>))]
@@ -222,7 +222,7 @@
(<| (_.covering /._)
(_.for [/.Encoding])
(`` (all _.and
- (~~ (template [<definition> <by_letter>]
+ (~~ (with_template [<definition> <by_letter>]
[<definition>]
<encodings>))
diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux
index 8a897d348..c6c961dfe 100644
--- a/stdlib/source/test/lux/data/text/escape.lux
+++ b/stdlib/source/test/lux/data/text/escape.lux
@@ -89,7 +89,7 @@
(do random.monad
[ascii ..ascii_range]
(_.coverage [/.escapable?]
- (`` (if (or (~~ (template [<char>]
+ (`` (if (or (~~ (with_template [<char>]
[(n.= (debug.private <char>) ascii)]
[/.\0] [/.\a] [/.\b] [/.\t]
diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux
index 13446a8ce..20c8ea453 100644
--- a/stdlib/source/test/lux/data/text/format.lux
+++ b/stdlib/source/test/lux/data/text/format.lux
@@ -73,7 +73,7 @@
(def: codec
Test
(`` (all _.and
- (~~ (template [<format> <codec> <random>]
+ (~~ (with_template [<format> <codec> <random>]
[(do random.monad
[sample <random>]
(_.coverage [<format>]
@@ -139,7 +139,7 @@
(text#= (/.format left mid right)
(all "lux text concat" left mid right))))
..codec
- (~~ (template [<format> <alias> <random>]
+ (~~ (with_template [<format> <alias> <random>]
[(do random.monad
[sample <random>]
(_.coverage [<format>]
diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux
index 00e98bf4d..c07da3b71 100644
--- a/stdlib/source/test/lux/data/text/unicode/block.lux
+++ b/stdlib/source/test/lux/data/text/unicode/block.lux
@@ -146,14 +146,14 @@
/.upper_case
/.lower_case]]
)
- <named> (template [<definition> <part>]
+ <named> (with_template [<definition> <part>]
[((is (-> Any (List /.Block))
(function (_ _)
(`` (list (~~ (template.spliced <part>))))))
[])]
<blocks>)]
- (template [<definition> <part>]
+ (with_template [<definition> <part>]
[(def: <definition>
Test
(`` (_.coverage [(~~ (template.spliced <part>))]
@@ -205,7 +205,7 @@
(and (/.within? sample inside)
(not (/.within? sample (-- (/.start sample))))
(not (/.within? sample (++ (/.end sample))))))
- (~~ (template [<definition> <part>]
+ (~~ (with_template [<definition> <part>]
[<definition>]
<blocks>))))
diff --git a/stdlib/source/test/lux/data/text/unicode/set.lux b/stdlib/source/test/lux/data/text/unicode/set.lux
index f2c9808c0..e4eed7710 100644
--- a/stdlib/source/test/lux/data/text/unicode/set.lux
+++ b/stdlib/source/test/lux/data/text/unicode/set.lux
@@ -73,7 +73,7 @@
(n.= (n.max (block.end left)
(block.end right))
(/.end composed)))))
- (~~ (template [<set>]
+ (~~ (with_template [<set>]
[(do random.monad
[char (random.char <set>)
.let [start (/.start <set>)
diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux
index bfa275ce7..1d88519e0 100644
--- a/stdlib/source/test/lux/debug.lux
+++ b/stdlib/source/test/lux/debug.lux
@@ -57,7 +57,7 @@
sample_text (random.upper_case 10)
sample_nat random.nat
sample_rev random.rev]
- (in (`` (and (~~ (template [<type> <format> <sample>]
+ (in (`` (and (~~ (with_template [<type> <format> <sample>]
[(|> (/.representation <type> <sample>)
(try#each (text#= (<format> <sample>)))
(try.else false))]
@@ -88,7 +88,7 @@
{try.#Failure error}
false)
... TODO: Uncomment after switching from the old (tag+last?) to the new (lefts+right?) representation for variants
- ... (~~ (template [<lefts> <right?> <value> <format>]
+ ... (~~ (with_template [<lefts> <right?> <value> <format>]
... [(|> (/.representation (type (Or Bit Int Frac))
... (is (Or Bit Int Frac)
... (<lefts> <right?> <value>)))
@@ -113,7 +113,7 @@
sample_code $//code.random
sample_xml $//xml.random
sample_json $//json.random]
- (in (`` (and (~~ (template [<type> <format> <sample>]
+ (in (`` (and (~~ (with_template [<type> <format> <sample>]
[(|> (/.representation <type> <sample>)
(try#each (text#= (<format> <sample>)))
(try.else false))]
@@ -136,7 +136,7 @@
sample_month random.month
sample_time random.time
sample_day random.day]
- (in (`` (and (~~ (template [<type> <format> <sample>]
+ (in (`` (and (~~ (with_template [<type> <format> <sample>]
[(|> (/.representation <type> <sample>)
(try#each (text#= (<format> <sample>)))
(try.else false))]
@@ -174,7 +174,7 @@
(|> (/.representation (type (List Nat)) (is (List Nat) (list sample_nat)))
(try#each (text#= (%.list %.nat (list sample_nat))))
(try.else false))
- (~~ (template [<sample>]
+ (~~ (with_template [<sample>]
[(|> (/.representation (type (Maybe Nat)) (is (Maybe Nat) <sample>))
(try#each (text#= (%.maybe %.nat <sample>)))
(try.else false))]
@@ -200,7 +200,7 @@
sample_frac random.frac
sample_text (random.upper_case 10)]
(_.coverage [/.inspection]
- (`` (and (~~ (template [<format> <sample>]
+ (`` (and (~~ (with_template [<format> <sample>]
[(text#= (<format> <sample>) (/.inspection <sample>))]
[%.bit sample_bit]
diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux
index 3052034b4..5d74472a2 100644
--- a/stdlib/source/test/lux/documentation.lux
+++ b/stdlib/source/test/lux/documentation.lux
@@ -107,7 +107,7 @@
false))))
))
(_.coverage [/.unqualified_symbol]
- (`` (and (~~ (template [<example>]
+ (`` (and (~~ (with_template [<example>]
[(macro_error <example>)]
[(/.default g!default)]
diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux
index 9079d5336..0716e76d1 100644
--- a/stdlib/source/test/lux/extension.lux
+++ b/stdlib/source/test/lux/extension.lux
@@ -64,7 +64,7 @@
(def: dummy_generation "dummy generation")
-(template [<name>]
+(with_template [<name>]
[(def: <name>
Text
(`` (%.symbol (symbol (~~ (template.symbol [.._ <name>]))))))]
@@ -187,7 +187,7 @@
(do random.monad
[expected random.nat]
(`` (all _.and
- (~~ (template [<macro> <extension>]
+ (~~ (with_template [<macro> <extension>]
[(_.coverage [<macro>]
(for @.old false
(n.= expected
diff --git a/stdlib/source/test/lux/ffi.js.lux b/stdlib/source/test/lux/ffi.js.lux
index ade4d78a8..6de496499 100644
--- a/stdlib/source/test/lux/ffi.js.lux
+++ b/stdlib/source/test/lux/ffi.js.lux
@@ -59,7 +59,7 @@
object random.nat]
(<| (_.covering /._)
(`` (all _.and
- (~~ (template [<type> <value>]
+ (~~ (with_template [<type> <value>]
[(_.coverage [<type>]
(exec
(is <type> <value>)
@@ -71,7 +71,7 @@
))
(_.for [/.Object]
(all _.and
- (~~ (template [<type>]
+ (~~ (with_template [<type>]
[(_.coverage [<type>]
(exec
(is (Ex (_ a) (/.Object a))
diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux
index 3a6df69db..1b96680d3 100644
--- a/stdlib/source/test/lux/ffi.jvm.lux
+++ b/stdlib/source/test/lux/ffi.jvm.lux
@@ -55,7 +55,7 @@
"[1]::[0]"
(getName [] java/lang/String))
-(template [<name> <type> <conversion> <lux> <=>]
+(with_template [<name> <type> <conversion> <lux> <=>]
[(def: (<name> left right)
(-> <type> <type> Bit)
(<=> (as <lux> (<conversion> left))
@@ -94,7 +94,7 @@
(random.only (|>> f.not_a_number? not))
(at ! each (|>> /.as_float)))]
(`` (all _.and
- (~~ (template [<sample> <=> <to> <from>]
+ (~~ (with_template [<sample> <=> <to> <from>]
[(_.coverage [<to> <from>]
(or (|> <sample> <to> <from> (<=> <sample>))
(let [capped (|> <sample> <to> <from>)]
@@ -197,7 +197,7 @@
/.!!!
/.null?
not)))
- (~~ (template [<object> <primitive> <jvm#value> <jvm#=>
+ (~~ (with_template [<object> <primitive> <jvm#value> <jvm#=>
<lux#value> <as> <of> <lux#=>]
[(_.coverage [<object> <primitive>]
(|> <jvm#value>
diff --git a/stdlib/source/test/lux/ffi.lua.lux b/stdlib/source/test/lux/ffi.lua.lux
index cd80999b8..4ca013d88 100644
--- a/stdlib/source/test/lux/ffi.lua.lux
+++ b/stdlib/source/test/lux/ffi.lua.lux
@@ -24,7 +24,7 @@
string (random.lower_case 1)]
(<| (_.covering /._)
(`` (all _.and
- (~~ (template [<type> <sample>]
+ (~~ (with_template [<type> <sample>]
[(_.coverage [<type>]
(exec
(is <type> <sample>)
@@ -37,7 +37,7 @@
))
(_.for [/.Object]
(all _.and
- (~~ (template [<type>]
+ (~~ (with_template [<type>]
[(_.coverage [<type>]
(exec
(|> []
diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux
index 021af2ad4..3c00f11c5 100644
--- a/stdlib/source/test/lux/ffi.old.lux
+++ b/stdlib/source/test/lux/ffi.old.lux
@@ -100,7 +100,7 @@
(random.only (|>> f.not_a_number? not))
(at ! each (|>> /.double_to_float)))]
(`` (all _.and
- (~~ (template [<=> <sample> <to> <from>]
+ (~~ (with_template [<=> <sample> <to> <from>]
[(_.coverage [<to> <from>]
(or (|> <sample> <to> <from> (<=> <sample>))
(let [capped (|> <sample> <to> <from>)]
@@ -115,7 +115,7 @@
[f.= double /.double_to_float /.float_to_double]
[f.= double /.double_to_int /.int_to_double]
))
- (~~ (template [<to> <from>]
+ (~~ (with_template [<to> <from>]
[(_.coverage [<to>]
(or (|> int <to> <from> (i.= (/.int_to_long int)))
(let [capped (|> int <to> <from>)]
@@ -125,7 +125,7 @@
[/.int_to_short /.short_to_long]
[/.int_to_char /.char_to_long]
))
- (~~ (template [<sample> <to> <from>]
+ (~~ (with_template [<sample> <to> <from>]
[(_.coverage [<to> <from>]
(or (|> <sample> <to> <from> /.float_to_double (f.= (/.float_to_double <sample>)))
(let [capped (|> <sample> <to> <from>)]
@@ -133,7 +133,7 @@
[float /.float_to_int /.int_to_float]
))
- (~~ (template [<to> <from>]
+ (~~ (with_template [<to> <from>]
[(_.coverage [<to>]
(or (|> char <to> <from> (i.= (|> char /.char_to_int /.int_to_long)))
(let [capped (|> char <to> <from>)]
diff --git a/stdlib/source/test/lux/ffi.py.lux b/stdlib/source/test/lux/ffi.py.lux
index 98d68142f..bdaab94c5 100644
--- a/stdlib/source/test/lux/ffi.py.lux
+++ b/stdlib/source/test/lux/ffi.py.lux
@@ -27,7 +27,7 @@
string (random.lower_case 1)]
(<| (_.covering /._)
(`` (all _.and
- (~~ (template [<type> <sample>]
+ (~~ (with_template [<type> <sample>]
[(_.coverage [<type>]
(exec
(is <type> <sample>)
@@ -40,7 +40,7 @@
))
(_.for [/.Object]
(all _.and
- (~~ (template [<type>]
+ (~~ (with_template [<type>]
[(_.coverage [<type>]
(exec
(|> []
diff --git a/stdlib/source/test/lux/ffi.rb.lux b/stdlib/source/test/lux/ffi.rb.lux
index 268512134..f5185ea81 100644
--- a/stdlib/source/test/lux/ffi.rb.lux
+++ b/stdlib/source/test/lux/ffi.rb.lux
@@ -24,7 +24,7 @@
string (random.lower_case 1)]
(<| (_.covering /._)
(`` (all _.and
- (~~ (template [<type> <sample>]
+ (~~ (with_template [<type> <sample>]
[(_.coverage [<type>]
(exec
(is <type> <sample>)
@@ -37,7 +37,7 @@
))
(_.for [/.Object]
(all _.and
- (~~ (template [<type>]
+ (~~ (with_template [<type>]
[(_.coverage [<type>]
(exec
(|> []
diff --git a/stdlib/source/test/lux/ffi/export.jvm.lux b/stdlib/source/test/lux/ffi/export.jvm.lux
index 3ad692d50..d79489e9b 100644
--- a/stdlib/source/test/lux/ffi/export.jvm.lux
+++ b/stdlib/source/test/lux/ffi/export.jvm.lux
@@ -46,7 +46,7 @@
(actual_double double ..expected_double)
... Methods
- (~~ (template [<type> <+>]
+ (~~ (with_template [<type> <+>]
[(((~~ (template.symbol [<type> "_method"]))
[left <type>
right <type>])
@@ -77,7 +77,7 @@
("static" actual_float float)
("static" actual_double double)
- (~~ (template [<type>]
+ (~~ (with_template [<type>]
[("static" (~~ (template.symbol [<type> "_method"])) [<type> <type>] <type>)]
[boolean]
@@ -126,7 +126,7 @@
Test
(<| (_.covering /._)
(do [! random.monad]
- [(~~ (template [<type> <as> <random>]
+ [(~~ (with_template [<type> <as> <random>]
[(~~ (template.symbol [left_ <type>])) (at ! each (|>> <as>) <random>)
(~~ (template.symbol [right_ <type>])) (at ! each (|>> <as>) <random>)]
@@ -151,7 +151,7 @@
(frac#= (//.of_float ..expected_float) (//.of_float (Primitives::actual_float)))
(frac#= (//.of_double ..expected_double) (//.of_double (Primitives::actual_double)))
- (~~ (template [<=> <+> <type>]
+ (~~ (with_template [<=> <+> <type>]
[(with_expansions [<left> (template.symbol ["left_" <type>])
<right> (template.symbol ["right_" <type>])
<of> (template.symbol [//._] ["of_" <type>])
diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux
index cb2fb5477..8691b1dc4 100644
--- a/stdlib/source/test/lux/locale/language.lux
+++ b/stdlib/source/test/lux/locale/language.lux
@@ -31,7 +31,7 @@
#languages (Set /.Language)
#test Test]))
-(template [<bundle> <languages>]
+(with_template [<bundle> <languages>]
[(def: <bundle>
Bundle
(let [amount (template.amount <languages>)
@@ -202,7 +202,7 @@
(list#each (the #test))
(list#mix _.and
(`` (all _.and
- (~~ (template [<lens> <tag> <hash>]
+ (~~ (with_template [<lens> <tag> <hash>]
[(let [[amount set] (..aggregate (the <tag>) <hash> ..languages)]
(_.coverage [<lens>]
(n.= amount (set.size set))))]
@@ -213,10 +213,11 @@
))
)))))
-(template: (!aliases <reference> <aliases>)
- [(_.coverage <aliases>
- (list.every? (at /.equivalence = <reference>)
- (`` (list (~~ (template.spliced <aliases>))))))])
+(def: !aliases
+ (template (_ <reference> <aliases>)
+ [(_.coverage <aliases>
+ (list.every? (at /.equivalence = <reference>)
+ (`` (list (~~ (template.spliced <aliases>))))))]))
(def: aliases_test/0
Test
diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux
index 6a8051f66..a68eaf8f3 100644
--- a/stdlib/source/test/lux/locale/territory.lux
+++ b/stdlib/source/test/lux/locale/territory.lux
@@ -33,7 +33,7 @@
#territories (Set /.Territory)
#test Test]))
-(template [<bundle> <territories>]
+(with_template [<bundle> <territories>]
[(def: <bundle>
Bundle
(let [amount (template.amount <territories>)
@@ -157,7 +157,7 @@
(list#each (the #test))
(list#mix _.and
(`` (all _.and
- (~~ (template [<lens> <tag> <hash>]
+ (~~ (with_template [<lens> <tag> <hash>]
[(let [[amount set] (..aggregate (the <tag>) <hash> ..territories)]
(_.coverage [<lens>]
(n.= amount (set.size set))))]
@@ -170,10 +170,11 @@
))
)))))
-(template: (!aliases <reference> <aliases>)
- [(_.coverage <aliases>
- (list.every? (at /.equivalence = <reference>)
- (`` (list (~~ (template.spliced <aliases>))))))])
+(def: !aliases
+ (template (_ <reference> <aliases>)
+ [(_.coverage <aliases>
+ (list.every? (at /.equivalence = <reference>)
+ (`` (list (~~ (template.spliced <aliases>))))))]))
(def: aliases_test
Test
diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux
index 349ec7bbd..0a16b1491 100644
--- a/stdlib/source/test/lux/macro.lux
+++ b/stdlib/source/test/lux/macro.lux
@@ -36,14 +36,16 @@
["[1][0]" template]
["[1][0]" pattern]])
-(template: (!expect <pattern> <value>)
- [(case <value>
- <pattern> true
- _ false)])
+(def: !expect
+ (template (_ <pattern> <value>)
+ [(case <value>
+ <pattern> true
+ _ false)]))
-(template: (!global <definition>)
- [(is [Text .Global]
- [(template.text [<definition>]) {.#Definition [true .Macro <definition>]}])])
+(def: !global
+ (template (_ <definition>)
+ [(is [Text .Global]
+ [(template.text [<definition>]) {.#Definition [true .Macro <definition>]}])]))
(def: pow/2
(syntax (_ [number <code>.any])
@@ -130,7 +132,7 @@
full_expansion (` (n.* (n.* (~ pow/1) (~ pow/1))
(n.* (~ pow/1) (~ pow/1))))]]
(`` (all _.and
- (~~ (template [<expander> <logger> <expansion>]
+ (~~ (with_template [<expander> <logger> <expansion>]
[(_.coverage [<expander>]
(|> (<expander> (` (..pow/4 (~ pow/1))))
(meta.result lux)
diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux
index f01a61c3f..b0479c538 100644
--- a/stdlib/source/test/lux/macro/code.lux
+++ b/stdlib/source/test/lux/macro/code.lux
@@ -104,7 +104,7 @@
(def: for_format
Test
(`` (all _.and
- (~~ (template [<coverage> <random> <tag>]
+ (~~ (with_template [<coverage> <random> <tag>]
[(do [! random.monad]
[expected <random>]
(_.coverage [<coverage>]
@@ -130,7 +130,7 @@
[/.form (..random_sequence ..random) .#Form]
[/.variant (..random_sequence ..random) .#Variant]
[/.tuple (..random_sequence ..random) .#Tuple]))
- (~~ (template [<coverage> <random> <tag>]
+ (~~ (with_template [<coverage> <random> <tag>]
[(do [! random.monad]
[expected <random>]
(_.coverage [<coverage>]
diff --git a/stdlib/source/test/lux/macro/pattern.lux b/stdlib/source/test/lux/macro/pattern.lux
index 277d02830..53d3435ce 100644
--- a/stdlib/source/test/lux/macro/pattern.lux
+++ b/stdlib/source/test/lux/macro/pattern.lux
@@ -22,9 +22,10 @@
[#left l
#right r]))
-(template: (!pair <left> <right>)
- [[..#left <left>
- ..#right <right>]])
+(def: !pair
+ (template (_ <left> <right>)
+ [[..#left <left>
+ ..#right <right>]]))
(def: .public test
Test
@@ -41,9 +42,9 @@
(all _.and
(do [! random.monad]
[sample (at ! each (n.% 5) random.nat)]
- (_.coverage [/.template]
+ (_.coverage [/.with_template]
(case sample
- (/.template [<case>]
+ (/.with_template [<case>]
[<case> true])
([0] [1] [2] [3] [4])
diff --git a/stdlib/source/test/lux/math.lux b/stdlib/source/test/lux/math.lux
index 38c704927..3695f4be8 100644
--- a/stdlib/source/test/lux/math.lux
+++ b/stdlib/source/test/lux/math.lux
@@ -58,10 +58,10 @@
parameterC (random.only (|>> (complex.= complex/0) not) random.complex)
subjectC random.complex])
(`` (all _.and
- (~~ (template [</> <scenarios>']
+ (~~ (with_template [</> <scenarios>']
[(_.coverage [</>]
(with_expansions [<scenarios> (template.spliced <scenarios>')]
- (`` (and (~~ (template [<=> <//> <parameter> <subject>]
+ (`` (and (~~ (with_template [<=> <//> <parameter> <subject>]
[(<=> (<//> <parameter> <subject>)
(</> <parameter> <subject>))]
@@ -98,10 +98,10 @@
[ratio.= ratio.% parameter/ subject/]
[complex.= complex.% parameterC subjectC]]]
))
- (~~ (template [</> <scenarios>']
+ (~~ (with_template [</> <scenarios>']
[(_.coverage [</>]
(with_expansions [<scenarios> (template.spliced <scenarios>')]
- (`` (and (~~ (template [<//> <parameter> <subject>]
+ (`` (and (~~ (with_template [<//> <parameter> <subject>]
[(bit#= (<//> <parameter> <subject>)
(</> <parameter> <subject>))]
diff --git a/stdlib/source/test/lux/math/logic/continuous.lux b/stdlib/source/test/lux/math/logic/continuous.lux
index af3727efd..b4c4614e5 100644
--- a/stdlib/source/test/lux/math/logic/continuous.lux
+++ b/stdlib/source/test/lux/math/logic/continuous.lux
@@ -21,7 +21,7 @@
mid random.rev
right random.rev]
(`` (all _.and
- (~~ (template [<monoid>]
+ (~~ (with_template [<monoid>]
[(_.for [<monoid>]
($monoid.spec r.= <monoid> random.rev))]
diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux
index aaf670ba2..76098ff66 100644
--- a/stdlib/source/test/lux/math/modular.lux
+++ b/stdlib/source/test/lux/math/modular.lux
@@ -52,7 +52,7 @@
($equivalence.spec /.equivalence (..random subject::%)))
(_.for [/.order /.<]
($order.spec /.order (..random subject::%)))
- (~~ (template [<composite> <monoid>]
+ (~~ (with_template [<composite> <monoid>]
[(_.for [<monoid> <composite>]
($monoid.spec /.equivalence (<monoid> subject::%) (..random subject::%)))]
diff --git a/stdlib/source/test/lux/math/number.lux b/stdlib/source/test/lux/math/number.lux
index eaa74ac25..9d8b8ce52 100644
--- a/stdlib/source/test/lux/math/number.lux
+++ b/stdlib/source/test/lux/math/number.lux
@@ -33,7 +33,7 @@
(<| (_.covering /._)
(all _.and
(_.coverage [/.bin]
- (`` (and (~~ (template [<=> <codec> <number>]
+ (`` (and (~~ (with_template [<=> <codec> <number>]
[(case (at <codec> decoded (..clean_commas <number>))
{try.#Success actual}
(<=> (/.bin <number>) actual)
@@ -52,7 +52,7 @@
[f.= f.binary "-11,00.10,01"]
)))))
(_.coverage [/.oct]
- (`` (and (~~ (template [<=> <codec> <number>]
+ (`` (and (~~ (with_template [<=> <codec> <number>]
[(case (at <codec> decoded (..clean_commas <number>))
{try.#Success actual}
(<=> (/.oct <number>) actual)
@@ -71,7 +71,7 @@
[f.= f.octal "-61,52.43"]
)))))
(_.coverage [/.hex]
- (`` (and (~~ (template [<=> <codec> <number>]
+ (`` (and (~~ (with_template [<=> <codec> <number>]
[(case (at <codec> decoded (..clean_commas <number>))
{try.#Success actual}
(<=> (/.hex <number>) actual)
diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux
index d06a60251..88862c47f 100644
--- a/stdlib/source/test/lux/math/number/frac.lux
+++ b/stdlib/source/test/lux/math/number/frac.lux
@@ -102,7 +102,7 @@
($hash.spec /.hash random.frac))
(_.for [/.order /.<]
($order.spec /.order random.safe_frac))
- (~~ (template [<composite> <monoid>]
+ (~~ (with_template [<composite> <monoid>]
[(_.for [<monoid> <composite>]
($monoid.spec /.equivalence <monoid> ..random))]
@@ -112,7 +112,7 @@
[/.min /.minimum]
[/.max /.maximum]
))
- (~~ (template [<codec>]
+ (~~ (with_template [<codec>]
[(_.for [<codec>]
($codec.spec /.equivalence <codec> random.safe_frac))]
diff --git a/stdlib/source/test/lux/math/number/int.lux b/stdlib/source/test/lux/math/number/int.lux
index 76ed060da..8f451d37e 100644
--- a/stdlib/source/test/lux/math/number/int.lux
+++ b/stdlib/source/test/lux/math/number/int.lux
@@ -36,7 +36,7 @@
($enum.spec /.enum random.int))
(_.for [/.interval]
($interval.spec /.interval random.int))
- (~~ (template [<monoid>]
+ (~~ (with_template [<monoid>]
[(_.for [<monoid>]
($monoid.spec /.equivalence <monoid> random.int))]
@@ -46,7 +46,7 @@
[/.minimum]
[/.maximum]
))
- (~~ (template [<codec>]
+ (~~ (with_template [<codec>]
[(_.for [<codec>]
($codec.spec /.equivalence <codec> random.int))]
diff --git a/stdlib/source/test/lux/math/number/nat.lux b/stdlib/source/test/lux/math/number/nat.lux
index 54471e9b3..a29ce19a3 100644
--- a/stdlib/source/test/lux/math/number/nat.lux
+++ b/stdlib/source/test/lux/math/number/nat.lux
@@ -34,7 +34,7 @@
($enum.spec /.enum random.nat))
(_.for [/.interval]
($interval.spec /.interval random.nat))
- (~~ (template [<composite> <monoid>]
+ (~~ (with_template [<composite> <monoid>]
[(_.for [<monoid> <composite>]
($monoid.spec /.equivalence <monoid> random.nat))]
@@ -44,7 +44,7 @@
[/.min /.minimum]
[/.max /.maximum]
))
- (~~ (template [<codec>]
+ (~~ (with_template [<codec>]
[(_.for [<codec>]
($codec.spec /.equivalence <codec> random.nat))]
diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux
index 7b8d252ef..536ce838c 100644
--- a/stdlib/source/test/lux/math/number/ratio.lux
+++ b/stdlib/source/test/lux/math/number/ratio.lux
@@ -43,7 +43,7 @@
($equivalence.spec /.equivalence ..random))
(_.for [/.order /.<]
($order.spec /.order ..random))
- (~~ (template [<composite> <monoid>]
+ (~~ (with_template [<composite> <monoid>]
[(_.for [<monoid> <composite>]
($monoid.spec /.equivalence <monoid> ..random))]
diff --git a/stdlib/source/test/lux/math/number/rev.lux b/stdlib/source/test/lux/math/number/rev.lux
index 72d03d335..b7403a4f2 100644
--- a/stdlib/source/test/lux/math/number/rev.lux
+++ b/stdlib/source/test/lux/math/number/rev.lux
@@ -36,7 +36,7 @@
($enum.spec /.enum random.rev))
(_.for [/.interval]
($interval.spec /.interval random.rev))
- (~~ (template [<composite> <monoid>]
+ (~~ (with_template [<composite> <monoid>]
[(_.for [<monoid> <composite>]
($monoid.spec /.equivalence <monoid> random.rev))]
@@ -45,7 +45,7 @@
[/.min /.minimum]
[/.max /.maximum]
))
- (~~ (template [<codec>]
+ (~~ (with_template [<codec>]
[(_.for [<codec>]
($codec.spec /.equivalence <codec> random.rev))]
@@ -58,7 +58,7 @@
(<| (_.covering /._)
(_.for [.Rev])
(`` (all _.and
- (~~ (template [<half> <whole>]
+ (~~ (with_template [<half> <whole>]
[(_.coverage [<half>]
(/.= <whole>
(/.+ <half> <half>)))]
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index c4f1f334c..807e0b3e0 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -38,10 +38,11 @@
["[1][0]" configuration]
["[1][0]" version]])
-(template: (!expect <pattern> <value>)
- [(case <value>
- <pattern> true
- _ false)])
+(def: !expect
+ (template (_ <pattern> <value>)
+ [(case <value>
+ <pattern> true
+ _ false)]))
(def: compiler_related
Test
diff --git a/stdlib/source/test/lux/static.lux b/stdlib/source/test/lux/static.lux
index 2e810c517..016fccd9e 100644
--- a/stdlib/source/test/lux/static.lux
+++ b/stdlib/source/test/lux/static.lux
@@ -27,7 +27,7 @@
(for @.old (_.property "PLACEHOLDER" true))
(_.for [meta.eval])
(`` (all _.and
- (~~ (template [<static> <random> <=> <+> <tag>]
+ (~~ (with_template [<static> <random> <=> <+> <tag>]
[(_.coverage [<static> <random>]
(with_expansions [<left> (<random>)
<right> (<random>)
diff --git a/stdlib/source/test/lux/target/js.lux b/stdlib/source/test/lux/target/js.lux
index 3bdd3ce1d..bff4822e6 100644
--- a/stdlib/source/test/lux/target/js.lux
+++ b/stdlib/source/test/lux/target/js.lux
@@ -47,7 +47,7 @@
(maybe.else false)))
(try.else false)))
-(template [<range>]
+(with_template [<range>]
[(`` (def: (~~ (template.symbol ["as_int_" <range>]))
(-> Int Int)
(|>> (i64.and (static.nat (-- (i64.left_shifted <range> 1)))))))
@@ -102,7 +102,7 @@
[left random.bit
right random.bit]
(`` (all _.and
- (~~ (template [<js> <lux>]
+ (~~ (with_template [<js> <lux>]
[(_.coverage [<js>]
(let [expected (<lux> left right)]
(expression (|>> (as Bit) (bit#= expected))
@@ -123,7 +123,7 @@
random.safe_frac)
subject random.safe_frac]
(`` (all _.and
- (~~ (template [<js> <lux>]
+ (~~ (with_template [<js> <lux>]
[(_.coverage [<js>]
(let [expected (<lux> parameter subject)]
(expression (|>> (as Frac) (f.= expected))
@@ -135,7 +135,7 @@
[/./ f./]
[/.% f.%]
))
- (~~ (template [<js> <lux>]
+ (~~ (with_template [<js> <lux>]
[(_.coverage [<js>]
(let [expected (<lux> parameter subject)]
(expression (|>> (as Bit) (bit#= expected))
@@ -159,7 +159,7 @@
i16 ..int_16
shift (at ! each (n.% 16) random.nat)]
(`` (all _.and
- (~~ (template [<js> <lux>]
+ (~~ (with_template [<js> <lux>]
[(_.coverage [<js>]
(let [expected (<lux> left right)]
(expression (|>> (as Frac) f.int (i.= expected))
@@ -411,7 +411,7 @@
(list (/.number number/0)))))
))
(_.coverage [/.Access]
- (`` (and (~~ (template [<js> <lux>]
+ (`` (and (~~ (with_template [<js> <lux>]
[(expression (|>> (as Frac) f.int (i.= (<lux> int/0)))
(/.apply (/.closure (list $foreign)
(all /.then
@@ -781,7 +781,7 @@
(/.statement (/.+ $arg/0 $arg/0))
(/.return $arg/0)))
(/.number number/0))))
- (~~ (template [<js> <lux>]
+ (~~ (with_template [<js> <lux>]
[(_.coverage [<js>]
(expression (|>> (as Frac) f.int (i.= (<lux> int)))
(/.apply_1 (/.closure (list $arg/0)
diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux
index 974394c30..94b88c41f 100644
--- a/stdlib/source/test/lux/target/jvm.lux
+++ b/stdlib/source/test/lux/target/jvm.lux
@@ -319,7 +319,7 @@
#random ..$String::random
#literal ..$String::literal])
-(template [<name> <bits> <type> <push> <wrap> <message> <to_long> <signed>]
+(with_template [<name> <bits> <type> <push> <wrap> <message> <to_long> <signed>]
[(def: <name>
Test
(do [! random.monad]
@@ -338,17 +338,18 @@
[short 15 java/lang/Short /.sipush ..$Short::wrap "SIPUSH" ffi.short_to_long /signed.s2]
)
-(template [<name> <type>]
- [(template: (<name> <old_extension> <new_extension>)
- [(is (-> <type> <type> <type>)
- (function (_ parameter subject)
- (for @.old
- (<old_extension> subject parameter)
-
- @.jvm
- ("jvm object cast"
- (<new_extension> ("jvm object cast" parameter)
- ("jvm object cast" subject))))))])]
+(with_template [<name> <type>]
+ [(def: <name>
+ (template (_ <old_extension> <new_extension>)
+ [(is (-> <type> <type> <type>)
+ (function (_ parameter subject)
+ (for @.old
+ (<old_extension> subject parameter)
+
+ @.jvm
+ ("jvm object cast"
+ (<new_extension> ("jvm object cast" parameter)
+ ("jvm object cast" subject))))))]))]
[int/2 java/lang/Integer]
[long/2 java/lang/Long]
@@ -356,16 +357,17 @@
[double/2 java/lang/Double]
)
-(template: (int+long/2 <old_extension> <new_extension>)
- [(is (-> java/lang/Integer java/lang/Long java/lang/Long)
- (function (_ parameter subject)
- (for @.old
- (<old_extension> subject parameter)
-
- @.jvm
- ("jvm object cast"
- (<new_extension> ("jvm object cast" parameter)
- ("jvm object cast" subject))))))])
+(def: int+long/2
+ (template (_ <old_extension> <new_extension>)
+ [(is (-> java/lang/Integer java/lang/Long java/lang/Long)
+ (function (_ parameter subject)
+ (for @.old
+ (<old_extension> subject parameter)
+
+ @.jvm
+ ("jvm object cast"
+ (<new_extension> ("jvm object cast" parameter)
+ ("jvm object cast" subject))))))]))
(def: int
Test
@@ -1056,14 +1058,15 @@
$Long::wrap))))
)))
-(template: (!::= <type> <old> <new>)
- [(is (-> <type> Any Bit)
- (function (_ expected)
- (for @.old
- (|>> (as <type>) (<old> expected))
-
- @.jvm
- (|>> (as <type>) "jvm object cast" (<new> ("jvm object cast" (as <type> expected)))))))])
+(def: !::=
+ (template (_ <type> <old> <new>)
+ [(is (-> <type> Any Bit)
+ (function (_ expected)
+ (for @.old
+ (|>> (as <type>) (<old> expected))
+
+ @.jvm
+ (|>> (as <type>) "jvm object cast" (<new> ("jvm object cast" (as <type> expected)))))))]))
(def: conversion
Test
diff --git a/stdlib/source/test/lux/target/lua.lux b/stdlib/source/test/lux/target/lua.lux
index 38babfca6..fc3c1ac13 100644
--- a/stdlib/source/test/lux/target/lua.lux
+++ b/stdlib/source/test/lux/target/lua.lux
@@ -79,7 +79,7 @@
[left random.bit
right random.bit]
(`` (all _.and
- (~~ (template [</> <lux>]
+ (~~ (with_template [</> <lux>]
[(_.coverage [</>]
(let [expected (<lux> left right)]
(expression (|>> (as Bit) (bit#= expected))
@@ -93,7 +93,7 @@
(/.not (/.boolean left))))
))))
-(template [<bits>]
+(with_template [<bits>]
[(`` (def: (~~ (template.symbol [int_ <bits>]))
(Random Int)
(let [mask (|> 1 (i64.left_shifted (-- <bits>)) --)]
@@ -114,7 +114,7 @@
random.int)
subject random.int]
(`` (all _.and
- (~~ (template [</> <lux>]
+ (~~ (with_template [</> <lux>]
[(_.coverage [</>]
(let [expected (<lux> left right)]
(expression (|>> (as Int) (i.= expected))
@@ -153,7 +153,7 @@
random.safe_frac)
subject random.safe_frac]
(`` (all _.and
- (~~ (template [</> <lux> <pre>]
+ (~~ (with_template [</> <lux> <pre>]
[(_.coverage [</>]
(let [expected (<lux> (<pre> parameter) (<pre> subject))]
(expression (|>> (as Frac) (f.= expected))
@@ -166,7 +166,7 @@
[/.% f.mod |>]
[/.^ f.pow f.abs]
))
- (~~ (template [</> <lux>]
+ (~~ (with_template [</> <lux>]
[(_.coverage [</>]
(let [expected (<lux> parameter subject)]
(expression (|>> (as Bit) (bit#= expected))
diff --git a/stdlib/source/test/lux/target/python.lux b/stdlib/source/test/lux/target/python.lux
index 56e946bd5..c49cc117f 100644
--- a/stdlib/source/test/lux/target/python.lux
+++ b/stdlib/source/test/lux/target/python.lux
@@ -86,7 +86,7 @@
[left random.bit
right random.bit]
(`` (all _.and
- (~~ (template [</> <lux>]
+ (~~ (with_template [</> <lux>]
[(_.coverage [</>]
(let [expected (<lux> left right)]
(expression (|>> (as Bit) (bit#= expected))
@@ -107,7 +107,7 @@
random.safe_frac)
subject random.safe_frac]
(`` (all _.and
- (~~ (template [</> <lux> <pre>]
+ (~~ (with_template [</> <lux> <pre>]
[(_.coverage [</>]
(let [expected (<lux> (<pre> parameter) (<pre> subject))]
(expression (|>> (as Frac) (f.= expected))
@@ -120,7 +120,7 @@
[/.% f.mod |>]
[/.** f.pow f.abs]
))
- (~~ (template [</> <lux>]
+ (~~ (with_template [</> <lux>]
[(_.coverage [</>]
(let [expected (<lux> parameter subject)]
(expression (|>> (as Bit) (bit#= expected))
@@ -160,7 +160,7 @@
i16 (at ! each ..int_16 random.int)
shift (at ! each (n.% 16) random.nat)]
(`` (all _.and
- (~~ (template [</> <lux>]
+ (~~ (with_template [</> <lux>]
[(_.coverage [</>]
(let [expected (<lux> left right)]
(expression (|>> (as Frac) f.int (i.= expected))
@@ -170,7 +170,7 @@
[/.bit_xor i64.xor]
[/.bit_and i64.and]
))
- (~~ (template [</> <lux>]
+ (~~ (with_template [</> <lux>]
[(_.coverage [</>]
(let [left (.int shift)
right (i.* (.int shift) i16)
@@ -451,7 +451,7 @@
field (at ! each /.string (random.upper_case 1))]
(all _.and
(_.coverage [/.item]
- (`` (and (~~ (template [<seq>]
+ (`` (and (~~ (with_template [<seq>]
[(expression (|>> (as Frac) (f.= expected/0))
(/.item (/.int +0)
(<seq> (list (/.float expected/0)))))]
@@ -500,7 +500,7 @@
(as Frac)
(f.= expected/0)))
(_.coverage [/.multi]
- (`` (and (~~ (template [<var> <value>]
+ (`` (and (~~ (with_template [<var> <value>]
[(|> (..statement
(function (_ $output)
(all /.then
diff --git a/stdlib/source/test/lux/target/ruby.lux b/stdlib/source/test/lux/target/ruby.lux
index 62639b7d5..ab5a871ab 100644
--- a/stdlib/source/test/lux/target/ruby.lux
+++ b/stdlib/source/test/lux/target/ruby.lux
@@ -90,7 +90,7 @@
[left random.bit
right random.bit]
(`` (all _.and
- (~~ (template [</> <lux>]
+ (~~ (with_template [</> <lux>]
[(_.coverage [</>]
(let [expected (<lux> left right)]
(expression (|>> (as Bit) (bit#= expected))
@@ -111,7 +111,7 @@
random.safe_frac)
subject random.safe_frac]
(`` (all _.and
- (~~ (template [</> <lux> <pre>]
+ (~~ (with_template [</> <lux> <pre>]
[(_.coverage [</>]
(let [expected (<lux> (<pre> parameter) (<pre> subject))]
(expression (|>> (as Frac) (f.= expected))
@@ -124,7 +124,7 @@
[/.% f.mod |>]
[/.pow f.pow f.abs]
))
- (~~ (template [</> <lux>]
+ (~~ (with_template [</> <lux>]
[(_.coverage [</>]
(let [expected (<lux> parameter subject)]
(expression (|>> (as Bit) (bit#= expected))
@@ -151,7 +151,7 @@
i16 (at ! each ..int_16 random.int)
shift (at ! each (n.% 16) random.nat)]
(`` (all _.and
- (~~ (template [</> <lux>]
+ (~~ (with_template [</> <lux>]
[(_.coverage [</>]
(let [expected (<lux> left right)]
(expression (|>> (as Frac) f.int (i.= expected))
diff --git a/stdlib/source/test/lux/time.lux b/stdlib/source/test/lux/time.lux
index 5fe4af48e..a054a8990 100644
--- a/stdlib/source/test/lux/time.lux
+++ b/stdlib/source/test/lux/time.lux
@@ -68,7 +68,7 @@
invalid_minute (|> valid_minute (n.+ /.minutes) (n.min 99))
invalid_second (|> valid_second (n.+ /.seconds) (n.min 99))]]
(`` (all _.and
- (~~ (template [<cap> <exception> <prefix> <suffix> <valid> <invalid>]
+ (~~ (with_template [<cap> <exception> <prefix> <suffix> <valid> <invalid>]
[(_.coverage [<cap> <exception>]
(let [valid!
(|> <valid>
diff --git a/stdlib/source/test/lux/time/duration.lux b/stdlib/source/test/lux/time/duration.lux
index 4abe6f2e6..2d4847d29 100644
--- a/stdlib/source/test/lux/time/duration.lux
+++ b/stdlib/source/test/lux/time/duration.lux
@@ -83,7 +83,7 @@
(i.= +1 (/.ticks sample sample)))
(_.coverage [/.milli_second]
(#= /.empty (at /.enum pred /.milli_second)))
- (~~ (template [<factor> <big> <small>]
+ (~~ (with_template [<factor> <big> <small>]
[(_.coverage [<big>]
(|> <big> (/.ticks <small>) (i.= <factor>)))]
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux
index c8d3a3c6d..407833523 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux
@@ -116,7 +116,7 @@
_
false))
- (~~ (template [<tag> <expected>]
+ (~~ (with_template [<tag> <expected>]
[(_.coverage [<tag>]
(case (<tag> <expected>)
(pattern (<tag> actual))
@@ -170,7 +170,7 @@
expected_constant (/symbol.random 1 1)
expected_variable /variable.random]
(`` (all _.and
- (~~ (template [<tag> <expected>]
+ (~~ (with_template [<tag> <expected>]
[(_.coverage [<tag>]
(case (<tag> <expected>)
(pattern (<tag> actual))
@@ -186,13 +186,14 @@
))
))))
-(template: (tagged? <tag> <it>)
- [(case <it>
- {<tag> _}
- true
+(def: tagged?
+ (template (_ <tag> <it>)
+ [(case <it>
+ {<tag> _}
+ true
- _
- false)])
+ _
+ false)]))
(def: test|reification
Test
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux
index 21c47404c..14ed1bef3 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux
@@ -84,7 +84,7 @@
[it random.bit]
(in [{/.#Bit it}
{//pattern.#Simple {//simple.#Bit it}}]))
- (~~ (template [<random> <hash> <coverage> <pattern>]
+ (~~ (with_template [<random> <hash> <coverage> <pattern>]
[(do random.monad
[it <random>]
(in [{<coverage> (set.of_list <hash> (list it))}
@@ -266,7 +266,7 @@
(/.composite {/.#Exhaustive})
(try#each (/#= {/.#Exhaustive}))
(try.else false))
- (~~ (template [<tag> <hash> <value> <next>]
+ (~~ (with_template [<tag> <hash> <value> <next>]
[(|> (/.composite {<tag> (set.of_list <hash> (list <value>))}
{<tag> (set.of_list <hash> (list (|> <value> <next>)))})
(try#each (/#= {<tag> (set.of_list <hash> (list <value> (|> <value> <next>)))}))
@@ -416,7 +416,7 @@
(_.coverage [/.redundancy]
(let [redundant? (..failure? /.redundancy)]
(`` (and (redundant? (/.composite {/.#Exhaustive} {/.#Exhaustive}))
- (~~ (template [<it>]
+ (~~ (with_template [<it>]
[(redundant? (/.composite <it> <it>))
(redundant? (/.composite <it> {/.#Exhaustive}))]
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux
index 86c9c3409..6b7c63309 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux
@@ -84,7 +84,7 @@
(def: .public simple_parameter
(Random [Type Code])
(`` (all random.either
- (~~ (template [<type> <random> <code>]
+ (~~ (with_template [<type> <random> <code>]
[(random#each (|>> <code> [<type>]) <random>)]
[.Bit random.bit code.bit]
@@ -270,7 +270,7 @@
(not (variant? (type (Maybe type/0)) 0 #1 term/1)))
only_bottom_conforms_to_tags_outside_of_range!
- (`` (and (~~ (template [<verdict> <term>]
+ (`` (and (~~ (with_template [<verdict> <term>]
[(bit#= <verdict> (variant? variantT arity arbitrary_right? <term>))]
[#0 term/0]
@@ -293,7 +293,7 @@
0 #0 (' []))
existential_types_affect_dependent_cases!
- (`` (and (~~ (template [<verdict> <term>]
+ (`` (and (~~ (with_template [<verdict> <term>]
[(bit#= <verdict> (variant?' (type (Ex (_ a) (Maybe a))) {.#None} 0 #1 <term>))]
[#0 term/0]
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux
index 9f641f906..d81170a17 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux
@@ -94,7 +94,7 @@
(try#each (..new? hash))
(try.else false)))
(_.coverage [/.import]
- (`` (and (~~ (template [<expected>]
+ (`` (and (~~ (with_template [<expected>]
[(|> (do [! /phase.monad]
[_ (/.create hash expected_import)
[it ?] (/.with hash name
@@ -140,7 +140,7 @@
name (random.lower_case 1)
hash random.nat]
(`` (all _.and
- (~~ (template [<set> <query> <not/0> <not/1>]
+ (~~ (with_template [<set> <query> <not/0> <not/1>]
[(_.coverage [<set> <query>]
(|> (do [! /phase.monad]
[[it ?] (/.with hash name
@@ -159,7 +159,7 @@
[/.set_cached /.cached? /.active? /.compiled?]
))
(_.coverage [/.can_only_change_state_of_active_module]
- (and (~~ (template [<pre> <post>]
+ (and (~~ (with_template [<pre> <post>]
[(|> (/.with hash name
(do /phase.monad
[_ (<pre> name)]
@@ -180,7 +180,7 @@
[/.set_cached /.set_cached]
))))
(_.coverage [/.unknown_module]
- (and (~~ (template [<set>]
+ (and (~~ (with_template [<set>]
[(|> (<set> name)
(/phase.result state)
(pipe.case
@@ -220,7 +220,7 @@
alias {.#Alias [module_name def_name]}]]
(all _.and
(_.coverage [/.define]
- (`` (and (~~ (template [<global>]
+ (`` (and (~~ (with_template [<global>]
[(|> (/.with hash module_name
(/.define def_name <global>))
(/phase.result state)
@@ -242,7 +242,7 @@
{try.#Success _} true
{try.#Failure _} false)))))
(_.coverage [/.cannot_define_more_than_once]
- (`` (and (~~ (template [<global>]
+ (`` (and (~~ (with_template [<global>]
[(|> (/.with hash module_name
(do /phase.monad
[_ (/.define def_name <global>)]
@@ -289,7 +289,7 @@
(at ! each set.list))]
(all _.and
(_.coverage [/.declare_labels]
- (`` (and (~~ (template [<side> <record?> <query> <on_success>]
+ (`` (and (~~ (with_template [<side> <record?> <query> <on_success>]
[(|> (/.with hash module_name
(do [! /phase.monad]
[.let [it {.#Named [module_name def_name] def_type}]
@@ -307,7 +307,7 @@
[.#Right true meta.slot true]
[.#Right true meta.tag false])))))
(_.coverage [/.cannot_declare_labels_for_anonymous_type]
- (`` (and (~~ (template [<side> <record?>]
+ (`` (and (~~ (with_template [<side> <record?>]
[(|> (/.with hash module_name
(do [! /phase.monad]
[.let [it def_type]
@@ -324,7 +324,7 @@
[.#Left false]
[.#Right true])))))
(_.coverage [/.cannot_declare_labels_for_foreign_type]
- (`` (and (~~ (template [<side> <record?>]
+ (`` (and (~~ (with_template [<side> <record?>]
[(|> (/.with hash module_name
(do [! /phase.monad]
[.let [it {.#Named [foreign_module def_name] def_type}]
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux
index b45859c4f..8c3636a55 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux
@@ -61,7 +61,7 @@
_
false))
- (~~ (template [<tag> <value>]
+ (~~ (with_template [<tag> <value>]
[(_.coverage [<tag>]
(case (<tag> <value>)
(pattern (<tag> actual))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/scope.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/scope.lux
index 8a4730a35..584eb63b2 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/scope.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/scope.lux
@@ -32,7 +32,7 @@
["$[0]" //
["[1][0]" type]])
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: (<name> expected_type expected_register [actual_type actual_var])
(-> Type Register [Type Variable] Bit)
(and (same? expected_type actual_type)
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux
index 16e9fa6c6..6cc3dd37a 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux
@@ -79,7 +79,7 @@
(-> Lux Text [.Bit .Nat .Int .Rev .Frac .Text] Bit)
(let [state [extension.#bundle (extension/analysis.bundle ..eval)
extension.#state lux]]
- (`` (and (~~ (template [<expected> <code> <type> <analysis>]
+ (`` (and (~~ (with_template [<expected> <code> <type> <analysis>]
[(|> (do phase.monad
[[:it: it] (|> <expected>
<code>
@@ -138,7 +138,7 @@
(phase#each (|>> product.right product.right))
(phase.result state)
(try.else false))
- (~~ (template [<lefts> <right> <expected> <tag> <code> <analysis>]
+ (~~ (with_template [<lefts> <right> <expected> <tag> <code> <analysis>]
[(|> (do phase.monad
[it (|> (code.variant (list (code.nat <lefts>) (code.bit <right>) (<code> <expected>)))
(/.phase ..expander archive.empty)
@@ -252,7 +252,7 @@
(phase#each (|>> product.right product.right))
(phase.result state)
(try.else false))
- (~~ (template [<lefts> <right> <expected> <tag> <code> <analysis>]
+ (~~ (with_template [<lefts> <right> <expected> <tag> <code> <analysis>]
[(|> (do phase.monad
[_ (//module.declare_labels false tags/* false :variant:)
[:it: it] (|> (code.variant (list (code.local <tag>) (<code> <expected>)))
@@ -668,7 +668,7 @@
slots/* (list @any @bit @nat @int @rev @frac @text)
simple!
- (`` (and (~~ (template [<input> <code> <analysis> <pattern>]
+ (`` (and (~~ (with_template [<input> <code> <analysis> <pattern>]
[(|> (do phase.monad
[[:it: it] (|> (` ({(~ $parameter/0) (~ (code.frac frac/0))} (~ (<code> <input>))))
(/.phase ..expander archive.empty)
@@ -755,7 +755,7 @@
(try.else false))
variant!
- (`` (and (~~ (template [<lefts> <right?> <expected> <tag> <code> <analysis> <pattern>]
+ (`` (and (~~ (with_template [<lefts> <right?> <expected> <tag> <code> <analysis> <pattern>]
[(|> (do phase.monad
[_ (//module.declare_labels false tags/* false :variant:)
[:it: it] (|> (` ({{(~ (code.local <tag>)) (~ (<code> <expected>))}
@@ -935,7 +935,7 @@
(..can_analyse_pattern_matching! lux module/0 [@any @bit @nat @int @rev @frac @text] [bit/0 nat/0 int/0 rev/0 frac/0 text/0] $parameter/0)
))
(_.coverage [/.invalid]
- (`` (and (~~ (template [<syntax>]
+ (`` (and (~~ (with_template [<syntax>]
[(|> (do phase.monad
[_ (|> <syntax>
(/.phase ..expander archive.empty)
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux
index c991c5850..aecf1d14b 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux
@@ -90,7 +90,7 @@
(def: simple_parameter
(Random [Type Code])
(`` (all random.either
- (~~ (template [<type> <random> <code>]
+ (~~ (with_template [<type> <random> <code>]
[(random#each (|>> <code> [<type>]) <random>)]
[.Bit random.bit code.bit]
@@ -115,7 +115,7 @@
(analysed? expected actual))
(list.zipped_2 expected actual)))
- (^.template [<expected> <actual>]
+ (^.with_template [<expected> <actual>]
[(pattern [[_ {<expected> expected}] (<actual> actual)])
(same? expected actual)])
([.#Bit //analysis.bit]
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux
index 66d8d5833..03a9dc1e6 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux
@@ -66,15 +66,16 @@
_
false))))
-(template: (analysis? <type> <tag>)
- [(is (-> <type> Analysis Bit)
- (function (_ expected)
- (|>> (pipe.case
- (pattern (<tag> actual))
- (same? expected actual)
+(def: analysis?
+ (template (_ <type> <tag>)
+ [(is (-> <type> Analysis Bit)
+ (function (_ expected)
+ (|>> (pipe.case
+ (pattern (<tag> actual))
+ (same? expected actual)
- _
- false))))])
+ _
+ false))))]))
(def: .public test
(<| (_.covering /._)
@@ -88,7 +89,7 @@
(_.coverage [/.unit]
(..analysis state module .Any /.unit
(|>> (pipe.case (pattern (/analysis.unit)) true _ false))))
- (~~ (template [<analysis> <type> <random> <tag>]
+ (~~ (with_template [<analysis> <type> <random> <tag>]
[(do !
[sample <random>]
(_.coverage [<analysis>]
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux
index b2e9131ca..0123bd0bc 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux
@@ -33,7 +33,7 @@
[meta
["[0]" archive]]]]]])
-(template [<name> <success> <failure>]
+(with_template [<name> <success> <failure>]
[(def: (<name> procedure params output_type)
(-> Text (List Code) Type Bit)
(|> (////scope.with_scope ""
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 11cadf681..4a79735c7 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
@@ -195,7 +195,7 @@
_
(undefined))))))
-(template [<name> <hash> <random> <path> <synthesis> <pattern> <analysis>]
+(with_template [<name> <hash> <random> <path> <synthesis> <pattern> <analysis>]
[(def: <name>
(Random [Path Match])
(do [! random.monad]
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 9ec225645..9dae4cabc 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
@@ -63,13 +63,14 @@
body
(list.reversed (list.indices arity))))
-(template: (!expect <pattern> <value>)
- (case <value>
- <pattern>
- true
-
- _
- false))
+(def: !expect
+ (template (_ <pattern> <value>)
+ (case <value>
+ <pattern>
+ true
+
+ _
+ false)))
(type: Circumstance
(Record
@@ -87,7 +88,7 @@
(synthesis.text synthesis.unit)
(analysis.unit)]))
-(template [<name> <random> <synthesis> <analysis>]
+(with_template [<name> <random> <synthesis> <analysis>]
[(def: (<name> output?)
Scenario
(do [! random.monad]
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
index 6c17b1883..c123d5ef7 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
@@ -29,7 +29,7 @@
(def: (primitive offset arity next)
(Scenario Synthesis)
(`` (all random.either
- (~~ (template [<synthesis> <random>]
+ (~~ (with_template [<synthesis> <random>]
[(do [! random.monad]
[example (at ! each (|>> <synthesis>) <random>)]
(in [next
@@ -72,7 +72,7 @@
(def: (reference offset arity next)
(Scenario Synthesis)
(`` (all random.either
- (~~ (template [<tag> <random>]
+ (~~ (with_template [<tag> <random>]
[(do [! random.monad]
[[next [exampleE exampleA]] (<random> offset arity next)]
(in [next
@@ -115,7 +115,7 @@
(random#in [next
[//.path/pop
//.path/pop]])
- (~~ (template [<path> <random>]
+ (~~ (with_template [<path> <random>]
[(do [! random.monad]
[example (at ! each (|>> <path>) <random>)]
(in [next
@@ -127,7 +127,7 @@
[//.path/f64 random.frac]
[//.path/text (random.unicode 1)]
))
- (~~ (template [<path>]
+ (~~ (with_template [<path>]
[(do [! random.monad]
[example (at ! each (|>> <path>)
(random.or random.nat
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux
index 3e6cdda9c..fc6758d5a 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux
@@ -45,7 +45,7 @@
(def: .public (corresponds? analysis synthesis)
(-> Analysis Synthesis Bit)
(`` (case [analysis synthesis]
- (~~ (template [<analysis> <post_analysis> <synthesis> <post_synthesis>]
+ (~~ (with_template [<analysis> <post_analysis> <synthesis> <post_synthesis>]
[[{////analysis.#Primitive {<analysis> expected}}
{////synthesis.#Primitive {<synthesis> actual}}]
(same? (|> expected <post_analysis>)
@@ -75,7 +75,7 @@
Test
(<| (_.context (%.symbol (symbol ////synthesis.#Primitive)))
(`` (all _.and
- (~~ (template [<analysis> <synthesis> <generator>]
+ (~~ (with_template [<analysis> <synthesis> <generator>]
[(do r.monad
[expected <generator>]
(_.property (%.symbol (symbol <synthesis>))
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 4f3d1de26..8d284b15f 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
@@ -27,13 +27,14 @@
[reference
["[0]" variable]]]]]])
-(template: (!expect <pattern> <value>)
- (case <value>
- <pattern>
- true
-
- _
- false))
+(def: !expect
+ (template (_ <pattern> <value>)
+ (case <value>
+ <pattern>
+ true
+
+ _
+ false)))
(type: Context
[#redundants Nat
@@ -42,7 +43,7 @@
(type: (Scenario a)
(-> Context (Random [a a])))
-(template [<name> <synthesis> <random>]
+(with_template [<name> <synthesis> <random>]
[(def: (<name> context)
(Scenario Synthesis)
(do [! random.monad]
@@ -178,7 +179,7 @@
{synthesis.#Seq {synthesis.#Pop}
{synthesis.#Then actual_then}}}])))
(all random.either
- (~~ (template [<tag> <random>]
+ (~~ (with_template [<tag> <random>]
[(do [! random.monad]
[test <random>
[expected_then actual_then] (scenario context)]
diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux
index 8fa2fc9e6..ec53d9f99 100644
--- a/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux
+++ b/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux
@@ -29,13 +29,14 @@
["[0]" artifact (.only)
["[0]" category]]]]])
-(template: (tagged? <tag> <it>)
- [(case <it>
- {<tag> _}
- true
-
- _
- false)])
+(def: tagged?
+ (template (_ <tag> <it>)
+ [(case <it>
+ {<tag> _}
+ true
+
+ _
+ false)]))
(def: random_dependency
(Random unit.ID)
@@ -78,7 +79,7 @@
_
false)))
- (~~ (template [<new> <expected>' <query> <tag> <wrong_new> <wrong_expected>']
+ (~~ (with_template [<new> <expected>' <query> <tag> <wrong_new> <wrong_expected>']
[(_.coverage [<new> <query>]
(let [<expected> <expected>'
<wrong_expected> <wrong_expected>']
@@ -119,7 +120,7 @@
[/.custom expected_name /.customs category.#Custom /.definition (is category.Definition [expected_name {.#None}])]
))
(_.coverage [/.id]
- (and (~~ (template [<new> <expected>' <name>]
+ (and (~~ (with_template [<new> <expected>' <name>]
[(let [<expected> <expected>'
[@expected registry] (<new> <expected> mandatory? expected_dependencies /.empty)]
(|> (/.id (<name> <expected>) registry)
@@ -134,7 +135,7 @@
[/.custom expected_name |>]
))))
(_.coverage [/.artifacts]
- (and (~~ (template [<new> <query> <equivalence> <$>]
+ (and (~~ (with_template [<new> <query> <equivalence> <$>]
[(let [expected/* (list#each <$> expected_names)
[ids registry] (is [(Sequence artifact.ID) /.Registry]
(list#mix (function (_ expected [ids registry])
@@ -159,7 +160,7 @@
[/.custom /.customs text.equivalence (|>>)]
))))
(_.coverage [/.writer /.parser]
- (and (~~ (template [<new> <expected>' <name>]
+ (and (~~ (with_template [<new> <expected>' <name>]
[(let [<expected> <expected>'
[@expected before] (<new> <expected> mandatory? expected_dependencies /.empty)]
(|> before
diff --git a/stdlib/source/test/lux/tool/compiler/meta/cache/module.lux b/stdlib/source/test/lux/tool/compiler/meta/cache/module.lux
index 3975036e0..30dd30486 100644
--- a/stdlib/source/test/lux/tool/compiler/meta/cache/module.lux
+++ b/stdlib/source/test/lux/tool/compiler/meta/cache/module.lux
@@ -21,7 +21,7 @@
(`` (implementation: (bad it)
(-> (file.System Async) (file.System Async))
- (~~ (template [<name>]
+ (~~ (with_template [<name>]
[(def: <name>
(at it <name>))]
diff --git a/stdlib/source/test/lux/tool/compiler/meta/cli.lux b/stdlib/source/test/lux/tool/compiler/meta/cli.lux
index cc1951950..9617831ab 100644
--- a/stdlib/source/test/lux/tool/compiler/meta/cli.lux
+++ b/stdlib/source/test/lux/tool/compiler/meta/cli.lux
@@ -55,7 +55,7 @@
(all _.and
(_.for [/.Compilation]
(`` (all _.and
- (~~ (template [<type> <slot> <?>]
+ (~~ (with_template [<type> <slot> <?>]
[(_.coverage [<type>]
(|> (partial_list "build" compilation')
(<cli>.result /.service)
@@ -79,7 +79,7 @@
))
)))
(_.coverage [/.Interpretation]
- (`` (and (~~ (template [<slot> <?>]
+ (`` (and (~~ (with_template [<slot> <?>]
[(|> (partial_list "repl" compilation')
(<cli>.result /.service)
(try#each (|>> (pipe.case
@@ -101,7 +101,7 @@
[/.#configuration (configuration#= configuration)]
)))))
(_.coverage [/.Export]
- (`` (and (~~ (template [<side> <?>]
+ (`` (and (~~ (with_template [<side> <?>]
[(|> (partial_list "export" export)
(<cli>.result /.service)
(try#each (|>> (pipe.case
@@ -118,7 +118,7 @@
[product.right (same? target)]
)))))
(_.coverage [/.target]
- (`` (and (~~ (template [<it>]
+ (`` (and (~~ (with_template [<it>]
[(same? target (/.target <it>))]
[{/.#Compilation [/.#host_dependencies host_dependencies
diff --git a/stdlib/source/test/lux/tool/compiler/meta/context.lux b/stdlib/source/test/lux/tool/compiler/meta/context.lux
index 9c993c22a..41c2adf26 100644
--- a/stdlib/source/test/lux/tool/compiler/meta/context.lux
+++ b/stdlib/source/test/lux/tool/compiler/meta/context.lux
@@ -41,7 +41,7 @@
(/.python target)
(/.ruby target))
maximum (list.size contexts)]
- (`` (and (~~ (template [<amount> <slot>]
+ (`` (and (~~ (with_template [<amount> <slot>]
[(|> contexts
(list#each (the <slot>))
(set.of_list text.hash)
diff --git a/stdlib/source/test/lux/tool/compiler/reference.lux b/stdlib/source/test/lux/tool/compiler/reference.lux
index 183e872ff..1991765de 100644
--- a/stdlib/source/test/lux/tool/compiler/reference.lux
+++ b/stdlib/source/test/lux/tool/compiler/reference.lux
@@ -49,7 +49,7 @@
(_.for [/.hash]
($hash.spec /.hash ..random))
- (~~ (template [<tag>]
+ (~~ (with_template [<tag>]
[(_.coverage [<tag>]
(case (<tag> expected_register)
(pattern (<tag> actual_register))
diff --git a/stdlib/source/test/lux/tool/compiler/version.lux b/stdlib/source/test/lux/tool/compiler/version.lux
index cd3bf39ee..88cb62e09 100644
--- a/stdlib/source/test/lux/tool/compiler/version.lux
+++ b/stdlib/source/test/lux/tool/compiler/version.lux
@@ -30,7 +30,7 @@
(_.coverage [/.format]
(bit#= (n.= this that)
(text#= (/.format this) (/.format that))))
- (~~ (template [<level>]
+ (~~ (with_template [<level>]
[(_.coverage [<level>]
(text.contains? (%.nat (<level> this))
(/.format this)))]
diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux
index 6279c98ac..299da6fc7 100644
--- a/stdlib/source/test/lux/type.lux
+++ b/stdlib/source/test/lux/type.lux
@@ -108,7 +108,7 @@
.let [(open "/#[0]") /.equivalence
(open "list#[0]") (list.equivalence /.equivalence)]]
(`` (all _.and
- (~~ (template [<ctor> <dtor> <unit>]
+ (~~ (with_template [<ctor> <dtor> <unit>]
[(_.coverage [<ctor> <dtor>]
(let [flat (|> members <ctor> <dtor>)]
(or (list#= members flat)
@@ -161,7 +161,7 @@
#1))))
.let [(open "/#[0]") /.equivalence]]
(`` (all _.and
- (~~ (template [<ctor> <dtor>]
+ (~~ (with_template [<ctor> <dtor>]
[(_.coverage [<ctor> <dtor>]
(let [[flat_size flat_body] (|> body_type (<ctor> size) <dtor>)]
(and (n.= size flat_size)
diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux
index 292cb35c1..31c2efd14 100644
--- a/stdlib/source/test/lux/type/check.lux
+++ b/stdlib/source/test/lux/type/check.lux
@@ -79,7 +79,7 @@
{.#Ex id}
#1
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
(and (valid_type? left)
(valid_type? right))])
@@ -419,7 +419,7 @@
parameters_matter!
covariant_parameters!)))
-(template [<assertion> <combinator>]
+(with_template [<assertion> <combinator>]
[(def: (<assertion> name/0 name/1)
(-> Text Text Bit)
(let [pair/0 {<combinator> {.#Primitive name/0 (list)} {.#Primitive name/0 (list)}}
@@ -695,7 +695,7 @@
anonymousT dirty_type]
(in (function (_ holeT)
{.#Named [module short] (anonymousT holeT)})))
- (~~ (template [<tag>]
+ (~~ (with_template [<tag>]
[(do random.monad
[leftT dirty_type
rightT dirty_type]
@@ -712,7 +712,7 @@
parameterT dirty_type]
(in (function (_ holeT)
{.#Primitive name (list (parameterT holeT))})))
- (~~ (template [<tag>]
+ (~~ (with_template [<tag>]
[(do [! random.monad]
[funcT dirty_type
argT dirty_type
@@ -820,7 +820,7 @@
{.#Function left right}))
))))
-(template [<tag> <name>]
+(with_template [<tag> <name>]
[(def: <name>
(Random Bit)
(do random.monad
diff --git a/stdlib/source/test/lux/type/primitive.lux b/stdlib/source/test/lux/type/primitive.lux
index 8ef01f41f..dd544ceb8 100644
--- a/stdlib/source/test/lux/type/primitive.lux
+++ b/stdlib/source/test/lux/type/primitive.lux
@@ -24,7 +24,7 @@
["[0]" /]])
(template.with_locals [g!Foo g!Bar]
- (these (template [<syntax> <meta>]
+ (these (with_template [<syntax> <meta>]
[(def: <syntax>
(syntax (_ [])
(do meta.monad
diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux
index 3de50b8a7..2182c600e 100644
--- a/stdlib/source/test/lux/type/resource.lux
+++ b/stdlib/source/test/lux/type/resource.lux
@@ -34,7 +34,7 @@
.let [! identity.monad]]
(_.for [/.Linear /.run! /.monad]
(`` (all _.and
- (~~ (template [<coverage> <bindings>]
+ (~~ (with_template [<coverage> <bindings>]
[(_.coverage <coverage>
(<| (text#= (format pre post))
(is (Identity Text))
@@ -76,7 +76,7 @@
.let [! io.monad]]
(_.for [/.Linear /.run! /.monad]
(`` (all _.and
- (~~ (template [<coverage> <bindings>]
+ (~~ (with_template [<coverage> <bindings>]
[(_.coverage <coverage>
(<| (text#= (format pre post))
io.run!
@@ -119,7 +119,7 @@
.let [! async.monad]]
(_.for [/.Linear /.run! /.monad]
(`` (all _.and
- (~~ (template [<coverage> <bindings>]
+ (~~ (with_template [<coverage> <bindings>]
[(in (monad.do !
[outcome (<| (is (Async Text))
(/.run! !)
@@ -179,7 +179,7 @@
..async
(_.coverage [/.amount_cannot_be_zero]
- (`` (and (~~ (template [<group|un_group>]
+ (`` (and (~~ (with_template [<group|un_group>]
[(with_error /.amount_cannot_be_zero
(<group|un_group> 0))]
diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux
index edf3fe6bd..1006d9dbb 100644
--- a/stdlib/source/test/lux/type/unit.lux
+++ b/stdlib/source/test/lux/type/unit.lux
@@ -22,7 +22,7 @@
[\\library
["[0]" /]])
-(template [<name> <type> <unit>]
+(with_template [<name> <type> <unit>]
[(def: (<name> range)
(-> Nat (Random (/.Qty <type>)))
(|> random.int
@@ -53,7 +53,7 @@
[expected random.int]
(_.for [/.Unit]
(`` (all _.and
- (~~ (template [<type> <unit>]
+ (~~ (with_template [<type> <unit>]
[(_.coverage [<type> <unit>]
(|> expected
(at <unit> in)
@@ -110,7 +110,7 @@
(at ! each (at /.meter in)))]
(_.for [/.Scale]
(`` (all _.and
- (~~ (template [<type> <scale>]
+ (~~ (with_template [<type> <scale>]
[(_.coverage [<type> <scale>]
(|> large
(at <scale> scale)
@@ -123,7 +123,7 @@
[/.Mega /.mega]
[/.Giga /.giga]
))
- (~~ (template [<type> <scale>]
+ (~~ (with_template [<type> <scale>]
[(_.coverage [<type> <scale>]
(|> small
(at <scale> scale)
@@ -163,7 +163,7 @@
right (..meter 1,000)
extra (..second 1,000)]
(`` (all _.and
- (~~ (template [<q> <i>]
+ (~~ (with_template [<q> <i>]
[(_.coverage [<q>]
(i.= (<i> (at /.meter out left) (at /.meter out right))
(at /.meter out (<q> left right))))]
diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux
index 4e9db7301..6d3daa301 100644
--- a/stdlib/source/test/lux/world/input/keyboard.lux
+++ b/stdlib/source/test/lux/world/input/keyboard.lux
@@ -112,7 +112,7 @@
/.f24]])]
(def: listing
(List /.Key)
- (list.together (`` (list (~~ (template [<definition> <keys>]
+ (list.together (`` (list (~~ (with_template [<definition> <keys>]
[((is (-> Any (List /.Key))
(function (_ _)
(`` (list (~~ (template.spliced <keys>))))))
@@ -128,7 +128,7 @@
(n.= (list.size ..listing)
(set.size ..catalogue)))
- (template [<definition> <keys>]
+ (with_template [<definition> <keys>]
[(def: <definition>
Test
(_.coverage <keys>
@@ -148,14 +148,14 @@
(<| (_.covering /._)
(_.for [/.Key])
(`` (all _.and
- (~~ (template [<definition> <keys>]
+ (~~ (with_template [<definition> <keys>]
[<definition>]
<groups>))
(_.for [/.Press]
(`` (all _.and
- (~~ (template [<pressed?> <function>]
+ (~~ (with_template [<pressed?> <function>]
[(do random.monad
[key ..random
.let [sample (<function> key)]]
diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux
index 380e3a257..4123cf264 100644
--- a/stdlib/source/test/lux/world/net/http/client.lux
+++ b/stdlib/source/test/lux/world/net/http/client.lux
@@ -98,7 +98,7 @@
[/.options on_options]
[/.trace on_trace])]
(`` (all _.and
- (~~ (template [<definition> <expected>]
+ (~~ (with_template [<definition> <expected>]
[(_.coverage [<definition>]
(|> (<definition> "" //.empty {.#None} mock)
(verification io.monad <expected>)
@@ -114,13 +114,13 @@
dictionary.size)))
(in (do [! async.monad]
[.let [mock (/.async mock)]
- (~~ (template [<definition> <expected>]
+ (~~ (with_template [<definition> <expected>]
[<expected> (|> (<definition> "" //.empty {.#None} mock)
(verification ! <expected>))]
<cases>))]
(_.coverage' [/.async]
- (and (~~ (template [<definition> <expected>]
+ (and (~~ (with_template [<definition> <expected>]
[<expected>]
<cases>))))))
diff --git a/stdlib/source/test/lux/world/net/http/status.lux b/stdlib/source/test/lux/world/net/http/status.lux
index fe1a74690..28789a09a 100644
--- a/stdlib/source/test/lux/world/net/http/status.lux
+++ b/stdlib/source/test/lux/world/net/http/status.lux
@@ -84,7 +84,7 @@
/.network_authentication_required]])]
(def: all
(List //.Status)
- (list.together (`` (list (~~ (template [<category> <status+>]
+ (list.together (`` (list (~~ (with_template [<category> <status+>]
[((is (-> Any (List //.Status))
(function (_ _)
(`` (list (~~ (template.spliced <status+>))))))
@@ -100,7 +100,7 @@
(n.= (list.size ..all)
(set.size ..unique)))
- (template [<category> <status+>]
+ (with_template [<category> <status+>]
[(def: <category>
Test
(_.coverage <status+>
@@ -112,7 +112,7 @@
Test
(<| (_.covering /._)
(`` (.all _.and
- (~~ (template [<category> <status+>]
+ (~~ (with_template [<category> <status+>]
[<category>]
<categories>))
diff --git a/stdlib/source/unsafe/lux/data/binary.lux b/stdlib/source/unsafe/lux/data/binary.lux
index 6f51fde27..1dc9fc96c 100644
--- a/stdlib/source/unsafe/lux/data/binary.lux
+++ b/stdlib/source/unsafe/lux/data/binary.lux
@@ -60,57 +60,59 @@
(`` (with_expansions [<size> (.is .Nat size)
<jvm> (ffi.array byte <size>)
<jvm> (.is ..Binary <jvm>)]
- (template: .public (empty size)
- [(is ..Binary
- (for (~~ (.static @.old)) <jvm>
- (~~ (.static @.jvm)) <jvm>
-
- (~~ (.static @.js))
- (.|> <size>
- .int
- "lux i64 f64"
- []
- ("js object new" ("js constant" "ArrayBuffer"))
- []
- ("js object new" ("js constant" "Uint8Array"))
- (.as ..Binary))
-
- (~~ (.static @.python))
- (.|> <size>
- []
- ("python apply" (.as ffi.Function ("python constant" "bytearray")))
- (.as ..Binary))
-
- (~~ (.static @.scheme))
- (..make-bytevector <size>)
-
- ... Default
- (array.empty <size>)))])))
-
-(`` (with_expansions [<it> (.is ..Binary it)
- <jvm> (ffi.length <it>)]
- (template: .public (size it)
- [(.is .Nat
- (.for (~~ (.static @.old)) <jvm>
+ (def: .public empty
+ (template (empty size)
+ [(is ..Binary
+ (for (~~ (.static @.old)) <jvm>
(~~ (.static @.jvm)) <jvm>
(~~ (.static @.js))
- (.|> <it>
- ("js object get" "length")
- (.as .Frac)
- "lux f64 i64"
- .nat)
+ (.|> <size>
+ .int
+ "lux i64 f64"
+ []
+ ("js object new" ("js constant" "ArrayBuffer"))
+ []
+ ("js object new" ("js constant" "Uint8Array"))
+ (.as ..Binary))
(~~ (.static @.python))
- (.|> <it>
- (.as (array.Array (.I64 .Any)))
- "python array length")
+ (.|> <size>
+ []
+ ("python apply" (.as ffi.Function ("python constant" "bytearray")))
+ (.as ..Binary))
(~~ (.static @.scheme))
- (..bytevector-length [<it>])
+ (..make-bytevector <size>)
... Default
- (array.size <it>)))])))
+ (array.empty <size>)))]))))
+
+(`` (with_expansions [<it> (.is ..Binary it)
+ <jvm> (ffi.length <it>)]
+ (def: .public size
+ (template (size it)
+ [(.is .Nat
+ (.for (~~ (.static @.old)) <jvm>
+ (~~ (.static @.jvm)) <jvm>
+
+ (~~ (.static @.js))
+ (.|> <it>
+ ("js object get" "length")
+ (.as .Frac)
+ "lux f64 i64"
+ .nat)
+
+ (~~ (.static @.python))
+ (.|> <it>
+ (.as (array.Array (.I64 .Any)))
+ "python array length")
+
+ (~~ (.static @.scheme))
+ (..bytevector-length [<it>])
+
+ ... Default
+ (array.size <it>)))]))))
(def: byte_mask
Nat
@@ -124,67 +126,71 @@
<jvm> (.|> <jvm>
(.as .I64)
("lux i64 and" <byte_mask>))]
- (template: .public (bits_8 index it)
- [(.<| (.as .I64)
+ (def: .public bits_8
+ (template (bits_8 index it)
+ [(.<| (.as .I64)
+ (.is (.I64 .Any))
+ (`` (.for (~~ (.static @.old)) (~~ <jvm>)
+ (~~ (.static @.jvm)) (~~ <jvm>)
+
+ (~~ (.static @.js))
+ (.|> <it>
+ (.as (array.Array .Frac))
+ ("js array read" <index>)
+ (.as .Frac)
+ "lux f64 i64"
+ .i64)
+
+ (~~ (.static @.python))
+ (.|> <it>
+ (.as (array.Array .I64))
+ ("python array read" <index>))
+
+ (~~ (.static @.scheme))
+ (..bytevector-u8-ref [<it> <index>])
+
+ ... Default
+ (.if (array.lacks? <index> <it>)
+ (.i64 0)
+ (array.item <index> <it>)))))])))
+
+(def: .public bits_16
+ (template (bits_16 index' it')
+ [(.<| (.let [index (.is Nat index')
+ it (.is ..Binary it')])
+ (.as .I64)
(.is (.I64 .Any))
- (`` (.for (~~ (.static @.old)) (~~ <jvm>)
- (~~ (.static @.jvm)) (~~ <jvm>)
-
- (~~ (.static @.js))
- (.|> <it>
- (.as (array.Array .Frac))
- ("js array read" <index>)
- (.as .Frac)
- "lux f64 i64"
- .i64)
-
- (~~ (.static @.python))
- (.|> <it>
- (.as (array.Array .I64))
- ("python array read" <index>))
-
- (~~ (.static @.scheme))
- (..bytevector-u8-ref [<it> <index>])
-
- ... Default
- (.if (array.lacks? <index> <it>)
- (.i64 0)
- (array.item <index> <it>)))))]))
-
-(template: .public (bits_16 index' it')
- [(.<| (.let [index (.is Nat index')
- it (.is ..Binary it')])
- (.as .I64)
- (.is (.I64 .Any))
- (.all "lux i64 or"
- ("lux i64 left-shift" 8 (..bits_8 index it))
- (..bits_8 ("lux i64 +" 1 index) it)))])
-
-(template: .public (bits_32 index' it')
- [(.<| (.let [index (.is Nat index')
- it (.is ..Binary it')])
- (.as .I64)
- (.is (.I64 .Any))
- (.all "lux i64 or"
- ("lux i64 left-shift" 24 (..bits_8 index it))
- ("lux i64 left-shift" 16 (..bits_8 ("lux i64 +" 1 index) it))
- ("lux i64 left-shift" 8 (..bits_8 ("lux i64 +" 2 index) it))
- (..bits_8 ("lux i64 +" 3 index) it)))])
-
-(template: .public (bits_64 index' it')
- [(.<| (.let [index (.is Nat index')
- it (.is ..Binary it')])
- (.as .I64)
- (.is (.I64 .Any))
- (.all "lux i64 or"
- ("lux i64 left-shift" 56 (..bits_8 index it))
- ("lux i64 left-shift" 48 (..bits_8 ("lux i64 +" 1 index) it))
- ("lux i64 left-shift" 40 (..bits_8 ("lux i64 +" 2 index) it))
- ("lux i64 left-shift" 32 (..bits_8 ("lux i64 +" 3 index) it))
- ("lux i64 left-shift" 24 (..bits_8 ("lux i64 +" 4 index) it))
- ("lux i64 left-shift" 16 (..bits_8 ("lux i64 +" 5 index) it))
- ("lux i64 left-shift" 8 (..bits_8 ("lux i64 +" 6 index) it))
- (..bits_8 ("lux i64 +" 7 index) it)))])
+ (.all "lux i64 or"
+ ("lux i64 left-shift" 8 (..bits_8 index it))
+ (..bits_8 ("lux i64 +" 1 index) it)))]))
+
+(def: .public bits_32
+ (template (bits_32 index' it')
+ [(.<| (.let [index (.is Nat index')
+ it (.is ..Binary it')])
+ (.as .I64)
+ (.is (.I64 .Any))
+ (.all "lux i64 or"
+ ("lux i64 left-shift" 24 (..bits_8 index it))
+ ("lux i64 left-shift" 16 (..bits_8 ("lux i64 +" 1 index) it))
+ ("lux i64 left-shift" 8 (..bits_8 ("lux i64 +" 2 index) it))
+ (..bits_8 ("lux i64 +" 3 index) it)))]))
+
+(def: .public bits_64
+ (template (bits_64 index' it')
+ [(.<| (.let [index (.is Nat index')
+ it (.is ..Binary it')])
+ (.as .I64)
+ (.is (.I64 .Any))
+ (.all "lux i64 or"
+ ("lux i64 left-shift" 56 (..bits_8 index it))
+ ("lux i64 left-shift" 48 (..bits_8 ("lux i64 +" 1 index) it))
+ ("lux i64 left-shift" 40 (..bits_8 ("lux i64 +" 2 index) it))
+ ("lux i64 left-shift" 32 (..bits_8 ("lux i64 +" 3 index) it))
+ ("lux i64 left-shift" 24 (..bits_8 ("lux i64 +" 4 index) it))
+ ("lux i64 left-shift" 16 (..bits_8 ("lux i64 +" 5 index) it))
+ ("lux i64 left-shift" 8 (..bits_8 ("lux i64 +" 6 index) it))
+ (..bits_8 ("lux i64 +" 7 index) it)))]))
(with_expansions [<byte> (hex "FF")
<it> (.is ..Binary it)
@@ -199,99 +205,104 @@
<jvm_value> <jvm_value>
<jvm_value> (ffi.long_to_byte <jvm_value>)
<jvm> (ffi.write! <index> <jvm_value> <it>)]
- (`` (template: .public (has_8! index value it)
- [(.is ..Binary
- (.for (~~ (.static @.old)) <jvm>
- (~~ (.static @.jvm)) <jvm>
-
- (~~ (.static @.js))
- (.|> <it>
- (.is ..Binary)
- (.as (array.Array .Frac))
- ("js array write" <index>
- (.|> <value>
- .int
- ("lux i64 and" (.int <byte>))
- "lux i64 f64"
- .as_expected))
- (.as ..Binary))
-
- (~~ (.static @.python))
- (.|> <it>
- (.is ..Binary)
- (.as (array.Array (.I64 .Any)))
- ("python array write" <index> (.|> <value> ("lux i64 and" <byte>) (.is (.I64 .Any))))
- (.as ..Binary))
-
- (~~ (.static @.scheme))
- (.let [it' <it>]
- (.exec
- (..bytevector-u8-set! [it' <index> <value>])
- it'))
-
- ... Default
- (array.has! <index> (.|> <value> .int ("lux i64 and" (.int <byte>))) <it>)))])))
-
-(template: .public (has_16! index' value' it)
- [(.let [index (.is .Nat index')
- value (.is (.I64 .Any) value')]
- (.|> it
- (..has_8! index ("lux i64 right-shift" 8 value))
- (..has_8! ("lux i64 +" 1 index) value)))])
-
-(template: .public (has_32! index' value' it)
- [(.let [index (.is .Nat index')
- value (.is (.I64 .Any) value')]
- (.|> it
- (..has_8! index ("lux i64 right-shift" 24 value))
- (..has_8! ("lux i64 +" 1 index) ("lux i64 right-shift" 16 value))
- (..has_8! ("lux i64 +" 2 index) ("lux i64 right-shift" 8 value))
- (..has_8! ("lux i64 +" 3 index) value)))])
-
-(`` (template: .public (has_64! index' value' it)
- [(.let [index (.is .Nat index')
- value (.is (.I64 .Any) value')]
- (.for (~~ (.static @.scheme)) (.let [write_high (.is (.-> ..Binary ..Binary)
- (.|>> (..has_8! index ("lux i64 right-shift" 56 value))
- (..has_8! ("lux i64 +" 1 index) ("lux i64 right-shift" 48 value))
- (..has_8! ("lux i64 +" 2 index) ("lux i64 right-shift" 40 value))
- (..has_8! ("lux i64 +" 3 index) ("lux i64 right-shift" 32 value))))
- write_low (.is (.-> ..Binary ..Binary)
- (.|>> (..has_8! ("lux i64 +" 4 index) ("lux i64 right-shift" 24 value))
- (..has_8! ("lux i64 +" 5 index) ("lux i64 right-shift" 16 value))
- (..has_8! ("lux i64 +" 6 index) ("lux i64 right-shift" 8 value))
- (..has_8! ("lux i64 +" 7 index) value)))]
- (.|> it
- write_high
- write_low))
- (.|> it
- (..has_8! index ("lux i64 right-shift" 56 value))
- (..has_8! ("lux i64 +" 1 index) ("lux i64 right-shift" 48 value))
- (..has_8! ("lux i64 +" 2 index) ("lux i64 right-shift" 40 value))
- (..has_8! ("lux i64 +" 3 index) ("lux i64 right-shift" 32 value))
- (..has_8! ("lux i64 +" 4 index) ("lux i64 right-shift" 24 value))
- (..has_8! ("lux i64 +" 5 index) ("lux i64 right-shift" 16 value))
- (..has_8! ("lux i64 +" 6 index) ("lux i64 right-shift" 8 value))
- (..has_8! ("lux i64 +" 7 index) value))))]))
+ (`` (def: .public has_8!
+ (template (has_8! index value it)
+ [(.is ..Binary
+ (.for (~~ (.static @.old)) <jvm>
+ (~~ (.static @.jvm)) <jvm>
+
+ (~~ (.static @.js))
+ (.|> <it>
+ (.is ..Binary)
+ (.as (array.Array .Frac))
+ ("js array write" <index>
+ (.|> <value>
+ .int
+ ("lux i64 and" (.int <byte>))
+ "lux i64 f64"
+ .as_expected))
+ (.as ..Binary))
+
+ (~~ (.static @.python))
+ (.|> <it>
+ (.is ..Binary)
+ (.as (array.Array (.I64 .Any)))
+ ("python array write" <index> (.|> <value> ("lux i64 and" <byte>) (.is (.I64 .Any))))
+ (.as ..Binary))
+
+ (~~ (.static @.scheme))
+ (.let [it' <it>]
+ (.exec
+ (..bytevector-u8-set! [it' <index> <value>])
+ it'))
+
+ ... Default
+ (array.has! <index> (.|> <value> .int ("lux i64 and" (.int <byte>))) <it>)))]))))
+
+(def: .public has_16!
+ (template (has_16! index' value' it)
+ [(.let [index (.is .Nat index')
+ value (.is (.I64 .Any) value')]
+ (.|> it
+ (..has_8! index ("lux i64 right-shift" 8 value))
+ (..has_8! ("lux i64 +" 1 index) value)))]))
+
+(def: .public has_32!
+ (template (has_32! index' value' it)
+ [(.let [index (.is .Nat index')
+ value (.is (.I64 .Any) value')]
+ (.|> it
+ (..has_8! index ("lux i64 right-shift" 24 value))
+ (..has_8! ("lux i64 +" 1 index) ("lux i64 right-shift" 16 value))
+ (..has_8! ("lux i64 +" 2 index) ("lux i64 right-shift" 8 value))
+ (..has_8! ("lux i64 +" 3 index) value)))]))
+
+(`` (def: .public has_64!
+ (template (has_64! index' value' it)
+ [(.let [index (.is .Nat index')
+ value (.is (.I64 .Any) value')]
+ (.for (~~ (.static @.scheme)) (.let [write_high (.is (.-> ..Binary ..Binary)
+ (.|>> (..has_8! index ("lux i64 right-shift" 56 value))
+ (..has_8! ("lux i64 +" 1 index) ("lux i64 right-shift" 48 value))
+ (..has_8! ("lux i64 +" 2 index) ("lux i64 right-shift" 40 value))
+ (..has_8! ("lux i64 +" 3 index) ("lux i64 right-shift" 32 value))))
+ write_low (.is (.-> ..Binary ..Binary)
+ (.|>> (..has_8! ("lux i64 +" 4 index) ("lux i64 right-shift" 24 value))
+ (..has_8! ("lux i64 +" 5 index) ("lux i64 right-shift" 16 value))
+ (..has_8! ("lux i64 +" 6 index) ("lux i64 right-shift" 8 value))
+ (..has_8! ("lux i64 +" 7 index) value)))]
+ (.|> it
+ write_high
+ write_low))
+ (.|> it
+ (..has_8! index ("lux i64 right-shift" 56 value))
+ (..has_8! ("lux i64 +" 1 index) ("lux i64 right-shift" 48 value))
+ (..has_8! ("lux i64 +" 2 index) ("lux i64 right-shift" 40 value))
+ (..has_8! ("lux i64 +" 3 index) ("lux i64 right-shift" 32 value))
+ (..has_8! ("lux i64 +" 4 index) ("lux i64 right-shift" 24 value))
+ (..has_8! ("lux i64 +" 5 index) ("lux i64 right-shift" 16 value))
+ (..has_8! ("lux i64 +" 6 index) ("lux i64 right-shift" 8 value))
+ (..has_8! ("lux i64 +" 7 index) value))))])))
(with_expansions [<reference> (.is ..Binary reference')
<sample> (.is ..Binary sample')
<jvm> (java/util/Arrays::equals <reference> <sample>)
<jvm> (ffi.of_boolean <jvm>)]
- (`` (template: .public (= reference' sample')
- [(.for (~~ (.static @.old)) <jvm>
- (~~ (.static @.jvm)) <jvm>
- (.let [reference <reference>
- sample <sample>
- limit (..size reference)]
- (.and ("lux i64 =" limit (..size sample))
- (.loop (again [index 0])
- (.if ("lux i64 =" limit index)
- .true
- (.and ("lux i64 ="
- (..bits_8 index reference)
- (..bits_8 index sample))
- (again ("lux i64 +" 1 index))))))))])))
+ (`` (def: .public =
+ (template (= reference' sample')
+ [(.for (~~ (.static @.old)) <jvm>
+ (~~ (.static @.jvm)) <jvm>
+ (.let [reference <reference>
+ sample <sample>
+ limit (..size reference)]
+ (.and ("lux i64 =" limit (..size sample))
+ (.loop (again [index 0])
+ (.if ("lux i64 =" limit index)
+ .true
+ (.and ("lux i64 ="
+ (..bits_8 index reference)
+ (..bits_8 index sample))
+ (again ("lux i64 +" 1 index))))))))]))))
... TODO: Turn into a template ASAP.
(`` (inline: .public (copy! bytes source_offset source target_offset target)
diff --git a/stdlib/source/unsafe/lux/data/collection/array.lux b/stdlib/source/unsafe/lux/data/collection/array.lux
index fd43808c5..d3116b89b 100644
--- a/stdlib/source/unsafe/lux/data/collection/array.lux
+++ b/stdlib/source/unsafe/lux/data/collection/array.lux
@@ -13,7 +13,7 @@
(def: .public type
"#Array")
-(template [<item> <array>]
+(with_template [<item> <array>]
[(type: .public <array>
{.#Primitive ..type {.#Item <item> {.#End}}})]
@@ -23,390 +23,416 @@
(with_expansions [<index_type> (.Primitive "java.lang.Long")
<item_type> (.Primitive "java.lang.Object")]
- (for @.jvm (template: (jvm_int value)
- [(.|> value
- (.as <index_type>)
- "jvm object cast"
- "jvm conversion long-to-int")])
+ (for @.jvm (def: jvm_int
+ (template (jvm_int value)
+ [(.|> value
+ (.as <index_type>)
+ "jvm object cast"
+ "jvm conversion long-to-int")]))
(these))
- (`` (template: .public (empty <size>)
- [((.is (.All (_ a) (.-> .Nat (..Array a)))
- (.function (empty size)
- (.as_expected
- (.for (~~ (.static @.old))
- ("jvm anewarray" "(java.lang.Object )" size)
-
- (~~ (.static @.jvm))
- (|> (~~ (..jvm_int size))
- "jvm array new object"
- (.is (..Array <item_type>)))
-
- (~~ (.static @.js)) ("js array new" size)
- (~~ (.static @.python)) ("python array new" size)
- (~~ (.static @.lua)) ("lua array new" size)
- (~~ (.static @.ruby)) ("ruby array new" size)
- (~~ (.static @.php)) ("php array new" size)
- (~~ (.static @.scheme)) ("scheme array new" size)))))
- <size>)]))
-
- (`` (template: .public (size <array>)
- [((.is (.All (_ r w) (.-> (..Array' r w) .Nat))
- (.function (size array)
- (.for (~~ (.static @.old))
- ("jvm arraylength" array)
-
- (~~ (.static @.jvm))
- (.|> array
- "jvm array length object"
- "jvm conversion int-to-long"
- "jvm object cast"
- (.is <index_type>)
- (.as .Nat))
-
- (~~ (.static @.js)) ("js array length" array)
- (~~ (.static @.python)) ("python array length" array)
- (~~ (.static @.lua)) ("lua array length" array)
- (~~ (.static @.ruby)) ("ruby array length" array)
- (~~ (.static @.php)) ("php array length" array)
- (~~ (.static @.scheme)) ("scheme array length" array))))
- <array>)]))
-
- (template: (lacks?' <read!> <null?> index array)
- [(<null?> (<read!> index array))])
-
- (`` (template: .public (lacks? <index> <array>)
- [((.is (.All (_ r w)
- (.-> .Nat (..Array' r w) .Bit))
- (.function (lacks? index array)
- (.let [size (..size array)]
- (.if ("lux i64 <" (.int size) (.int index))
- (.for (~~ (.static @.old))
- ("jvm object null?" ("jvm aaload" array index))
-
- (~~ (.static @.jvm))
- (.|> array
- ("jvm array read object" (~~ (jvm_int index)))
- "jvm object null?")
-
- (~~ (.static @.js)) (~~ (lacks?' "js array read" "js object undefined?" index array))
- (~~ (.static @.python)) (~~ (lacks?' "python array read" "python object none?" index array))
- (~~ (.static @.lua)) (~~ (lacks?' "lua array read" "lua object nil?" index array))
- (~~ (.static @.ruby)) (~~ (lacks?' "ruby array read" "ruby object nil?" index array))
- (~~ (.static @.php)) (~~ (lacks?' "php array read" "php object null?" index array))
- (~~ (.static @.scheme)) (~~ (lacks?' "scheme array read" "scheme object nil?" index array)))
- .true))))
- <index> <array>)]))
-
- (template: .public (has? index array)
- [(.not (..lacks? index array))])
-
- (`` (template: .public (item <index> <array>)
- [((.is (.All (_ r w)
- (.-> .Nat (..Array' r w) r))
- (.function (item index array)
- (.as_expected
- (.for (~~ (.static @.old))
- ("jvm aaload" array index)
-
- (~~ (.static @.jvm))
- ("jvm array read object" (~~ (jvm_int index)) array)
-
- (~~ (.static @.js)) ("js array read" index array)
- (~~ (.static @.python)) ("python array read" index array)
- (~~ (.static @.lua)) ("lua array read" index array)
- (~~ (.static @.ruby)) ("ruby array read" index array)
- (~~ (.static @.php)) ("php array read" index array)
- (~~ (.static @.scheme)) ("scheme array read" index array)))))
- <index> <array>)]))
-
- (`` (template: .public (has! <index> <value> <array>)
- [((.is (.All (_ r w)
- (.-> .Nat w (..Array' r w) (..Array' r w)))
- (.function (has! index value array)
- (.for (~~ (.static @.old))
- ("jvm aastore" array index value)
-
- (~~ (.static @.jvm))
- (.|> array
- ("jvm array write object" (~~ (jvm_int index)) value)
- .as_expected)
-
- (~~ (.static @.js)) ("js array write" index (.as_expected value) array)
- (~~ (.static @.python)) ("python array write" index (.as_expected value) array)
- (~~ (.static @.lua)) ("lua array write" index (.as_expected value) array)
- (~~ (.static @.ruby)) ("ruby array write" index (.as_expected value) array)
- (~~ (.static @.php)) ("php array write" index (.as_expected value) array)
- (~~ (.static @.scheme)) ("scheme array write" index (.as_expected value) array))))
- <index> <value> <array>)]))
-
- (`` (template: .public (lacks! <index> <array>)
- [((.is (.All (_ r w)
- (.-> .Nat (..Array' r w) (..Array' r w)))
- (.function (lacks! index array)
- (.let [size (..size array)]
- (.if ("lux i64 <" (.int size) (.int index))
- (.for (~~ (.static @.old))
- (..has! index (.as_expected ("jvm object null")) array)
-
- (~~ (.static @.jvm))
- (..has! index (.as_expected (is <item_type> ("jvm object null"))) array)
-
- (~~ (.static @.js)) ("js array delete" index array)
- (~~ (.static @.python)) ("python array delete" index array)
- (~~ (.static @.lua)) ("lua array delete" index array)
- (~~ (.static @.ruby)) ("ruby array delete" index array)
- (~~ (.static @.php)) ("php array delete" index array)
- (~~ (.static @.scheme)) ("scheme array delete" index array))
- array))))
- <index> <array>)]))
+ (`` (def: .public empty
+ (template (empty <size>)
+ [((.is (.All (_ a) (.-> .Nat (..Array a)))
+ (.function (empty size)
+ (.as_expected
+ (.for (~~ (.static @.old))
+ ("jvm anewarray" "(java.lang.Object )" size)
+
+ (~~ (.static @.jvm))
+ (|> (~~ (..jvm_int size))
+ "jvm array new object"
+ (.is (..Array <item_type>)))
+
+ (~~ (.static @.js)) ("js array new" size)
+ (~~ (.static @.python)) ("python array new" size)
+ (~~ (.static @.lua)) ("lua array new" size)
+ (~~ (.static @.ruby)) ("ruby array new" size)
+ (~~ (.static @.php)) ("php array new" size)
+ (~~ (.static @.scheme)) ("scheme array new" size)))))
+ <size>)])))
+
+ (`` (def: .public size
+ (template (size <array>)
+ [((.is (.All (_ r w) (.-> (..Array' r w) .Nat))
+ (.function (size array)
+ (.for (~~ (.static @.old))
+ ("jvm arraylength" array)
+
+ (~~ (.static @.jvm))
+ (.|> array
+ "jvm array length object"
+ "jvm conversion int-to-long"
+ "jvm object cast"
+ (.is <index_type>)
+ (.as .Nat))
+
+ (~~ (.static @.js)) ("js array length" array)
+ (~~ (.static @.python)) ("python array length" array)
+ (~~ (.static @.lua)) ("lua array length" array)
+ (~~ (.static @.ruby)) ("ruby array length" array)
+ (~~ (.static @.php)) ("php array length" array)
+ (~~ (.static @.scheme)) ("scheme array length" array))))
+ <array>)])))
+
+ (def: lacks?'
+ (template (lacks?' <read!> <null?> index array)
+ [(<null?> (<read!> index array))]))
+
+ (`` (def: .public lacks?
+ (template (lacks? <index> <array>)
+ [((.is (.All (_ r w)
+ (.-> .Nat (..Array' r w) .Bit))
+ (.function (lacks? index array)
+ (.let [size (..size array)]
+ (.if ("lux i64 <" (.int size) (.int index))
+ (.for (~~ (.static @.old))
+ ("jvm object null?" ("jvm aaload" array index))
+
+ (~~ (.static @.jvm))
+ (.|> array
+ ("jvm array read object" (~~ (jvm_int index)))
+ "jvm object null?")
+
+ (~~ (.static @.js)) (~~ (lacks?' "js array read" "js object undefined?" index array))
+ (~~ (.static @.python)) (~~ (lacks?' "python array read" "python object none?" index array))
+ (~~ (.static @.lua)) (~~ (lacks?' "lua array read" "lua object nil?" index array))
+ (~~ (.static @.ruby)) (~~ (lacks?' "ruby array read" "ruby object nil?" index array))
+ (~~ (.static @.php)) (~~ (lacks?' "php array read" "php object null?" index array))
+ (~~ (.static @.scheme)) (~~ (lacks?' "scheme array read" "scheme object nil?" index array)))
+ .true))))
+ <index> <array>)])))
+
+ (def: .public has?
+ (template (has? index array)
+ [(.not (..lacks? index array))]))
+
+ (`` (def: .public item
+ (template (item <index> <array>)
+ [((.is (.All (_ r w)
+ (.-> .Nat (..Array' r w) r))
+ (.function (item index array)
+ (.as_expected
+ (.for (~~ (.static @.old))
+ ("jvm aaload" array index)
+
+ (~~ (.static @.jvm))
+ ("jvm array read object" (~~ (jvm_int index)) array)
+
+ (~~ (.static @.js)) ("js array read" index array)
+ (~~ (.static @.python)) ("python array read" index array)
+ (~~ (.static @.lua)) ("lua array read" index array)
+ (~~ (.static @.ruby)) ("ruby array read" index array)
+ (~~ (.static @.php)) ("php array read" index array)
+ (~~ (.static @.scheme)) ("scheme array read" index array)))))
+ <index> <array>)])))
+
+ (`` (def: .public has!
+ (template (has! <index> <value> <array>)
+ [((.is (.All (_ r w)
+ (.-> .Nat w (..Array' r w) (..Array' r w)))
+ (.function (has! index value array)
+ (.for (~~ (.static @.old))
+ ("jvm aastore" array index value)
+
+ (~~ (.static @.jvm))
+ (.|> array
+ ("jvm array write object" (~~ (jvm_int index)) value)
+ .as_expected)
+
+ (~~ (.static @.js)) ("js array write" index (.as_expected value) array)
+ (~~ (.static @.python)) ("python array write" index (.as_expected value) array)
+ (~~ (.static @.lua)) ("lua array write" index (.as_expected value) array)
+ (~~ (.static @.ruby)) ("ruby array write" index (.as_expected value) array)
+ (~~ (.static @.php)) ("php array write" index (.as_expected value) array)
+ (~~ (.static @.scheme)) ("scheme array write" index (.as_expected value) array))))
+ <index> <value> <array>)])))
+
+ (`` (def: .public lacks!
+ (template (lacks! <index> <array>)
+ [((.is (.All (_ r w)
+ (.-> .Nat (..Array' r w) (..Array' r w)))
+ (.function (lacks! index array)
+ (.let [size (..size array)]
+ (.if ("lux i64 <" (.int size) (.int index))
+ (.for (~~ (.static @.old))
+ (..has! index (.as_expected ("jvm object null")) array)
+
+ (~~ (.static @.jvm))
+ (..has! index (.as_expected (is <item_type> ("jvm object null"))) array)
+
+ (~~ (.static @.js)) ("js array delete" index array)
+ (~~ (.static @.python)) ("python array delete" index array)
+ (~~ (.static @.lua)) ("lua array delete" index array)
+ (~~ (.static @.ruby)) ("ruby array delete" index array)
+ (~~ (.static @.php)) ("php array delete" index array)
+ (~~ (.static @.scheme)) ("scheme array delete" index array))
+ array))))
+ <index> <array>)])))
)
-(template: .public (revised! <index> <$> <array>)
- [((.is (.All (_ r w)
- (.-> .Nat (.-> r w) (..Array' r w) (..Array' r w)))
- (.function (revised! index $ array)
- (.if (..lacks? index array)
- array
- (..has! index ($ (..item index array)) array))))
- <index> <$> <array>)])
-
-(template: .public (upsert! <index> <default> <$> <array>)
- [((.is (.All (_ r w)
- (.-> .Nat r (.-> r w) (..Array' r w) (..Array' r w)))
- (.function (upsert! index default $ array)
- (..has! index
- ($ (.if (..lacks? index array)
- default
- (..item index array)))
- array)))
- <index> <default> <$> <array>)])
-
-(template: .public (copy! <length> <src_start> <src_array> <dest_start> <dest_array>)
- [((.is (.All (_ r w)
- (.-> .Nat .Nat (..Array' w .Nothing) .Nat (..Array' r w)
- (..Array' r w)))
- (.function (copy! length src_start src_array dest_start dest_array)
- (.loop (again [offset 0])
- (.if ("lux i64 <" (.int length) (.int offset))
- (.exec
- (.if (..lacks? ("lux i64 +" offset src_start) src_array)
- (..lacks! ("lux i64 +" offset dest_start) dest_array)
- (..has! ("lux i64 +" offset dest_start)
- (..item ("lux i64 +" offset src_start) src_array)
- dest_array))
- (again ("lux i64 +" 1 offset)))
- dest_array))))
- <length> <src_start> <src_array> <dest_start> <dest_array>)])
-
-(template [<name> <when_lacks> <when_has>]
- [(template: .public (<name> <array>)
- [((.is (.All (_ r w) (.-> (..Array' r w) .Nat))
- (.function (occupancy array)
- (.let [size (..size array)]
- (.loop (again [index 0
- it 0])
- (.if ("lux i64 <" (.int size) (.int index))
- (.if (..lacks? index array)
- (again ("lux i64 +" 1 index) <when_lacks>)
- (again ("lux i64 +" 1 index) <when_has>))
- it)))))
- <array>)])]
+(def: .public revised!
+ (template (revised! <index> <$> <array>)
+ [((.is (.All (_ r w)
+ (.-> .Nat (.-> r w) (..Array' r w) (..Array' r w)))
+ (.function (revised! index $ array)
+ (.if (..lacks? index array)
+ array
+ (..has! index ($ (..item index array)) array))))
+ <index> <$> <array>)]))
+
+(def: .public upsert!
+ (template (upsert! <index> <default> <$> <array>)
+ [((.is (.All (_ r w)
+ (.-> .Nat r (.-> r w) (..Array' r w) (..Array' r w)))
+ (.function (upsert! index default $ array)
+ (..has! index
+ ($ (.if (..lacks? index array)
+ default
+ (..item index array)))
+ array)))
+ <index> <default> <$> <array>)]))
+
+(def: .public copy!
+ (template (copy! <length> <src_start> <src_array> <dest_start> <dest_array>)
+ [((.is (.All (_ r w)
+ (.-> .Nat .Nat (..Array' w .Nothing) .Nat (..Array' r w)
+ (..Array' r w)))
+ (.function (copy! length src_start src_array dest_start dest_array)
+ (.loop (again [offset 0])
+ (.if ("lux i64 <" (.int length) (.int offset))
+ (.exec
+ (.if (..lacks? ("lux i64 +" offset src_start) src_array)
+ (..lacks! ("lux i64 +" offset dest_start) dest_array)
+ (..has! ("lux i64 +" offset dest_start)
+ (..item ("lux i64 +" offset src_start) src_array)
+ dest_array))
+ (again ("lux i64 +" 1 offset)))
+ dest_array))))
+ <length> <src_start> <src_array> <dest_start> <dest_array>)]))
+
+(with_template [<name> <when_lacks> <when_has>]
+ [(def: .public <name>
+ (template (<name> <array>)
+ [((.is (.All (_ r w) (.-> (..Array' r w) .Nat))
+ (.function (occupancy array)
+ (.let [size (..size array)]
+ (.loop (again [index 0
+ it 0])
+ (.if ("lux i64 <" (.int size) (.int index))
+ (.if (..lacks? index array)
+ (again ("lux i64 +" 1 index) <when_lacks>)
+ (again ("lux i64 +" 1 index) <when_has>))
+ it)))))
+ <array>)]))]
[occupancy it ("lux i64 +" 1 it)]
[vacancy ("lux i64 +" 1 it) it]
)
-(template: .public (only! <?> <it>)
- [((.is (.All (_ r w)
- (.-> (.-> r .Bit) (..Array' r w) (..Array' r w)))
- (.function (only! ? it)
- (.let [size (..size it)]
- (.loop (again [index 0])
- (.if ("lux i64 <" (.int size) (.int index))
- (.exec
- (.if (..lacks? index it)
- it
- (.if (? (..item index it))
+(def: .public only!
+ (template (only! <?> <it>)
+ [((.is (.All (_ r w)
+ (.-> (.-> r .Bit) (..Array' r w) (..Array' r w)))
+ (.function (only! ? it)
+ (.let [size (..size it)]
+ (.loop (again [index 0])
+ (.if ("lux i64 <" (.int size) (.int index))
+ (.exec
+ (.if (..lacks? index it)
it
- (..lacks! index it)))
- (again ("lux i64 +" 1 index)))
- it)))))
- <?> <it>)])
-
-(template [<name> <predicate> <test> <type> <term>]
- [(template: .public (<name> <?> <it>)
- [((.is (.All (_ r w)
- (.-> <predicate> (..Array' r w) (.Maybe <type>)))
- (.function (<name> ? it)
- (.let [size (..size it)]
- (.loop (again [index 0])
- (.if ("lux i64 <" (.int size) (.int index))
- (.if (..lacks? index it)
- (again ("lux i64 +" 1 index))
- (.let [it (..item index it)]
- (.if <test>
- {.#Some <term>}
- (again ("lux i64 +" 1 index)))))
- {.#None})))))
- <?> <it>)])]
+ (.if (? (..item index it))
+ it
+ (..lacks! index it)))
+ (again ("lux i64 +" 1 index)))
+ it)))))
+ <?> <it>)]))
+
+(with_template [<name> <predicate> <test> <type> <term>]
+ [(def: .public <name>
+ (template (<name> <?> <it>)
+ [((.is (.All (_ r w)
+ (.-> <predicate> (..Array' r w) (.Maybe <type>)))
+ (.function (<name> ? it)
+ (.let [size (..size it)]
+ (.loop (again [index 0])
+ (.if ("lux i64 <" (.int size) (.int index))
+ (.if (..lacks? index it)
+ (again ("lux i64 +" 1 index))
+ (.let [it (..item index it)]
+ (.if <test>
+ {.#Some <term>}
+ (again ("lux i64 +" 1 index)))))
+ {.#None})))))
+ <?> <it>)]))]
[example (.-> r .Bit) (? it) r it]
[example' (.-> Nat r .Bit) (? index it) [Nat r] [index it]]
)
-(template: .public (clone <it>)
- [((.is (.All (_ a) (.-> (..Array a) (..Array a)))
- (.function (clone it)
- (.let [size (..size it)]
- (..copy! size 0 it 0 (..empty size)))))
- <it>)])
-
-(template: .public (of_list <input>)
- [((.is (.All (_ a) (.-> (.List a) (..Array a)))
- (.function (of_list input)
- (.let [size (list.size input)
- output (..empty size)]
- (.loop (again [index 0
- input input])
- (.case input
- {.#End}
- output
-
- {.#Item head tail}
- (.exec
- (..has! index head output)
- (again ("lux i64 +" 1 index) tail)))))))
- <input>)])
+(def: .public clone
+ (template (clone <it>)
+ [((.is (.All (_ a) (.-> (..Array a) (..Array a)))
+ (.function (clone it)
+ (.let [size (..size it)]
+ (..copy! size 0 it 0 (..empty size)))))
+ <it>)]))
+
+(def: .public of_list
+ (template (of_list <input>)
+ [((.is (.All (_ a) (.-> (.List a) (..Array a)))
+ (.function (of_list input)
+ (.let [size (list.size input)
+ output (..empty size)]
+ (.loop (again [index 0
+ input input])
+ (.case input
+ {.#End}
+ output
+
+ {.#Item head tail}
+ (.exec
+ (..has! index head output)
+ (again ("lux i64 +" 1 index) tail)))))))
+ <input>)]))
(def: underflow
Nat
(-- 0))
-(`` (template: (list|-default <empty> <array>)
- [((.is (.All (_ r w) (.-> (.List r) (..Array' r w) (.List r)))
- (.function (list|-default empty array)
- (.loop (again [index ("lux i64 -" 1 (..size array))
- output empty])
- (.if ("lux i64 =" (~~ (.static ..underflow)) index)
- output
- (again ("lux i64 -" 1 index)
- (.if (..lacks? index array)
- output
- {.#Item (..item index array) output}))))))
- <empty> <array>)]))
-
-(`` (template: (list|+default <default> <array>)
- [((.is (.All (_ r w) (.-> r (..Array' r w) (.List r)))
- (.function (list|+default default array)
- (.loop (again [index ("lux i64 -" 1 (..size array))
- output (`` (.is (.List (~~ (.these (~~ (.type_of default)))))
- {.#End}))])
- (.if ("lux i64 =" (~~ (.static ..underflow)) index)
- output
- (again ("lux i64 -" 1 index)
- {.#Item (.if (..lacks? index array)
- default
- (..item index array))
- output})))))
- <default> <array>)]))
-
-(`` (template: .public (list <default> <array>)
- [((.is (.All (_ r w) (.-> (.Maybe r) (..Array' r w) (.List r)))
- (.function (list default array)
- (.case default
- {.#Some default}
- (~~ (..list|+default default array))
-
- {.#None}
- (~~ (..list|-default {.#End} array)))))
- <default> <array>)]))
-
-(template: .public (= <//#=> <left/*> <right/*>)
- [((.is (.All (_ r w0 w1) (.-> (.-> r r .Bit) (..Array' r w0) (..Array' r w1) .Bit))
- (.function (= //#= left/* right/*)
- (.let [size (..size left/*)]
- (.and ("lux i64 =" (..size right/*) size)
- (.loop (again [index 0])
- (.if ("lux i64 <" (.int size) (.int index))
- (.if (..lacks? index left/*)
- (..lacks? index right/*)
- (.if (..lacks? index right/*)
- .false
- (.and (//#= (..item index left/*)
- (..item index right/*))
- (again ("lux i64 +" 1 index)))))
- true))))))
- <//#=> <left/*> <right/*>)])
-
-(template: .public (composite <left/*> <right/*>)
- [((.is (.All (_ a) (.-> (..Array' a .Nothing) (..Array' a .Nothing) (..Array a)))
- (.function (composite left/* right/*)
- (.let [|left| (..size left/*)
- |right| (..size right/*)]
- (.|> (..empty ("lux i64 +" |left| |right|))
- (..copy! |left| 0 left/* 0)
- (..copy! |right| 0 right/* |left|)))))
- <left/*> <right/*>)])
-
-(template: .public (mix <$> <init> <it>)
- [((.is (.All (_ r w s)
- (.-> (.-> Nat r s s) s (..Array' r w) s))
- (.function (mix $ init it)
- (.let [size (..size it)]
- (.loop (again [index 0
- so_far init])
- (.if ("lux i64 <" (.int size) (.int index))
- (.if (..lacks? index it)
- (again ("lux i64 +" 1 index) so_far)
- (again ("lux i64 +" 1 index) ($ index (..item index it) so_far)))
- so_far)))))
- <$> <init> <it>)])
-
-(template: .public (each <$> <input>)
- [((.is (functor.Functor ..Array)
- (.function (each $ input)
- (..mix (.function (_ index item output)
- (..has! index ($ item) output))
- (..empty (..size input))
- input)))
- <$> <input>)])
-
-(template [<name> <init> <op>]
- [(template: .public (<name> <?> <it>)
- [((.is (.All (_ r w)
- (.-> (.-> r .Bit)
- (.-> (..Array' r w) .Bit)))
- (.function (<name> ? it)
- (.let [size (..size it)]
- (.loop (again [index 0])
- (.if ("lux i64 <" (.int size) (.int index))
- (.if (..lacks? index it)
- (again ("lux i64 +" 1 index))
- (<op> (? (..item index it))
- (again ("lux i64 +" 1 index))))
- <init>)))))
- <?> <it>)])]
+(`` (def: list|-default
+ (template (list|-default <empty> <array>)
+ [((.is (.All (_ r w) (.-> (.List r) (..Array' r w) (.List r)))
+ (.function (list|-default empty array)
+ (.loop (again [index ("lux i64 -" 1 (..size array))
+ output empty])
+ (.if ("lux i64 =" (~~ (.static ..underflow)) index)
+ output
+ (again ("lux i64 -" 1 index)
+ (.if (..lacks? index array)
+ output
+ {.#Item (..item index array) output}))))))
+ <empty> <array>)])))
+
+(`` (def: list|+default
+ (template (list|+default <default> <array>)
+ [((.is (.All (_ r w) (.-> r (..Array' r w) (.List r)))
+ (.function (list|+default default array)
+ (.loop (again [index ("lux i64 -" 1 (..size array))
+ output (`` (.is (.List (~~ (.these (~~ (.type_of default)))))
+ {.#End}))])
+ (.if ("lux i64 =" (~~ (.static ..underflow)) index)
+ output
+ (again ("lux i64 -" 1 index)
+ {.#Item (.if (..lacks? index array)
+ default
+ (..item index array))
+ output})))))
+ <default> <array>)])))
+
+(`` (def: .public list
+ (template (list <default> <array>)
+ [((.is (.All (_ r w) (.-> (.Maybe r) (..Array' r w) (.List r)))
+ (.function (list default array)
+ (.case default
+ {.#Some default}
+ (~~ (..list|+default default array))
+
+ {.#None}
+ (~~ (..list|-default {.#End} array)))))
+ <default> <array>)])))
+
+(def: .public =
+ (template (= <//#=> <left/*> <right/*>)
+ [((.is (.All (_ r w0 w1) (.-> (.-> r r .Bit) (..Array' r w0) (..Array' r w1) .Bit))
+ (.function (= //#= left/* right/*)
+ (.let [size (..size left/*)]
+ (.and ("lux i64 =" (..size right/*) size)
+ (.loop (again [index 0])
+ (.if ("lux i64 <" (.int size) (.int index))
+ (.if (..lacks? index left/*)
+ (..lacks? index right/*)
+ (.if (..lacks? index right/*)
+ .false
+ (.and (//#= (..item index left/*)
+ (..item index right/*))
+ (again ("lux i64 +" 1 index)))))
+ true))))))
+ <//#=> <left/*> <right/*>)]))
+
+(def: .public composite
+ (template (composite <left/*> <right/*>)
+ [((.is (.All (_ a) (.-> (..Array' a .Nothing) (..Array' a .Nothing) (..Array a)))
+ (.function (composite left/* right/*)
+ (.let [|left| (..size left/*)
+ |right| (..size right/*)]
+ (.|> (..empty ("lux i64 +" |left| |right|))
+ (..copy! |left| 0 left/* 0)
+ (..copy! |right| 0 right/* |left|)))))
+ <left/*> <right/*>)]))
+
+(def: .public mix
+ (template (mix <$> <init> <it>)
+ [((.is (.All (_ r w s)
+ (.-> (.-> Nat r s s) s (..Array' r w) s))
+ (.function (mix $ init it)
+ (.let [size (..size it)]
+ (.loop (again [index 0
+ so_far init])
+ (.if ("lux i64 <" (.int size) (.int index))
+ (.if (..lacks? index it)
+ (again ("lux i64 +" 1 index) so_far)
+ (again ("lux i64 +" 1 index) ($ index (..item index it) so_far)))
+ so_far)))))
+ <$> <init> <it>)]))
+
+(def: .public each
+ (template (each <$> <input>)
+ [((.is (functor.Functor ..Array)
+ (.function (each $ input)
+ (..mix (.function (_ index item output)
+ (..has! index ($ item) output))
+ (..empty (..size input))
+ input)))
+ <$> <input>)]))
+
+(with_template [<name> <init> <op>]
+ [(def: .public <name>
+ (template (<name> <?> <it>)
+ [((.is (.All (_ r w)
+ (.-> (.-> r .Bit)
+ (.-> (..Array' r w) .Bit)))
+ (.function (<name> ? it)
+ (.let [size (..size it)]
+ (.loop (again [index 0])
+ (.if ("lux i64 <" (.int size) (.int index))
+ (.if (..lacks? index it)
+ (again ("lux i64 +" 1 index))
+ (<op> (? (..item index it))
+ (again ("lux i64 +" 1 index))))
+ <init>)))))
+ <?> <it>)]))]
[every? .true and]
[any? .false or]
)
-(template: .public (one <?> <it>)
- [((.is (.All (_ r r' w)
- (.-> (.-> r (.Maybe r')) (..Array' r w) (.Maybe r')))
- (.function (one ? it)
- (.let [size (..size it)]
- (.loop (again [index 0])
- (.if ("lux i64 <" (.int size) (.int index))
- (with_expansions [<again> (again ("lux i64 +" 1 index))]
- (.if (..lacks? index it)
- <again>
- (.case (? (..item index it))
- {.#None}
+(def: .public one
+ (template (one <?> <it>)
+ [((.is (.All (_ r r' w)
+ (.-> (.-> r (.Maybe r')) (..Array' r w) (.Maybe r')))
+ (.function (one ? it)
+ (.let [size (..size it)]
+ (.loop (again [index 0])
+ (.if ("lux i64 <" (.int size) (.int index))
+ (with_expansions [<again> (again ("lux i64 +" 1 index))]
+ (.if (..lacks? index it)
<again>
-
- output
- output)))
- {.#None})))))
- <?> <it>)])
+ (.case (? (..item index it))
+ {.#None}
+ <again>
+
+ output
+ output)))
+ {.#None})))))
+ <?> <it>)]))