aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux.lux90
-rw-r--r--stdlib/source/library/lux/abstract/apply.lux3
-rw-r--r--stdlib/source/library/lux/abstract/interval.lux7
-rw-r--r--stdlib/source/library/lux/abstract/monad.lux12
-rw-r--r--stdlib/source/library/lux/abstract/monad/indexed.lux14
-rw-r--r--stdlib/source/library/lux/abstract/monoid.lux2
-rw-r--r--stdlib/source/library/lux/control/concatenative.lux14
-rw-r--r--stdlib/source/library/lux/control/concurrency/actor.lux38
-rw-r--r--stdlib/source/library/lux/control/concurrency/async.lux11
-rw-r--r--stdlib/source/library/lux/control/concurrency/frp.lux8
-rw-r--r--stdlib/source/library/lux/control/concurrency/semaphore.lux34
-rw-r--r--stdlib/source/library/lux/control/concurrency/thread.lux8
-rw-r--r--stdlib/source/library/lux/control/exception.lux22
-rw-r--r--stdlib/source/library/lux/control/function.lux2
-rw-r--r--stdlib/source/library/lux/control/function/contract.lux13
-rw-r--r--stdlib/source/library/lux/control/function/memo.lux5
-rw-r--r--stdlib/source/library/lux/control/function/mixin.lux9
-rw-r--r--stdlib/source/library/lux/control/function/mutual.lux62
-rw-r--r--stdlib/source/library/lux/control/io.lux1
-rw-r--r--stdlib/source/library/lux/control/maybe.lux3
-rw-r--r--stdlib/source/library/lux/control/parser.lux33
-rw-r--r--stdlib/source/library/lux/control/parser/analysis.lux8
-rw-r--r--stdlib/source/library/lux/control/parser/binary.lux18
-rw-r--r--stdlib/source/library/lux/control/parser/cli.lux9
-rw-r--r--stdlib/source/library/lux/control/parser/code.lux13
-rw-r--r--stdlib/source/library/lux/control/parser/environment.lux6
-rw-r--r--stdlib/source/library/lux/control/parser/json.lux2
-rw-r--r--stdlib/source/library/lux/control/parser/text.lux6
-rw-r--r--stdlib/source/library/lux/control/parser/type.lux14
-rw-r--r--stdlib/source/library/lux/control/pipe.lux69
-rw-r--r--stdlib/source/library/lux/control/reader.lux8
-rw-r--r--stdlib/source/library/lux/control/region.lux11
-rw-r--r--stdlib/source/library/lux/control/remember.lux7
-rw-r--r--stdlib/source/library/lux/control/security/capability.lux15
-rw-r--r--stdlib/source/library/lux/control/security/policy.lux41
-rw-r--r--stdlib/source/library/lux/control/state.lux13
-rw-r--r--stdlib/source/library/lux/control/thread.lux9
-rw-r--r--stdlib/source/library/lux/control/try.lux15
-rw-r--r--stdlib/source/library/lux/control/writer.lux6
-rw-r--r--stdlib/source/library/lux/data/binary.lux20
-rw-r--r--stdlib/source/library/lux/data/collection/array.lux30
-rw-r--r--stdlib/source/library/lux/data/collection/bits.lux24
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary.lux28
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/ordered.lux418
-rw-r--r--stdlib/source/library/lux/data/collection/list.lux66
-rw-r--r--stdlib/source/library/lux/data/collection/queue.lux22
-rw-r--r--stdlib/source/library/lux/data/collection/row.lux138
-rw-r--r--stdlib/source/library/lux/data/collection/sequence.lux6
-rw-r--r--stdlib/source/library/lux/data/collection/set/ordered.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/tree.lux16
-rw-r--r--stdlib/source/library/lux/data/collection/tree/finger.lux14
-rw-r--r--stdlib/source/library/lux/data/collection/tree/zipper.lux108
-rw-r--r--stdlib/source/library/lux/data/color.lux6
-rw-r--r--stdlib/source/library/lux/data/format/binary.lux12
-rw-r--r--stdlib/source/library/lux/data/format/css.lux20
-rw-r--r--stdlib/source/library/lux/data/format/css/value.lux4
-rw-r--r--stdlib/source/library/lux/data/format/tar.lux62
-rw-r--r--stdlib/source/library/lux/data/format/xml.lux2
-rw-r--r--stdlib/source/library/lux/data/product.lux4
-rw-r--r--stdlib/source/library/lux/data/store.lux4
-rw-r--r--stdlib/source/library/lux/data/sum.lux2
-rw-r--r--stdlib/source/library/lux/data/text.lux10
-rw-r--r--stdlib/source/library/lux/data/text/buffer.lux42
-rw-r--r--stdlib/source/library/lux/data/text/escape.lux12
-rw-r--r--stdlib/source/library/lux/data/text/format.lux2
-rw-r--r--stdlib/source/library/lux/data/text/regex.lux4
-rw-r--r--stdlib/source/library/lux/data/text/unicode/block.lux8
-rw-r--r--stdlib/source/library/lux/data/trace.lux10
-rw-r--r--stdlib/source/library/lux/debug.lux6
-rw-r--r--stdlib/source/library/lux/documentation.lux79
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux60
-rw-r--r--stdlib/source/library/lux/ffi.old.lux56
-rw-r--r--stdlib/source/library/lux/locale/language.lux2
-rw-r--r--stdlib/source/library/lux/locale/territory.lux4
-rw-r--r--stdlib/source/library/lux/macro/local.lux14
-rw-r--r--stdlib/source/library/lux/macro/syntax/annotations.lux2
-rw-r--r--stdlib/source/library/lux/macro/syntax/declaration.lux4
-rw-r--r--stdlib/source/library/lux/macro/syntax/definition.lux8
-rw-r--r--stdlib/source/library/lux/macro/syntax/input.lux4
-rw-r--r--stdlib/source/library/lux/macro/template.lux6
-rw-r--r--stdlib/source/library/lux/math.lux2
-rw-r--r--stdlib/source/library/lux/math/number/complex.lux66
-rw-r--r--stdlib/source/library/lux/math/number/frac.lux8
-rw-r--r--stdlib/source/library/lux/math/number/i64.lux12
-rw-r--r--stdlib/source/library/lux/math/number/int.lux14
-rw-r--r--stdlib/source/library/lux/math/number/nat.lux12
-rw-r--r--stdlib/source/library/lux/math/number/ratio.lux38
-rw-r--r--stdlib/source/library/lux/math/number/rev.lux48
-rw-r--r--stdlib/source/library/lux/math/random.lux12
-rw-r--r--stdlib/source/library/lux/meta.lux74
-rw-r--r--stdlib/source/library/lux/meta/location.lux14
-rw-r--r--stdlib/source/library/lux/target/js.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/attribute/code.lux14
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode.lux60
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment.lux18
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/instruction.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/class.lux10
-rw-r--r--stdlib/source/library/lux/target/jvm/constant/pool.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/encoding/signed.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/field.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/loader.lux14
-rw-r--r--stdlib/source/library/lux/target/jvm/method.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/reflection.lux6
-rw-r--r--stdlib/source/library/lux/target/jvm/type/descriptor.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type/lux.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type/signature.lux17
-rw-r--r--stdlib/source/library/lux/target/lua.lux2
-rw-r--r--stdlib/source/library/lux/target/php.lux8
-rw-r--r--stdlib/source/library/lux/target/python.lux8
-rw-r--r--stdlib/source/library/lux/target/r.lux2
-rw-r--r--stdlib/source/library/lux/target/ruby.lux2
-rw-r--r--stdlib/source/library/lux/target/scheme.lux2
-rw-r--r--stdlib/source/library/lux/test.lux42
-rw-r--r--stdlib/source/library/lux/time.lux16
-rw-r--r--stdlib/source/library/lux/time/date.lux50
-rw-r--r--stdlib/source/library/lux/time/instant.lux4
-rw-r--r--stdlib/source/library/lux/time/month.lux2
-rw-r--r--stdlib/source/library/lux/time/year.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/init.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux108
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux38
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/directive.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/generation.lux60
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux46
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux33
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux92
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux72
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux12
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux28
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux46
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux20
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/count.lux (renamed from stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux)8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux16
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux16
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux2
-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/case.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux2
-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.lux56
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux16
-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/program.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux70
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux12
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive.lux38
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/document.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/archive.lux52
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/context.lux41
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux2
-rw-r--r--stdlib/source/library/lux/tool/interpreter.lux46
-rw-r--r--stdlib/source/library/lux/type.lux20
-rw-r--r--stdlib/source/library/lux/type/abstract.lux20
-rw-r--r--stdlib/source/library/lux/type/check.lux110
-rw-r--r--stdlib/source/library/lux/type/implicit.lux12
-rw-r--r--stdlib/source/library/lux/type/poly.lux2
-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.lux8
-rw-r--r--stdlib/source/library/lux/type/unit.lux4
-rw-r--r--stdlib/source/library/lux/world/db/jdbc.lux36
-rw-r--r--stdlib/source/library/lux/world/db/jdbc/input.lux4
-rw-r--r--stdlib/source/library/lux/world/db/jdbc/output.lux4
-rw-r--r--stdlib/source/library/lux/world/file.lux18
-rw-r--r--stdlib/source/library/lux/world/file/watch.lux6
-rw-r--r--stdlib/source/library/lux/world/net/http/client.lux10
-rw-r--r--stdlib/source/library/lux/world/net/http/request.lux12
-rw-r--r--stdlib/source/library/lux/world/net/http/response.lux2
-rw-r--r--stdlib/source/library/lux/world/net/http/route.lux12
-rw-r--r--stdlib/source/library/lux/world/service/journal.lux12
-rw-r--r--stdlib/source/library/lux/world/shell.lux13
225 files changed, 1945 insertions, 2213 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index f9be2bf36..6554978c9 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -2109,8 +2109,8 @@
"... By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary." __paragraph
"(template [<name> <diff>]" ..\n
" " "[(def: .public <name> (-> Int Int) (+ <diff>))]" __paragraph
- " " "[inc +1]" ..\n
- " " "[dec -1]"))])
+ " " "[++ +1]" ..\n
+ " " "[-- -1]"))])
({(#Item [[_ (#Tuple bindings)] (#Item [[_ (#Tuple templates)] data])])
({[(#Some bindings') (#Some data')]
(let' [apply ("lux type check" (-> Replacement_Environment ($' List Code))
@@ -4460,16 +4460,16 @@
(All [a] (-> (List a) (List [Nat a])))
(enumeration' 0 xs))
-(macro: .public (get@ tokens)
+(macro: .public (value@ tokens)
{#.doc (text$ ($_ "lux text concat"
"... Accesses the value of a record at a given tag." ..\n
- "(get@ #field my_record)"
+ "(value@ #field my_record)"
__paragraph
"... Can also work with multiple levels of nesting:" ..\n
- "(get@ [#foo #bar #baz] my_record)"
+ "(value@ [#foo #bar #baz] my_record)"
__paragraph
"... And, if only the slot/path is given, generates an accessor function:" ..\n
- "(let [getter (get@ [#foo #bar #baz])]" ..\n
+ "(let [getter (value@ [#foo #bar #baz])]" ..\n
" (getter my_record))"))}
(case tokens
(^ (list [_ (#Tag slot')] record))
@@ -4491,12 +4491,12 @@
(in_meta (list (` ({(~ pattern) (~ g!output)} (~ record))))))
_
- (failure "get@ can only use records.")))
+ (failure "value@ can only use records.")))
(^ (list [_ (#Tuple slots)] record))
(in_meta (list (list\fold (: (-> Code Code Code)
(function (_ slot inner)
- (` (..get@ (~ slot) (~ inner)))))
+ (` (..value@ (~ slot) (~ inner)))))
record
slots)))
@@ -4504,10 +4504,10 @@
(do meta_monad
[g!_ (..identifier "_")
g!record (..identifier "record")]
- (in (list (` (function ((~ g!_) (~ g!record)) (..get@ (~ selector) (~ g!record)))))))
+ (in (list (` (function ((~ g!_) (~ g!record)) (..value@ (~ selector) (~ g!record)))))))
_
- (failure "Wrong syntax for get@")))
+ (failure "Wrong syntax for value@")))
(def: (open_declaration alias tags my_tag_index [module short] source type)
(-> Text (List Name) Nat Name Code Type (Meta (List Code)))
@@ -4774,17 +4774,17 @@
_
(failure "Wrong syntax for \")))
-(macro: .public (set@ tokens)
+(macro: .public (with@ tokens)
{#.doc (text$ ($_ "lux text concat"
"... Sets the value of a record at a given tag." ..\n
- "(set@ #name ''Lux'' lang)"
+ "(with@ #name ''Lux'' lang)"
__paragraph
"... Can also work with multiple levels of nesting:" ..\n
- "(set@ [#foo #bar #baz] value my_record)"
+ "(with@ [#foo #bar #baz] value my_record)"
__paragraph
"... And, if only the slot/path and (optionally) the value are given, generates a mutator function:" ..\n
- "(let [setter (set@ [#foo #bar #baz] value)] (setter my_record))" ..\n
- "(let [setter (set@ [#foo #bar #baz])] (setter value my_record))"))}
+ "(let [setter (with@ [#foo #bar #baz] value)] (setter my_record))" ..\n
+ "(let [setter (with@ [#foo #bar #baz])] (setter value my_record))"))}
(case tokens
(^ (list [_ (#Tag slot')] value record))
(do meta_monad
@@ -4816,12 +4816,12 @@
(in_meta (list (` ({(~ pattern) (~ output)} (~ record)))))))
_
- (failure "set@ can only use records.")))
+ (failure "with@ can only use records.")))
(^ (list [_ (#Tuple slots)] value record))
(case slots
#End
- (failure "Wrong syntax for set@")
+ (failure "Wrong syntax for with@")
_
(do meta_monad
@@ -4832,12 +4832,12 @@
.let [pairs (zipped/2 slots bindings)
update_expr (list\fold (: (-> [Code Code] Code Code)
(function (_ [s b] v)
- (` (..set@ (~ s) (~ v) (~ b)))))
+ (` (..with@ (~ s) (~ v) (~ b)))))
value
(list\reverse pairs))
[_ accesses'] (list\fold (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))])
(function (_ [new_slot new_binding] [old_record accesses'])
- [(` (get@ (~ new_slot) (~ new_binding)))
+ [(` (value@ (~ new_slot) (~ new_binding)))
(#Item (list new_binding old_record) accesses')]))
[record (: (List (List Code)) #End)]
pairs)
@@ -4850,7 +4850,7 @@
[g!_ (..identifier "_")
g!record (..identifier "record")]
(in (list (` (function ((~ g!_) (~ g!record))
- (..set@ (~ selector) (~ value) (~ g!record)))))))
+ (..with@ (~ selector) (~ value) (~ g!record)))))))
(^ (list selector))
(do meta_monad
@@ -4858,22 +4858,22 @@
g!value (..identifier "value")
g!record (..identifier "record")]
(in (list (` (function ((~ g!_) (~ g!value) (~ g!record))
- (..set@ (~ selector) (~ g!value) (~ g!record)))))))
+ (..with@ (~ selector) (~ g!value) (~ g!record)))))))
_
- (failure "Wrong syntax for set@")))
+ (failure "Wrong syntax for with@")))
-(macro: .public (update@ tokens)
+(macro: .public (revised@ tokens)
{#.doc (text$ ($_ "lux text concat"
"... Modifies the value of a record at a given tag, based on some function." ..\n
- "(update@ #age inc person)"
+ "(revised@ #age ++ person)"
__paragraph
"... Can also work with multiple levels of nesting:" ..\n
- "(update@ [#foo #bar #baz] func my_record)"
+ "(revised@ [#foo #bar #baz] func my_record)"
__paragraph
"... And, if only the slot/path and (optionally) the value are given, generates a mutator function:" ..\n
- "(let [updater (update@ [#foo #bar #baz] func)] (updater my_record))" ..\n
- "(let [updater (update@ [#foo #bar #baz])] (updater func my_record))"))}
+ "(let [updater (revised@ [#foo #bar #baz] func)] (updater my_record))" ..\n
+ "(let [updater (revised@ [#foo #bar #baz])] (updater func my_record))"))}
(case tokens
(^ (list [_ (#Tag slot')] fun record))
(do meta_monad
@@ -4905,27 +4905,27 @@
(in_meta (list (` ({(~ pattern) (~ output)} (~ record)))))))
_
- (failure "update@ can only use records.")))
+ (failure "revised@ can only use records.")))
(^ (list [_ (#Tuple slots)] fun record))
(case slots
#End
- (failure "Wrong syntax for update@")
+ (failure "Wrong syntax for revised@")
_
(do meta_monad
[g!record (..identifier "record")
g!temp (..identifier "temp")]
(in (list (` (let [(~ g!record) (~ record)
- (~ g!temp) (get@ [(~+ slots)] (~ g!record))]
- (set@ [(~+ slots)] ((~ fun) (~ g!temp)) (~ g!record))))))))
+ (~ g!temp) (value@ [(~+ slots)] (~ g!record))]
+ (with@ [(~+ slots)] ((~ fun) (~ g!temp)) (~ g!record))))))))
(^ (list selector fun))
(do meta_monad
[g!_ (..identifier "_")
g!record (..identifier "record")]
(in (list (` (function ((~ g!_) (~ g!record))
- (..update@ (~ selector) (~ fun) (~ g!record)))))))
+ (..revised@ (~ selector) (~ fun) (~ g!record)))))))
(^ (list selector))
(do meta_monad
@@ -4933,10 +4933,10 @@
g!fun (..identifier "fun")
g!record (..identifier "record")]
(in (list (` (function ((~ g!_) (~ g!fun) (~ g!record))
- (..update@ (~ selector) (~ g!fun) (~ g!record)))))))
+ (..revised@ (~ selector) (~ g!fun) (~ g!record)))))))
_
- (failure "Wrong syntax for update@")))
+ (failure "Wrong syntax for revised@")))
(macro: .public (^template tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -5047,8 +5047,8 @@
(All [s] (-> (I64 s) (I64 s)))
(|>> (<extension> 1)))]
- [inc "lux i64 +" "Increment function."]
- [dec "lux i64 -" "Decrement function."]
+ [++ "lux i64 +" "Increment function."]
+ [-- "lux i64 -" "Decrement function."]
)
(def: tag\encode
@@ -5107,9 +5107,9 @@
(let [[group_location' parts_text] (list\fold (function (_ part [last_location text_accum])
(let [[part_location part_text] (example_documentation last_location baseline part)]
[part_location (text\compose text_accum part_text)]))
- [(update@ #column inc group_location) ""]
+ [(revised@ #column ++ group_location) ""]
(<prep> parts))]
- [(update@ #column inc group_location')
+ [(revised@ #column ++ group_location')
($_ text\compose (location_padding baseline prev_location group_location)
<open>
parts_text
@@ -5134,7 +5134,7 @@
(#Documentation_Example example)
(let [baseline (baseline_column example)
[location _] example
- [_ text] (..example_documentation (set@ #.column baseline location) baseline example)]
+ [_ text] (..example_documentation (with@ #.column baseline location) baseline example)]
(text\compose text __paragraph))))
(macro: .public (example tokens)
@@ -5147,7 +5147,7 @@
" (loop [count +0" ..\n
" x init]" ..\n
" (if (< +10 count)" ..\n
- " (recur (inc count) (f x))" ..\n
+ " (recur (++ count) (f x))" ..\n
" x)))"))}
(in_meta (list (` [(~ location_code)
(#.Text (~ (|> tokens
@@ -5206,7 +5206,7 @@
(loop [count +0
x init]
(if (< +10 count)
- (recur (inc count) (f x))
+ (recur (++ count) (f x))
x))
"Loops can also be given custom names."
@@ -5214,7 +5214,7 @@
[count +0
x init]
(if (< +10 count)
- (my_loop (inc count) (f x))
+ (my_loop (++ count) (f x))
x)))}
(let [?params (case tokens
(^ (list name [_ (#Tuple bindings)] body))
@@ -5665,7 +5665,7 @@
(macro: .public (^|> tokens)
{#.doc (example "Pipes the value being pattern-matched against prior to binding it to a variable."
(case input
- (^|> value [inc (% 10) (max 1)])
+ (^|> value [++ (% 10) (max 1)])
(foo value)))}
(case tokens
(^ (list& [_meta (#Form (list [_ (#Identifier ["" name])] [_ (#Tuple steps)]))] body branches))
@@ -5696,7 +5696,7 @@
{#.doc "The location of the current expression being analyzed."}
(Meta Location)
(function (_ compiler)
- (#Right [compiler (get@ #location compiler)])))
+ (#Right [compiler (value@ #location compiler)])))
(macro: .public (undefined tokens)
{#.doc (example "Meant to be used as a stand-in for functions with undefined implementations."
@@ -5845,7 +5845,7 @@
(def: target
(Meta Text)
(function (_ compiler)
- (#Right [compiler (get@ [#info #target] compiler)])))
+ (#Right [compiler (value@ [#info #target] compiler)])))
(def: (platform_name choice)
(-> Code (Meta Text))
diff --git a/stdlib/source/library/lux/abstract/apply.lux b/stdlib/source/library/lux/abstract/apply.lux
index 7b57f5671..0b80263e8 100644
--- a/stdlib/source/library/lux/abstract/apply.lux
+++ b/stdlib/source/library/lux/abstract/apply.lux
@@ -19,7 +19,8 @@
(Apply (All [a] (F (G a))))))
(def: &functor
- (functor.composite (get@ #&functor f_apply) (get@ #&functor g_apply)))
+ (functor.composite (value@ #&functor f_apply)
+ (value@ #&functor g_apply)))
(def: (apply fgf fgx)
... TODO: Switch from this version to the one below (in comments) ASAP.
diff --git a/stdlib/source/library/lux/abstract/interval.lux b/stdlib/source/library/lux/abstract/interval.lux
index cea44c57b..4c6060d4d 100644
--- a/stdlib/source/library/lux/abstract/interval.lux
+++ b/stdlib/source/library/lux/abstract/interval.lux
@@ -25,7 +25,6 @@
(def: top top)))
(def: .public (singleton enum elem)
- {#.doc (example "An interval where both top and bottom are the same value.")}
(All [a] (-> (Enum a) a (Interval a)))
(implementation
(def: &enum enum)
@@ -76,21 +75,21 @@
(implementation: .public (union left right)
(All [a] (-> (Interval a) (Interval a) (Interval a)))
- (def: &enum (get@ #&enum right))
+ (def: &enum (value@ #&enum right))
(def: bottom (order.min (\ right &order) (\ left bottom) (\ right bottom)))
(def: top (order.max (\ right &order) (\ left top) (\ right top))))
(implementation: .public (intersection left right)
(All [a] (-> (Interval a) (Interval a) (Interval a)))
- (def: &enum (get@ #&enum right))
+ (def: &enum (value@ #&enum right))
(def: bottom (order.max (\ right &order) (\ left bottom) (\ right bottom)))
(def: top (order.min (\ right &order) (\ left top) (\ right top))))
(implementation: .public (complement interval)
(All [a] (-> (Interval a) (Interval a)))
- (def: &enum (get@ #&enum interval))
+ (def: &enum (value@ #&enum interval))
(def: bottom (\ interval succ (\ interval top)))
(def: top (\ interval pred (\ interval bottom))))
diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux
index 6ba4f74aa..2d81c09e7 100644
--- a/stdlib/source/library/lux/abstract/monad.lux
+++ b/stdlib/source/library/lux/abstract/monad.lux
@@ -25,7 +25,7 @@
counter
(#.Item _ xs')
- (recur (inc counter) xs'))))
+ (recur (++ counter) xs'))))
(def: (reversed xs)
(All [a]
@@ -105,17 +105,17 @@
#.None
(#.Left "Wrong syntax for 'do'")))
-(def: .public (bind monad f)
+(def: .public (then monad f)
(All [! a b]
(-> (Monad !) (-> a (! b))
(-> (! a) (! b))))
(|>> (\ monad map f)
(\ monad join)))
-(def: .public (seq monad)
- (All [M a]
- (-> (Monad M) (List (M a))
- (M (List a))))
+(def: .public (all monad)
+ (All [! a]
+ (-> (Monad !) (List (! a))
+ (! (List a))))
(let [(^open "!\.") monad]
(function (recur xs)
(case xs
diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux
index 9f64ec76d..b43ac87e8 100644
--- a/stdlib/source/library/lux/abstract/monad/indexed.lux
+++ b/stdlib/source/library/lux/abstract/monad/indexed.lux
@@ -21,7 +21,7 @@
(-> (-> vi (m it io vo))
(m ii it vi)
(m ii io vo)))
- bind))
+ then))
(type: Binding
[Code Code])
@@ -32,7 +32,7 @@
(type: Context
(#Macro Name Code)
- (#Bind Binding))
+ (#Binding Binding))
(def: global_identifier
(Parser Name)
@@ -62,7 +62,7 @@
(syntax: .public (do [[?name monad] ..named_monad
context (<code>.tuple (<>.some context))
expression <code>.any])
- (macro.with_identifiers [g!_ g!bind]
+ (macro.with_identifiers [g!_ g!then]
(let [body (list\fold (function (_ context next)
(case context
(#Macro macro parameter)
@@ -70,8 +70,8 @@
(~ parameter)
(~ next)))
- (#Bind [binding value])
- (` ((~ g!bind)
+ (#Binding [binding value])
+ (` ((~ g!then)
(.function ((~ g!_) (~ binding))
(~ next))
(~ value)))))
@@ -82,10 +82,10 @@
(let [name (code.local_identifier name)]
(` (let [(~ name) (~ monad)
{#..in (~' in)
- #..bind (~ g!bind)} (~ name)]
+ #..then (~ g!then)} (~ name)]
(~ body))))
#.None
(` (let [{#..in (~' in)
- #..bind (~ g!bind)} (~ monad)]
+ #..then (~ g!then)} (~ monad)]
(~ body)))))))))
diff --git a/stdlib/source/library/lux/abstract/monoid.lux b/stdlib/source/library/lux/abstract/monoid.lux
index 53c3288c6..fac4862ae 100644
--- a/stdlib/source/library/lux/abstract/monoid.lux
+++ b/stdlib/source/library/lux/abstract/monoid.lux
@@ -3,8 +3,6 @@
[lux #*]])
(interface: .public (Monoid a)
- {#.doc (example "A way to compose values."
- "Includes an identity value which does not alter any other value when combined with.")}
(: a
identity)
(: (-> a a a)
diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux
index 03ae8afe6..93a99ceb2 100644
--- a/stdlib/source/library/lux/control/concatenative.lux
+++ b/stdlib/source/library/lux/control/concatenative.lux
@@ -78,20 +78,20 @@
(code.replaced (code.local_identifier from) to pre))
aliased
aliases))]
- (case [(|> inputs (get@ #bottom) (maybe\map (|>> code.nat (~) #.Parameter (`))))
- (|> outputs (get@ #bottom) (maybe\map (|>> code.nat (~) #.Parameter (`))))]
+ (case [(|> inputs (value@ #bottom) (maybe\map (|>> code.nat (~) #.Parameter (`))))
+ (|> outputs (value@ #bottom) (maybe\map (|>> code.nat (~) #.Parameter (`))))]
[(#.Some bottomI) (#.Some bottomO)]
(monad.do meta.monad
- [inputC (singleton (macro.full_expansion (stack_fold (get@ #top inputs) bottomI)))
- outputC (singleton (macro.full_expansion (stack_fold (get@ #top outputs) bottomO)))]
+ [inputC (singleton (macro.full_expansion (stack_fold (value@ #top inputs) bottomI)))
+ outputC (singleton (macro.full_expansion (stack_fold (value@ #top outputs) bottomO)))]
(in (list (` (-> (~ (de_alias inputC))
(~ (de_alias outputC)))))))
[?bottomI ?bottomO]
(with_identifiers [g!stack]
(monad.do meta.monad
- [inputC (singleton (macro.full_expansion (stack_fold (get@ #top inputs) (maybe.else g!stack ?bottomI))))
- outputC (singleton (macro.full_expansion (stack_fold (get@ #top outputs) (maybe.else g!stack ?bottomO))))]
+ [inputC (singleton (macro.full_expansion (stack_fold (value@ #top inputs) (maybe.else g!stack ?bottomI))))
+ outputC (singleton (macro.full_expansion (stack_fold (value@ #top outputs) (maybe.else g!stack ?bottomO))))]
(in (list (` (All [(~ g!stack)]
(-> (~ (de_alias inputC))
(~ (de_alias outputC))))))))))))
@@ -130,7 +130,7 @@
(syntax: .public (apply [arity (<>.only (n.> 0) <code>.nat)])
(with_identifiers [g! g!func g!stack g!output]
(monad.do {! meta.monad}
- [g!inputs (|> (macro.identifier "input") (list.repeated arity) (monad.seq !))]
+ [g!inputs (|> (macro.identifier "input") (list.repeated arity) (monad.all !))]
(in (list (` (: (All [(~+ g!inputs) (~ g!output)]
(-> (-> (~+ g!inputs) (~ g!output))
(=> [(~+ g!inputs)] [(~ g!output)])))
diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux
index e51be0b98..20ab00c06 100644
--- a/stdlib/source/library/lux/control/concurrency/actor.lux
+++ b/stdlib/source/library/lux/control/concurrency/actor.lux
@@ -90,13 +90,13 @@
(:abstraction {#obituary (async.async [])
#mailbox (atom (async.async []))}))
process (loop [state (on_init init)
- [|mailbox| _] (io.run! (atom.read! (get@ #mailbox (:representation self))))]
+ [|mailbox| _] (io.run! (atom.read! (value@ #mailbox (:representation self))))]
(do {! async.monad}
[[head tail] |mailbox|
?state' (on_mail head state self)]
(case ?state'
(#try.Failure error)
- (let [[_ resolve] (get@ #obituary (:representation self))]
+ (let [[_ resolve] (value@ #obituary (:representation self))]
(exec (io.run!
(do io.monad
[pending (..pending tail)]
@@ -109,7 +109,7 @@
(def: .public (alive? actor)
(All [s] (-> (Actor s) (IO Bit)))
- (let [[obituary _] (get@ #obituary (:representation actor))]
+ (let [[obituary _] (value@ #obituary (:representation actor))]
(|> obituary
async.value
(\ io.functor map
@@ -121,13 +121,13 @@
(def: .public (obituary' actor)
(All [s] (-> (Actor s) (IO (Maybe (Obituary s)))))
- (let [[obituary _] (get@ #obituary (:representation actor))]
+ (let [[obituary _] (value@ #obituary (:representation actor))]
(async.value obituary)))
(def: .public obituary
(All [s] (-> (Actor s) (Async (Obituary s))))
(|>> :representation
- (get@ #obituary)
+ (value@ #obituary)
product.left))
(def: .public (mail! mail actor)
@@ -137,7 +137,7 @@
(if alive?
(let [entry [mail (async.async [])]]
(do !
- [|mailbox|&resolve (atom.read! (get@ #mailbox (:representation actor)))]
+ [|mailbox|&resolve (atom.read! (value@ #mailbox (:representation actor)))]
(loop [[|mailbox| resolve] |mailbox|&resolve]
(do !
[|mailbox| (async.value |mailbox|)]
@@ -147,7 +147,7 @@
[resolved? (resolve entry)]
(if resolved?
(do !
- [_ (atom.write! (product.right entry) (get@ #mailbox (:representation actor)))]
+ [_ (atom.write! (product.right entry) (value@ #mailbox (:representation actor)))]
(in (#try.Success [])))
(recur |mailbox|&resolve)))
@@ -323,27 +323,27 @@
(with_identifiers [g!_ g!return]
(do meta.monad
[actor_scope abstract.current
- .let [g!type (code.local_identifier (get@ #abstract.name actor_scope))
- g!message (code.local_identifier (get@ #name signature))
- g!actor_vars (get@ #abstract.type_vars actor_scope)
- g!all_vars (|> signature (get@ #vars) (list\map code.local_identifier) (list\compose g!actor_vars))
- g!inputsC (|> signature (get@ #inputs) (list\map product.left))
- g!inputsT (|> signature (get@ #inputs) (list\map product.right))
- g!state (|> signature (get@ #state) code.local_identifier)
- g!self (|> signature (get@ #self) code.local_identifier)]]
+ .let [g!type (code.local_identifier (value@ #abstract.name actor_scope))
+ g!message (code.local_identifier (value@ #name signature))
+ g!actor_vars (value@ #abstract.type_vars actor_scope)
+ g!all_vars (|> signature (value@ #vars) (list\map code.local_identifier) (list\compose g!actor_vars))
+ g!inputsC (|> signature (value@ #inputs) (list\map product.left))
+ g!inputsT (|> signature (value@ #inputs) (list\map product.right))
+ g!state (|> signature (value@ #state) code.local_identifier)
+ g!self (|> signature (value@ #self) code.local_identifier)]]
(in (list (` (def: (~ export_policy) ((~ g!message) (~+ g!inputsC))
(~ (|annotations|.format annotations))
(All [(~+ g!all_vars)]
(-> (~+ g!inputsT)
- (..Message (~ (get@ #abstract.abstraction actor_scope))
+ (..Message (~ (value@ #abstract.abstraction actor_scope))
(~ output_type))))
(function ((~ g!_) (~ g!state) (~ g!self))
- (let [(~ g!state) (:as (~ (get@ #abstract.representation actor_scope))
+ (let [(~ g!state) (:as (~ (value@ #abstract.representation actor_scope))
(~ g!state))]
(|> (~ body)
- (: ((~! async.Async) ((~! try.Try) [(~ (get@ #abstract.representation actor_scope))
+ (: ((~! async.Async) ((~! try.Try) [(~ (value@ #abstract.representation actor_scope))
(~ output_type)])))
- (:as ((~! async.Async) ((~! try.Try) [(~ (get@ #abstract.abstraction actor_scope))
+ (:as ((~! async.Async) ((~! try.Try) [(~ (value@ #abstract.abstraction actor_scope))
(~ output_type)]))))))))
)))))
diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux
index 3dcb864b6..58fbb4ea6 100644
--- a/stdlib/source/library/lux/control/concurrency/async.lux
+++ b/stdlib/source/library/lux/control/concurrency/async.lux
@@ -25,8 +25,8 @@
(type: .public (Resolver a)
(-> a (IO Bit)))
+ ... Sets an async's value if it has not been done yet.
(def: (resolver async)
- {#.doc "Sets an async's value if it has not been done yet."}
(All [a] (-> (Async a) (Resolver a)))
(function (resolve value)
(let [async (:representation async)]
@@ -181,14 +181,15 @@
(All [a] (-> (IO a) (Async a)))
(..schedule! 0))
-(def: .public (delayed milli_seconds value)
+(def: .public (after milli_seconds value)
(All [a] (-> Nat a (Async a)))
(..schedule! milli_seconds (io value)))
(def: .public (delay milli_seconds)
(-> Nat (Async Any))
- (..delayed milli_seconds []))
+ (..after milli_seconds []))
-(def: .public (time_out milli_seconds async)
+(def: .public (within milli_seconds async)
(All [a] (-> Nat (Async a) (Async (Maybe a))))
- (..or (..delay milli_seconds) async))
+ (..or (..delay milli_seconds)
+ async))
diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux
index e14fb6505..cb3645138 100644
--- a/stdlib/source/library/lux/control/concurrency/frp.lux
+++ b/stdlib/source/library/lux/control/concurrency/frp.lux
@@ -189,7 +189,7 @@
(#.Some [value ..empty]))
async))
-(def: .public (fold f init channel)
+(def: .public (aggregate f init channel)
(All [a b]
(-> (-> b a (Async a)) a (Channel b)
(Async a)))
@@ -202,9 +202,9 @@
(#.Some [head tail])
(do !
[init' (f head init)]
- (fold f init' tail)))))
+ (aggregate f init' tail)))))
-(def: .public (folds f init channel)
+(def: .public (aggregates f init channel)
(All [a b]
(-> (-> b a (Async a)) a (Channel b)
(Channel a)))
@@ -217,7 +217,7 @@
(#.Some [head tail])
(do !
[init' (f head init)]
- (in (#.Some [init (folds f init' tail)]))))))
+ (in (#.Some [init (aggregates f init' tail)]))))))
(def: .public (poll milli_seconds action)
(All [a]
diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux
index c266617a5..e2cdb2aca 100644
--- a/stdlib/source/library/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux
@@ -52,12 +52,12 @@
(async.async []))]
(exec
(io.run!
- (with_expansions [<had_open_position?> (as_is (get@ #open_positions) (i.> -1))]
+ (with_expansions [<had_open_position?> (as_is (value@ #open_positions) (i.> -1))]
(do io.monad
- [[_ state'] (atom.update! (|>> (update@ #open_positions dec)
+ [[_ state'] (atom.update! (|>> (revised@ #open_positions --)
(if> [<had_open_position?>]
[]
- [(update@ #waiting_list (queue.end sink))]))
+ [(revised@ #waiting_list (queue.end sink))]))
semaphore)]
(with_expansions [<go_ahead> (sink [])
<get_in_line> (in false)]
@@ -76,23 +76,23 @@
(async.future
(do {! io.monad}
[[pre post] (atom.update! (function (_ state)
- (if (i.= (.int (get@ #max_positions state))
- (get@ #open_positions state))
+ (if (i.= (.int (value@ #max_positions state))
+ (value@ #open_positions state))
state
(|> state
- (update@ #open_positions inc)
- (update@ #waiting_list queue.next))))
+ (revised@ #open_positions ++)
+ (revised@ #waiting_list queue.next))))
semaphore)]
(if (same? pre post)
- (in (exception.except ..semaphore_is_maxed_out [(get@ #max_positions pre)]))
+ (in (exception.except ..semaphore_is_maxed_out [(value@ #max_positions pre)]))
(do !
- [_ (case (queue.front (get@ #waiting_list pre))
+ [_ (case (queue.front (value@ #waiting_list pre))
#.None
(in true)
(#.Some sink)
(sink []))]
- (in (#try.Success (get@ #open_positions post)))))))))
+ (in (#try.Success (value@ #open_positions post)))))))))
)
(abstract: .public Mutex
@@ -148,23 +148,23 @@
(if (n.< times step)
(do async.monad
[outcome (..signal! turnstile)]
- (recur (inc step)))
+ (recur (++ step)))
(\ async.monad in []))))
(template [<phase> <update> <goal> <turnstile>]
[(def: (<phase> (^:representation barrier))
(-> Barrier (Async Any))
(do async.monad
- [.let [limit (refinement.value (get@ #limit barrier))
+ [.let [limit (refinement.value (value@ #limit barrier))
goal <goal>
- [_ count] (io.run! (atom.update! <update> (get@ #count barrier)))
+ [_ count] (io.run! (atom.update! <update> (value@ #count barrier)))
reached? (n.= goal count)]]
(if reached?
- (..un_block! (dec limit) (get@ <turnstile> barrier))
- (..wait! (get@ <turnstile> barrier)))))]
+ (..un_block! (-- limit) (value@ <turnstile> barrier))
+ (..wait! (value@ <turnstile> barrier)))))]
- [start! inc limit #start_turnstile]
- [end! dec 0 #end_turnstile]
+ [start! ++ limit #start_turnstile]
+ [end! -- 0 #end_turnstile]
)
(def: .public (block! barrier)
diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux
index e067d1ac5..1011da5bb 100644
--- a/stdlib/source/library/lux/control/concurrency/thread.lux
+++ b/stdlib/source/library/lux/control/concurrency/thread.lux
@@ -143,8 +143,8 @@
(as_is (exception: .public cannot_continue_running_threads)
... https://en.wikipedia.org/wiki/Event_loop
+ ... Starts the event-loop.
(def: .public run!
- {#.doc (example "Starts the event-loop.")}
(IO Any)
(loop [_ []]
(do {! io.monad}
@@ -158,14 +158,14 @@
(do !
[now (\ ! map (|>> instant.millis .nat) instant.now)
.let [[ready pending] (list.partition (function (_ thread)
- (|> (get@ #creation thread)
- (n.+ (get@ #delay thread))
+ (|> (value@ #creation thread)
+ (n.+ (value@ #delay thread))
(n.<= now)))
threads)]
swapped? (atom.compare_and_swap! threads pending ..runner)]
(if swapped?
(do !
- [_ (monad.map ! (|>> (get@ #action) ..execute! io.io) ready)]
+ [_ (monad.map ! (|>> (value@ #action) ..execute! io.io) ready)]
(recur []))
(panic! (exception.error ..cannot_continue_running_threads []))))
))))
diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux
index f89611e19..d957188ea 100644
--- a/stdlib/source/library/lux/control/exception.lux
+++ b/stdlib/source/library/lux/control/exception.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Pure-Lux exception-handling functionality."}
[library
[lux #*
["." macro]
@@ -33,7 +32,7 @@
(def: .public (match? exception error)
(All [e] (-> (Exception e) Text Bit))
- (text.starts_with? (get@ #label exception) error))
+ (text.starts_with? (value@ #label exception) error))
(def: .public (when exception then try)
(All [e a]
@@ -44,7 +43,7 @@
(#//.Success output)
(#//.Failure error)
- (let [reference (get@ #label exception)]
+ (let [reference (value@ #label exception)]
(if (text.starts_with? reference error)
(#//.Success (|> error
(text.clip' (text.size reference))
@@ -64,7 +63,7 @@
(def: .public (error exception message)
(All [e] (-> (Exception e) e Text))
- ((get@ #..constructor exception) message))
+ ((value@ #..constructor exception) message))
(def: .public (except exception message)
(All [e a] (-> (Exception e) e (Try a)))
@@ -91,9 +90,6 @@
)))
(syntax: .public (exception: [[export_policy t_vars [name inputs] body] ..exception])
- {#.doc (example
- ""
- )}
(macro.with_identifiers [g!descriptor]
(do meta.monad
[current_module meta.current_module_name
@@ -102,10 +98,10 @@
(in (list (` (def: (~ export_policy)
(~ g!self)
(All [(~+ (list\map |type_variable|.format t_vars))]
- (..Exception [(~+ (list\map (get@ #|input|.type) inputs))]))
+ (..Exception [(~+ (list\map (value@ #|input|.type) inputs))]))
(let [(~ g!descriptor) (~ (code.text descriptor))]
{#..label (~ g!descriptor)
- #..constructor (function ((~ g!self) [(~+ (list\map (get@ #|input|.binding) inputs))])
+ #..constructor (function ((~ g!self) [(~+ (list\map (value@ #|input|.binding) inputs))])
((~! text\compose) (~ g!descriptor)
(~ (maybe.else (' "") body))))}))))))))
@@ -119,14 +115,14 @@
on_new_line (|> " "
(list.repeated (n.+ (text.size header_separator)
largest_header_size))
- text.joined
+ text.together
(text\compose text.new_line))
on_entry (: (-> [Text Text] Text)
(function (_ [header message])
(let [padding (|> " "
(list.repeated (n.- (text.size header)
largest_header_size))
- text.joined)]
+ text.together)]
(|> message
(text.replaced text.new_line on_new_line)
($_ text\compose padding header header_separator)))))]
@@ -150,7 +146,7 @@
(-> (-> a Text) (List a) Text))
(|> entries
(list\fold (function (_ entry [index next])
- [(inc index)
+ [(++ index)
(#.Item [(n\encode index) (format entry)]
next)])
[0 #.End])
@@ -160,7 +156,7 @@
(def: separator
(let [gap ($_ "lux text concat" text.new_line text.new_line)
- horizontal_line (|> "-" (list.repeated 64) text.joined)]
+ horizontal_line (|> "-" (list.repeated 64) text.together)]
($_ "lux text concat"
gap
horizontal_line
diff --git a/stdlib/source/library/lux/control/function.lux b/stdlib/source/library/lux/control/function.lux
index 865ea6930..11cc82e62 100644
--- a/stdlib/source/library/lux/control/function.lux
+++ b/stdlib/source/library/lux/control/function.lux
@@ -22,7 +22,7 @@
(-> (-> a b c) (-> b a c)))
(function (_ x y) (f y x)))
-(def: .public (apply input function)
+(def: .public (on input function)
(All [i o]
(-> i (-> i o) o))
(function input))
diff --git a/stdlib/source/library/lux/control/function/contract.lux b/stdlib/source/library/lux/control/function/contract.lux
index 0fb706a14..b568a7068 100644
--- a/stdlib/source/library/lux/control/function/contract.lux
+++ b/stdlib/source/library/lux/control/function/contract.lux
@@ -16,7 +16,7 @@
["i" int]]]]])
(template [<name>]
- [(exception: (<name> {condition Code})
+ [(exception: .public (<name> {condition Code})
(exception.report
["Condition" (%.code condition)]))]
@@ -32,11 +32,6 @@
(syntax: .public (pre [test <code>.any
expr <code>.any])
- {#.doc (example "Pre-conditions."
- "Given a test and an expression to run, only runs the expression if the test passes."
- "Otherwise, an error is raised."
- (pre (i.= +4 (i.+ +2 +2))
- (foo +123 +456 +789)))}
(in (list (` (exec
((~! ..assert!) (~ (code.text (exception.error ..pre_condition_failed test)))
(~ test))
@@ -44,12 +39,6 @@
(syntax: .public (post [test <code>.any
expr <code>.any])
- {#.doc (example "Post-conditions."
- "Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate."
- "If the predicate returns #1, returns the value of the expression."
- "Otherwise, an error is raised."
- (post i.even?
- (i.+ +2 +2)))}
(with_identifiers [g!output]
(in (list (` (let [(~ g!output) (~ expr)]
(exec
diff --git a/stdlib/source/library/lux/control/function/memo.lux b/stdlib/source/library/lux/control/function/memo.lux
index ee20672b1..4d89e9778 100644
--- a/stdlib/source/library/lux/control/function/memo.lux
+++ b/stdlib/source/library/lux/control/function/memo.lux
@@ -36,7 +36,6 @@
(Recursive i (State (Dictionary i o) o)))
(def: .public (open memo)
- {#.doc (example "Memoization where the memoized results can be re-used accross invocations.")}
(All [i o]
(:let [Memory (Dictionary i o)]
(-> (Memo i o) (-> [Memory i] [Memory o]))))
@@ -45,8 +44,6 @@
(|> input memo (state.result memory)))))
(def: .public (closed hash memo)
- {#.doc (example "Memoization confined to a single invocation to the function (not counting any subsequent recursive invocations)."
- "Memoized results will be re-used during recursive invocations, but cannot be accessed after the main invocation has ended.")}
(All [i o]
(-> (Hash i) (Memo i o) (-> i o)))
(let [memo (//.mixin (//.with ..memoization (//.of_recursive memo)))
@@ -54,8 +51,6 @@
(|>> memo (state.result empty) product.right)))
(def: .public (none hash memo)
- {#.doc (example "No memoization at all."
- "This is useful as a test control when measuring the effect of using memoization.")}
(All [i o]
(-> (Hash i) (Memo i o) (-> i o)))
(let [memo (//.mixin (//.of_recursive memo))
diff --git a/stdlib/source/library/lux/control/function/mixin.lux b/stdlib/source/library/lux/control/function/mixin.lux
index cdaa35a6c..98009b21d 100644
--- a/stdlib/source/library/lux/control/function/mixin.lux
+++ b/stdlib/source/library/lux/control/function/mixin.lux
@@ -10,23 +10,19 @@
[monad (#+ Monad do)]]]])
(type: .public (Mixin i o)
- {#.doc (example "A function which can be mixed with others to inherit their behavior.")}
(-> (-> i o) (-> i o) (-> i o)))
(def: .public (mixin f)
- {#.doc (example "Given a mixin, produces a normal function.")}
(All [i o] (-> (Mixin i o) (-> i o)))
(function (mix input)
((f mix mix) input)))
(def: .public nothing
- {#.doc (example "A mixin that does nothing and just delegates work to the next mixin.")}
Mixin
(function (_ delegate recur)
delegate))
(def: .public (with parent child)
- {#.doc (example "Produces a new mixin, where the behavior of the child can make use of the behavior of the parent.")}
(All [i o] (-> (Mixin i o) (Mixin i o) (Mixin i o)))
(function (_ delegate recur)
(parent (child delegate recur) recur)))
@@ -38,7 +34,6 @@
(def: compose ..with))
(def: .public (advice when then)
- {#.doc (example "Only apply then mixin when the input meets some criterion.")}
(All [i o] (-> (Predicate i) (Mixin i o) (Mixin i o)))
(function (_ delegate recur input)
(if (when input)
@@ -46,7 +41,6 @@
(delegate input))))
(def: .public (before monad action)
- {#.doc (example "Executes an action before doing the main work.")}
(All [! i o] (-> (Monad !) (-> i (! Any)) (Mixin i (! o))))
(function (_ delegate recur input)
(do monad
@@ -54,7 +48,6 @@
(delegate input))))
(def: .public (after monad action)
- {#.doc (example "Executes an action after doing the main work.")}
(All [! i o] (-> (Monad !) (-> i o (! Any)) (Mixin i (! o))))
(function (_ delegate recur input)
(do monad
@@ -63,11 +56,9 @@
(in output))))
(type: .public (Recursive i o)
- {#.doc (example "An indirectly recursive function.")}
(-> (-> i o) (-> i o)))
(def: .public (of_recursive recursive)
- {#.doc (example "Transform an indirectly recursive function into a mixin.")}
(All [i o] (-> (Recursive i o) (Mixin i o)))
(function (_ delegate recur)
(recursive recur)))
diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux
index fd36ac10b..dd647ce41 100644
--- a/stdlib/source/library/lux/control/function/mutual.lux
+++ b/stdlib/source/library/lux/control/function/mutual.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc (.example "Macros for implementing mutually-recursive functions.")}
[library
[lux (#- Definition let def:)
["." meta]
@@ -42,8 +41,8 @@
(-> (List Code) Code [Code Mutual] Code)
(` (function ((~ g!name) (~ g!context))
(.let [[(~+ context)] (~ g!context)]
- (function (~ (declaration.format (get@ #declaration mutual)))
- (~ (get@ #body mutual)))))))
+ (function (~ (declaration.format (value@ #declaration mutual)))
+ (~ (value@ #body mutual)))))))
(.def: (macro g!context g!self)
(-> Code Code Macro)
@@ -54,29 +53,15 @@
(syntax: .public (let [functions (<code>.tuple (<>.some ..mutual))
body <code>.any])
- {#.doc (example "Locally-defined mutually-recursive functions."
- (let [(even? number)
- (-> Nat Bit)
- (case number
- 0 true
- _ (odd? (dec number)))
-
- (odd? number)
- (-> Nat Bit)
- (case number
- 0 false
- _ (even? (dec number)))]
- (and (even? 4)
- (odd? 5))))}
(case functions
#.End
(in (list body))
(#.Item mutual #.End)
- (.let [g!name (|> mutual (get@ [#declaration #declaration.name]) code.local_identifier)]
- (in (list (` (.let [(~ g!name) (: (~ (get@ #type mutual))
- (function (~ (declaration.format (get@ #declaration mutual)))
- (~ (get@ #body mutual))))]
+ (.let [g!name (|> mutual (value@ [#declaration #declaration.name]) code.local_identifier)]
+ (in (list (` (.let [(~ g!name) (: (~ (value@ #type mutual))
+ (function (~ (declaration.format (value@ #declaration mutual)))
+ (~ (value@ #body mutual))))]
(~ body))))))
_
@@ -89,12 +74,12 @@
(list.zipped/2 hidden_names
functions))
context_types (list\map (function (_ mutual)
- (` (-> (~ g!context) (~ (get@ #type mutual)))))
+ (` (-> (~ g!context) (~ (value@ #type mutual)))))
functions)
- user_names (list\map (|>> (get@ [#declaration #declaration.name]) code.local_identifier)
+ user_names (list\map (|>> (value@ [#declaration #declaration.name]) code.local_identifier)
functions)]
g!pop (local.push (list\map (function (_ [g!name mutual])
- [[here_name (get@ [#declaration #declaration.name] mutual)]
+ [[here_name (value@ [#declaration #declaration.name] mutual)]
(..macro g!context g!name)])
(list.zipped/2 hidden_names
functions)))]
@@ -119,19 +104,6 @@
(<>.and (<>\in (` .private)) ..mutual))))
(syntax: .public (def: [functions (<>.many ..definition)])
- {#.doc (example "Globally-defined mutually-recursive functions."
- (def:
- [.public (even? number)
- (-> Nat Bit)
- (case number
- 0 true
- _ (odd? (dec number)))]
-
- [.public (odd? number)
- (-> Nat Bit)
- (case number
- 0 false
- _ (even? (dec number)))]))}
(case functions
#.End
(in (list))
@@ -151,19 +123,19 @@
functions)
.let [definitions (list\map (..mutual_definition hidden_names g!context)
(list.zipped/2 hidden_names
- (list\map (get@ #mutual) functions)))
+ (list\map (value@ #mutual) functions)))
context_types (list\map (function (_ mutual)
- (` (-> (~ g!context) (~ (get@ [#mutual #type] mutual)))))
+ (` (-> (~ g!context) (~ (value@ [#mutual #type] mutual)))))
functions)
- user_names (list\map (|>> (get@ [#mutual #declaration #declaration.name]) code.local_identifier)
+ user_names (list\map (|>> (value@ [#mutual #declaration #declaration.name]) code.local_identifier)
functions)]
g!pop (local.push (list\map (function (_ [g!name mutual])
- [[here_name (get@ [#mutual #declaration #declaration.name] mutual)]
+ [[here_name (value@ [#mutual #declaration #declaration.name] mutual)]
(..macro g!context g!name)])
(list.zipped/2 hidden_names
functions)))]
(in (list& (` (.def: (~ g!context)
- [(~+ (list\map (get@ [#mutual #type]) functions))]
+ [(~+ (list\map (value@ [#mutual #type]) functions))]
(.let [(~ g!context) (: (Rec (~ g!context)
[(~+ context_types)])
[(~+ definitions)])
@@ -173,11 +145,11 @@
user_names))])))
g!pop
(list\map (function (_ mutual)
- (.let [g!name (|> mutual (get@ [#mutual #declaration #declaration.name]) code.local_identifier)]
+ (.let [g!name (|> mutual (value@ [#mutual #declaration #declaration.name]) code.local_identifier)]
(` (.def:
- (~ (get@ #export_policy mutual))
+ (~ (value@ #export_policy mutual))
(~ g!name)
- (~ (get@ [#mutual #type] mutual))
+ (~ (value@ [#mutual #type] mutual))
(.let [[(~+ user_names)] (~ g!context)]
(~ g!name))))))
functions)))))))
diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux
index 1b3b58f7b..125ebfb67 100644
--- a/stdlib/source/library/lux/control/io.lux
+++ b/stdlib/source/library/lux/control/io.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "A method for abstracting I/O and effectful computations to make it safe while writing pure functional code."}
[library
[lux #*
[abstract
diff --git a/stdlib/source/library/lux/control/maybe.lux b/stdlib/source/library/lux/control/maybe.lux
index 74b5f06d2..7dcf84574 100644
--- a/stdlib/source/library/lux/control/maybe.lux
+++ b/stdlib/source/library/lux/control/maybe.lux
@@ -97,7 +97,8 @@
(All [M] (-> (Monad M) (Monad (All [a] (M (Maybe a))))))
(def: &functor
- (functor.composite (get@ #monad.&functor monad) ..functor))
+ (functor.composite (value@ #monad.&functor monad)
+ ..functor))
(def: in (|>> (\ ..monad in) (\ monad in)))
diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux
index f4e304045..6d3246295 100644
--- a/stdlib/source/library/lux/control/parser.lux
+++ b/stdlib/source/library/lux/control/parser.lux
@@ -17,7 +17,6 @@
["n" nat]]]]])
(type: .public (Parser s a)
- {#.doc "A generic parser."}
(-> s (Try [s a])))
(implementation: .public functor
@@ -70,7 +69,6 @@
(ma input')))))
(def: .public (assertion message test)
- {#.doc "Fails with the given message if the test is #0."}
(All [s] (-> Text Bit (Parser s Any)))
(function (_ input)
(if test
@@ -78,7 +76,6 @@
(#try.Failure message))))
(def: .public (maybe parser)
- {#.doc "Optionality combinator."}
(All [s a]
(-> (Parser s a) (Parser s (Maybe a))))
(function (_ input)
@@ -90,15 +87,11 @@
(#try.Success [input' (#.Some x)]))))
(def: .public (result parser input)
- {#.doc (example "Executes the parser on the input."
- "Does not verify that all of the input has been consumed by the parser."
- "Returns both the parser's output, and a value that represents the remaining input.")}
(All [s a]
(-> (Parser s a) s (Try [s a])))
(parser input))
(def: .public (and first second)
- {#.doc "Sequencing combinator."}
(All [s a b]
(-> (Parser s a) (Parser s b) (Parser s [a b])))
(do {! ..monad}
@@ -106,7 +99,6 @@
(\ ! map (|>> [head]) second)))
(def: .public (or left right)
- {#.doc "Heterogeneous alternative combinator."}
(All [s a b]
(-> (Parser s a) (Parser s b) (Parser s (Or a b))))
(function (_ tokens)
@@ -123,7 +115,6 @@
(#try.Failure error)))))
(def: .public (either this that)
- {#.doc "Homogeneous alternative combinator."}
(All [s a]
(-> (Parser s a) (Parser s a) (Parser s a)))
(function (_ tokens)
@@ -135,7 +126,6 @@
output)))
(def: .public (some parser)
- {#.doc "0-or-more combinator."}
(All [s a]
(-> (Parser s a) (Parser s (List a))))
(function (_ input)
@@ -149,7 +139,6 @@
input'))))
(def: .public (many parser)
- {#.doc "1-or-more combinator."}
(All [s a]
(-> (Parser s a) (Parser s (List a))))
(|> (..some parser)
@@ -157,25 +146,22 @@
(\ ..monad map (|>> #.Item))))
(def: .public (exactly amount parser)
- {#.doc "Parse exactly N times."}
(All [s a] (-> Nat (Parser s a) (Parser s (List a))))
(case amount
0 (\ ..monad in (list))
_ (do {! ..monad}
[x parser]
(|> parser
- (exactly (dec amount))
+ (exactly (-- amount))
(\ ! map (|>> (#.Item x)))))))
(def: .public (at_least amount parser)
- {#.doc "Parse at least N times."}
(All [s a] (-> Nat (Parser s a) (Parser s (List a))))
(do {! ..monad}
[minimum (..exactly amount parser)]
(\ ! map (list\compose minimum) (..some parser))))
(def: .public (at_most amount parser)
- {#.doc "Parse at most N times."}
(All [s a] (-> Nat (Parser s a) (Parser s (List a))))
(case amount
0 (\ ..monad in (list))
@@ -186,7 +172,7 @@
(#try.Success [input' x])
(..result (\ ..monad map (|>> (#.Item x))
- (at_most (dec amount) parser))
+ (at_most (-- amount) parser))
input')))))
(def: .public (between minimum additional parser)
@@ -199,7 +185,6 @@
(..at_most additional parser)))))
(def: .public (separated_by separator parser)
- {#.doc "Parses instances of 'parser' that are separated by instances of 'separator'."}
(All [s a b] (-> (Parser s b) (Parser s a) (Parser s (List a))))
(do {! ..monad}
[?x (..maybe parser)]
@@ -214,7 +199,6 @@
(\ ! map (|>> (list\map product.right) (#.Item x)))))))
(def: .public (not parser)
- {#.doc (example "Only succeeds when the underlying parser fails.")}
(All [s a] (-> (Parser s a) (Parser s Any)))
(function (_ input)
(case (parser input)
@@ -225,13 +209,11 @@
(#try.Failure "Expected to fail; yet succeeded."))))
(def: .public (failure message)
- {#.doc (example "Always fail with this 'message'.")}
(All [s a] (-> Text (Parser s a)))
(function (_ input)
(#try.Failure message)))
(def: .public (lifted operation)
- {#.doc (example "Lift a potentially failed computation into a parser.")}
(All [s a] (-> (Try a) (Parser s a)))
(function (_ input)
(case operation
@@ -242,7 +224,6 @@
(#try.Failure error))))
(def: .public (else value parser)
- {#.doc "If the given parser fails, returns the default value."}
(All [s a] (-> a (Parser s a) (Parser s a)))
(function (_ input)
(case (parser input)
@@ -253,26 +234,22 @@
(#try.Success [input' output]))))
(def: .public remaining
- {#.doc (example "Yield the remaining input (without consuming it).")}
(All [s] (Parser s s))
(function (_ inputs)
(#try.Success [inputs inputs])))
(def: .public (rec parser)
- {#.doc "Combinator for recursive parsers."}
(All [s a] (-> (-> (Parser s a) (Parser s a)) (Parser s a)))
(function (_ inputs)
(..result (parser (rec parser)) inputs)))
(def: .public (after param subject)
- {#.doc (example "Run the parser after another one (whose output is ignored).")}
(All [s _ a] (-> (Parser s _) (Parser s a) (Parser s a)))
(do ..monad
[_ param]
subject))
(def: .public (before param subject)
- {#.doc (example "Run the parser before another one (whose output is ignored).")}
(All [s _ a] (-> (Parser s _) (Parser s a) (Parser s a)))
(do ..monad
[output subject
@@ -280,7 +257,6 @@
(in output)))
(def: .public (only test parser)
- {#.doc (example "Only succeed when the parser's output passes a test.")}
(All [s a] (-> (-> a Bit) (Parser s a) (Parser s a)))
(do ..monad
[output parser
@@ -288,7 +264,6 @@
(in output)))
(def: .public (parses? parser)
- {#.doc (example "Ignore a parser's output and just verify that it succeeds.")}
(All [s a] (-> (Parser s a) (Parser s Bit)))
(function (_ input)
(case (parser input)
@@ -299,7 +274,6 @@
(#try.Success [input' true]))))
(def: .public (parses parser)
- {#.doc (example "Ignore a parser's output and just execute it.")}
(All [s a] (-> (Parser s a) (Parser s Any)))
(function (_ input)
(case (parser input)
@@ -310,8 +284,6 @@
(#try.Success [input' []]))))
(def: .public (speculative parser)
- {#.doc (example "Executes a parser, without actually consuming the input."
- "That way, the same input can be consumed again by another parser.")}
(All [s a] (-> (Parser s a) (Parser s a)))
(function (_ input)
(case (parser input)
@@ -322,7 +294,6 @@
output)))
(def: .public (codec codec parser)
- {#.doc (example "Decode the output of a parser using a codec.")}
(All [s a z] (-> (Codec a z) (Parser s a) (Parser s z)))
(function (_ input)
(case (parser input)
diff --git a/stdlib/source/library/lux/control/parser/analysis.lux b/stdlib/source/library/lux/control/parser/analysis.lux
index fb32f4608..42bffc310 100644
--- a/stdlib/source/library/lux/control/parser/analysis.lux
+++ b/stdlib/source/library/lux/control/parser/analysis.lux
@@ -48,11 +48,9 @@
["Input" (exception.listing /.%analysis input)]))
(type: .public Parser
- {#.doc (example "A parser for Lux code analysis nodes.")}
(//.Parser (List Analysis)))
(def: .public (result parser input)
- {#.doc (example "Executes a parser and makes sure no inputs go unconsumed.")}
(All [a] (-> (Parser a) (List Analysis) (Try a)))
(case (parser input)
(#try.Failure error)
@@ -65,7 +63,6 @@
(exception.except ..unconsumed_input unconsumed)))
(def: .public any
- {#.doc (example "Matches any value, without discrimination.")}
(Parser Analysis)
(function (_ input)
(case input
@@ -76,7 +73,6 @@
(#try.Success [tail head]))))
(def: .public end!
- {#.doc "Ensures there are no more inputs."}
(Parser Any)
(function (_ tokens)
(case tokens
@@ -85,7 +81,6 @@
(remaining_inputs tokens))))))
(def: .public end?
- {#.doc "Checks whether there are no more inputs."}
(Parser Bit)
(function (_ tokens)
(#try.Success [tokens (case tokens
@@ -94,7 +89,6 @@
(template [<query> <assertion> <tag> <type> <eq>]
[(`` (as_is (def: .public <query>
- {#.doc (example (~~ (template.text ["Queries for a " <query> " value."])))}
(Parser <type>)
(function (_ input)
(case input
@@ -105,7 +99,6 @@
(exception.except ..cannot_parse input))))
(def: .public (<assertion> expected)
- {#.doc (example (~~ (template.text ["Assert a specific " <query> " value."])))}
(-> <type> (Parser Any))
(function (_ input)
(case input
@@ -129,7 +122,6 @@
)
(def: .public (tuple parser)
- {#.doc (example "Parses only within the context of a tuple's contents.")}
(All [a] (-> (Parser a) (Parser a)))
(function (_ input)
(case input
diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux
index d2d195888..ec251b304 100644
--- a/stdlib/source/library/lux/control/parser/binary.lux
+++ b/stdlib/source/library/lux/control/parser/binary.lux
@@ -27,11 +27,9 @@
["." // ("#\." monad)])
(type: .public Offset
- {#.doc (example "An offset for reading within binary data.")}
Nat)
(type: .public Parser
- {#.doc (example "A parser for raw binary data.")}
(//.Parser [Offset Binary]))
(exception: .public (binary_was_not_fully_read {binary_length Nat} {bytes_read Nat})
@@ -40,7 +38,6 @@
["Bytes read" (%.nat bytes_read)]))
(def: .public (result parser input)
- {#.doc (example "Runs a parser and checks that all the binary data was read by it.")}
(All [a] (-> (Parser a) Binary (Try a)))
(case (parser [0 input])
(#try.Failure msg)
@@ -53,25 +50,21 @@
(exception.except ..binary_was_not_fully_read [length end])))))
(def: .public end?
- {#.doc (example "Checks whether there is no more data to read.")}
(Parser Bit)
(function (_ (^@ input [offset data]))
(#try.Success [input (n.= offset (/.size data))])))
(def: .public offset
- {#.doc (example "The current offset (i.e. how much data has been read).")}
(Parser Offset)
(function (_ (^@ input [offset data]))
(#try.Success [input offset])))
(def: .public remaining
- {#.doc (example "How much of the data remains to be read.")}
(Parser Nat)
(function (_ (^@ input [offset data]))
(#try.Success [input (n.- offset (/.size data))])))
(type: .public Size
- {#.doc (example "The size of a chunk of data within a binary array.")}
Nat)
(def: .public size/8 Size 1)
@@ -129,14 +122,12 @@
[1 #.Right right]]))
(def: .public (rec body)
- {#.doc (example "Tie the knot for a recursive parser.")}
(All [a] (-> (-> (Parser a) (Parser a)) (Parser a)))
(function (_ input)
(let [parser (body (rec body))]
(parser input))))
(def: .public any
- {#.doc (example "Does no parsing, and just returns a dummy value.")}
(Parser Any)
(//\in []))
@@ -156,7 +147,6 @@
_ (//.lifted (exception.except ..not_a_bit [value])))))
(def: .public (segment size)
- {#.doc (example "Parses a chunk of data of a given size.")}
(-> Nat (Parser Binary))
(function (_ [offset binary])
(case size
@@ -167,7 +157,6 @@
(template [<size> <name> <bits>]
[(`` (def: .public <name>
- {#.doc (example (~~ (template.text ["Parses a block of data prefixed with a size that is " <size> " bytes long."])))}
(Parser Binary)
(do //.monad
[size (//\map .nat <bits>)]
@@ -181,7 +170,6 @@
(template [<size> <name> <binary>]
[(`` (def: .public <name>
- {#.doc (example (~~ (template.text ["Parses a block of (UTF-8 encoded) text prefixed with a size that is " <size> " bytes long."])))}
(Parser Text)
(do //.monad
[utf8 <binary>]
@@ -197,7 +185,6 @@
(template [<size> <name> <bits>]
[(def: .public (<name> valueP)
- {#.doc (example (~~ (template.text ["Parses a row of values prefixed with a size that is " <size> " bytes long."])))}
(All [v] (-> (Parser v) (Parser (Row v))))
(do //.monad
[amount (: (Parser Nat)
@@ -212,8 +199,8 @@
(if (n.< amount index)
(do //.monad
[value valueP]
- (recur (.inc index)
- (row.add value output)))
+ (recur (.++ index)
+ (row.suffix value output)))
(//\in output)))))]
[08 row/8 ..bits/8]
@@ -227,7 +214,6 @@
(..or ..any))
(def: .public (list value)
- {#.doc (example "Parses an arbitrarily long list of values.")}
(All [a] (-> (Parser a) (Parser (List a))))
(..rec
(|>> (//.and value)
diff --git a/stdlib/source/library/lux/control/parser/cli.lux b/stdlib/source/library/lux/control/parser/cli.lux
index 3dd50a349..d9b4928ab 100644
--- a/stdlib/source/library/lux/control/parser/cli.lux
+++ b/stdlib/source/library/lux/control/parser/cli.lux
@@ -11,11 +11,9 @@
["." //])
(type: .public (Parser a)
- {#.doc "A command-line interface parser."}
(//.Parser (List Text) a))
(def: .public (result parser inputs)
- {#.doc (example "Executes the parser and verifies that all inputs are processed.")}
(All [a] (-> (Parser a) (List Text) (Try a)))
(case (//.result parser inputs)
(#try.Success [remaining output])
@@ -30,7 +28,6 @@
(#try.Failure try)))
(def: .public any
- {#.doc "Just returns the next input without applying any logic."}
(Parser Text)
(function (_ inputs)
(case inputs
@@ -41,7 +38,6 @@
(#try.Failure "Cannot parse empty arguments."))))
(def: .public (parse parser)
- {#.doc "Parses the next input with a parsing function."}
(All [a] (-> (-> Text (Try a)) (Parser a)))
(function (_ inputs)
(do try.monad
@@ -50,7 +46,6 @@
(in [remaining output]))))
(def: .public (this reference)
- {#.doc "Checks that a token is in the inputs."}
(-> Text (Parser Any))
(function (_ inputs)
(do try.monad
@@ -60,7 +55,6 @@
(#try.Failure (format "Missing token: '" reference "'"))))))
(def: .public (somewhere cli)
- {#.doc "Given a parser, tries to parse it somewhere in the inputs (i.e. not necessarily parsing the immediate inputs)."}
(All [a] (-> (Parser a) (Parser a)))
(function (_ inputs)
(loop [immediate inputs]
@@ -80,7 +74,6 @@
output])))))))
(def: .public end
- {#.doc "Ensures there are no more inputs."}
(Parser Any)
(function (_ inputs)
(case inputs
@@ -88,14 +81,12 @@
_ (#try.Failure (format "Unknown parameters: " (text.interposed " " inputs))))))
(def: .public (named name value)
- {#.doc (example "Parses a named parameter and yields its value.")}
(All [a] (-> Text (Parser a) (Parser a)))
(|> value
(//.after (..this name))
..somewhere))
(def: .public (parameter [short long] value)
- {#.doc (example "Parses a parameter that can have either a short or a long name.")}
(All [a] (-> [Text Text] (Parser a) (Parser a)))
(|> value
(//.after (//.either (..this short) (..this long)))
diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux
index 93a2f65d9..1a3bbc5a7 100644
--- a/stdlib/source/library/lux/control/parser/code.lux
+++ b/stdlib/source/library/lux/control/parser/code.lux
@@ -28,7 +28,6 @@
(#.Item [[x y] pairs']) (list& x y (un_paired pairs'))))
(type: .public Parser
- {#.doc "A Lux code parser."}
(//.Parser (List Code)))
(def: remaining_inputs
@@ -38,7 +37,6 @@
($_ text\compose text.new_line "Remaining input: ")))
(def: .public any
- {#.doc "Yields the next input without applying any logic."}
(Parser Code)
(function (_ tokens)
(case tokens
@@ -51,7 +49,6 @@
(template [<query> <check> <type> <tag> <eq> <desc>]
[(with_expansions [<failure> (as_is (#try.Failure ($_ text\compose "Cannot parse " <desc> (remaining_inputs tokens))))]
(def: .public <query>
- {#.doc (code.text ($_ text\compose "Parses the next " <desc> " input."))}
(Parser <type>)
(function (_ tokens)
(case tokens
@@ -62,7 +59,6 @@
<failure>)))
(def: .public (<check> expected)
- {#.doc (code.text ($_ text\compose "Checks for a specific " <desc> " input."))}
(-> <type> (Parser Any))
(function (_ tokens)
(case tokens
@@ -85,7 +81,6 @@
)
(def: .public (this! code)
- {#.doc "Ensures the given Code is the next input."}
(-> Code (Parser Any))
(function (_ tokens)
(case tokens
@@ -101,7 +96,6 @@
(template [<query> <check> <tag> <eq> <desc>]
[(with_expansions [<failure> (as_is (#try.Failure ($_ text\compose "Cannot parse " <desc> (remaining_inputs tokens))))]
(def: .public <query>
- {#.doc (code.text ($_ text\compose "Parse a local " <desc> " (a " <desc> " that has no module prefix)."))}
(Parser Text)
(function (_ tokens)
(case tokens
@@ -112,7 +106,6 @@
<failure>)))
(def: .public (<check> expected)
- {#.doc (code.text ($_ text\compose "Checks for a specific local " <desc> " (a " <desc> " that has no module prefix)."))}
(-> Text (Parser Any))
(function (_ tokens)
(case tokens
@@ -130,7 +123,6 @@
(template [<name> <tag> <desc>]
[(def: .public (<name> p)
- {#.doc (code.text ($_ text\compose "Parses the contents of a " <desc> "."))}
(All [a]
(-> (Parser a) (Parser a)))
(function (_ tokens)
@@ -148,7 +140,6 @@
)
(def: .public (record p)
- {#.doc "Parses the contents of a record."}
(All [a]
(-> (Parser a) (Parser a)))
(function (_ tokens)
@@ -162,7 +153,6 @@
(#try.Failure ($_ text\compose "Cannot parse record" (remaining_inputs tokens))))))
(def: .public end!
- {#.doc "Verifies there are no more inputs."}
(Parser Any)
(function (_ tokens)
(case tokens
@@ -170,7 +160,6 @@
_ (#try.Failure ($_ text\compose "Expected list of tokens to be empty!" (remaining_inputs tokens))))))
(def: .public end?
- {#.doc "Checks whether there are no more inputs."}
(Parser Bit)
(function (_ tokens)
(#try.Success [tokens (case tokens
@@ -178,7 +167,6 @@
_ false)])))
(def: .public (result parser inputs)
- {#.doc (example "Executes a parser against a stream of code, and verifies all the inputs are consumed.")}
(All [a] (-> (Parser a) (List Code) (Try a)))
(case (parser inputs)
(#try.Failure error)
@@ -196,7 +184,6 @@
(text\compose "Unconsumed inputs: "))))))
(def: .public (local inputs parser)
- {#.doc "Runs parser against the given list of inputs."}
(All [a] (-> (List Code) (Parser a) (Parser a)))
(function (_ real)
(do try.monad
diff --git a/stdlib/source/library/lux/control/parser/environment.lux b/stdlib/source/library/lux/control/parser/environment.lux
index e12febdf3..f084a838d 100644
--- a/stdlib/source/library/lux/control/parser/environment.lux
+++ b/stdlib/source/library/lux/control/parser/environment.lux
@@ -13,11 +13,9 @@
["." //])
(type: .public Property
- {#.doc (example "A property in the environment.")}
Text)
(type: .public Environment
- {#.doc (example "An abstraction for environment variables of a program.")}
(Dictionary Property Text))
(exception: .public (unknown_property {property Property})
@@ -25,11 +23,9 @@
["Property" (%.text property)]))
(type: .public (Parser a)
- {#.doc (example "A parser of environment variables of a program.")}
(//.Parser Environment a))
(def: .public empty
- {#.doc (example "An empty environment.")}
Environment
(dictionary.empty text.hash))
@@ -44,7 +40,5 @@
(exception.except ..unknown_property [name]))))
(def: .public (result parser environment)
- {#.doc (example "Executes a parser against the given environment variables."
- "Does not check whether all environment variables were parsed, since they're usually an open set.")}
(All [a] (-> (Parser a) Environment (Try a)))
(\ try.monad map product.right (parser environment)))
diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux
index 51c3cc2bf..65569ff9e 100644
--- a/stdlib/source/library/lux/control/parser/json.lux
+++ b/stdlib/source/library/lux/control/parser/json.lux
@@ -159,7 +159,7 @@
dictionary.entries
(list\map (function (_ [key value])
(list (#/.String key) value)))
- list.joined
+ list.together
(//.result parser))
(#try.Failure error)
(//.failure error)
diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux
index fb2c59128..46ed6e987 100644
--- a/stdlib/source/library/lux/control/parser/text.lux
+++ b/stdlib/source/library/lux/control/parser/text.lux
@@ -302,7 +302,7 @@
[(def: .public (<name> parser)
{#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " characters as a single continuous text (as a slice)."))}
(-> (Parser Text) (Parser Text))
- (|> parser <base> (\ //.monad map /.joined)))]
+ (|> parser <base> (\ //.monad map /.together)))]
[some //.some "some"]
[many //.many "many"]
@@ -324,7 +324,7 @@
(-> Nat (Parser Text) (Parser Text))
(|> parser
(<base> amount)
- (\ //.monad map /.joined)))]
+ (\ //.monad map /.together)))]
[exactly //.exactly "exactly"]
[at_most //.at_most "at most"]
@@ -347,7 +347,7 @@
(-> Nat Nat (Parser Text) (Parser Text))
(|> parser
(//.between minimum additional)
- (\ //.monad map /.joined)))
+ (\ //.monad map /.together)))
(def: .public (between! minimum additional parser)
(-> Nat Nat (Parser Slice) (Parser Slice))
diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux
index 8016080b5..e6ea2b3dd 100644
--- a/stdlib/source/library/lux/control/parser/type.lux
+++ b/stdlib/source/library/lux/control/parser/type.lux
@@ -197,19 +197,19 @@
all_varsL (: (List Code) (list))]
(if (n.< num_args current_arg)
(if (n.= 0 current_arg)
- (let [varL (label (inc funcI))]
- (recur (inc current_arg)
+ (let [varL (label (++ funcI))]
+ (recur (++ current_arg)
(|> env'
(dictionary.has funcI [headT funcL])
- (dictionary.has (inc funcI) [(#.Parameter (inc funcI)) varL]))
+ (dictionary.has (++ funcI) [(#.Parameter (++ funcI)) varL]))
(#.Item varL all_varsL)))
(let [partialI (|> current_arg (n.* 2) (n.+ funcI))
- partial_varI (inc partialI)
+ partial_varI (++ partialI)
partial_varL (label partial_varI)
partialC (` ((~ funcL) (~+ (|> (list.indices num_args)
- (list\map (|>> (n.* 2) inc (n.+ funcI) label))
+ (list\map (|>> (n.* 2) ++ (n.+ funcI) label))
list.reversed))))]
- (recur (inc current_arg)
+ (recur (++ current_arg)
(|> env'
(dictionary.has partialI [.Nothing partialC])
(dictionary.has partial_varI [(#.Parameter partial_varI) partial_varL]))
@@ -265,7 +265,7 @@
(let [env_level (n./ 2 (dictionary.size env))
parameter_level (n./ 2 idx)
parameter_idx (n.% 2 idx)]
- (|> env_level dec (n.- parameter_level) (n.* 2) (n.+ parameter_idx))))
+ (|> env_level -- (n.- parameter_level) (n.* 2) (n.+ parameter_idx))))
(def: .public parameter
(Parser Code)
diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux
index 66d3f2a06..b194d6749 100644
--- a/stdlib/source/library/lux/control/pipe.lux
+++ b/stdlib/source/library/lux/control/pipe.lux
@@ -27,21 +27,11 @@
(syntax: .public (new> [start <code>.any
body body^
prev <code>.any])
- {#.doc (example "Ignores the piped argument, and begins a new pipe."
- (n.= 1
- (|> 20
- (n.* 3)
- (n.+ 4)
- (new> 0 [inc]))))}
(in (list (` (|> (~ start) (~+ body))))))
(syntax: .public (let> [binding <code>.any
body <code>.any
prev <code>.any])
- {#.doc (example "Gives a name to the piped-argument, within the given expression."
- (n.= 10
- (|> 5
- (let> x (n.+ x x)))))}
(in (list (` (let [(~ binding) (~ prev)]
(~ body))))))
@@ -55,12 +45,6 @@
else body^
_ _reversed_
branches (<>.some (<>.and body^ body^))])
- {#.doc (example "Branching for pipes."
- "Both the tests and the bodies are piped-code, and must be given inside a tuple."
- (|> +5
- (cond> [i.even?] [(i.* +2)]
- [i.odd?] [(i.* +3)]
- [(new> -1 [])])))}
(with_identifiers [g!temp]
(in (list (` (let [(~ g!temp) (~ prev)]
(cond (~+ (do list.monad
@@ -73,14 +57,6 @@
then body^
else body^
prev <code>.any])
- {#.doc (example "If-branching."
- (same? (if (n.even? sample)
- "even"
- "odd")
- (|> sample
- (if> [n.even?]
- [(new> "even" [])]
- [(new> "odd" [])]))))}
(in (list (` (cond> [(~+ test)] [(~+ then)]
[(~+ else)]
(~ prev))))))
@@ -88,13 +64,6 @@
(syntax: .public (when> [test body^
then body^
prev <code>.any])
- {#.doc (example "Only execute the body when the test passes."
- (same? (if (n.even? sample)
- (n.* 2 sample)
- sample)
- (|> sample
- (when> [n.even?]
- [(n.* 2)]))))}
(in (list (` (cond> [(~+ test)] [(~+ then)]
[]
(~ prev))))))
@@ -102,11 +71,6 @@
(syntax: .public (loop> [test body^
then body^
prev <code>.any])
- {#.doc (example "Loops for pipes."
- "Both the testing and calculating steps are pipes and must be given inside tuples."
- (|> +1
- (loop> [(i.< +10)]
- [inc])))}
(with_identifiers [g!temp]
(in (list (` (loop [(~ g!temp) (~ prev)]
(if (|> (~ g!temp) (~+ test))
@@ -116,13 +80,6 @@
(syntax: .public (do> [monad <code>.any
steps (<>.some body^)
prev <code>.any])
- {#.doc (example "Monadic pipes."
- "Each steps in the monadic computation is a pipe and must be given inside a tuple."
- (|> +5
- (do> identity.monad
- [(i.* +3)]
- [(i.+ +4)]
- [inc])))}
(with_identifiers [g!temp]
(case (list.reversed steps)
(^ (list& last_step prev_steps))
@@ -139,11 +96,6 @@
(syntax: .public (exec> [body body^
prev <code>.any])
- {#.doc (example "Non-updating pipes."
- "Will generate piped computations, but their results will not be used in the larger scope."
- (|> +5
- (exec> [.nat %n log!])
- (i.* +10)))}
(with_identifiers [g!temp]
(in (list (` (let [(~ g!temp) (~ prev)]
(exec (|> (~ g!temp) (~+ body))
@@ -151,13 +103,6 @@
(syntax: .public (tuple> [paths (<>.many body^)
prev <code>.any])
- {#.doc (example "Parallel branching for pipes."
- "Allows to run multiple pipelines for a value and gives you a tuple of the outputs."
- (|> +5
- (tuple> [(i.* +10)]
- [dec (i./ +2)]
- [Int/encode]))
- "Will become: [+50 +2 '+5']")}
(with_identifiers [g!temp]
(in (list (` (let [(~ g!temp) (~ prev)]
[(~+ (list\map (function (_ body) (` (|> (~ g!temp) (~+ body))))
@@ -165,20 +110,6 @@
(syntax: .public (case> [branches (<>.many (<>.and <code>.any <code>.any))
prev <code>.any])
- {#.doc (example "Pattern-matching for pipes."
- "The bodies of each branch are NOT pipes; just regular values."
- (|> +5
- (case> +0 "zero"
- +1 "one"
- +2 "two"
- +3 "three"
- +4 "four"
- +5 "five"
- +6 "six"
- +7 "seven"
- +8 "eight"
- +9 "nine"
- _ "???")))}
(in (list (` (case (~ prev)
(~+ (list\join (list\map (function (_ [pattern body]) (list pattern body))
branches))))))))
diff --git a/stdlib/source/library/lux/control/reader.lux b/stdlib/source/library/lux/control/reader.lux
index 09fcd2058..e1ffffd7b 100644
--- a/stdlib/source/library/lux/control/reader.lux
+++ b/stdlib/source/library/lux/control/reader.lux
@@ -7,21 +7,17 @@
["." monad (#+ Monad do)]]]])
(type: .public (Reader r a)
- {#.doc "Computations that have access to some environmental value."}
(-> r a))
(def: .public read
- {#.doc "Get the environment."}
(All [r] (Reader r r))
(function (_ env) env))
(def: .public (local change proc)
- {#.doc "Run computation with a locally-modified environment."}
(All [r a] (-> (-> r r) (Reader r a) (Reader r a)))
(|>> change proc))
(def: .public (result env proc)
- {#.doc "Executes the reader against the given environment."}
(All [r a] (-> r (Reader r a) a))
(proc env))
@@ -54,11 +50,10 @@
(mma env env))))
(implementation: .public (with monad)
- {#.doc "Monad transformer for Reader."}
(All [M] (-> (Monad M) (All [e] (Monad (All [a] (Reader e (M a)))))))
(def: &functor
- (functor.composite ..functor (get@ #monad.&functor monad)))
+ (functor.composite ..functor (value@ #monad.&functor monad)))
(def: in
(|>> (\ monad in) (\ ..monad in)))
@@ -70,6 +65,5 @@
(result env eMa)))))
(def: .public lifted
- {#.doc "Lift monadic values to the Reader wrapper."}
(All [M e a] (-> (M a) (Reader e (M a))))
(\ ..monad in))
diff --git a/stdlib/source/library/lux/control/region.lux b/stdlib/source/library/lux/control/region.lux
index 191c6a328..9d9f579c0 100644
--- a/stdlib/source/library/lux/control/region.lux
+++ b/stdlib/source/library/lux/control/region.lux
@@ -19,8 +19,6 @@
(-> r (! (Try Any))))
(type: .public (Region r ! a)
- {#.doc (example "A region where resources may be be claimed and where a side-effecting computation may be performed."
- "Every resource is paired with a function that knows how to clean/reclaim it, to make sure there are no leaks.")}
(-> [r (List (Cleaner r !))]
(! [(List (Cleaner r !))
(Try a)])))
@@ -54,7 +52,6 @@
(exception.except ..clean_up_error [error output])))
(def: .public (run! monad computation)
- {#.doc (example "Executes a region-based computation, with a side-effect determined by the monad.")}
(All [! a]
(-> (Monad !) (All [r] (Region r ! a))
(! (Try a))))
@@ -65,7 +62,6 @@
(\ ! map (list\fold clean output)))))
(def: .public (acquire! monad cleaner value)
- {#.doc (example "Acquire a resource while pairing it a function that knows how to reclaim it.")}
(All [! a] (-> (Monad !) (-> a (! (Try Any))) a
(All [r] (Region r ! a))))
(function (_ [region cleaners])
@@ -97,7 +93,7 @@
(All [r] (Apply (Region r !)))))
(def: &functor
- (..functor (get@ #monad.&functor super)))
+ (..functor (value@ #monad.&functor super)))
(def: (apply ff fa)
(function (_ [region cleaners])
@@ -122,7 +118,7 @@
(All [r] (Monad (Region r !)))))
(def: &functor
- (..functor (get@ #monad.&functor super)))
+ (..functor (value@ #monad.&functor super)))
(def: (in value)
(function (_ [region cleaners])
@@ -140,7 +136,6 @@
(in [cleaners (#try.Failure error)]))))))
(def: .public (failure monad error)
- {#.doc (example "Immediately fail with this 'message'.")}
(All [! a]
(-> (Monad !) Text
(All [r] (Region r ! a))))
@@ -148,14 +143,12 @@
(\ monad in [cleaners (#try.Failure error)])))
(def: .public (except monad exception message)
- {#.doc (example "Fail by throwing/raising an exception.")}
(All [! e a]
(-> (Monad !) (Exception e) e
(All [r] (Region r ! a))))
(failure monad (exception.error exception message)))
(def: .public (lifted monad operation)
- {#.doc (example "Lift an effectful computation into a region-based computation.")}
(All [! a]
(-> (Monad !) (! a)
(All [r] (Region r ! a))))
diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux
index 25b595b63..9c6e7a97e 100644
--- a/stdlib/source/library/lux/control/remember.lux
+++ b/stdlib/source/library/lux/control/remember.lux
@@ -50,13 +50,6 @@
(syntax: .public (remember [deadline ..deadline
message <c>.text
focus (<>.maybe <c>.any)])
- {#.doc (example "A message with an expiration date."
- "Can have an optional piece of code to focus on."
- (remember "2022-04-01"
- "Do this, that and the other.")
- (remember "2022-04-01"
- "Improve the performace."
- (some (complicated (computation 123)))))}
(let [now (io.run! instant.now)
today (instant.date now)]
(if (date\< deadline today)
diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux
index 3762c6e8f..45b2bd083 100644
--- a/stdlib/source/library/lux/control/security/capability.lux
+++ b/stdlib/source/library/lux/control/security/capability.lux
@@ -25,8 +25,7 @@
["|.|" annotations]]]]])
(abstract: .public (Capability brand input output)
- {#.doc (example "Represents the capability to perform an operation."
- "This operation is assumed to have security implications.")}
+ {}
(-> input output)
@@ -37,7 +36,6 @@
(|>> :abstraction))
(def: .public (use capability input)
- {#.doc (example "Applies a capability against its required input.")}
(All [brand input output]
(-> (Capability brand input output)
input
@@ -50,16 +48,6 @@
|declaration|.parser
(<>.maybe |annotations|.parser)
(<c>.form ($_ <>.and <c>.local_identifier <c>.any <c>.any))))])
- {#.doc (example "Defines a capability as a unique type, and a constructor for instances."
-
- (capability: (Can_Duplicate a)
- (can_duplicate a [a a]))
-
- (let [capability (can_duplicate
- (function (_ value)
- [value value]))
- [left right] (..use capability 123)]
- (same? left right)))}
(do {! meta.monad}
[this_module meta.current_module_name
.let [[name vars] declaration]
@@ -77,7 +65,6 @@
))))
(def: .public (async capability)
- {#.doc (example "Converts a synchronous I/O-based capability into an asynchronous capability.")}
(All [brand input output]
(-> (Capability brand input (IO output))
(Capability brand input (Async output))))
diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux
index ea47056bd..9e33fa86b 100644
--- a/stdlib/source/library/lux/control/security/policy.lux
+++ b/stdlib/source/library/lux/control/security/policy.lux
@@ -9,38 +9,32 @@
abstract]]])
(abstract: .public (Policy brand value label)
- {#.doc (example "A security policy encoded as the means to 'upgrade' or 'downgrade' in a secure context.")}
+ {}
value
(type: .public (Can_Upgrade brand label value)
- {#.doc (example "Represents the capacity to 'upgrade' a value.")}
(-> value (Policy brand value label)))
(type: .public (Can_Downgrade brand label value)
- {#.doc (example "Represents the capacity to 'downgrade' a value.")}
(-> (Policy brand value label) value))
(type: .public (Privilege brand label)
- {#.doc (example "Represents the privilege to both 'upgrade' and 'downgrade' a value.")}
{#can_upgrade (Can_Upgrade brand label)
#can_downgrade (Can_Downgrade brand label)})
(type: .public (Delegation brand from to)
- {#.doc (example "Represents the act of delegating policy capacities.")}
(All [value]
(-> (Policy brand value from)
(Policy brand value to))))
(def: .public (delegation downgrade upgrade)
- {#.doc (example "Delegating policy capacities.")}
(All [brand from to]
(-> (Can_Downgrade brand from) (Can_Upgrade brand to)
(Delegation brand from to)))
(|>> downgrade upgrade))
(type: .public (Context brand scope label)
- {#.doc (example "A computational context with an associated policy privilege.")}
(-> (Privilege brand label)
(scope label)))
@@ -50,27 +44,6 @@
#can_downgrade (|>> :representation)})
(def: .public (with_policy context)
- {#.doc (example "Activates a security context with the priviledge to enforce it's policy."
-
- (type: Password
- (Private Text))
-
- (interface: (Policy %)
- (: (-> Text (Password %))
- password)
- (: (-> (Password %) Text)
- unsafe))
-
- (def: (policy _)
- (Ex [%] (-> Any (Policy %)))
- (with_policy
- (: (Context Privacy Policy)
- (function (_ (^open "%::."))
- (implementation
- (def: (password value)
- (%::can_upgrade value))
- (def: (unsafe password)
- (%::can_downgrade password))))))))}
(All [brand scope]
(Ex [label]
(-> (Context brand scope label)
@@ -104,9 +77,9 @@
(def: join (|>> :representation)))
)
-(template [<brand> <value> <upgrade> <downgrade> <doc>]
+(template [<brand> <value> <upgrade> <downgrade>]
[(abstract: .public <brand>
- {#.doc <doc>}
+ {}
Any
@@ -120,10 +93,6 @@
(Can_Downgrade <brand>))
)]
- [Privacy Private Can_Conceal Can_Reveal
- (example "A security context for privacy."
- "Private data is data which cannot be allowed to leak outside of the programmed.")]
- [Safety Safe Can_Trust Can_Distrust
- (example "A security context for safety."
- "Safe data is data coming from outside the program which can be trusted to be properly formatted and lacking injections.")]
+ [Privacy Private Can_Conceal Can_Reveal]
+ [Safety Safe Can_Trust Can_Distrust]
)
diff --git a/stdlib/source/library/lux/control/state.lux b/stdlib/source/library/lux/control/state.lux
index 470751832..109491fee 100644
--- a/stdlib/source/library/lux/control/state.lux
+++ b/stdlib/source/library/lux/control/state.lux
@@ -7,42 +7,35 @@
[monad (#+ Monad do)]]]])
(type: .public (State s a)
- {#.doc "Stateful computations."}
(-> s [s a]))
(def: .public get
- {#.doc "Read the current state."}
(All [s] (State s s))
(function (_ state)
[state state]))
(def: .public (put new_state)
- {#.doc "Set the new state."}
(All [s] (-> s (State s Any)))
(function (_ state)
[new_state []]))
(def: .public (update change)
- {#.doc "Compute the new state."}
(All [s] (-> (-> s s) (State s Any)))
(function (_ state)
[(change state) []]))
(def: .public (use user)
- {#.doc "Run a function on the current state."}
(All [s a] (-> (-> s a) (State s a)))
(function (_ state)
[state (user state)]))
(def: .public (local change action)
- {#.doc "Run the computation with a locally-modified state."}
(All [s a] (-> (-> s s) (State s a) (State s a)))
(function (_ state)
(let [[state' output] (action (change state))]
[state output])))
(def: .public (result state action)
- {#.doc "Run a stateful computation."}
(All [s a] (-> s (State s a) [s a]))
(action state))
@@ -80,7 +73,6 @@
(ma state')))))
(def: .public (while condition body)
- {#.doc (example "A stateful while loop.")}
(All [s] (-> (State s Bit) (State s Any) (State s Any)))
(do {! ..monad}
[execute? condition]
@@ -91,7 +83,6 @@
(in []))))
(def: .public (do_while condition body)
- {#.doc (example "A stateful do-while loop.")}
(All [s] (-> (State s Bit) (State s Any) (State s Any)))
(do ..monad
[_ body]
@@ -118,16 +109,13 @@
(in [state (f a)])))))
(type: .public (+State M s a)
- {#.doc "Stateful computations decorated by a monad."}
(-> s (M [s a])))
(def: .public (result' state action)
- {#.doc "Execute a stateful computation decorated by a monad."}
(All [M s a] (-> s (+State M s a) (M [s a])))
(action state))
(implementation: .public (with monad)
- {#.doc "A monad transformer to create composite stateful computations."}
(All [M s] (-> (Monad M) (Monad (+State M s))))
(def: &functor (with//functor (\ monad &functor)))
@@ -143,7 +131,6 @@
(sMa state')))))
(def: .public (lifted monad ma)
- {#.doc "Lift monadic values to the +State wrapper."}
(All [M s a] (-> (Monad M) (M a) (+State M s a)))
(function (_ state)
(do monad
diff --git a/stdlib/source/library/lux/control/thread.lux b/stdlib/source/library/lux/control/thread.lux
index 266c12afc..b70813ec9 100644
--- a/stdlib/source/library/lux/control/thread.lux
+++ b/stdlib/source/library/lux/control/thread.lux
@@ -15,16 +15,14 @@
abstract]]])
(type: .public (Thread ! a)
- {#.doc (example "An imperative process with access to mutable values.")}
(-> ! a))
(abstract: .public (Box t v)
- {#.doc "A mutable box holding a value."}
+ {}
(Array v)
(def: .public (box init)
- {#.doc (example "A brand-new box initialized to the given value.")}
(All [a] (-> a (All [!] (Thread ! (Box ! a)))))
(function (_ !)
(|> (array.empty 1)
@@ -32,7 +30,6 @@
:abstraction)))
(def: .public (read! box)
- {#.doc (example "Reads the current value in the box.")}
(All [! a] (-> (Box ! a) (Thread ! a)))
(function (_ !)
(for {@.old
@@ -54,21 +51,18 @@
@.scheme ("scheme array read" 0 (:representation box))})))
(def: .public (write! value box)
- {#.doc (example "Mutates the value in the box.")}
(All [a] (-> a (All [!] (-> (Box ! a) (Thread ! Any)))))
(function (_ !)
(|> box :representation (array.write! 0 value) :abstraction)))
)
(def: .public (result thread)
- {#.doc (example "Executes the imperative thread in a self-contained way.")}
(All [a]
(-> (All [!] (Thread ! a))
a))
(thread []))
(def: .public io
- {#.doc (example "Transforms the imperative thread into an I/O computation.")}
(All [a]
(-> (All [!] (Thread ! a))
(IO a)))
@@ -105,7 +99,6 @@
((ffa !) !))))
(def: .public (update! f box)
- {#.doc (example "Update a box's value by applying a function to it.")}
(All [a !] (-> (-> a a) (Box ! a) (Thread ! a)))
(do ..monad
[old (read! box)
diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux
index c7dc9f1d9..05d7d69ea 100644
--- a/stdlib/source/library/lux/control/try.lux
+++ b/stdlib/source/library/lux/control/try.lux
@@ -10,7 +10,6 @@
["." location]]]])
(type: .public (Try a)
- {#.doc (example "A computation that can fail with an error message.")}
(#Failure Text)
(#Success a))
@@ -60,12 +59,11 @@
ma)))
(implementation: .public (with monad)
- {#.doc (example "Enhances a monad with error-handling functionality.")}
... TODO: Replace (All [a] (! (Try a))) with (functor.Then ! Try)
(All [!] (-> (Monad !) (Monad (All [a] (! (Try a))))))
(def: &functor
- (functor.composite (get@ #monad.&functor monad) ..functor))
+ (functor.composite (value@ #monad.&functor monad) ..functor))
(def: in
(|>> (\ ..monad in)
@@ -82,7 +80,6 @@
Mea))))
(def: .public (lifted monad)
- {#.doc (example "Wraps a monadic value with error-handling machinery.")}
(All [! a] (-> (Monad !) (-> (! a) (! (Try a)))))
(\ monad map (\ ..monad in)))
@@ -102,9 +99,6 @@
)))
(def: .public (trusted try)
- {#.doc (example "Assumes a Try value succeeded, and yields its value."
- "If it didn't, raises the error as a runtime error."
- "WARNING: Use with caution.")}
(All [a] (-> (Try a) a))
(case try
(#Success value)
@@ -133,13 +127,6 @@
(name_of ..of_maybe))))))
(macro: .public (else tokens compiler)
- {#.doc (example "Allows you to provide a default value that will be used"
- "if a (Try x) value turns out to be #Failure."
- "Note: the expression for the default value will not be computed if the base computation succeeds."
- (= "bar"
- (else "foo" (#..Success "bar")))
- (= "foo"
- (else "foo" (#..Failure "KABOOM!"))))}
(case tokens
(^ (list else try))
(#Success [compiler (list (` (case (~ try)
diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux
index 18a0fc7e1..194822f60 100644
--- a/stdlib/source/library/lux/control/writer.lux
+++ b/stdlib/source/library/lux/control/writer.lux
@@ -9,12 +9,10 @@
["." monad (#+ Monad do)]]]])
(type: .public (Writer log value)
- {#.doc "Represents a value with an associated 'log' to record arbitrary information."}
{#log log
#value value})
(def: .public (write message)
- {#.doc "Write a value to the log."}
(All [log] (-> log (Writer log Any)))
[message []])
@@ -51,11 +49,10 @@
[(\ monoid compose log1 log2) a])))
(implementation: .public (with monoid monad)
- {#.doc (example "Enhances a monad with Writer functionality.")}
(All [l M] (-> (Monoid l) (Monad M) (Monad (All [a] (M (Writer l a))))))
(def: &functor
- (functor.composite (get@ #monad.&functor monad)
+ (functor.composite (value@ #monad.&functor monad)
..functor))
(def: in
@@ -73,7 +70,6 @@
(in [(\ monoid compose l1 l2) a]))))
(def: .public (lifted monoid monad)
- {#.doc (example "Wraps a monadic value with Writer machinery.")}
(All [l M a]
(-> (Monoid l) (Monad M)
(-> (M a) (M (Writer l a)))))
diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux
index cff9714e2..13b9b5a9d 100644
--- a/stdlib/source/library/lux/data/binary.lux
+++ b/stdlib/source/library/lux/data/binary.lux
@@ -102,8 +102,8 @@
(array.Array (I64 Any)))))
(template: (!size binary)
- [(for {@.old (ffi.array_length binary)
- @.jvm (ffi.array_length binary)
+ [(for {@.old (ffi.length binary)
+ @.jvm (ffi.length binary)
@.js
(|> binary
@@ -122,8 +122,8 @@
(array.size binary))])
(template: (!read index binary)
- [(for {@.old (..i64 (ffi.array_read index binary))
- @.jvm (..i64 (ffi.array_read index binary))
+ [(for {@.old (..i64 (ffi.read! index binary))
+ @.jvm (..i64 (ffi.read! index binary))
@.js
(|> binary
@@ -155,8 +155,8 @@
(:as ..Binary))])
(template: (!write index value binary)
- [(for {@.old (ffi.array_write index (..byte value) binary)
- @.jvm (ffi.array_write index (..byte value) binary)
+ [(for {@.old (ffi.write! index (..byte value) binary)
+ @.jvm (ffi.write! index (..byte value) binary)
@.js (!!write .Frac n.frac "js array write" index value binary)
@.python (!!write (I64 Any) (:as (I64 Any)) "python array write" index value binary)
@@ -190,13 +190,13 @@
... Default
(array.empty size)))
-(def: .public (fold f init binary)
+(def: .public (aggregate f init binary)
(All [a] (-> (-> I64 a a) a Binary a))
(let [size (..!size binary)]
(loop [index 0
output init]
(if (n.< size index)
- (recur (inc index) (f (!read index binary) output))
+ (recur (++ index) (f (!read index binary) output))
output))))
(def: .public (read/8! index binary)
@@ -307,7 +307,7 @@
(if (n.< limit index)
(and (n.= (!read index reference)
(!read index sample))
- (recur (inc index)))
+ (recur (++ index)))
true))))))))
(for {@.old (as_is)
@@ -341,7 +341,7 @@
(exec (!write (n.+ target_offset index)
(!read (n.+ source_offset index) source)
target)
- (recur (inc index)))
+ (recur (++ index)))
(#try.Success target))))))))
(def: .public (slice offset length binary)
diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux
index 5d306f773..ae6aa7b96 100644
--- a/stdlib/source/library/lux/data/collection/array.lux
+++ b/stdlib/source/library/lux/data/collection/array.lux
@@ -205,7 +205,7 @@
count
(#.Some _)
- (inc count)))
+ (++ count)))
0
(list.indices (size array))))
@@ -239,12 +239,12 @@
(if (n.< arr_size idx)
(case (read! idx xs)
#.None
- (recur (inc idx))
+ (recur (++ idx))
(#.Some x)
(if (p x)
(#.Some x)
- (recur (inc idx))))
+ (recur (++ idx))))
#.None))))
(def: .public (example+ p xs)
@@ -256,12 +256,12 @@
(if (n.< arr_size idx)
(case (read! idx xs)
#.None
- (recur (inc idx))
+ (recur (++ idx))
(#.Some x)
(if (p idx x)
(#.Some [idx x])
- (recur (inc idx))))
+ (recur (++ idx))))
#.None))))
(def: .public (clone xs)
@@ -281,25 +281,25 @@
(def: .public (of_list xs)
(All [a] (-> (List a) (Array a)))
(product.right (list\fold (function (_ x [idx arr])
- [(inc idx) (write! idx x arr)])
+ [(++ idx) (write! idx x arr)])
[0 (empty (list.size xs))]
xs)))
(def: underflow
Nat
- (dec 0))
+ (-- 0))
(def: .public (list array)
{#.doc (.example "Yields a list with every non-empty item in the array.")}
(All [a] (-> (Array a) (List a)))
- (loop [idx (dec (size array))
+ (loop [idx (-- (size array))
output #.End]
(case idx
(^ (static ..underflow))
output
_
- (recur (dec idx)
+ (recur (-- idx)
(case (read! idx array)
(#.Some head)
(#.Item head output)
@@ -310,14 +310,14 @@
(def: .public (list' default array)
{#.doc (.example "Like 'list', but uses the 'default' value when encountering an empty cell in the array.")}
(All [a] (-> a (Array a) (List a)))
- (loop [idx (dec (size array))
+ (loop [idx (-- (size array))
output #.End]
(case idx
(^ (static ..underflow))
output
_
- (recur (dec idx)
+ (recur (-- idx)
(#.Item (maybe.else default (read! idx array))
output)))))
@@ -382,10 +382,10 @@
(if (n.< arr_size idx)
(case (read! idx xs)
#.None
- (recur so_far (inc idx))
+ (recur so_far (++ idx))
(#.Some value)
- (recur (f value so_far) (inc idx)))
+ (recur (f value so_far) (++ idx)))
so_far)))))
(template [<name> <init> <op>]
@@ -399,10 +399,10 @@
(case (..read! idx array)
(#.Some value)
(<op> (predicate value)
- (recur (inc idx)))
+ (recur (++ idx)))
#.None
- (recur (inc idx)))
+ (recur (++ idx)))
<init>)))))]
[every? true and]
diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux
index e5e85e361..b5059ea8a 100644
--- a/stdlib/source/library/lux/data/collection/bits.lux
+++ b/stdlib/source/library/lux/data/collection/bits.lux
@@ -66,10 +66,10 @@
[(def: .public (<name> index input)
(-> Nat Bits Bits)
(let [[chunk_index bit_index] (n./% chunk_size index)]
- (loop [size|output (n.max (inc chunk_index)
+ (loop [size|output (n.max (++ chunk_index)
(array.size input))
output ..empty]
- (let [idx|output (dec size|output)]
+ (let [idx|output (-- size|output)]
(if (n.> 0 size|output)
(case (|> (..chunk idx|output input)
(cond> [(new> (n.= chunk_index idx|output) [])]
@@ -80,7 +80,7 @@
.nat)
0
... TODO: Remove 'no_op' once new-luxc is the official compiler.
- (let [no_op (recur (dec size|output) output)]
+ (let [no_op (recur (-- size|output) output)]
no_op)
chunk
@@ -88,7 +88,7 @@
(: Bits (array.empty size|output))
output)
(array.write! idx|output (.i64 chunk))
- (recur (dec size|output))))
+ (recur (-- size|output))))
output)))))]
[one i64.one]
@@ -106,7 +106,7 @@
(i64.and (..chunk idx reference))
("lux i64 =" empty_chunk)
.not)
- (recur (inc idx)))
+ (recur (++ idx)))
#0))))
(def: .public (not input)
@@ -118,10 +118,10 @@
size|output
(loop [size|output size|output
output ..empty]
- (let [idx (dec size|output)]
+ (let [idx (-- size|output)]
(case (|> input (..chunk idx) i64.not .nat)
0
- (recur (dec size|output) output)
+ (recur (-- size|output) output)
chunk
(if (n.> 0 size|output)
@@ -129,7 +129,7 @@
(: Bits (array.empty size|output))
output)
(array.write! idx (.i64 chunk))
- (recur (dec size|output)))
+ (recur (-- size|output)))
output))))))
(template [<name> <op>]
@@ -143,20 +143,20 @@
size|output
(loop [size|output size|output
output ..empty]
- (let [idx (dec size|output)]
+ (let [idx (-- size|output)]
(if (n.> 0 size|output)
(case (|> (..chunk idx subject)
(<op> (..chunk idx param))
.nat)
0
- (recur (dec size|output) output)
+ (recur (-- size|output) output)
chunk
(|> (if (same? ..empty output)
(: Bits (array.empty size|output))
output)
(array.write! idx (.i64 chunk))
- (recur (dec size|output))))
+ (recur (-- size|output))))
output)))))]
[and i64.and]
@@ -175,5 +175,5 @@
(.and ("lux i64 ="
(..chunk idx reference)
(..chunk idx sample))
- (recur (inc idx)))
+ (recur (++ idx)))
#1)))))
diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux
index fb7aaaa83..6773a3b95 100644
--- a/stdlib/source/library/lux/data/collection/dictionary.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary.lux
@@ -133,10 +133,10 @@
(def: (array\has idx value old_array)
(All [a] (-> Index a (Array a) (Array a)))
(let [old_size (array.size old_array)]
- (|> (array.empty (inc old_size))
+ (|> (array.empty (++ old_size))
(array.copy! idx 0 old_array 0)
(array.write! idx value)
- (array.copy! (n.- idx old_size) idx old_array (inc idx)))))
+ (array.copy! (n.- idx old_size) idx old_array (++ idx)))))
... Creates a copy of an array with an index set to a particular value.
(def: (array\revised idx value array)
@@ -151,10 +151,10 @@
... Shrinks a copy of the array by removing the space at index.
(def: (array\lacks idx array)
(All [a] (-> Index (Array a) (Array a)))
- (let [new_size (dec (array.size array))]
+ (let [new_size (-- (array.size array))]
(|> (array.empty new_size)
(array.copy! idx 0 array 0)
- (array.copy! (n.- idx new_size) (inc idx) array idx))))
+ (array.copy! (n.- idx new_size) (++ idx) array idx))))
... Increases the level-shift by the branching-exponent, to explore
... levels further down the tree.
@@ -164,7 +164,7 @@
(def: hierarchy_mask
Bit_Map
- (dec hierarchy_nodes_size))
+ (-- hierarchy_nodes_size))
... Gets the branching-factor sized section of the hash corresponding
... to a particular level, and uses that as an index into the array.
@@ -214,7 +214,7 @@
... associated with it.
(def: bit_position_mask
(-> Bit_Position Bit_Map)
- dec)
+ --)
... The index on the base array, based on its bit-position.
(def: (base_index bit_position bitmap)
@@ -240,12 +240,12 @@
#.None [insertion_idx node]
(#.Some sub_node) (if (n.= except_idx idx)
[insertion_idx node]
- [(inc insertion_idx)
+ [(++ insertion_idx)
[(with_bit_position (to_bit_position idx) bitmap)
(array.write! insertion_idx (#.Left sub_node) base)]])
)))
[0 [clean_bitmap
- (array.empty (dec h_size))]]
+ (array.empty (-- h_size))]]
(list.indices (array.size h_array)))))
... When #Base nodes grow too large, they're promoted to #Hierarchy to
@@ -263,7 +263,7 @@
(product.right (list\fold (function (_ hierarchy_idx (^@ default [base_idx h_array]))
(if (with_bit_position? (to_bit_position hierarchy_idx)
bitmap)
- [(inc base_idx)
+ [(++ base_idx)
(case (array.read! base_idx base)
(#.Some (#.Left sub_node))
(array.write! hierarchy_idx sub_node h_array)
@@ -304,7 +304,7 @@
[_size sub_node]
_
- [(inc _size) empty_node])]
+ [(++ _size) empty_node])]
(#Hierarchy _size'
(array\revised idx (node\has (level_up level) hash key val key_hash sub_node)
hierarchy)))
@@ -357,7 +357,7 @@
(if (n.>= ..promotion_threshold base_count)
... If so, promote it to a #Hierarchy node, and add the new
... KV-pair as a singleton node to it.
- (#Hierarchy (inc base_count)
+ (#Hierarchy (++ base_count)
(|> base
(promotion node\has key_hash level bitmap)
(array.write! (level_index level hash)
@@ -415,7 +415,7 @@
... If so, perform it.
(#Base (demotion idx [h_size h_array]))
... Otherwise, just clear the space.
- (#Hierarchy (dec h_size) (array\lacks' idx h_array)))
+ (#Hierarchy (-- h_size) (array\lacks' idx h_array)))
... But if the sub_removal yielded a non_empty node, then
... just update the hiearchy branch.
(#Hierarchy h_size (array\revised idx sub_node' h_array)))))))
@@ -562,7 +562,7 @@
(def: .public key_hash
(All [k v] (-> (Dictionary k v) (Hash k)))
- (get@ #..hash))
+ (value@ #..hash))
(def: .public (empty key_hash)
{#.doc (example "An empty dictionary.")}
@@ -737,4 +737,4 @@
(All [k] (Functor (Dictionary k)))
(def: (map f fa)
- (update@ #root (\ ..functor' map f) fa)))
+ (revised@ #root (\ ..functor' map f) fa)))
diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
index 84e883b1d..567c1f457 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
@@ -60,60 +60,60 @@
... TODO: Must improve it as soon as bug is fixed.
(def: .public (value key dict)
(All [k v] (-> k (Dictionary k v) (Maybe v)))
- (let [... (^open "_\.") (get@ #&order dict)
+ (let [... (^open "_\.") (value@ #&order dict)
]
- (loop [node (get@ #root dict)]
+ (loop [node (value@ #root dict)]
(case node
#.None
#.None
(#.Some node)
- (let [node_key (get@ #key node)]
+ (let [node_key (value@ #key node)]
(cond (\ dict = node_key key)
... (_\= node_key key)
- (#.Some (get@ #value node))
+ (#.Some (value@ #value node))
(\ dict < node_key key)
... (_\< node_key key)
- (recur (get@ #left node))
+ (recur (value@ #left node))
- ... (_\> (get@ #key node) key)
- (recur (get@ #right node))))
+ ... (_\> (value@ #key node) key)
+ (recur (value@ #right node))))
))))
... TODO: Doing inneficient access of Order functions due to compiler bug.
... TODO: Must improve it as soon as bug is fixed.
(def: .public (key? dict key)
(All [k v] (-> (Dictionary k v) k Bit))
- (let [... (^open "_\.") (get@ #&order dict)
+ (let [... (^open "_\.") (value@ #&order dict)
]
- (loop [node (get@ #root dict)]
+ (loop [node (value@ #root dict)]
(case node
#.None
#0
(#.Some node)
- (let [node_key (get@ #key node)]
+ (let [node_key (value@ #key node)]
(or (\ dict = node_key key)
... (_\= node_key key)
(if (\ dict < node_key key)
... (_\< node_key key)
- (recur (get@ #left node))
- (recur (get@ #right node)))))))))
+ (recur (value@ #left node))
+ (recur (value@ #right node)))))))))
(template [<name> <side>]
[(def: .public (<name> dict)
{#.doc (example (~~ (template.text ["Yields value under the " <name> "imum key."])))}
(All [k v] (-> (Dictionary k v) (Maybe v)))
- (case (get@ #root dict)
+ (case (value@ #root dict)
#.None
#.None
(#.Some node)
(loop [node node]
- (case (get@ <side> node)
+ (case (value@ <side> node)
#.None
- (#.Some (get@ #value node))
+ (#.Some (value@ #value node))
(#.Some side)
(recur side)))))]
@@ -124,14 +124,14 @@
(def: .public (size dict)
(All [k v] (-> (Dictionary k v) Nat))
- (loop [node (get@ #root dict)]
+ (loop [node (value@ #root dict)]
(case node
#.None
0
(#.Some node)
- (inc (n.+ (recur (get@ #left node))
- (recur (get@ #right node)))))))
+ (++ (n.+ (recur (value@ #left node))
+ (recur (value@ #right node)))))))
(def: .public empty?
(All [k v] (-> (Dictionary k v) Bit))
@@ -140,9 +140,9 @@
(template [<name> <other_color> <self_color> <no_change>]
[(def: (<name> self)
(All [k v] (-> (Node k v) (Node k v)))
- (case (get@ #color self)
+ (case (value@ #color self)
<other_color>
- (set@ #color <self_color> self)
+ (with@ #color <self_color> self)
<self_color>
<no_change>
@@ -154,46 +154,46 @@
(def: (with_left addition center)
(All [k v] (-> (Node k v) (Node k v) (Node k v)))
- (case (get@ #color center)
+ (case (value@ #color center)
#Red
- (red (get@ #key center)
- (get@ #value center)
+ (red (value@ #key center)
+ (value@ #value center)
(#.Some addition)
- (get@ #right center))
+ (value@ #right center))
#Black
(with_expansions
- [<default_behavior> (as_is (black (get@ #key center)
- (get@ #value center)
+ [<default_behavior> (as_is (black (value@ #key center)
+ (value@ #value center)
(#.Some addition)
- (get@ #right center)))]
- (case (get@ #color addition)
+ (value@ #right center)))]
+ (case (value@ #color addition)
#Red
- (case (get@ #left addition)
+ (case (value@ #left addition)
(^multi (#.Some left)
- {(get@ #color left) #Red})
- (red (get@ #key addition)
- (get@ #value addition)
+ {(value@ #color left) #Red})
+ (red (value@ #key addition)
+ (value@ #value addition)
(#.Some (blackened left))
- (#.Some (black (get@ #key center)
- (get@ #value center)
- (get@ #right addition)
- (get@ #right center))))
+ (#.Some (black (value@ #key center)
+ (value@ #value center)
+ (value@ #right addition)
+ (value@ #right center))))
_
- (case (get@ #right addition)
+ (case (value@ #right addition)
(^multi (#.Some right)
- {(get@ #color right) #Red})
- (red (get@ #key right)
- (get@ #value right)
- (#.Some (black (get@ #key addition)
- (get@ #value addition)
- (get@ #left addition)
- (get@ #left right)))
- (#.Some (black (get@ #key center)
- (get@ #value center)
- (get@ #right right)
- (get@ #right center))))
+ {(value@ #color right) #Red})
+ (red (value@ #key right)
+ (value@ #value right)
+ (#.Some (black (value@ #key addition)
+ (value@ #value addition)
+ (value@ #left addition)
+ (value@ #left right)))
+ (#.Some (black (value@ #key center)
+ (value@ #value center)
+ (value@ #right right)
+ (value@ #right center))))
_
<default_behavior>))
@@ -203,46 +203,46 @@
(def: (with_right addition center)
(All [k v] (-> (Node k v) (Node k v) (Node k v)))
- (case (get@ #color center)
+ (case (value@ #color center)
#Red
- (red (get@ #key center)
- (get@ #value center)
- (get@ #left center)
+ (red (value@ #key center)
+ (value@ #value center)
+ (value@ #left center)
(#.Some addition))
#Black
(with_expansions
- [<default_behavior> (as_is (black (get@ #key center)
- (get@ #value center)
- (get@ #left center)
+ [<default_behavior> (as_is (black (value@ #key center)
+ (value@ #value center)
+ (value@ #left center)
(#.Some addition)))]
- (case (get@ #color addition)
+ (case (value@ #color addition)
#Red
- (case (get@ #right addition)
+ (case (value@ #right addition)
(^multi (#.Some right)
- {(get@ #color right) #Red})
- (red (get@ #key addition)
- (get@ #value addition)
- (#.Some (black (get@ #key center)
- (get@ #value center)
- (get@ #left center)
- (get@ #left addition)))
+ {(value@ #color right) #Red})
+ (red (value@ #key addition)
+ (value@ #value addition)
+ (#.Some (black (value@ #key center)
+ (value@ #value center)
+ (value@ #left center)
+ (value@ #left addition)))
(#.Some (blackened right)))
_
- (case (get@ #left addition)
+ (case (value@ #left addition)
(^multi (#.Some left)
- {(get@ #color left) #Red})
- (red (get@ #key left)
- (get@ #value left)
- (#.Some (black (get@ #key center)
- (get@ #value center)
- (get@ #left center)
- (get@ #left left)))
- (#.Some (black (get@ #key addition)
- (get@ #value addition)
- (get@ #right left)
- (get@ #right addition))))
+ {(value@ #color left) #Red})
+ (red (value@ #key left)
+ (value@ #value left)
+ (#.Some (black (value@ #key center)
+ (value@ #value center)
+ (value@ #left center)
+ (value@ #left left)))
+ (#.Some (black (value@ #key addition)
+ (value@ #value addition)
+ (value@ #right left)
+ (value@ #right addition))))
_
<default_behavior>))
@@ -252,17 +252,17 @@
(def: .public (has key value dict)
(All [k v] (-> k v (Dictionary k v) (Dictionary k v)))
- (let [(^open "_\.") (get@ #&order dict)
- root' (loop [?root (get@ #root dict)]
+ (let [(^open "_\.") (value@ #&order dict)
+ root' (loop [?root (value@ #root dict)]
(case ?root
#.None
(#.Some (red key value #.None #.None))
(#.Some root)
- (let [reference (get@ #key root)]
+ (let [reference (value@ #key root)]
(`` (cond (~~ (template [<comp> <tag> <add>]
[(<comp> reference key)
- (let [side_root (get@ <tag> root)
+ (let [side_root (value@ <tag> root)
outcome (recur side_root)]
(if (same? side_root outcome)
?root
@@ -270,39 +270,39 @@
root))))]
[_\< #left ..with_left]
- [(order.> (get@ #&order dict)) #right ..with_right]
+ [(order.> (value@ #&order dict)) #right ..with_right]
))
... (_\= reference key)
- (#.Some (set@ #value value root))
+ (#.Some (with@ #value value root))
)))
))]
- (set@ #root root' dict)))
+ (with@ #root root' dict)))
(def: (left_balanced key value ?left ?right)
(All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v)))
(case ?left
(^multi (#.Some left)
- {(get@ #color left) #Red}
- {(get@ #left left) (#.Some left>>left)}
- {(get@ #color left>>left) #Red})
- (red (get@ #key left)
- (get@ #value left)
+ {(value@ #color left) #Red}
+ {(value@ #left left) (#.Some left>>left)}
+ {(value@ #color left>>left) #Red})
+ (red (value@ #key left)
+ (value@ #value left)
(#.Some (blackened left>>left))
- (#.Some (black key value (get@ #right left) ?right)))
+ (#.Some (black key value (value@ #right left) ?right)))
(^multi (#.Some left)
- {(get@ #color left) #Red}
- {(get@ #right left) (#.Some left>>right)}
- {(get@ #color left>>right) #Red})
- (red (get@ #key left>>right)
- (get@ #value left>>right)
- (#.Some (black (get@ #key left)
- (get@ #value left)
- (get@ #left left)
- (get@ #left left>>right)))
+ {(value@ #color left) #Red}
+ {(value@ #right left) (#.Some left>>right)}
+ {(value@ #color left>>right) #Red})
+ (red (value@ #key left>>right)
+ (value@ #value left>>right)
+ (#.Some (black (value@ #key left)
+ (value@ #value left)
+ (value@ #left left)
+ (value@ #left left>>right)))
(#.Some (black key value
- (get@ #right left>>right)
+ (value@ #right left>>right)
?right)))
_
@@ -312,25 +312,25 @@
(All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v)))
(case ?right
(^multi (#.Some right)
- {(get@ #color right) #Red}
- {(get@ #right right) (#.Some right>>right)}
- {(get@ #color right>>right) #Red})
- (red (get@ #key right)
- (get@ #value right)
- (#.Some (black key value ?left (get@ #left right)))
+ {(value@ #color right) #Red}
+ {(value@ #right right) (#.Some right>>right)}
+ {(value@ #color right>>right) #Red})
+ (red (value@ #key right)
+ (value@ #value right)
+ (#.Some (black key value ?left (value@ #left right)))
(#.Some (blackened right>>right)))
(^multi (#.Some right)
- {(get@ #color right) #Red}
- {(get@ #left right) (#.Some right>>left)}
- {(get@ #color right>>left) #Red})
- (red (get@ #key right>>left)
- (get@ #value right>>left)
- (#.Some (black key value ?left (get@ #left right>>left)))
- (#.Some (black (get@ #key right)
- (get@ #value right)
- (get@ #right right>>left)
- (get@ #right right))))
+ {(value@ #color right) #Red}
+ {(value@ #left right) (#.Some right>>left)}
+ {(value@ #color right>>left) #Red})
+ (red (value@ #key right>>left)
+ (value@ #value right>>left)
+ (#.Some (black key value ?left (value@ #left right>>left)))
+ (#.Some (black (value@ #key right)
+ (value@ #value right)
+ (value@ #right right>>left)
+ (value@ #right right))))
_
(black key value ?left ?right)))
@@ -339,26 +339,26 @@
(All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v)))
(case ?left
(^multi (#.Some left)
- {(get@ #color left) #Red})
+ {(value@ #color left) #Red})
(red key value (#.Some (blackened left)) ?right)
_
(case ?right
(^multi (#.Some right)
- {(get@ #color right) #Black})
+ {(value@ #color right) #Black})
(right_balanced key value ?left (#.Some (reddened right)))
(^multi (#.Some right)
- {(get@ #color right) #Red}
- {(get@ #left right) (#.Some right>>left)}
- {(get@ #color right>>left) #Black})
- (red (get@ #key right>>left)
- (get@ #value right>>left)
- (#.Some (black key value ?left (get@ #left right>>left)))
- (#.Some (right_balanced (get@ #key right)
- (get@ #value right)
- (get@ #right right>>left)
- (\ maybe.functor map reddened (get@ #right right)))))
+ {(value@ #color right) #Red}
+ {(value@ #left right) (#.Some right>>left)}
+ {(value@ #color right>>left) #Black})
+ (red (value@ #key right>>left)
+ (value@ #value right>>left)
+ (#.Some (black key value ?left (value@ #left right>>left)))
+ (#.Some (right_balanced (value@ #key right)
+ (value@ #value right)
+ (value@ #right right>>left)
+ (\ maybe.functor map reddened (value@ #right right)))))
_
(panic! error_message))
@@ -368,26 +368,26 @@
(All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v)))
(case ?right
(^multi (#.Some right)
- {(get@ #color right) #Red})
+ {(value@ #color right) #Red})
(red key value ?left (#.Some (blackened right)))
_
(case ?left
(^multi (#.Some left)
- {(get@ #color left) #Black})
+ {(value@ #color left) #Black})
(left_balanced key value (#.Some (reddened left)) ?right)
(^multi (#.Some left)
- {(get@ #color left) #Red}
- {(get@ #right left) (#.Some left>>right)}
- {(get@ #color left>>right) #Black})
- (red (get@ #key left>>right)
- (get@ #value left>>right)
- (#.Some (left_balanced (get@ #key left)
- (get@ #value left)
- (\ maybe.functor map reddened (get@ #left left))
- (get@ #left left>>right)))
- (#.Some (black key value (get@ #right left>>right) ?right)))
+ {(value@ #color left) #Red}
+ {(value@ #right left) (#.Some left>>right)}
+ {(value@ #color left>>right) #Black})
+ (red (value@ #key left>>right)
+ (value@ #value left>>right)
+ (#.Some (left_balanced (value@ #key left)
+ (value@ #value left)
+ (\ maybe.functor map reddened (value@ #left left))
+ (value@ #left left>>right)))
+ (#.Some (black key value (value@ #right left>>right) ?right)))
_
(panic! error_message)
@@ -403,70 +403,70 @@
?left
[(#.Some left) (#.Some right)]
- (case [(get@ #color left) (get@ #color right)]
+ (case [(value@ #color left) (value@ #color right)]
[#Red #Red]
(do maybe.monad
- [fused (prepended (get@ #right left) (get@ #right right))]
- (case (get@ #color fused)
+ [fused (prepended (value@ #right left) (value@ #right right))]
+ (case (value@ #color fused)
#Red
- (in (red (get@ #key fused)
- (get@ #value fused)
- (#.Some (red (get@ #key left)
- (get@ #value left)
- (get@ #left left)
- (get@ #left fused)))
- (#.Some (red (get@ #key right)
- (get@ #value right)
- (get@ #right fused)
- (get@ #right right)))))
+ (in (red (value@ #key fused)
+ (value@ #value fused)
+ (#.Some (red (value@ #key left)
+ (value@ #value left)
+ (value@ #left left)
+ (value@ #left fused)))
+ (#.Some (red (value@ #key right)
+ (value@ #value right)
+ (value@ #right fused)
+ (value@ #right right)))))
#Black
- (in (red (get@ #key left)
- (get@ #value left)
- (get@ #left left)
- (#.Some (red (get@ #key right)
- (get@ #value right)
+ (in (red (value@ #key left)
+ (value@ #value left)
+ (value@ #left left)
+ (#.Some (red (value@ #key right)
+ (value@ #value right)
(#.Some fused)
- (get@ #right right)))))))
+ (value@ #right right)))))))
[#Red #Black]
- (#.Some (red (get@ #key left)
- (get@ #value left)
- (get@ #left left)
- (prepended (get@ #right left)
+ (#.Some (red (value@ #key left)
+ (value@ #value left)
+ (value@ #left left)
+ (prepended (value@ #right left)
?right)))
[#Black #Red]
- (#.Some (red (get@ #key right)
- (get@ #value right)
+ (#.Some (red (value@ #key right)
+ (value@ #value right)
(prepended ?left
- (get@ #left right))
- (get@ #right right)))
+ (value@ #left right))
+ (value@ #right right)))
[#Black #Black]
(do maybe.monad
- [fused (prepended (get@ #right left) (get@ #left right))]
- (case (get@ #color fused)
+ [fused (prepended (value@ #right left) (value@ #left right))]
+ (case (value@ #color fused)
#Red
- (in (red (get@ #key fused)
- (get@ #value fused)
- (#.Some (black (get@ #key left)
- (get@ #value left)
- (get@ #left left)
- (get@ #left fused)))
- (#.Some (black (get@ #key right)
- (get@ #value right)
- (get@ #right fused)
- (get@ #right right)))))
+ (in (red (value@ #key fused)
+ (value@ #value fused)
+ (#.Some (black (value@ #key left)
+ (value@ #value left)
+ (value@ #left left)
+ (value@ #left fused)))
+ (#.Some (black (value@ #key right)
+ (value@ #value right)
+ (value@ #right fused)
+ (value@ #right right)))))
#Black
- (in (without_left (get@ #key left)
- (get@ #value left)
- (get@ #left left)
- (#.Some (black (get@ #key right)
- (get@ #value right)
+ (in (without_left (value@ #key left)
+ (value@ #value left)
+ (value@ #left left)
+ (#.Some (black (value@ #key right)
+ (value@ #value right)
(#.Some fused)
- (get@ #right right)))))
+ (value@ #right right)))))
))
)
@@ -475,45 +475,45 @@
(def: .public (lacks key dict)
(All [k v] (-> k (Dictionary k v) (Dictionary k v)))
- (let [(^open "_\.") (get@ #&order dict)
- [?root found?] (loop [?root (get@ #root dict)]
+ (let [(^open "_\.") (value@ #&order dict)
+ [?root found?] (loop [?root (value@ #root dict)]
(case ?root
#.None
[#.None #0]
(#.Some root)
- (let [root_key (get@ #key root)
- root_val (get@ #value root)]
+ (let [root_key (value@ #key root)
+ root_val (value@ #value root)]
(if (_\= root_key key)
- [(prepended (get@ #left root)
- (get@ #right root))
+ [(prepended (value@ #left root)
+ (value@ #right root))
#1]
(let [go_left? (_\< root_key key)]
(case (recur (if go_left?
- (get@ #left root)
- (get@ #right root)))
+ (value@ #left root)
+ (value@ #right root)))
[#.None #0]
[#.None #0]
[side_outcome _]
(if go_left?
- (case (get@ #left root)
+ (case (value@ #left root)
(^multi (#.Some left)
- {(get@ #color left) #Black})
- [(#.Some (without_left root_key root_val side_outcome (get@ #right root)))
+ {(value@ #color left) #Black})
+ [(#.Some (without_left root_key root_val side_outcome (value@ #right root)))
#0]
_
- [(#.Some (red root_key root_val side_outcome (get@ #right root)))
+ [(#.Some (red root_key root_val side_outcome (value@ #right root)))
#0])
- (case (get@ #right root)
+ (case (value@ #right root)
(^multi (#.Some right)
- {(get@ #color right) #Black})
- [(#.Some (without_right root_key root_val (get@ #left root) side_outcome))
+ {(value@ #color right) #Black})
+ [(#.Some (without_right root_key root_val (value@ #left root) side_outcome))
#0]
_
- [(#.Some (red root_key root_val (get@ #left root) side_outcome))
+ [(#.Some (red root_key root_val (value@ #left root) side_outcome))
#0])
)))
))
@@ -521,11 +521,11 @@
(case ?root
#.None
(if found?
- (set@ #root ?root dict)
+ (with@ #root ?root dict)
dict)
(#.Some root)
- (set@ #root (#.Some (blackened root)) dict)
+ (with@ #root (#.Some (blackened root)) dict)
)))
(def: .public (revised key transform dict)
@@ -547,27 +547,27 @@
(template [<name> <type> <output>]
[(def: .public (<name> dict)
(All [k v] (-> (Dictionary k v) (List <type>)))
- (loop [node (get@ #root dict)]
+ (loop [node (value@ #root dict)]
(case node
#.None
(list)
(#.Some node')
($_ list\compose
- (recur (get@ #left node'))
+ (recur (value@ #left node'))
(list <output>)
- (recur (get@ #right node'))))))]
+ (recur (value@ #right node'))))))]
- [entries [k v] [(get@ #key node') (get@ #value node')]]
- [keys k (get@ #key node')]
- [values v (get@ #value node')]
+ [entries [k v] [(value@ #key node') (value@ #value node')]]
+ [keys k (value@ #key node')]
+ [values v (value@ #value node')]
)
(implementation: .public (equivalence (^open ",\."))
(All [k v] (-> (Equivalence v) (Equivalence (Dictionary k v))))
(def: (= reference sample)
- (let [(^open "/\.") (get@ #&order reference)]
+ (let [(^open "/\.") (value@ #&order reference)]
(loop [entriesR (entries reference)
entriesS (entries sample)]
(case [entriesR entriesS]
diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux
index 8cba7efb2..cb52d478d 100644
--- a/stdlib/source/library/lux/data/collection/list.lux
+++ b/stdlib/source/library/lux/data/collection/list.lux
@@ -34,14 +34,14 @@
(#.Item x xs')
(fold f (f x init) xs'))))
-(def: .public (folds f init inputs)
+(def: .public (aggregates f init inputs)
(All [a b] (-> (-> a b b) b (List a) (List b)))
(case inputs
#.End
(list init)
(#.Item [head tail])
- (#.Item [init (folds f (f head init) tail)])))
+ (#.Item [init (aggregates f (f head init) tail)])))
(def: .public (reversed xs)
(All [a]
@@ -100,8 +100,8 @@
<then>)
<else>))]
- [first (#.Item x (first (dec n) xs')) #.End]
- [after (after (dec n) xs') xs]
+ [first (#.Item x (first (-- n) xs')) #.End]
+ [after (after (-- n) xs') xs]
)
(template [<name> <then> <else>]
@@ -130,7 +130,7 @@
[#.End #.End]
(#.Item x xs')
- (let [[tail rest] (split_at (dec n) xs')]
+ (let [[tail rest] (split_at (-- n) xs')]
[(#.Item x tail) rest]))
[#.End xs]))
@@ -170,7 +170,7 @@
(-> Nat a (List a)))
(case n
0 #.End
- _ (#.Item x (repeated (dec n) x))))
+ _ (#.Item x (repeated (-- n) x))))
(def: (iterations' f x)
(All [a]
@@ -263,21 +263,16 @@
(fold (function (_ _ acc) (n.+ 1 acc)) 0 list))
(template [<name> <init> <op>]
- [(def: .public (<name> predicate xs)
+ [(def: .public (<name> predicate items)
(All [a]
(-> (Predicate a) (List a) Bit))
- (loop [xs xs]
- (case xs
- #.End
- <init>
-
- (#.Item x xs')
- (case (predicate x)
- <init>
- (recur xs')
+ (case items
+ #.End
+ <init>
- output
- output))))]
+ (#.Item head tail)
+ (<op> (predicate head)
+ (<name> predicate tail))))]
[every? #1 and]
[any? #0 or]
@@ -292,9 +287,9 @@
#.None
(#.Item x xs')
- (if (n.= 0 i)
- (#.Some x)
- (item (dec i) xs'))))
+ (case i
+ 0 (#.Some x)
+ _ (item (-- i) xs'))))
(implementation: .public (equivalence Equivalence<a>)
(All [a] (-> (Equivalence a) (Equivalence (List a))))
@@ -428,9 +423,9 @@
(def: .public (indices size)
{#.doc "Produces all the valid indices for a given size."}
(All [a] (-> Nat (List Nat)))
- (if (n.= 0 size)
- (list)
- (|> size dec (enum.range n.enum 0))))
+ (case size
+ 0 (list)
+ _ (|> size -- (enum.range n.enum 0))))
(def: (identifier$ name)
(-> Text Code)
@@ -454,9 +449,9 @@
_ (undefined))
output' ("lux text concat" digit output)
input' (n./ 10 input)]
- (if (n.= 0 input')
- output'
- (recur input' output')))))
+ (case input'
+ 0 output'
+ _ (recur input' output')))))
(macro: .public (zipped tokens state)
{#.doc (.example "Create list zippers with the specified number of input lists."
@@ -475,7 +470,7 @@
type_vars))
(List [(~+ type_vars)]))))
vars+lists (|> indices
- (map inc)
+ (map ++)
(map (function (_ idx)
(let [base (nat\encode idx)]
[(identifier$ base)
@@ -523,7 +518,7 @@
type_vars))
(List (~ g!return_type)))))
vars+lists (|> indices
- (map inc)
+ (map ++)
(map (function (_ idx)
(let [base (nat\encode idx)]
[(identifier$ base)
@@ -583,7 +578,7 @@
(#.Some (#.Item x tail)))
))
-(def: .public joined
+(def: .public together
{#.doc (.example "The sequential combination of all the lists.")}
(All [a] (-> (List (List a)) (List a)))
(\ ..monad join))
@@ -593,7 +588,8 @@
(All [M] (-> (Monad M) (Monad (All [a] (M (List a))))))
(def: &functor
- (functor.composite (get@ #monad.&functor monad) ..functor))
+ (functor.composite (value@ #monad.&functor monad)
+ ..functor))
(def: in
(|>> (\ ..monad in) (\ monad in)))
@@ -604,9 +600,9 @@
... TODO: Remove this version ASAP and use one below.
lla (for {@.old
(: ((:parameter 0) (List (List (:parameter 1))))
- (monad.seq ! lMla))}
- (monad.seq ! lMla))]
- (in (..joined lla)))))
+ (monad.all ! lMla))}
+ (monad.all ! lMla))]
+ (in (..together lla)))))
(def: .public (lifted monad)
{#.doc (.example "Wraps a monadic value with List machinery.")}
@@ -623,7 +619,7 @@
#.End
(#.Item x xs')
- (#.Item [idx x] (recur (inc idx) xs')))))
+ (#.Item [idx x] (recur (++ idx) xs')))))
(macro: .public (when tokens state)
{#.doc (.example "Can be used as a guard in (co)monadic be/do expressions."
diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux
index 3e017d382..a54543eae 100644
--- a/stdlib/source/library/lux/data/collection/queue.lux
+++ b/stdlib/source/library/lux/data/collection/queue.lux
@@ -34,7 +34,7 @@
(def: .public front
{#.doc (example "Yields the first value in the queue, if any.")}
(All [a] (-> (Queue a) (Maybe a)))
- (|>> (get@ #front) list.head))
+ (|>> (value@ #front) list.head))
(def: .public (size queue)
(All [a] (-> (Queue a) Nat))
@@ -44,7 +44,7 @@
(def: .public empty?
(All [a] (-> (Queue a) Bit))
- (|>> (get@ #front) list.empty?))
+ (|>> (value@ #front) list.empty?))
(def: .public (member? equivalence queue member)
(All [a] (-> (Equivalence a) (Queue a) a Bit))
@@ -54,7 +54,7 @@
(def: .public (next queue)
(All [a] (-> (Queue a) (Queue a)))
- (case (get@ #front queue)
+ (case (value@ #front queue)
... Empty...
(^ (.list))
queue
@@ -62,22 +62,22 @@
... Front has dried up...
(^ (.list _))
(|> queue
- (set@ #front (list.reversed (get@ #rear queue)))
- (set@ #rear (.list)))
+ (with@ #front (list.reversed (value@ #rear queue)))
+ (with@ #rear (.list)))
... Consume front!
(^ (.list& _ front'))
(|> queue
- (set@ #front front'))))
+ (with@ #front front'))))
(def: .public (end val queue)
(All [a] (-> a (Queue a) (Queue a)))
- (case (get@ #front queue)
+ (case (value@ #front queue)
#.End
- (set@ #front (.list val) queue)
+ (with@ #front (.list val) queue)
_
- (update@ #rear (|>> (#.Item val)) queue)))
+ (revised@ #rear (|>> (#.Item val)) queue)))
(implementation: .public (equivalence super)
(All [a] (-> (Equivalence a) (Equivalence (Queue a))))
@@ -91,5 +91,5 @@
(Functor Queue)
(def: (map f fa)
- {#front (|> fa (get@ #front) (list\map f))
- #rear (|> fa (get@ #rear) (list\map f))}))
+ {#front (|> fa (value@ #front) (list\map f))
+ #rear (|> fa (value@ #rear) (list\map f))}))
diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux
index 6a4b88587..e77ef1bdf 100644
--- a/stdlib/source/library/lux/data/collection/row.lux
+++ b/stdlib/source/library/lux/data/collection/row.lux
@@ -17,8 +17,8 @@
["." maybe]
["." try (#+ Try)]
["." exception (#+ exception:)]
- ["p" parser
- ["s" code (#+ Parser)]]]
+ ["<>" parser
+ ["<.>" code (#+ Parser)]]]
[data
["." product]
[collection
@@ -29,8 +29,8 @@
["." code]]
[math
[number
- ["." i64]
- ["n" nat]]]]])
+ ["n" nat]
+ ["." i64]]]]])
(type: (Node a)
(#Base (Array a))
@@ -66,7 +66,7 @@
(def: branch_idx_mask
Nat
- (dec full_node_size))
+ (-- full_node_size))
(def: branch_idx
(-> Index Index)
@@ -80,7 +80,7 @@
(-> Nat Nat)
(if (n.< full_node_size row_size)
0
- (|> (dec row_size)
+ (|> (-- row_size)
(i64.right_shifted branching_exponent)
(i64.left_shifted branching_exponent))))
@@ -99,7 +99,7 @@
(def: (with_tail size level tail parent)
(All [a] (-> Nat Level (Base a) (Hierarchy a) (Hierarchy a)))
- (let [sub_idx (branch_idx (i64.right_shifted level (dec size)))
+ (let [sub_idx (branch_idx (i64.right_shifted level (-- size)))
... If we're currently on a bottom node
sub_node (if (n.= branching_exponent level)
... Just add the tail to it
@@ -122,7 +122,7 @@
(def: (expanded_tail val tail)
(All [a] (-> a (Base a) (Base a)))
(let [tail_size (array.size tail)]
- (|> (array.empty (inc tail_size))
+ (|> (array.empty (++ tail_size))
(array.copy! tail_size 0 tail 0)
(array.write! tail_size val))))
@@ -198,45 +198,45 @@
(def: .public (size row)
(All [a] (-> (Row a) Nat))
- (get@ #size row))
+ (value@ #size row))
-(def: .public (add val row)
+(def: .public (suffix val row)
(All [a] (-> a (Row a) (Row a)))
... Check if there is room in the tail.
- (let [row_size (get@ #size row)]
+ (let [row_size (value@ #size row)]
(if (|> row_size (n.- (tail_off row_size)) (n.< full_node_size))
... If so, append to it.
(|> row
- (update@ #size inc)
- (update@ #tail (..expanded_tail val)))
+ (revised@ #size ++)
+ (revised@ #tail (..expanded_tail val)))
... Otherwise, push tail into the tree
... --------------------------------------------------------
... Will the root experience an overflow with this addition?
- (|> (if (n.> (i64.left_shifted (get@ #level row) 1)
+ (|> (if (n.> (i64.left_shifted (value@ #level row) 1)
(i64.right_shifted branching_exponent row_size))
... If so, a brand-new root must be established, that is
... 1-level taller.
(|> row
- (set@ #root (|> (for {@.old
- (: (Hierarchy (:parameter 0))
- (empty_hierarchy []))}
- (empty_hierarchy []))
- (array.write! 0 (#Hierarchy (get@ #root row)))
- (array.write! 1 (..path (get@ #level row) (get@ #tail row)))))
- (update@ #level level_up))
+ (with@ #root (|> (for {@.old
+ (: (Hierarchy (:parameter 0))
+ (empty_hierarchy []))}
+ (empty_hierarchy []))
+ (array.write! 0 (#Hierarchy (value@ #root row)))
+ (array.write! 1 (..path (value@ #level row) (value@ #tail row)))))
+ (revised@ #level level_up))
... Otherwise, just push the current tail onto the root.
(|> row
- (update@ #root (..with_tail row_size (get@ #level row) (get@ #tail row)))))
+ (revised@ #root (..with_tail row_size (value@ #level row) (value@ #tail row)))))
... Finally, update the size of the row and grow a new
... tail with the new element as it's sole member.
- (update@ #size inc)
- (set@ #tail (..tail val)))
+ (revised@ #size ++)
+ (with@ #tail (..tail val)))
)))
(exception: incorrect_row_structure)
(exception: .public [a] (index_out_of_bounds {row (Row a)} {index Nat})
- (exception.report ["Size" (\ n.decimal encode (get@ #size row))]
+ (exception.report ["Size" (\ n.decimal encode (value@ #size row))]
["Index" (\ n.decimal encode index)]))
(exception: base_was_not_found)
@@ -244,15 +244,15 @@
(def: .public (within_bounds? row idx)
{#.doc (example "Determines whether the index is within the bounds of the row.")}
(All [a] (-> (Row a) Nat Bit))
- (n.< (get@ #size row) idx))
+ (n.< (value@ #size row) idx))
(def: (base_for idx row)
(All [a] (-> Index (Row a) (Try (Base a))))
(if (within_bounds? row idx)
- (if (n.>= (tail_off (get@ #size row)) idx)
- (#try.Success (get@ #tail row))
- (loop [level (get@ #level row)
- hierarchy (get@ #root row)]
+ (if (n.>= (tail_off (value@ #size row)) idx)
+ (#try.Success (value@ #tail row))
+ (loop [level (value@ #level row)
+ hierarchy (value@ #root row)]
(case [(n.> branching_exponent level)
(array.read! (branch_idx (i64.right_shifted level idx)) hierarchy)]
[#1 (#.Some (#Hierarchy sub))]
@@ -281,16 +281,16 @@
(def: .public (has idx val row)
(All [a] (-> Nat a (Row a) (Try (Row a))))
- (let [row_size (get@ #size row)]
+ (let [row_size (value@ #size row)]
(if (within_bounds? row idx)
(#try.Success (if (n.>= (tail_off row_size) idx)
- (update@ #tail (for {@.old
- (: (-> (Base (:parameter 0)) (Base (:parameter 0)))
- (|>> array.clone (array.write! (branch_idx idx) val)))}
- (|>> array.clone (array.write! (branch_idx idx) val)))
- row)
- (update@ #root (has' (get@ #level row) idx val)
- row)))
+ (revised@ #tail (for {@.old
+ (: (-> (Base (:parameter 0)) (Base (:parameter 0)))
+ (|>> array.clone (array.write! (branch_idx idx) val)))}
+ (|>> array.clone (array.write! (branch_idx idx) val)))
+ row)
+ (revised@ #root (has' (value@ #level row) idx val)
+ row)))
(exception.except ..index_out_of_bounds [row idx]))))
(def: .public (revised idx f row)
@@ -299,9 +299,9 @@
[val (..item idx row)]
(..has idx (f val) row)))
-(def: .public (pop row)
+(def: .public (prefix row)
(All [a] (-> (Row a) (Row a)))
- (case (get@ #size row)
+ (case (value@ #size row)
0
empty
@@ -310,19 +310,19 @@
row_size
(if (|> row_size (n.- (tail_off row_size)) (n.> 1))
- (let [old_tail (get@ #tail row)
- new_tail_size (dec (array.size old_tail))]
+ (let [old_tail (value@ #tail row)
+ new_tail_size (-- (array.size old_tail))]
(|> row
- (update@ #size dec)
- (set@ #tail (|> (array.empty new_tail_size)
- (array.copy! new_tail_size 0 old_tail 0)))))
+ (revised@ #size --)
+ (with@ #tail (|> (array.empty new_tail_size)
+ (array.copy! new_tail_size 0 old_tail 0)))))
(maybe.trusted
(do maybe.monad
[new_tail (base_for (n.- 2 row_size) row)
- .let [[level' root'] (let [init_level (get@ #level row)]
+ .let [[level' root'] (let [init_level (value@ #level row)]
(loop [level init_level
root (maybe.else (empty_hierarchy [])
- (without_tail row_size init_level (get@ #root row)))]
+ (without_tail row_size init_level (value@ #root row)))]
(if (n.> branching_exponent level)
(case [(array.read! 1 root) (array.read! 0 root)]
[#.None (#.Some (#Hierarchy sub_node))]
@@ -335,20 +335,20 @@
[level root])
[level root])))]]
(in (|> row
- (update@ #size dec)
- (set@ #level level')
- (set@ #root root')
- (set@ #tail new_tail))))))
+ (revised@ #size --)
+ (with@ #level level')
+ (with@ #root root')
+ (with@ #tail new_tail))))))
))
(def: .public (list row)
(All [a] (-> (Row a) (List a)))
- (list\compose (list' (#Hierarchy (get@ #root row)))
- (list' (#Base (get@ #tail row)))))
+ (list\compose (list' (#Hierarchy (value@ #root row)))
+ (list' (#Base (value@ #tail row)))))
(def: .public of_list
(All [a] (-> (List a) (Row a)))
- (list\fold ..add ..empty))
+ (list\fold ..suffix ..empty))
(def: .public (member? a/Equivalence row val)
(All [a] (-> (Equivalence a) (Row a) a Bit))
@@ -356,9 +356,9 @@
(def: .public empty?
(All [a] (-> (Row a) Bit))
- (|>> (get@ #size) (n.= 0)))
+ (|>> (value@ #size) (n.= 0)))
-(syntax: .public (row [elems (p.some s.any)])
+(syntax: .public (row [elems (<>.some <code>.any)])
{#.doc (example "Row literals."
(row 12 34 56 78 90))}
(in (.list (` (..of_list (.list (~+ elems)))))))
@@ -381,12 +381,12 @@
(All [a] (-> (Equivalence a) (Equivalence (Row a))))
(def: (= v1 v2)
- (and (n.= (get@ #size v1) (get@ #size v2))
+ (and (n.= (value@ #size v1) (value@ #size v2))
(let [(^open "node\.") (node_equivalence Equivalence<a>)]
- (and (node\= (#Base (get@ #tail v1))
- (#Base (get@ #tail v2)))
- (node\= (#Hierarchy (get@ #root v1))
- (#Hierarchy (get@ #root v2))))))))
+ (and (node\= (#Base (value@ #tail v1))
+ (#Base (value@ #tail v2)))
+ (node\= (#Hierarchy (value@ #root v1))
+ (#Hierarchy (value@ #root v2))))))))
(implementation: node_fold
(Fold Node)
@@ -409,8 +409,8 @@
(fold f
(fold f
init
- (#Hierarchy (get@ #root xs)))
- (#Base (get@ #tail xs))))))
+ (#Hierarchy (value@ #root xs)))
+ (#Base (value@ #tail xs))))))
(implementation: .public monoid
(All [a] (Monoid (Row a)))
@@ -418,7 +418,7 @@
(def: identity ..empty)
(def: (compose xs ys)
- (list\fold add xs (..list ys))))
+ (list\fold suffix xs (..list ys))))
(implementation: node_functor
(Functor Node)
@@ -435,10 +435,10 @@
(Functor Row)
(def: (map f xs)
- {#level (get@ #level xs)
- #size (get@ #size xs)
- #root (|> xs (get@ #root) (array\map (\ node_functor map f)))
- #tail (|> xs (get@ #tail) (array\map f))}))
+ {#level (value@ #level xs)
+ #size (value@ #size xs)
+ #root (|> xs (value@ #root) (array\map (\ node_functor map f)))
+ #tail (|> xs (value@ #tail) (array\map f))}))
(implementation: .public apply
(Apply Row)
@@ -469,7 +469,7 @@
(All [a] (-> (Row a) (Row a)))
(|>> ..list
list.reversed
- (list\fold add ..empty)))
+ (list\fold suffix ..empty)))
(template [<name> <array> <init> <op>]
[(def: .public <name>
diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux
index a7d2cc0b4..42cd682df 100644
--- a/stdlib/source/library/lux/data/collection/sequence.lux
+++ b/stdlib/source/library/lux/data/collection/sequence.lux
@@ -65,7 +65,7 @@
(let [[head tail] (//.result sequence)]
(case idx
0 head
- _ (item (dec idx) tail))))
+ _ (item (-- idx) tail))))
(template [<taker> <dropper> <pred_type> <pred_test> <pred_step> <post_test>]
[(def: .public (<taker> pred xs)
@@ -85,7 +85,7 @@
xs)))]
[while until (-> a Bit) (pred x) pred |>]
- [first after Nat (n.= 0 pred) (dec pred) not]
+ [first after Nat (n.= 0 pred) (-- pred) not]
)
(template [<splitter> <pred_type> <pred_test> <pred_step>]
@@ -99,7 +99,7 @@
[(#.Item [x tail]) next]))))]
[split_when (-> a Bit) (pred x) pred]
- [split_at Nat (n.= 0 pred) (dec pred)]
+ [split_at Nat (n.= 0 pred) (-- pred)]
)
(def: .public (only predicate sequence)
diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux
index 6ef570c31..28bbf1876 100644
--- a/stdlib/source/library/lux/data/collection/set/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/set/ordered.lux
@@ -60,13 +60,13 @@
(All [a] (-> (Set a) (Set a) (Set a)))
(|> (..list right)
(list.only (..member? left))
- (..of_list (get@ #/.&order (:representation right)))))
+ (..of_list (value@ #/.&order (:representation right)))))
(def: .public (difference param subject)
(All [a] (-> (Set a) (Set a) (Set a)))
(|> (..list subject)
(list.only (|>> (..member? param) not))
- (..of_list (get@ #/.&order (:representation subject)))))
+ (..of_list (value@ #/.&order (:representation subject)))))
(implementation: .public equivalence
(All [a] (Equivalence (Set a)))
diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux
index 451fc6143..112932a50 100644
--- a/stdlib/source/library/lux/data/collection/tree.lux
+++ b/stdlib/source/library/lux/data/collection/tree.lux
@@ -25,10 +25,10 @@
{#.doc (example "All the leaf values of the tree, in order.")}
(All [a] (-> (Tree a) (List a)))
(|> tree
- (get@ #children)
+ (value@ #children)
(list\map flat)
list\join
- (#.Item (get@ #value tree))))
+ (#.Item (value@ #value tree))))
(def: .public (leaf value)
(All [a] (-> a (Tree a)))
@@ -69,22 +69,22 @@
(All [a] (-> (Equivalence a) (Equivalence (Tree a))))
(def: (= tx ty)
- (and (\ super = (get@ #value tx) (get@ #value ty))
- (\ (list.equivalence (equivalence super)) = (get@ #children tx) (get@ #children ty)))))
+ (and (\ super = (value@ #value tx) (value@ #value ty))
+ (\ (list.equivalence (equivalence super)) = (value@ #children tx) (value@ #children ty)))))
(implementation: .public functor
(Functor Tree)
(def: (map f fa)
- {#value (f (get@ #value fa))
+ {#value (f (value@ #value fa))
#children (list\map (map f)
- (get@ #children fa))}))
+ (value@ #children fa))}))
(implementation: .public fold
(Fold Tree)
(def: (fold f init tree)
(list\fold (function (_ tree' init') (fold f init' tree'))
- (f (get@ #value tree)
+ (f (value@ #value tree)
init)
- (get@ #children tree))))
+ (value@ #children tree))))
diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux
index 9c2844be7..588cb4e5a 100644
--- a/stdlib/source/library/lux/data/collection/tree/finger.lux
+++ b/stdlib/source/library/lux/data/collection/tree/finger.lux
@@ -33,7 +33,7 @@
(template [<name> <tag> <output>]
[(def: .public <name>
(All [@ t v] (-> (Tree @ t v) <output>))
- (|>> :representation (get@ <tag>)))]
+ (|>> :representation (value@ <tag>)))]
[tag #tag t]
[root #root (Either v [(Tree @ t v) (Tree @ t v)])]
@@ -57,7 +57,7 @@
(def: .public (value tree)
(All [@ t v] (-> (Tree @ t v) v))
- (case (get@ #root (:representation tree))
+ (case (value@ #root (:representation tree))
(0 #0 value)
value
@@ -66,9 +66,9 @@
(def: .public (tags tree)
(All [@ t v] (-> (Tree @ t v) (List t)))
- (case (get@ #root (:representation tree))
+ (case (value@ #root (:representation tree))
(0 #0 value)
- (list (get@ #tag (:representation tree)))
+ (list (value@ #tag (:representation tree)))
(0 #1 [left right])
(list\compose (tags left)
@@ -76,7 +76,7 @@
(def: .public (values tree)
(All [@ t v] (-> (Tree @ t v) (List v)))
- (case (get@ #root (:representation tree))
+ (case (value@ #root (:representation tree))
(0 #0 value)
(list value)
@@ -99,8 +99,8 @@
(0 #1 [left right])
(let [shifted_tag (tag//compose _tag (..tag left))]
(if (predicate shifted_tag)
- (recur _tag (get@ #root (:representation left)))
- (recur shifted_tag (get@ #root (:representation right))))))))
+ (recur _tag (value@ #root (:representation left)))
+ (recur shifted_tag (value@ #root (:representation right))))))))
#.None)))
)
diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux
index b6fb27355..6d1709c55 100644
--- a/stdlib/source/library/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux
@@ -50,23 +50,23 @@
(def: .public tree
(All [a] (-> (Zipper a) (Tree a)))
- (get@ #node))
+ (value@ #node))
(def: .public value
(All [a] (-> (Zipper a) a))
- (get@ [#node #//.value]))
+ (value@ [#node #//.value]))
(def: .public (set value zipper)
(All [a] (-> a (Zipper a) (Zipper a)))
- (set@ [#node #//.value] value zipper))
+ (with@ [#node #//.value] value zipper))
(def: .public (update transform zipper)
(All [a] (-> (-> a a) (Zipper a) (Zipper a)))
- (update@ [#node #//.value] transform zipper))
+ (revised@ [#node #//.value] transform zipper))
(def: children
(All [a] (-> (Zipper a) (List (Tree a))))
- (get@ [#node #//.children]))
+ (value@ [#node #//.children]))
(def: .public leaf?
(All [a] (-> (Zipper a) Bit))
@@ -78,7 +78,7 @@
(def: .public (start? zipper)
(All [a] (-> (Zipper a) Bit))
- (case (get@ #family zipper)
+ (case (value@ #family zipper)
#.None
true
@@ -92,7 +92,7 @@
#.None
(#.Item head tail)
- (#.Some {#family (#.Some {#parent (set@ [#node #//.children] (list) zipper)
+ (#.Some {#family (#.Some {#parent (with@ [#node #//.children] (list) zipper)
#lefts #.End
#rights tail})
#node head})))
@@ -100,37 +100,37 @@
(def: .public (up zipper)
(All [a] (-> (Zipper a) (Maybe (Zipper a))))
(do maybe.monad
- [family (get@ #family zipper)]
+ [family (value@ #family zipper)]
(in (let [(^slots [#parent #lefts #rights]) family]
(for {@.old
- (update@ #node (: (-> (Tree (:parameter 0))
- (Tree (:parameter 0)))
- (set@ #//.children (list\compose (list.reversed lefts)
- (#.Item (get@ #node zipper)
- rights))))
- parent)}
- (set@ [#node #//.children]
- (list\compose (list.reversed lefts)
- (#.Item (get@ #node zipper)
- rights))
- parent))))))
+ (revised@ #node (: (-> (Tree (:parameter 0))
+ (Tree (:parameter 0)))
+ (with@ #//.children (list\compose (list.reversed lefts)
+ (#.Item (value@ #node zipper)
+ rights))))
+ parent)}
+ (with@ [#node #//.children]
+ (list\compose (list.reversed lefts)
+ (#.Item (value@ #node zipper)
+ rights))
+ parent))))))
(template [<one> <all> <side> <op_side>]
[(def: .public (<one> zipper)
(All [a] (-> (Zipper a) (Maybe (Zipper a))))
- (case (get@ #family zipper)
+ (case (value@ #family zipper)
(#.Some family)
- (case (get@ <side> family)
+ (case (value@ <side> family)
(#.Item next side')
(#.Some (for {@.old
{#family (#.Some (|> family
- (set@ <side> side')
- (update@ <op_side> (|>> (#.Item (get@ #node zipper))))))
+ (with@ <side> side')
+ (revised@ <op_side> (|>> (#.Item (value@ #node zipper))))))
#node next}}
(let [move (: (All [a] (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a)))
(function (_ side' zipper)
- (|>> (set@ <side> side')
- (update@ <op_side> (|>> (#.Item (get@ #node zipper)))))))]
+ (|>> (with@ <side> side')
+ (revised@ <op_side> (|>> (#.Item (value@ #node zipper)))))))]
{#family (#.Some (move side' zipper family))
#node next})))
@@ -142,26 +142,26 @@
(def: .public (<all> zipper)
(All [a] (-> (Zipper a) (Maybe (Zipper a))))
- (case (get@ #family zipper)
+ (case (value@ #family zipper)
#.None
#.None
(#.Some family)
- (case (list.reversed (get@ <side> family))
+ (case (list.reversed (value@ <side> family))
#.End
#.None
(#.Item last prevs)
(#.Some (for {@.old {#family (#.Some (|> family
- (set@ <side> #.End)
- (update@ <op_side> (|>> (#.Item (get@ #node zipper))
- (list\compose prevs)))))
+ (with@ <side> #.End)
+ (revised@ <op_side> (|>> (#.Item (value@ #node zipper))
+ (list\compose prevs)))))
#node last}}
(let [move (: (All [a] (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a)))
(function (_ prevs zipper)
- (|>> (set@ <side> #.End)
- (update@ <op_side> (|>> (#.Item (get@ #node zipper))
- (list\compose prevs))))))]
+ (|>> (with@ <side> #.End)
+ (revised@ <op_side> (|>> (#.Item (value@ #node zipper))
+ (list\compose prevs))))))]
{#family (#.Some (move prevs zipper family))
#node last}))))))]
@@ -245,44 +245,44 @@
(def: .public (interpose value zipper)
(All [a] (-> a (Zipper a) (Zipper a)))
- (update@ [#node #//.children]
- (|>> (//.branch value) list)
- zipper))
+ (revised@ [#node #//.children]
+ (|>> (//.branch value) list)
+ zipper))
(def: .public (adopt value zipper)
(All [a] (-> a (Zipper a) (Zipper a)))
- (update@ [#node #//.children]
- (|>> (#.Item (//.leaf value)))
- zipper))
+ (revised@ [#node #//.children]
+ (|>> (#.Item (//.leaf value)))
+ zipper))
(def: .public (remove zipper)
(All [a] (-> (Zipper a) (Maybe (Zipper a))))
(do maybe.monad
- [family (get@ #family zipper)]
- (case (get@ #lefts family)
+ [family (value@ #family zipper)]
+ (case (value@ #lefts family)
#.End
- (in (set@ [#node #//.children]
- (get@ #rights family)
- (get@ #parent family)))
+ (in (with@ [#node #//.children]
+ (value@ #rights family)
+ (value@ #parent family)))
(#.Item next side)
(in (|> zipper
- (set@ #family (|> family
- (set@ #lefts side)
- #.Some))
- (set@ #node next))))))
+ (with@ #family (|> family
+ (with@ #lefts side)
+ #.Some))
+ (with@ #node next))))))
(template [<name> <side>]
[(def: .public (<name> value zipper)
(All [a] (-> a (Zipper a) (Maybe (Zipper a))))
- (case (get@ #family zipper)
+ (case (value@ #family zipper)
#.None
#.None
(#.Some family)
- (#.Some (set@ #family
- (#.Some (update@ <side> (|>> (#.Item (//.leaf value))) family))
- zipper))))]
+ (#.Some (with@ #family
+ (#.Some (revised@ <side> (|>> (#.Item (//.leaf value))) family))
+ zipper))))]
[insert_left #lefts]
[insert_right #rights]
@@ -304,14 +304,14 @@
(def: &functor ..functor)
- (def: out (get@ [#node #//.value]))
+ (def: out (value@ [#node #//.value]))
(def: (split (^slots [#family #node]))
(let [tree_splitter (: (All [a] (-> (Tree a) (Tree (Zipper a))))
(function (tree_splitter tree)
{#//.value (..zipper tree)
#//.children (|> tree
- (get@ #//.children)
+ (value@ #//.children)
(list\map tree_splitter))}))]
{#family (maybe\map (function (_ (^slots [#parent #lefts #rights]))
{#parent (split parent)
diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux
index 19cdb0b66..1cebc0408 100644
--- a/stdlib/source/library/lux/data/color.lux
+++ b/stdlib/source/library/lux/data/color.lux
@@ -28,7 +28,7 @@
abstract]]])
(def: rgb_limit 256)
-(def: top (dec rgb_limit))
+(def: top (-- rgb_limit))
(def: rgb_factor
(|> top .int int.frac))
@@ -420,7 +420,7 @@
(let [[hue saturation brightness] (hsb color)
spread (..normal spread)]
(list\map (function (_ idx)
- (of_hsb [(|> idx inc .int int.frac (f.* spread) (f.+ hue) ..normal)
+ (of_hsb [(|> idx ++ .int int.frac (f.* spread) (f.+ hue) ..normal)
saturation
brightness]))
(list.indices variations)))))
@@ -431,7 +431,7 @@
(let [[hue saturation brightness] (hsb color)
spread (..normal spread)]
(|> (list.indices variations)
- (list\map (|>> inc .int int.frac
+ (list\map (|>> ++ .int int.frac
(f.* spread)
(f.+ brightness)
..normal
diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux
index e23ade3fb..7a6ccadba 100644
--- a/stdlib/source/library/lux/data/format/binary.lux
+++ b/stdlib/source/library/lux/data/format/binary.lux
@@ -93,12 +93,12 @@
(^template [<number> <tag> <writer>]
[(<tag> caseV)
(let [[caseS caseT] (<writer> caseV)]
- [(.inc caseS)
+ [(.++ caseS)
(function (_ [offset binary])
(|> binary
(binary.write/8! offset <number>)
try.trusted
- [(.inc offset)]
+ [(.++ offset)]
caseT))])])
([0 #.Left left]
[1 #.Right right])
@@ -243,12 +243,12 @@
(^template [<number> <tag> <writer>]
[(<tag> caseV)
(let [[caseS caseT] (<writer> caseV)]
- [(.inc caseS)
+ [(.++ caseS)
(function (_ [offset binary])
(|> binary
(binary.write/8! offset <number>)
try.trusted
- [(.inc offset)]
+ [(.++ offset)]
caseT))])])
([0 #.Primitive (..and ..text (..list recur))]
[1 #.Sum pair]
@@ -278,12 +278,12 @@
(^template [<number> <tag> <writer>]
[(<tag> caseV)
(let [[caseS caseT] (<writer> caseV)]
- [(.inc caseS)
+ [(.++ caseS)
(function (_ [offset binary])
(|> binary
(binary.write/8! offset <number>)
try.trusted
- [(.inc offset)]
+ [(.++ offset)]
caseT))])])
([0 #.Bit ..bit]
[1 #.Nat ..nat]
diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux
index 7ec9a0d35..8b3a9270c 100644
--- a/stdlib/source/library/lux/data/format/css.lux
+++ b/stdlib/source/library/lux/data/format/css.lux
@@ -51,19 +51,19 @@
(def: .public (font font)
(-> Font (CSS Special))
- (let [with_unicode (case (get@ #/font.unicode_range font)
+ (let [with_unicode (case (value@ #/font.unicode_range font)
(#.Some unicode_range)
- (let [unicode_range' (format "U+" (\ nat.hex encode (get@ #/font.start unicode_range))
- "-" (\ nat.hex encode (get@ #/font.end unicode_range)))]
+ (let [unicode_range' (format "U+" (\ nat.hex encode (value@ #/font.start unicode_range))
+ "-" (\ nat.hex encode (value@ #/font.end unicode_range)))]
(list ["unicode-range" unicode_range']))
#.None
(list))]
- (|> (list& ["font-family" (get@ #/font.family font)]
- ["src" (format "url(" (get@ #/font.source font) ")")]
- ["font-stretch" (|> font (get@ #/font.stretch) (maybe.else /value.normal_stretch) /value.value)]
- ["font-style" (|> font (get@ #/font.style) (maybe.else /value.normal_style) /value.value)]
- ["font-weight" (|> font (get@ #/font.weight) (maybe.else /value.normal_weight) /value.value)]
+ (|> (list& ["font-family" (value@ #/font.family font)]
+ ["src" (format "url(" (value@ #/font.source font) ")")]
+ ["font-stretch" (|> font (value@ #/font.stretch) (maybe.else /value.normal_stretch) /value.value)]
+ ["font-style" (|> font (value@ #/font.style) (maybe.else /value.normal_style) /value.value)]
+ ["font-weight" (|> font (value@ #/font.weight) (maybe.else /value.normal_weight) /value.value)]
with_unicode)
(list\map (function (_ [property value])
(format property ": " value ";")))
@@ -95,8 +95,8 @@
(:abstraction (format "@keyframes " (/value.value animation) " {"
(|> frames
(list\map (function (_ frame)
- (format (/value.percentage (get@ #when frame)) " {"
- (/style.inline (get@ #what frame))
+ (format (/value.percentage (value@ #when frame)) " {"
+ (/style.inline (value@ #what frame))
"}")))
(text.interposed ..css_separator))
"}")))
diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux
index 0c8e8f70f..54de6d97a 100644
--- a/stdlib/source/library/lux/data/format/css/value.lux
+++ b/stdlib/source/library/lux/data/format/css/value.lux
@@ -988,7 +988,7 @@
(-> Percentage Text)
(|>> :representation))
- (def: percentage_limit Nat (.inc 100))
+ (def: percentage_limit Nat (.++ 100))
(def: .public (%% value)
(-> Nat Percentage)
@@ -1131,7 +1131,7 @@
(def: .public (clip rectangle)
(-> Rectangle (Value Clip))
(`` (..apply "rect" (list (~~ (template [<side>]
- [(:representation (get@ <side> rectangle))]
+ [(:representation (value@ <side> rectangle))]
[#top] [#right] [#bottom] [#left]))))))
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux
index 7f1346df1..c26a7a751 100644
--- a/stdlib/source/library/lux/data/format/tar.lux
+++ b/stdlib/source/library/lux/data/format/tar.lux
@@ -44,7 +44,7 @@
max_size)
padding (|> "0"
(list.repeated padding_size)
- text.joined)]
+ text.together)]
(format padding number)))
(def: blank " ")
@@ -61,12 +61,12 @@
(|> ..octal_size
(list.repeated <size>)
(list\fold n.* 1)
- inc))
+ ++))
(exception: .public (<exception> {value Nat})
(exception.report
["Value" (%.nat value)]
- ["Maximum" (%.nat (dec <limit>))]))
+ ["Maximum" (%.nat (-- <limit>))]))
(abstract: .public <type>
{}
@@ -171,7 +171,7 @@
(def: checksum
(-> Binary Nat)
- (binary.fold n.+ 0))
+ (binary.aggregate n.+ 0))
(def: checksum_checksum
(|> ..dummy_checksum
@@ -216,10 +216,10 @@
(def: ascii?
(-> Text Bit)
(|>> (\ utf8.codec encode)
- (binary.fold (function (_ char verdict)
- (.and verdict
- (n.<= ..last_ascii char)))
- true)))
+ (binary.aggregate (function (_ char verdict)
+ (.and verdict
+ (n.<= ..last_ascii char)))
+ true)))
(exception: .public (not_ascii {text Text})
(exception.report
@@ -232,17 +232,17 @@
(-> Binary (Try Binary))
(case (binary.size string)
0 (#try.Success string)
- size (loop [end (dec size)]
+ size (loop [end (-- size)]
(case end
0 (#try.Success (\ utf8.codec encode ""))
_ (do try.monad
[last_char (binary.read/8! end string)]
(`` (case (.nat last_char)
(^ (char (~~ (static ..null))))
- (recur (dec end))
+ (recur (-- end))
_
- (binary.slice 0 (inc end) string))))))))
+ (binary.slice 0 (++ end) string))))))))
(template [<type> <representation> <size> <exception> <in> <out> <writer> <parser> <none>]
[(abstract: .public <type>
@@ -640,11 +640,11 @@
(def: (header_writer header)
(Writer Header)
(let [checksum (|> header
- (set@ #checksum ..dummy_checksum)
+ (with@ #checksum ..dummy_checksum)
(format.result ..header_writer')
..checksum_code)]
(|> header
- (set@ #checksum checksum)
+ (with@ #checksum checksum)
(format.result ..header_writer')
(format.segment ..block_size))))
@@ -664,16 +664,16 @@
(format.segment (..rounded_content_size size)))]
(writer [{#path path
#mode mode
- #user_id (get@ [#user #id] ownership)
- #group_id (get@ [#group #id] ownership)
+ #user_id (value@ [#user #id] ownership)
+ #group_id (value@ [#group #id] ownership)
#size size
#modification_time (..modification_time modification_time)
#checksum ..dummy_checksum
#link_flag link_flag
#link_name ..no_path
#magic ..ustar
- #user_name (get@ [#user #name] ownership)
- #group_name (get@ [#group #name] ownership)
+ #user_name (value@ [#user #name] ownership)
+ #group_name (value@ [#group #name] ownership)
#major_device ..no_device
#minor_device ..no_device}
content]))))
@@ -812,26 +812,26 @@
(-> Link_Flag (Parser File))
(do <>.monad
[header ..header_parser
- _ (<>.assertion (exception.error ..wrong_link_flag [expected (get@ #link_flag header)])
- (same? expected (get@ #link_flag header)))
- .let [size (get@ #size header)
+ _ (<>.assertion (exception.error ..wrong_link_flag [expected (value@ #link_flag header)])
+ (same? expected (value@ #link_flag header)))
+ .let [size (value@ #size header)
rounded_size (..rounded_content_size size)]
content (<binary>.segment (..from_big size))
content (<>.lifted (..content content))
_ (<binary>.segment (n.- (..from_big size) rounded_size))]
- (in [(get@ #path header)
+ (in [(value@ #path header)
(|> header
- (get@ #modification_time)
+ (value@ #modification_time)
..from_big
.int
duration.of_millis
(duration.up (|> duration.second duration.millis .nat))
instant.absolute)
- (get@ #mode header)
- {#user {#name (get@ #user_name header)
- #id (get@ #user_id header)}
- #group {#name (get@ #group_name header)
- #id (get@ #group_id header)}}
+ (value@ #mode header)
+ {#user {#name (value@ #user_name header)
+ #id (value@ #user_id header)}
+ #group {#name (value@ #group_name header)
+ #id (value@ #group_id header)}}
content])))
(def: (file_name_parser expected extractor)
@@ -839,9 +839,9 @@
(do <>.monad
[header ..header_parser
_ (<>.lifted
- (exception.assertion ..wrong_link_flag [expected (get@ #link_flag header)]
+ (exception.assertion ..wrong_link_flag [expected (value@ #link_flag header)]
(n.= (..link_flag expected)
- (..link_flag (get@ #link_flag header)))))]
+ (..link_flag (value@ #link_flag header)))))]
(in (extractor header))))
(def: entry_parser
@@ -851,9 +851,9 @@
(<>.either (..file_parser ..normal)
(..file_parser ..old_normal)))
(\ <>.monad map (|>> #..Symbolic_Link)
- (..file_name_parser ..symbolic_link (get@ #link_name)))
+ (..file_name_parser ..symbolic_link (value@ #link_name)))
(\ <>.monad map (|>> #..Directory)
- (..file_name_parser ..directory (get@ #path)))
+ (..file_name_parser ..directory (value@ #path)))
(\ <>.monad map (|>> #..Contiguous)
(..file_parser ..contiguous))))
diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux
index 67722607c..b596734ea 100644
--- a/stdlib/source/library/lux/data/format/xml.lux
+++ b/stdlib/source/library/lux/data/format/xml.lux
@@ -269,7 +269,7 @@
($_ text\compose prefix "<" tag attrs ">"
(|> xml_children
(list\map (|>> (recur (text\compose prefix text.tab)) (text\compose text.new_line)))
- text.joined)
+ text.together)
text.new_line prefix "</" tag ">")))))
))))
(def: decode
diff --git a/stdlib/source/library/lux/data/product.lux b/stdlib/source/library/lux/data/product.lux
index 4173f8133..aba9488bc 100644
--- a/stdlib/source/library/lux/data/product.lux
+++ b/stdlib/source/library/lux/data/product.lux
@@ -41,7 +41,7 @@
(let [[x y] xy]
[y x]))
-(def: .public (apply f g)
+(def: .public (then f g)
{#.doc (example "Apply functions to both sides of a pair.")}
(All [a b c d]
(-> (-> a c) (-> b d)
@@ -49,7 +49,7 @@
(function (_ [x y])
[(f x) (g y)]))
-(def: .public (fork f g)
+(def: .public (forked f g)
{#.doc (example "Yields a pair by applying both functions to a single value.")}
(All [a l r]
(-> (-> a l) (-> a r)
diff --git a/stdlib/source/library/lux/data/store.lux b/stdlib/source/library/lux/data/store.lux
index ba795f4d1..a25331cd4 100644
--- a/stdlib/source/library/lux/data/store.lux
+++ b/stdlib/source/library/lux/data/store.lux
@@ -13,8 +13,8 @@
(def: (extend f wa)
(All [s a b] (-> (-> (Store s a) b) (Store s a) (Store s b)))
- {#cursor (get@ #cursor wa)
- #peek (function (_ s) (f (set@ #cursor s wa)))})
+ {#cursor (value@ #cursor wa)
+ #peek (function (_ s) (f (with@ #cursor s wa)))})
(implementation: .public functor
(All [s] (Functor (Store s)))
diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux
index 84b19ffc3..f14efa463 100644
--- a/stdlib/source/library/lux/data/sum.lux
+++ b/stdlib/source/library/lux/data/sum.lux
@@ -28,7 +28,7 @@
(0 #0 l) (fl l)
(0 #1 r) (fr r))))
-(def: .public (apply fl fr)
+(def: .public (then fl fr)
{#.doc (example "Applies functions to both sides of a 2-variant.")}
(All [l l' r r']
(-> (-> l l') (-> r r')
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index 2670bdae3..baeade224 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -78,7 +78,7 @@
output
(#.Some from')
- (recur (inc from') output')))))
+ (recur (++ from') output')))))
(def: .public (last_index_of part text)
(-> Text Text (Maybe Nat))
@@ -284,14 +284,14 @@
(loop [index 0
hash 0]
(if (n.< length index)
- (recur (inc index)
+ (recur (++ index)
(|> hash
(i64.left_shifted 5)
(n.- hash)
(n.+ ("lux text char" index input))))
hash))))))
-(def: .public joined
+(def: .public together
(-> (List Text) Text)
(let [(^open ".") ..monoid]
(|>> list.reversed
@@ -300,8 +300,8 @@
(def: .public (interposed separator texts)
(-> Text (List Text) Text)
(case separator
- "" (..joined texts)
- _ (|> texts (list.interposed separator) ..joined)))
+ "" (..together texts)
+ _ (|> texts (list.interposed separator) ..together)))
(def: .public (empty? text)
(-> Text Bit)
diff --git a/stdlib/source/library/lux/data/text/buffer.lux b/stdlib/source/library/lux/data/text/buffer.lux
index 2d8708c58..196227220 100644
--- a/stdlib/source/library/lux/data/text/buffer.lux
+++ b/stdlib/source/library/lux/data/text/buffer.lux
@@ -67,37 +67,37 @@
... default
row.empty))))
- (def: .public (append chunk buffer)
+ (def: .public (then chunk buffer)
(-> Text Buffer Buffer)
(with_expansions [<jvm> (let [[capacity transform] (:representation buffer)
- append! (: (-> Text java/lang/StringBuilder java/lang/StringBuilder)
- (function (_ chunk builder)
- (exec
- (java/lang/Appendable::append (:as java/lang/CharSequence chunk)
- builder)
- builder)))]
+ then! (: (-> Text java/lang/StringBuilder java/lang/StringBuilder)
+ (function (_ chunk builder)
+ (exec
+ (java/lang/Appendable::append (:as java/lang/CharSequence chunk)
+ builder)
+ builder)))]
(:abstraction [(n.+ (//.size chunk) capacity)
- (|>> transform (append! chunk))]))]
+ (|>> transform (then! chunk))]))]
(for {@.old <jvm>
@.jvm <jvm>
@.js (let [[capacity transform] (:representation buffer)
- append! (: (-> (JS_Array Text) (JS_Array Text))
- (function (_ array)
- (exec
- (JS_Array::push [chunk] array)
- array)))]
+ then! (: (-> (JS_Array Text) (JS_Array Text))
+ (function (_ array)
+ (exec
+ (JS_Array::push [chunk] array)
+ array)))]
(:abstraction [(n.+ (//.size chunk) capacity)
- (|>> transform append!)]))
+ (|>> transform then!)]))
@.lua (let [[capacity transform] (:representation buffer)
- append! (: (-> (array.Array Text) (array.Array Text))
- (function (_ array)
- (exec
- (table/insert [array chunk])
- array)))]
+ then! (: (-> (array.Array Text) (array.Array Text))
+ (function (_ array)
+ (exec
+ (table/insert [array chunk])
+ array)))]
(:abstraction [(n.+ (//.size chunk) capacity)
- (|>> transform append!)]))}
+ (|>> transform then!)]))}
... default
- (|> buffer :representation (row.add chunk) :abstraction))))
+ (|> buffer :representation (row.suffix chunk) :abstraction))))
(def: .public size
(-> Buffer Nat)
diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux
index f46331176..89205cbff 100644
--- a/stdlib/source/library/lux/data/text/escape.lux
+++ b/stdlib/source/library/lux/data/text/escape.lux
@@ -84,7 +84,7 @@
(def: (ascii_escaped replacement pre_offset pre_limit previous current)
(-> Text Nat Nat Text Text [Text Text Nat])
- (let [post_offset (inc pre_offset)
+ (let [post_offset (++ pre_offset)
post_limit (n.- post_offset pre_limit)]
[(format previous
("lux text clip" 0 pre_offset current)
@@ -101,7 +101,7 @@
2 (format "00" code)
3 (format "0" code)
_ code))
- post_offset (inc pre_offset)
+ post_offset (++ pre_offset)
post_limit (n.- post_offset pre_limit)]
[(format previous
("lux text clip" 0 pre_offset current)
@@ -138,13 +138,13 @@
(n.> ..ascii_top char))
(let [[previous' current' limit'] (unicode_escaped char offset limit previous current)]
(recur 0 previous' current' limit'))
- (recur (inc offset) previous current limit)))
+ (recur (++ offset) previous current limit)))
(format previous current))))
(exception: .public (dangling_escape {text Text})
(exception.report
["In" (%.text text)]
- ["At" (%.nat (dec (//.size text)))]))
+ ["At" (%.nat (-- (//.size text)))]))
(exception: .public (invalid_escape {text Text} {offset Nat} {sigil Char})
(exception.report
@@ -202,7 +202,7 @@
(if (n.< limit offset)
(case ("lux text char" offset current)
(^ (static ..sigil_char))
- (let [@sigil (inc offset)]
+ (let [@sigil (++ offset)]
(if (n.< limit @sigil)
(case ("lux text char" @sigil current)
(^template [<sigil> <un_escaped>]
@@ -233,7 +233,7 @@
(exception.except ..dangling_escape [text])))
_
- (recur (inc offset) previous current limit))
+ (recur (++ offset) previous current limit))
(#try.Success (case previous
"" current
_ (format previous current))))))
diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux
index 1a274b692..894dd8321 100644
--- a/stdlib/source/library/lux/data/text/format.lux
+++ b/stdlib/source/library/lux/data/text/format.lux
@@ -121,7 +121,7 @@
(def: .public (list formatter)
(All [a] (-> (Format a) (Format (List a))))
(|>> (list\map (|>> formatter (format " ")))
- text.joined
+ text.together
(text.enclosed ["(list" ")"])))
(def: .public (maybe format)
diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux
index 4998e9ce9..3b26dac8e 100644
--- a/stdlib/source/library/lux/data/text/regex.lux
+++ b/stdlib/source/library/lux/data/text/regex.lux
@@ -54,7 +54,7 @@
(def: join_text^
(-> (Parser (List Text)) (Parser Text))
- (\ <>.monad map //.joined))
+ (\ <>.monad map //.together))
(def: name_char^
(Parser Text)
@@ -300,7 +300,7 @@
[idx (code.identifier ["" _name])]
#.None
- [(inc idx) (code.identifier ["" (n\encode idx)])])
+ [(++ idx) (code.identifier ["" (n\encode idx)])])
access (if (n.> 0 num_captures)
(` ((~! product.left) (~ name!)))
name!)]
diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux
index deb289a22..95931ff4a 100644
--- a/stdlib/source/library/lux/data/text/unicode/block.lux
+++ b/stdlib/source/library/lux/data/text/unicode/block.lux
@@ -48,7 +48,7 @@
(template [<name> <slot>]
[(def: .public <name>
(-> Block Char)
- (|>> :representation (get@ <slot>)))]
+ (|>> :representation (value@ <slot>)))]
[start #interval.bottom]
[end #interval.top]
@@ -56,9 +56,9 @@
(def: .public (size block)
(-> Block Nat)
- (let [start (get@ #interval.bottom (:representation block))
- end (get@ #interval.top (:representation block))]
- (|> end (n.- start) inc)))
+ (let [start (value@ #interval.bottom (:representation block))
+ end (value@ #interval.top (:representation block))]
+ (|> end (n.- start) ++)))
(def: .public (within? block char)
(All [a] (-> Block Char Bit))
diff --git a/stdlib/source/library/lux/data/trace.lux b/stdlib/source/library/lux/data/trace.lux
index 8917fc89a..4b5da0b54 100644
--- a/stdlib/source/library/lux/data/trace.lux
+++ b/stdlib/source/library/lux/data/trace.lux
@@ -13,22 +13,22 @@
(implementation: .public functor (All [t] (Functor (Trace t)))
(def: (map f fa)
- (update@ #trace (compose f) fa)))
+ (revised@ #trace (compose f) fa)))
(implementation: .public comonad (All [t] (CoMonad (Trace t)))
(def: &functor ..functor)
(def: (out wa)
- ((get@ #trace wa)
- (get@ [#monoid #monoid.identity] wa)))
+ ((value@ #trace wa)
+ (value@ [#monoid #monoid.identity] wa)))
(def: (split wa)
- (let [monoid (get@ #monoid wa)]
+ (let [monoid (value@ #monoid wa)]
{#monoid monoid
#trace (function (_ t1)
{#monoid monoid
#trace (function (_ t2)
- ((get@ #trace wa)
+ ((value@ #trace wa)
(\ monoid compose t1 t2)))})})))
(def: .public (result context tracer)
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux
index 8183fb6ff..7a5a9a153 100644
--- a/stdlib/source/library/lux/debug.lux
+++ b/stdlib/source/library/lux/debug.lux
@@ -126,7 +126,7 @@
(let [member ("lua array read" idx tuple)]
(if ("lua object nil?" member)
#.End
- (#.Item member (recur (inc idx))))))))}
+ (#.Item member (recur (++ idx))))))))}
(as_is))
(def: (tuple_inspection inspection)
@@ -461,7 +461,7 @@
[lefts #1 (rightR right)]
_
- (recur (inc lefts) (#.Item rightR extraR+) right)))
+ (recur (++ lefts) (#.Item rightR extraR+) right)))
_
(undefined)))]
@@ -601,7 +601,7 @@
[location meta.location
locals meta.locals
.let [environment (|> locals
- list.joined
+ list.together
... The list is reversed to make sure that, when building the dictionary,
... later bindings overshadow earlier ones if they have the same name.
list.reversed
diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux
index 8651dbdcc..37147b2f0 100644
--- a/stdlib/source/library/lux/documentation.lux
+++ b/stdlib/source/library/lux/documentation.lux
@@ -2,6 +2,7 @@
[library
[lux (#- Definition Module example type)
["." meta]
+ ["." type ("#\." equivalence)]
[abstract
[monad (#+ do)]]
[control
@@ -18,7 +19,7 @@
["." set (#+ Set)]]
[format
["md" markdown (#+ Markdown Block)]]]
- [macro
+ ["." macro
[syntax (#+ syntax:)]
["." code]
["." template]]
@@ -74,13 +75,13 @@
(if (n.= old_line new_line)
(if (n.< old_column new_column)
""
- (text.joined (list.repeated (n.- old_column new_column) " ")))
+ (text.together (list.repeated (n.- old_column new_column) " ")))
(format (if (n.< old_line new_line)
""
- (text.joined (list.repeated (n.- old_line new_line) \n)))
+ (text.together (list.repeated (n.- old_line new_line) \n)))
(if (n.< reference_column new_column)
""
- (text.joined (list.repeated (n.- reference_column new_column) " "))))))
+ (text.together (list.repeated (n.- reference_column new_column) " "))))))
(def: un_paired
(All [a] (-> (List [a a]) (List a)))
@@ -96,7 +97,7 @@
(^template [<tag> <format>]
[[new_location (<tag> value)]
(let [documentation (`` (|> value (~~ (template.spliced <format>))))]
- [(update@ #.column (n.+ (text.size documentation)) new_location)
+ [(revised@ #.column (n.+ (text.size documentation)) new_location)
(format (padding reference_column old_location new_location)
documentation)])])
([#.Bit [%.bit]]
@@ -113,9 +114,9 @@
(let [[group_location' members_documentation] (list\fold (function (_ part [last_location text_accum])
(let [[member_location member_documentation] (code_documentation last_location reference_column part)]
[member_location (format text_accum member_documentation)]))
- [(update@ #.column inc group_location) ""]
+ [(revised@ #.column ++ group_location) ""]
(<prep> members))]
- [(update@ #.column inc group_location')
+ [(revised@ #.column ++ group_location')
(format (padding reference_column old_location group_location)
|<| members_documentation |>|)])])
([syntax.open_form syntax.close_form #.Form |>]
@@ -141,7 +142,7 @@
(let [reference_column (..reference_column example)
[location _] example]
(|> example
- (..code_documentation (set@ #.column reference_column location) reference_column)
+ (..code_documentation (with@ #.column reference_column location) reference_column)
product.right))))
(def: type
@@ -194,16 +195,26 @@
(syntax: (minimal_definition_documentation
[name ..qualified_identifier])
(with_expansions [<\n> (~! text.\n)]
- (in (list (` ($_ ((~! md.then))
- ... Name
- (<| ((~! md.heading/3))
- (~ (code.text (|> name product.right [""] %.name))))
- ... Type
- (<| ((~! md.code))
- ((~! ..type) ("lux in-module"
- (~ (code.text (product.left name)))
- (.:of (~ (code.identifier name)))))))
- )))))
+ (macro.with_identifiers [g!type]
+ (in (list (` ($_ ((~! md.then))
+ ... Name
+ (<| ((~! md.heading/3))
+ (~ (code.text (|> name product.right [""] %.name))))
+ ... Type
+ (let [(~ g!type) ("lux in-module"
+ (~ (code.text (product.left name)))
+ (.:of (~ (code.identifier name))))]
+ ((~! md.code)
+ (if ((~! type\=) .Type (~ g!type))
+ (|> (~ (code.identifier name))
+ (:as .Type)
+ ((~! type.anonymous))
+ ((~! ..type))
+ ((~! %.format)
+ ((~! ..single_line_comment) ((~! ..type) (~ g!type)))
+ <\n>))
+ ((~! ..type) (~ g!type))))))
+ ))))))
(syntax: (definition_documentation
[name ..qualified_identifier
@@ -265,9 +276,9 @@
(def: definitions_documentation
(-> (List Definition) (Markdown Block))
(|>> (list.sorted (function (_ left right)
- (text\< (get@ #definition right)
- (get@ #definition left))))
- (list\map (get@ #documentation))
+ (text\< (value@ #definition right)
+ (value@ #definition left))))
+ (list\map (value@ #documentation))
(list\fold md.then md.empty)))
(def: expected_separator
@@ -326,23 +337,25 @@
(let [(^slots [#expected]) module]
($_ md.then
... Name
- (md.heading/1 (get@ #module module))
+ (md.heading/1 (value@ #module module))
... Description
- (<| md.paragraph
- md.text
- (get@ #description module))
+ (case (value@ #description module)
+ "" md.empty
+ description (<| md.paragraph
+ md.text
+ description))
... Definitions
(md.heading/2 "Definitions")
(|> module
- (get@ #definitions)
- (list.only (|>> (get@ #definition)
+ (value@ #definitions)
+ (list.only (|>> (value@ #definition)
(set.member? expected)))
..definitions_documentation)
... Missing documentation
(case (|> module
- (get@ #definitions)
+ (value@ #definitions)
(list\fold (function (_ definition missing)
- (set.lacks (get@ #definition definition) missing))
+ (set.lacks (value@ #definition definition) missing))
expected)
set.list)
#.End
@@ -354,9 +367,9 @@
(..listing missing)))
... Un-expected documentation
(case (|> module
- (get@ #definitions)
- (list.only (|>> (get@ #definition) (set.member? expected) not))
- (list\map (get@ #definition)))
+ (value@ #definitions)
+ (list.only (|>> (value@ #definition) (set.member? expected) not))
+ (list\map (value@ #definition)))
#.End
md.empty
@@ -369,7 +382,7 @@
(def: .public documentation
(-> (List Module) Text)
(|>> (list.sorted (function (_ left right)
- (text\< (get@ #module right) (get@ #module left))))
+ (text\< (value@ #module right) (value@ #module left))))
(list\map ..module_documentation)
(list.interposed md.horizontal_rule)
(list\fold md.then (: (Markdown Block) md.empty))
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index 52fdef075..d7f3c9544 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -1403,15 +1403,15 @@
(-> (List (Type Var)) Import_Member_Declaration (List (Type Var)))
(case member
(#ConstructorDecl [commons _])
- (list\compose class_tvars (get@ #import_member_tvars commons))
+ (list\compose class_tvars (value@ #import_member_tvars commons))
(#MethodDecl [commons _])
- (case (get@ #import_member_kind commons)
+ (case (value@ #import_member_kind commons)
#StaticIMK
- (get@ #import_member_tvars commons)
+ (value@ #import_member_tvars commons)
_
- (list\compose class_tvars (get@ #import_member_tvars commons)))
+ (list\compose class_tvars (value@ #import_member_tvars commons)))
_
class_tvars))
@@ -1431,7 +1431,7 @@
.let [input_jvm_types (list\map product.right import_member_args)
arg_types (list\map (: (-> [Bit (Type Value)] Code)
(function (_ [maybe? arg])
- (let [arg_type (value_type (get@ #import_member_mode commons) arg)]
+ (let [arg_type (value_type (value@ #import_member_mode commons) arg)]
(if maybe?
(` (Maybe (~ arg_type)))
arg_type))))
@@ -1449,7 +1449,7 @@
(dictionary.key? ..boxes unboxed))
return_term
- (get@ #import_member_maybe? commons)
+ (value@ #import_member_maybe? commons)
(` (??? (~ return_term)))
... else
@@ -1468,7 +1468,7 @@
(-> Import_Member_Declaration Code Code)
(case member
(^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _]))
- (if (get@ <tag> commons)
+ (if (value@ <tag> commons)
<term_trans>
return_term)
@@ -1599,16 +1599,16 @@
(#ConstructorDecl [commons _])
(do meta.monad
[.let [classT (type.class full_name (list))
- def_name (code.identifier ["" (..import_name import_format method_prefix (get@ #import_member_alias commons))])
+ def_name (code.identifier ["" (..import_name import_format method_prefix (value@ #import_member_alias commons))])
jvm_interop (|> [classT
(` ("jvm member invoke constructor"
[(~+ (list\map ..var$ class_tvars))]
(~ (code.text full_name))
- [(~+ (list\map ..var$ (get@ #import_member_tvars commons)))]
- (~+ (|> (jvm_invoke_inputs (get@ #import_member_mode commons) input_jvm_types arg_function_inputs)
+ [(~+ (list\map ..var$ (value@ #import_member_tvars commons)))]
+ (~+ (|> (jvm_invoke_inputs (value@ #import_member_mode commons) input_jvm_types arg_function_inputs)
(list.zipped/2 input_jvm_types)
(list\map ..decorate_input)))))]
- (with_automatic_output_conversion (get@ #import_member_mode commons))
+ (with_automatic_output_conversion (value@ #import_member_mode commons))
(with_return_maybe member true classT)
(with_return_try member)
(with_return_io member))]]
@@ -1618,7 +1618,7 @@
(#MethodDecl [commons method])
(with_identifiers [g!obj]
(do meta.monad
- [.let [def_name (code.identifier ["" (..import_name import_format method_prefix (get@ #import_member_alias commons))])
+ [.let [def_name (code.identifier ["" (..import_name import_format method_prefix (value@ #import_member_alias commons))])
(^slots [#import_member_kind]) commons
(^slots [#import_method_name]) method
[jvm_op object_ast] (: [Text (List Code)]
@@ -1637,18 +1637,18 @@
["jvm member invoke interface"
(list g!obj)]
)))
- method_return (get@ #import_method_return method)
+ method_return (value@ #import_method_return method)
callC (: Code
(` ((~ (code.text jvm_op))
[(~+ (list\map ..var$ class_tvars))]
(~ (code.text full_name))
(~ (code.text import_method_name))
- [(~+ (list\map ..var$ (get@ #import_member_tvars commons)))]
+ [(~+ (list\map ..var$ (value@ #import_member_tvars commons)))]
(~+ (|> object_ast
(list\map ..un_quoted)
(list.zipped/2 (list (type.class full_name (list))))
- (list\map (with_automatic_input_conversion (get@ #import_member_mode commons)))))
- (~+ (|> (jvm_invoke_inputs (get@ #import_member_mode commons) input_jvm_types arg_function_inputs)
+ (list\map (with_automatic_input_conversion (value@ #import_member_mode commons)))))
+ (~+ (|> (jvm_invoke_inputs (value@ #import_member_mode commons) input_jvm_types arg_function_inputs)
(list.zipped/2 input_jvm_types)
(list\map ..decorate_input))))))
jvm_interop (: Code
@@ -1656,7 +1656,7 @@
(#.Left method_return)
(|> [method_return
callC]
- (with_automatic_output_conversion (get@ #import_member_mode commons))
+ (with_automatic_output_conversion (value@ #import_member_mode commons))
(with_return_maybe member false method_return)
(with_return_try member)
(with_return_io member))
@@ -1809,7 +1809,7 @@
=members (|> bundles
(list\map (function (_ [import_format members])
(list\map (|>> [import_format]) members)))
- list.joined
+ list.together
(monad.map ! (member_import$ class_type_vars kind declaration)))]
(in (list& (class_import$ declaration) (list\join =members)))))
@@ -1933,9 +1933,9 @@
_
<failure>))))
-(syntax: .public (array_length [array <code>.any])
+(syntax: .public (length [array <code>.any])
{#.doc (example "Gives the length of an array."
- (array_length my_array))}
+ (length my_array))}
(case array
[_ (#.Identifier array_name)]
(do meta.monad
@@ -1967,12 +1967,12 @@
_
(with_identifiers [g!array]
(in (list (` (let [(~ g!array) (~ array)]
- (..array_length (~ g!array)))))))))
+ (..length (~ g!array)))))))))
-(syntax: .public (array_read [idx <code>.any
- array <code>.any])
+(syntax: .public (read! [idx <code>.any
+ array <code>.any])
{#.doc (example "Loads an element from an array."
- (array_read 10 my_array))}
+ (read! 10 my_array))}
(case array
[_ (#.Identifier array_name)]
(do meta.monad
@@ -2006,13 +2006,13 @@
_
(with_identifiers [g!array]
(in (list (` (let [(~ g!array) (~ array)]
- (..array_read (~ idx) (~ g!array)))))))))
+ (..read! (~ idx) (~ g!array)))))))))
-(syntax: .public (array_write [idx <code>.any
- value <code>.any
- array <code>.any])
+(syntax: .public (write! [idx <code>.any
+ value <code>.any
+ array <code>.any])
{#.doc (example "Stores an element into an array."
- (array_write 10 my_object my_array))}
+ (write! 10 my_object my_array))}
(case array
[_ (#.Identifier array_name)]
(do meta.monad
@@ -2047,7 +2047,7 @@
_
(with_identifiers [g!array]
(in (list (` (let [(~ g!array) (~ array)]
- (..array_write (~ idx) (~ value) (~ g!array)))))))))
+ (..write! (~ idx) (~ value) (~ g!array)))))))))
(syntax: .public (class_for [type (..type^ (list))])
{#.doc (example "Loads the class as a java.lang.Class object."
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 29c286b23..9acf8e055 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -1098,7 +1098,7 @@
.let [arg_decls' (: (List Text) (list\map (|>> product.right (simple_class$ (list)))
arg_decls))]]
(in (`' ((~ (code.text (format "jvm invokespecial"
- ":" (get@ #super_class_name super_class)
+ ":" (value@ #super_class_name super_class)
":" name
":" (text.interposed "," arg_decls'))))
(~' _jvm_this) (~+ args)))))))]
@@ -1368,15 +1368,15 @@
(-> (List Type_Parameter) Import_Member_Declaration (List Type_Parameter))
(case member
(#ConstructorDecl [commons _])
- (list\compose class_tvars (get@ #import_member_tvars commons))
+ (list\compose class_tvars (value@ #import_member_tvars commons))
(#MethodDecl [commons _])
- (case (get@ #import_member_kind commons)
+ (case (value@ #import_member_kind commons)
#StaticIMK
- (get@ #import_member_tvars commons)
+ (value@ #import_member_tvars commons)
_
- (list\compose class_tvars (get@ #import_member_tvars commons)))
+ (list\compose class_tvars (value@ #import_member_tvars commons)))
_
class_tvars))
@@ -1398,7 +1398,7 @@
import_member_args))
arg_types (list\map (: (-> [Bit GenericType] Code)
(function (_ [maybe? arg])
- (let [arg_type (class_type (get@ #import_member_mode commons) type_params arg)]
+ (let [arg_type (class_type (value@ #import_member_mode commons) type_params arg)]
(if maybe?
(` (Maybe (~ arg_type)))
arg_type))))
@@ -1412,7 +1412,7 @@
(-> Class_Declaration Import_Member_Declaration Code Code)
(case member
(^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _]))
- (if (get@ #import_member_maybe? commons)
+ (if (value@ #import_member_maybe? commons)
(` (??? (~ return_term)))
(let [g!temp (` ((~' ~') (~ (code.identifier ["" " Ω "]))))]
(` (let [(~ g!temp) (~ return_term)]
@@ -1420,8 +1420,8 @@
(~ g!temp))))
(~ g!temp)
(panic! (~ (code.text (format "Cannot produce null references from method calls @ "
- (get@ #class_name class)
- "." (get@ #import_member_alias commons))))))))))
+ (value@ #class_name class)
+ "." (value@ #import_member_alias commons))))))))))
_
return_term))
@@ -1431,7 +1431,7 @@
(-> Import_Member_Declaration Code Code)
(case member
(^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _]))
- (if (get@ <tag> commons)
+ (if (value@ <tag> commons)
<term_trans>
return_term)
@@ -1527,10 +1527,10 @@
(#ConstructorDecl [commons _])
(do meta.monad
- [.let [def_name (code.identifier ["" (..import_name import_format method_prefix (get@ #import_member_alias commons))])
+ [.let [def_name (code.identifier ["" (..import_name import_format method_prefix (value@ #import_member_alias commons))])
jvm_extension (code.text (format "jvm new" ":" full_name ":" (text.interposed "," arg_classes)))
jvm_interop (|> (` ((~ jvm_extension)
- (~+ (jvm_extension_inputs (get@ #import_member_mode commons) arg_classes arg_function_inputs))))
+ (~+ (jvm_extension_inputs (value@ #import_member_mode commons) arg_classes arg_function_inputs))))
(decorate_return_maybe class member)
(decorate_return_try member)
(decorate_return_io member))]]
@@ -1540,7 +1540,7 @@
(#MethodDecl [commons method])
(with_identifiers [g!obj]
(do meta.monad
- [.let [def_name (code.identifier ["" (..import_name import_format method_prefix (get@ #import_member_alias commons))])
+ [.let [def_name (code.identifier ["" (..import_name import_format method_prefix (value@ #import_member_alias commons))])
(^slots [#import_member_kind]) commons
(^slots [#import_method_name]) method
[jvm_op object_ast] (: [Text (List Code)]
@@ -1560,10 +1560,10 @@
(list g!obj)]
)))
jvm_extension (code.text (format "jvm " jvm_op ":" full_name ":" import_method_name ":" (text.interposed "," arg_classes)))
- jvm_interop (|> [(simple_class$ (list) (get@ #import_method_return method))
+ jvm_interop (|> [(simple_class$ (list) (value@ #import_method_return method))
(` ((~ jvm_extension) (~+ (list\map un_quote object_ast))
- (~+ (jvm_extension_inputs (get@ #import_member_mode commons) arg_classes arg_function_inputs))))]
- (auto_convert_output (get@ #import_member_mode commons))
+ (~+ (jvm_extension_inputs (value@ #import_member_mode commons) arg_classes arg_function_inputs))))]
+ (auto_convert_output (value@ #import_member_mode commons))
(decorate_return_maybe class member)
(decorate_return_try member)
(decorate_return_io member))]]
@@ -1717,7 +1717,7 @@
=members (|> bundles
(list\map (function (_ [import_format members])
(list\map (|>> [import_format]) members)))
- list.joined
+ list.together
(monad.map ! (member_import$ (product.right class_decl) kind class_decl)))]
(in (list& (class_import$ class_decl) (list\join =members)))))
@@ -1741,9 +1741,9 @@
_
(in (list (` ("jvm anewarray" (~ (code.text (generic_type$ type))) (~ size)))))))
-(syntax: .public (array_length [array <code>.any])
+(syntax: .public (length [array <code>.any])
{#.doc (example "Gives the length of an array."
- (array_length my_array))}
+ (length my_array))}
(in (list (` ("jvm arraylength" (~ array))))))
(def: (type_class_name type)
@@ -1768,10 +1768,10 @@
_
(meta.failure (format "Cannot convert to JvmType: " (type.format type))))))
-(syntax: .public (array_read [idx <code>.any
- array <code>.any])
+(syntax: .public (read! [idx <code>.any
+ array <code>.any])
{#.doc (example "Loads an element from an array."
- (array_read 10 my_array))}
+ (read! 10 my_array))}
(case array
[_ (#.Identifier array_name)]
(do meta.monad
@@ -1796,13 +1796,13 @@
_
(with_identifiers [g!array]
(in (list (` (let [(~ g!array) (~ array)]
- (..array_read (~ idx) (~ g!array)))))))))
+ (..read! (~ idx) (~ g!array)))))))))
-(syntax: .public (array_write [idx <code>.any
- value <code>.any
- array <code>.any])
+(syntax: .public (write! [idx <code>.any
+ value <code>.any
+ array <code>.any])
{#.doc (example "Stores an element into an array."
- (array_write 10 my_object my_array))}
+ (write! 10 my_object my_array))}
(case array
[_ (#.Identifier array_name)]
(do meta.monad
@@ -1827,7 +1827,7 @@
_
(with_identifiers [g!array]
(in (list (` (let [(~ g!array) (~ array)]
- (..array_write (~ idx) (~ value) (~ g!array)))))))))
+ (..write! (~ idx) (~ value) (~ g!array)))))))))
(syntax: .public (class_for [type (..generic_type^ (list))])
{#.doc (example "Loads the class as a java.lang.Class object."
diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux
index 1a7b52201..29ec7c190 100644
--- a/stdlib/source/library/lux/locale/language.lux
+++ b/stdlib/source/library/lux/locale/language.lux
@@ -21,7 +21,7 @@
(template [<name> <tag>]
[(def: .public <name>
(-> Language Text)
- (|>> :representation (get@ <tag>)))]
+ (|>> :representation (value@ <tag>)))]
[name #name]
[code #code]
diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux
index e0f569100..6309e1a86 100644
--- a/stdlib/source/library/lux/locale/territory.lux
+++ b/stdlib/source/library/lux/locale/territory.lux
@@ -24,7 +24,7 @@
[(def: .public <name>
(-> Territory <type>)
(|>> :representation
- (get@ <field>)))]
+ (value@ <field>)))]
[name #name Text]
[short_code #short Text]
@@ -309,6 +309,6 @@
(def: hash
(|>> :representation
- (get@ #long)
+ (value@ #long)
(\ text.hash hash))))
)
diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux
index 8a10f5f26..8c518b855 100644
--- a/stdlib/source/library/lux/macro/local.lux
+++ b/stdlib/source/library/lux/macro/local.lux
@@ -34,11 +34,11 @@
(def: (with_module name body)
(All [a] (-> Text (-> Module (Try [Module a])) (Meta a)))
(function (_ compiler)
- (case (|> compiler (get@ #.modules) (plist.value name))
+ (case (|> compiler (value@ #.modules) (plist.value name))
(#.Some module)
(case (body module)
(#try.Success [module' output])
- (#try.Success [(update@ #.modules (plist.has name module') compiler)
+ (#try.Success [(revised@ #.modules (plist.has name module') compiler)
output])
(#try.Failure error)
@@ -56,9 +56,9 @@
(plist.has definition_name definition))]]
(..with_module module_name
(function (_ module)
- (case (|> module (get@ #.definitions) (plist.value definition_name))
+ (case (|> module (value@ #.definitions) (plist.value definition_name))
#.None
- (#try.Success [(update@ #.definitions add_macro! module)
+ (#try.Success [(revised@ #.definitions add_macro! module)
[]])
(#.Some _)
@@ -72,9 +72,9 @@
(plist.lacks definition_name))]]
(..with_module module_name
(function (_ module)
- (case (|> module (get@ #.definitions) (plist.value definition_name))
+ (case (|> module (value@ #.definitions) (plist.value definition_name))
(#.Some _)
- (#try.Success [(update@ #.definitions lacks_macro! module)
+ (#try.Success [(revised@ #.definitions lacks_macro! module)
[]])
#.None
@@ -88,7 +88,7 @@
[_ (monad.map ! ..pop_one macros)
_ (..pop_one self)
compiler meta.compiler_state]
- (in (case (get@ #.expected compiler)
+ (in (case (value@ #.expected compiler)
(#.Some _)
(list (' []))
diff --git a/stdlib/source/library/lux/macro/syntax/annotations.lux b/stdlib/source/library/lux/macro/syntax/annotations.lux
index 1db17d9b5..5e23ea9d8 100644
--- a/stdlib/source/library/lux/macro/syntax/annotations.lux
+++ b/stdlib/source/library/lux/macro/syntax/annotations.lux
@@ -31,7 +31,7 @@
(def: .public format
(-> Annotations Code)
- (let [entry (product.apply code.tag function.identity)]
+ (let [entry (product.then code.tag function.identity)]
(|>> (list\map entry)
code.record)))
diff --git a/stdlib/source/library/lux/macro/syntax/declaration.lux b/stdlib/source/library/lux/macro/syntax/declaration.lux
index c85e74822..1a529d3db 100644
--- a/stdlib/source/library/lux/macro/syntax/declaration.lux
+++ b/stdlib/source/library/lux/macro/syntax/declaration.lux
@@ -39,8 +39,8 @@
(def: .public (format value)
(-> Declaration Code)
- (let [g!name (code.local_identifier (get@ #name value))]
- (case (get@ #arguments value)
+ (let [g!name (code.local_identifier (value@ #name value))]
+ (case (value@ #arguments value)
#.End
g!name
diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux
index 7ebf281d4..14e907870 100644
--- a/stdlib/source/library/lux/macro/syntax/definition.lux
+++ b/stdlib/source/library/lux/macro/syntax/definition.lux
@@ -66,9 +66,9 @@
(def: dummy
Code
- (` {#.module (~ (code.text (get@ #.module location.dummy)))
- #.line (~ (code.nat (get@ #.line location.dummy)))
- #.column (~ (code.nat (get@ #.column location.dummy)))}))
+ (` {#.module (~ (code.text (value@ #.module location.dummy)))
+ #.line (~ (code.nat (value@ #.line location.dummy)))
+ #.column (~ (code.nat (value@ #.column location.dummy)))}))
(def: .public (format (^slots [#name #value #anns #export?]))
(-> Definition Code)
@@ -133,7 +133,7 @@
(-> Lux (Parser Definition))
(do <>.monad
[definition (..parser compiler)
- _ (case (get@ #value definition)
+ _ (case (value@ #value definition)
(#.Left _)
(in [])
diff --git a/stdlib/source/library/lux/macro/syntax/input.lux b/stdlib/source/library/lux/macro/syntax/input.lux
index 6754185af..77623fbd7 100644
--- a/stdlib/source/library/lux/macro/syntax/input.lux
+++ b/stdlib/source/library/lux/macro/syntax/input.lux
@@ -26,8 +26,8 @@
(def: .public (format value)
(-> Input Code)
(code.record
- (list [(get@ #binding value)
- (get@ #type value)])))
+ (list [(value@ #binding value)
+ (value@ #type value)])))
(def: .public parser
{#.doc "Parser for the common typed-argument syntax used by many macros."}
diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux
index 8de4f2501..d378f9409 100644
--- a/stdlib/source/library/lux/macro/template.lux
+++ b/stdlib/source/library/lux/macro/template.lux
@@ -44,7 +44,7 @@
(do {! meta.monad}
[g!locals (|> locals
(list\map //.identifier)
- (monad.seq !))]
+ (monad.all !))]
(in (list (` (.with_expansions [(~+ (|> (list.zipped/2 locals g!locals)
(list\map (function (_ [name identifier])
(list (code.local_identifier name) (as_is identifier))))
@@ -196,14 +196,14 @@
[here_name meta.current_module_name
expression? (: (Meta Bit)
(function (_ lux)
- (#try.Success [lux (case (get@ #.expected lux)
+ (#try.Success [lux (case (value@ #.expected lux)
#.None
false
(#.Some _)
true)])))
g!pop (local.push (list\map (function (_ local)
- [[here_name (get@ #name local)]
+ [[here_name (value@ #name local)]
(..macro local)])
locals))]
(if expression?
diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux
index 7f19f1a85..e088df673 100644
--- a/stdlib/source/library/lux/math.lux
+++ b/stdlib/source/library/lux/math.lux
@@ -331,7 +331,7 @@
n n]
(if (n.<= 1 n)
acc
- (recur (n.* n acc) (dec n)))))
+ (recur (n.* n acc) (-- n)))))
(def: .public (hypotenuse catA catB)
(-> Frac Frac Frac)
diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux
index 1615bf633..d26544c0b 100644
--- a/stdlib/source/library/lux/math/number/complex.lux
+++ b/stdlib/source/library/lux/math/number/complex.lux
@@ -50,23 +50,23 @@
(..complex +0.0 +0.0))
(def: .public (not_a_number? complex)
- (or (f.not_a_number? (get@ #real complex))
- (f.not_a_number? (get@ #imaginary complex))))
+ (or (f.not_a_number? (value@ #real complex))
+ (f.not_a_number? (value@ #imaginary complex))))
(def: .public (= param input)
(-> Complex Complex Bit)
- (and (f.= (get@ #real param)
- (get@ #real input))
- (f.= (get@ #imaginary param)
- (get@ #imaginary input))))
+ (and (f.= (value@ #real param)
+ (value@ #real input))
+ (f.= (value@ #imaginary param)
+ (value@ #imaginary input))))
(template [<name> <op>]
[(def: .public (<name> param input)
(-> Complex Complex Complex)
- {#real (<op> (get@ #real param)
- (get@ #real input))
- #imaginary (<op> (get@ #imaginary param)
- (get@ #imaginary input))})]
+ {#real (<op> (value@ #real param)
+ (value@ #real input))
+ #imaginary (<op> (value@ #imaginary param)
+ (value@ #imaginary input))})]
[+ f.+]
[- f.-]
@@ -80,8 +80,8 @@
(template [<name> <transform>]
[(def: .public <name>
(-> Complex Complex)
- (|>> (update@ #real <transform>)
- (update@ #imaginary <transform>)))]
+ (|>> (revised@ #real <transform>)
+ (revised@ #imaginary <transform>)))]
[opposite f.opposite]
[signum f.signum]
@@ -89,25 +89,25 @@
(def: .public conjugate
(-> Complex Complex)
- (update@ #imaginary f.opposite))
+ (revised@ #imaginary f.opposite))
(def: .public (*' param input)
(-> Frac Complex Complex)
{#real (f.* param
- (get@ #real input))
+ (value@ #real input))
#imaginary (f.* param
- (get@ #imaginary input))})
+ (value@ #imaginary input))})
(def: .public (* param input)
(-> Complex Complex Complex)
- {#real (f.- (f.* (get@ #imaginary param)
- (get@ #imaginary input))
- (f.* (get@ #real param)
- (get@ #real input)))
- #imaginary (f.+ (f.* (get@ #real param)
- (get@ #imaginary input))
- (f.* (get@ #imaginary param)
- (get@ #real input)))})
+ {#real (f.- (f.* (value@ #imaginary param)
+ (value@ #imaginary input))
+ (f.* (value@ #real param)
+ (value@ #real input)))
+ #imaginary (f.+ (f.* (value@ #real param)
+ (value@ #imaginary input))
+ (f.* (value@ #imaginary param)
+ (value@ #real input)))})
(def: .public (/ param input)
(-> Complex Complex Complex)
@@ -116,12 +116,12 @@
(f.abs real))
(let [quot (f./ imaginary real)
denom (|> real (f.* quot) (f.+ imaginary))]
- {#real (|> (get@ #real input) (f.* quot) (f.+ (get@ #imaginary input)) (f./ denom))
- #imaginary (|> (get@ #imaginary input) (f.* quot) (f.- (get@ #real input)) (f./ denom))})
+ {#real (|> (value@ #real input) (f.* quot) (f.+ (value@ #imaginary input)) (f./ denom))
+ #imaginary (|> (value@ #imaginary input) (f.* quot) (f.- (value@ #real input)) (f./ denom))})
(let [quot (f./ real imaginary)
denom (|> imaginary (f.* quot) (f.+ real))]
- {#real (|> (get@ #imaginary input) (f.* quot) (f.+ (get@ #real input)) (f./ denom))
- #imaginary (|> (get@ #imaginary input) (f.- (f.* quot (get@ #real input))) (f./ denom))}))))
+ {#real (|> (value@ #imaginary input) (f.* quot) (f.+ (value@ #real input)) (f./ denom))
+ #imaginary (|> (value@ #imaginary input) (f.- (f.* quot (value@ #real input))) (f./ denom))}))))
(def: .public (/' param subject)
(-> Frac Complex Complex)
@@ -133,8 +133,8 @@
(-> Complex Complex Complex)
(let [scaled (/ param input)
quotient (|> scaled
- (update@ #real math.floor)
- (update@ #imaginary math.floor))]
+ (revised@ #real math.floor)
+ (revised@ #imaginary math.floor))]
(- (* quotient param)
input)))
@@ -311,8 +311,8 @@
(def: .public (approximately? margin_of_error standard value)
(-> Frac Complex Complex Bit)
(and (f.approximately? margin_of_error
- (get@ #..real standard)
- (get@ #..real value))
+ (value@ #..real standard)
+ (value@ #..real value))
(f.approximately? margin_of_error
- (get@ #..imaginary standard)
- (get@ #..imaginary value))))
+ (value@ #..imaginary standard)
+ (value@ #..imaginary value))))
diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux
index 9e49975f8..1d92184b8 100644
--- a/stdlib/source/library/lux/math/number/frac.lux
+++ b/stdlib/source/library/lux/math/number/frac.lux
@@ -288,7 +288,7 @@
exponent_bits (|> (if (..< +0.0 min_gap)
(|> (..int exponent)
(//int.- (..int min_gap))
- dec)
+ --)
(..int exponent))
(//int.+ (.int ..double_bias))
(//i64.and ..exponent_mask))
@@ -302,7 +302,7 @@
(template [<getter> <size> <offset>]
[(def: <getter>
(-> (I64 Any) I64)
- (let [mask (|> 1 (//i64.left_shifted <size>) dec (//i64.left_shifted <offset>))]
+ (let [mask (|> 1 (//i64.left_shifted <size>) -- (//i64.left_shifted <offset>))]
(|>> (//i64.and mask) (//i64.right_shifted <offset>) .i64)))]
[mantissa ..mantissa_size 0]
@@ -400,7 +400,7 @@
[whole decimal] (case ("lux text index" 0 "." mantissa)
(#.Some split_index)
(do !
- [.let [after_offset (inc split_index)
+ [.let [after_offset (++ split_index)
after_length (//nat.- after_offset ("lux text size" mantissa))]
decimal (|> mantissa
("lux text clip" after_offset after_length)
@@ -410,7 +410,7 @@
#.None
(#try.Failure ("lux text concat" <error> representation)))
- .let [whole ("lux text clip" 1 (dec ("lux text size" whole)) whole)]
+ .let [whole ("lux text clip" 1 (-- ("lux text size" whole)) whole)]
mantissa (\ <nat> decode (case decimal
0 whole
_ ("lux text concat" whole (\ <nat> encode decimal))))
diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux
index fd0c5545b..42c08e00a 100644
--- a/stdlib/source/library/lux/math/number/i64.lux
+++ b/stdlib/source/library/lux/math/number/i64.lux
@@ -48,12 +48,12 @@
(def: .public sign
{#.doc (example "A mask for the sign bit of ints.")}
Mask
- (..bit (dec ..width)))
+ (..bit (-- ..width)))
(def: .public not
{#.doc "Bitwise negation."}
(All [s] (-> (I64 s) (I64 s)))
- (..xor (.i64 (dec 0))))
+ (..xor (.i64 (-- 0))))
(def: .public false
Mask
@@ -70,7 +70,7 @@
0 ..false
bits (case (n.% ..width bits)
0 ..true
- bits (|> 1 .i64 (..left_shifted (n.% ..width bits)) .dec))))
+ bits (|> 1 .i64 (..left_shifted (n.% ..width bits)) .--))))
(def: (with_shift shift value)
(-> Nat Nat Nat)
@@ -161,7 +161,7 @@
(loop [iterations 1
output char]
(if (n.< times iterations)
- (recur (inc iterations)
+ (recur (++ iterations)
("lux text concat" char output))
output))))
pattern (repetitions (n./ (n.+ size size) ..width)
@@ -206,8 +206,8 @@
(if (.and (n.> 0 width)
(n.< ..width width))
(let [sign_shift (n.- width ..width)
- sign (..bit (dec width))
- mantissa (..mask (dec width))
+ sign (..bit (-- width))
+ mantissa (..mask (-- width))
co_mantissa (..xor (.i64 -1) mantissa)]
(#.Some (: Sub
(implementation
diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux
index 88ba6bba1..d5546a4a5 100644
--- a/stdlib/source/library/lux/math/number/int.lux
+++ b/stdlib/source/library/lux/math/number/int.lux
@@ -186,8 +186,8 @@
(Enum Int)
(def: &order ..order)
- (def: succ inc)
- (def: pred dec))
+ (def: succ ++)
+ (def: pred --))
... TODO: Find out why the numeric literals fail during JS compilation.
(implementation: .public interval
@@ -198,7 +198,7 @@
... +9,223,372,036,854,775,807
(let [half (//i64.left_shifted 62 +1)]
(+ half
- (dec half))))
+ (-- half))))
(def: bottom
... -9,223,372,036,854,775,808
(//i64.left_shifted 63 +1)))
@@ -225,7 +225,7 @@
(def: (encode value)
(if (..< +0 value)
- (|> value inc ..opposite .nat inc (\ <codec> encode) ("lux text concat" ..-sign))
+ (|> value ++ ..opposite .nat ++ (\ <codec> encode) ("lux text concat" ..-sign))
(|> value .nat (\ <codec> encode) ("lux text concat" ..+sign))))
(def: (decode repr)
@@ -234,15 +234,15 @@
(case ("lux text clip" 0 1 repr)
(^ (static ..+sign))
(|> repr
- ("lux text clip" 1 (dec input_size))
+ ("lux text clip" 1 (-- input_size))
(\ <codec> decode)
(\ try.functor map .int))
(^ (static ..-sign))
(|> repr
- ("lux text clip" 1 (dec input_size))
+ ("lux text clip" 1 (-- input_size))
(\ <codec> decode)
- (\ try.functor map (|>> dec .int ..opposite dec)))
+ (\ try.functor map (|>> -- .int ..opposite --)))
_
(#try.Failure <error>))
diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux
index bd6ff389c..c72289e0d 100644
--- a/stdlib/source/library/lux/math/number/nat.lux
+++ b/stdlib/source/library/lux/math/number/nat.lux
@@ -170,14 +170,14 @@
(Enum Nat)
(def: &order ..order)
- (def: succ inc)
- (def: pred dec))
+ (def: succ ++)
+ (def: pred --))
(implementation: .public interval
(Interval Nat)
(def: &enum ..enum)
- (def: top (dec 0))
+ (def: top (-- 0))
(def: bottom 0))
(template [<name> <compose> <identity>]
@@ -303,7 +303,7 @@
(Codec Text Nat)
(def: encode
- (let [mask (|> 1 ("lux i64 left-shift" <shift>) dec)]
+ (let [mask (|> 1 ("lux i64 left-shift" <shift>) --)]
(function (_ value)
(loop [input value
output ""]
@@ -325,7 +325,7 @@
(if (..< input_size idx)
(case (<to_value> ("lux text char" idx repr))
(#.Some digit_value)
- (recur (inc idx)
+ (recur (++ idx)
(|> output
("lux i64 left-shift" <shift>)
("lux i64 or" digit_value)))
@@ -367,7 +367,7 @@
<failure>
(#.Some digit_value)
- (recur (inc idx)
+ (recur (++ idx)
(|> output (..* 10) (..+ digit_value))))
(#try.Success output)))
<failure>)))))
diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux
index cfb3eca00..5d5962b47 100644
--- a/stdlib/source/library/lux/math/number/ratio.lux
+++ b/stdlib/source/library/lux/math/number/ratio.lux
@@ -30,8 +30,8 @@
(def: .public (nat value)
(-> Ratio (Maybe Nat))
- (case (get@ #denominator value)
- 1 (#.Some (get@ #numerator value))
+ (case (value@ #denominator value)
+ 1 (#.Some (value@ #numerator value))
_ #.None))
(def: (normal (^slots [#numerator #denominator]))
@@ -51,10 +51,10 @@
(def: .public (= parameter subject)
(-> Ratio Ratio Bit)
- (and (n.= (get@ #numerator parameter)
- (get@ #numerator subject))
- (n.= (get@ #denominator parameter)
- (get@ #denominator subject))))
+ (and (n.= (value@ #numerator parameter)
+ (value@ #numerator subject))
+ (n.= (value@ #denominator parameter)
+ (value@ #denominator subject))))
(implementation: .public equivalence
(Equivalence Ratio)
@@ -63,10 +63,10 @@
(def: (equalized parameter subject)
(-> Ratio Ratio [Nat Nat])
- [(n.* (get@ #denominator subject)
- (get@ #numerator parameter))
- (n.* (get@ #denominator parameter)
- (get@ #numerator subject))])
+ [(n.* (value@ #denominator subject)
+ (value@ #numerator parameter))
+ (n.* (value@ #denominator parameter)
+ (value@ #numerator subject))])
(def: .public (< parameter subject)
(-> Ratio Ratio Bit)
@@ -97,22 +97,22 @@
(-> Ratio Ratio Ratio)
(let [[parameter' subject'] (..equalized parameter subject)]
(normal [(n.+ parameter' subject')
- (n.* (get@ #denominator parameter)
- (get@ #denominator subject))])))
+ (n.* (value@ #denominator parameter)
+ (value@ #denominator subject))])))
(def: .public (- parameter subject)
(-> Ratio Ratio Ratio)
(let [[parameter' subject'] (..equalized parameter subject)]
(normal [(n.- parameter' subject')
- (n.* (get@ #denominator parameter)
- (get@ #denominator subject))])))
+ (n.* (value@ #denominator parameter)
+ (value@ #denominator subject))])))
(def: .public (* parameter subject)
(-> Ratio Ratio Ratio)
- (normal [(n.* (get@ #numerator parameter)
- (get@ #numerator subject))
- (n.* (get@ #denominator parameter)
- (get@ #denominator subject))]))
+ (normal [(n.* (value@ #numerator parameter)
+ (value@ #numerator subject))
+ (n.* (value@ #denominator parameter)
+ (value@ #denominator subject))]))
(def: .public (/ parameter subject)
(-> Ratio Ratio Ratio)
@@ -123,7 +123,7 @@
(-> Ratio Ratio Ratio)
(let [[parameter' subject'] (..equalized parameter subject)
quot (n./ parameter' subject')]
- (..- (update@ #numerator (n.* quot) parameter)
+ (..- (revised@ #numerator (n.* quot) parameter)
subject)))
(def: .public (reciprocal (^slots [#numerator #denominator]))
diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux
index 4eea3ecf7..3fc60202c 100644
--- a/stdlib/source/library/lux/math/number/rev.lux
+++ b/stdlib/source/library/lux/math/number/rev.lux
@@ -119,7 +119,7 @@
("lux i64 +" top))))
(def: even_one (//i64.right_rotated 1 1))
-(def: odd_one (dec 0))
+(def: odd_one (-- 0))
(def: (even_reciprocal numerator)
(-> Nat Nat)
@@ -205,8 +205,8 @@
(Enum Rev)
(def: &order ..order)
- (def: succ inc)
- (def: pred dec))
+ (def: succ ++)
+ (def: pred --))
(implementation: .public interval
(Interval Rev)
@@ -229,7 +229,7 @@
(def: (decimals input)
(-> Text Text)
- ("lux text clip" 1 (dec ("lux text size" input)) input))
+ ("lux text clip" 1 (-- ("lux text size" input)) input))
(template [<struct> <codec> <char_bit_size> <error>]
[(with_expansions [<error_output> (as_is (#try.Failure ("lux text concat" <error> repr)))]
@@ -248,7 +248,7 @@
output (: Text "")]
(if (//nat.= 0 zeroes_left)
output
- (recur (dec zeroes_left)
+ (recur (-- zeroes_left)
("lux text concat" "0" output)))))]
(|> raw_output
("lux text concat" zero_padding)
@@ -311,7 +311,7 @@
(let [raw (|> (..digit idx output)
(//nat.* 5)
(//nat.+ carry))]
- (recur (dec idx)
+ (recur (-- idx)
(//nat./ 10 raw)
(digits\put! idx (//nat.% 10 raw) output)))
output)))
@@ -322,21 +322,21 @@
output (|> (..digits [])
(digits\put! power 1))]
(if (//int.>= +0 (.int times))
- (recur (dec times)
+ (recur (-- times)
(digits\times_5! power output))
output)))
(def: (format digits)
(-> Digits Text)
- (loop [idx (dec //i64.width)
+ (loop [idx (-- //i64.width)
all_zeroes? true
output ""]
(if (//int.>= +0 (.int idx))
(let [digit (..digit idx digits)]
(if (and (//nat.= 0 digit)
all_zeroes?)
- (recur (dec idx) true output)
- (recur (dec idx)
+ (recur (-- idx) true output)
+ (recur (-- idx)
false
("lux text concat"
(\ //nat.decimal encode digit)
@@ -347,7 +347,7 @@
(def: (digits\+! param subject)
(-> Digits Digits Digits)
- (loop [idx (dec //i64.width)
+ (loop [idx (-- //i64.width)
carry 0
output (..digits [])]
(if (//int.>= +0 (.int idx))
@@ -355,7 +355,7 @@
carry
(..digit idx param)
(..digit idx subject))]
- (recur (dec idx)
+ (recur (-- idx)
(//nat./ 10 raw)
(digits\put! idx (//nat.% 10 raw) output)))
output)))
@@ -372,7 +372,7 @@
#.None
(#.Some digit)
- (recur (inc idx)
+ (recur (++ idx)
(digits\put! idx digit output)))
(#.Some output)))
#.None)))
@@ -384,7 +384,7 @@
(let [pd (..digit idx param)
sd (..digit idx subject)]
(if (//nat.= pd sd)
- (recur (inc idx))
+ (recur (++ idx))
(//nat.< pd sd))))))
(def: (digits\-!' idx param subject)
@@ -397,14 +397,14 @@
(//nat.- param))]
(|> subject
(digits\put! idx diff)
- (digits\-!' (dec idx) 1))))))
+ (digits\-!' (-- idx) 1))))))
(def: (digits\-! param subject)
(-> Digits Digits Digits)
- (loop [idx (dec //i64.width)
+ (loop [idx (-- //i64.width)
output subject]
(if (//int.>= +0 (.int idx))
- (recur (dec idx)
+ (recur (-- idx)
(digits\-!' idx (..digit idx param) output))
output)))
@@ -417,16 +417,16 @@
".0"
input
- (let [last_idx (dec //i64.width)]
+ (let [last_idx (-- //i64.width)]
(loop [idx last_idx
digits (..digits [])]
(if (//int.>= +0 (.int idx))
(if (//i64.one? idx input)
(let [digits' (digits\+! (power_digits (//nat.- idx last_idx))
digits)]
- (recur (dec idx)
+ (recur (-- idx)
digits'))
- (recur (dec idx)
+ (recur (-- idx)
digits))
("lux text concat" "." (..format digits))
)))))
@@ -438,7 +438,7 @@
_
false)
- within_limits? (//nat.<= (inc //i64.width)
+ within_limits? (//nat.<= (++ //i64.width)
("lux text size" input))]
(if (and dotted? within_limits?)
(case (|> input ..decimals ..text_digits)
@@ -450,10 +450,10 @@
(let [power (power_digits idx)]
(if (digits\< power digits)
... Skip power
- (recur digits (inc idx) output)
+ (recur digits (++ idx) output)
(recur (digits\-! power digits)
- (inc idx)
- (//i64.one (//nat.- idx (dec //i64.width)) output))))
+ (++ idx)
+ (//i64.one (//nat.- idx (-- //i64.width)) output))))
(#try.Success (.rev output))))
#.None
diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux
index bb66000be..6b61b5159 100644
--- a/stdlib/source/library/lux/math/random.lux
+++ b/stdlib/source/library/lux/math/random.lux
@@ -145,7 +145,7 @@
{#.doc (example "A number in the interval [0.0,1.0].")}
(Random Frac)
(let [mantissa_range (.int (i64.left_shifted 53 1))
- mantissa_max (i.frac (dec mantissa_range))]
+ mantissa_max (i.frac (-- mantissa_range))]
(\ ..monad map
(|>> (i.% mantissa_range)
i.frac
@@ -169,7 +169,7 @@
(\ ..monad in "")
(do ..monad
[x char_gen
- xs (text char_gen (dec size))]
+ xs (text char_gen (-- size))]
(in (text\compose (text.of_char x) xs)))))
(template [<name> <set>]
@@ -251,12 +251,12 @@
(if (n.> 0 size)
(do ..monad
[x value_gen
- xs (<name> (dec size) value_gen)]
+ xs (<name> (-- size) value_gen)]
(in (<plus> x xs)))
(\ ..monad in <zero>)))]
[list List (.list) #.Item]
- [row Row row.empty row.add]
+ [row Row row.empty row.suffix]
)
(template [<name> <type> <ctor>]
@@ -275,7 +275,7 @@
(All [a] (-> (Hash a) Nat (Random a) (Random (Set a))))
(if (n.> 0 size)
(do {! ..monad}
- [xs (set hash (dec size) value_gen)]
+ [xs (set hash (-- size) value_gen)]
(loop [_ []]
(do !
[x value_gen
@@ -289,7 +289,7 @@
(All [k v] (-> (Hash k) Nat (Random k) (Random v) (Random (Dictionary k v))))
(if (n.> 0 size)
(do {! ..monad}
- [kv (dictionary hash (dec size) key_gen value_gen)]
+ [kv (dictionary hash (-- size) key_gen value_gen)]
(loop [_ []]
(do !
[k key_gen
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index b415adb91..7b6e893d3 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -118,13 +118,13 @@
(All [a]
(-> Text (Meta a)))
(function (_ state)
- (#try.Failure (location.with (get@ #.location state) error))))
+ (#try.Failure (location.with (value@ #.location state) error))))
(def: .public (module name)
{#.doc (example "Looks-up a module with the given name.")}
(-> Text (Meta Module))
(function (_ lux)
- (case (plist.value name (get@ #.modules lux))
+ (case (plist.value name (value@ #.modules lux))
(#.Some module)
(#try.Success [lux module])
@@ -135,7 +135,7 @@
{#.doc (example "The name of the module currently being compiled, if any.")}
(Meta Text)
(function (_ lux)
- (case (get@ #.current_module lux)
+ (case (value@ #.current_module lux)
(#.Some current_module)
(#try.Success [lux current_module])
@@ -179,7 +179,7 @@
[$module (plist.value module modules)
definition (: (Maybe Global)
(|> (: Module $module)
- (get@ #.definitions)
+ (value@ #.definitions)
(plist.value name)))]
(case definition
(#.Alias [r_module r_name])
@@ -202,7 +202,7 @@
#.None
(#try.Success [_ this_module])
- (macro' (get@ #.modules lux) this_module module name))]
+ (macro' (value@ #.modules lux) this_module module name))]
(#try.Success [lux macro]))))))
(def: .public seed
@@ -211,13 +211,13 @@
"This number can be used for generating data 'randomly' during compilation.")}
(Meta Nat)
(function (_ lux)
- (#try.Success [(update@ #.seed inc lux)
- (get@ #.seed lux)])))
+ (#try.Success [(revised@ #.seed ++ lux)
+ (value@ #.seed lux)])))
(def: .public (module_exists? module)
(-> Text (Meta Bit))
(function (_ lux)
- (#try.Success [lux (case (plist.value module (get@ #.modules lux))
+ (#try.Success [lux (case (plist.value module (value@ #.modules lux))
(#.Some _)
#1
@@ -248,7 +248,7 @@
(#.Var var)
(function (_ lux)
(case (|> lux
- (get@ [#.type_context #.var_bindings])
+ (value@ [#.type_context #.var_bindings])
(type_variable var))
(^or #.None (#.Some (#.Var _)))
(#try.Success [lux type])
@@ -268,15 +268,15 @@
(case (do maybe.monad
[scope (list.example (function (_ env)
(or (list.any? test (: (List [Text [Type Any]])
- (get@ [#.locals #.mappings] env)))
+ (value@ [#.locals #.mappings] env)))
(list.any? test (: (List [Text [Type Any]])
- (get@ [#.captured #.mappings] env)))))
- (get@ #.scopes lux))
+ (value@ [#.captured #.mappings] env)))))
+ (value@ #.scopes lux))
[_ [type _]] (on_either (list.example test)
(: (List [Text [Type Any]])
- (get@ [#.locals #.mappings] scope))
+ (value@ [#.locals #.mappings] scope))
(: (List [Text [Type Any]])
- (get@ [#.captured #.mappings] scope)))]
+ (value@ [#.captured #.mappings] scope)))]
(in type))
(#.Some var_type)
((clean_type var_type) lux)
@@ -310,28 +310,28 @@
(case (: (Maybe Global)
(do maybe.monad
[(^slots [#.definitions]) (|> lux
- (get@ #.modules)
+ (value@ #.modules)
(plist.value normal_module))]
(plist.value normal_short definitions)))
(#.Some definition)
(#try.Success [lux definition])
_
- (let [current_module (|> lux (get@ #.current_module) (maybe.else "???"))
+ (let [current_module (|> lux (value@ #.current_module) (maybe.else "???"))
all_known_modules (|> lux
- (get@ #.modules)
+ (value@ #.modules)
(list\map product.left)
..module_listing)]
(#try.Failure ($_ text\compose
"Unknown definition: " (name\encode name) text.new_line
" Current module: " current_module text.new_line
- (case (plist.value current_module (get@ #.modules lux))
+ (case (plist.value current_module (value@ #.modules lux))
(#.Some this_module)
(let [candidates (|> lux
- (get@ #.modules)
+ (value@ #.modules)
(list\map (function (_ [module_name module])
(|> module
- (get@ #.definitions)
+ (value@ #.definitions)
(list.all (function (_ [def_name global])
(case global
(#.Definition [exported? _ _ _])
@@ -342,14 +342,14 @@
(#.Alias _)
#.None))))))
- list.joined
+ list.together
(list.sorted text\<)
(text.interposed ..listing_separator))
imports (|> this_module
- (get@ #.imports)
+ (value@ #.imports)
..module_listing)
aliases (|> this_module
- (get@ #.module_aliases)
+ (value@ #.module_aliases)
(list\map (function (_ [alias real]) ($_ text\compose alias " => " real)))
(list.sorted text\<)
(text.interposed ..listing_separator))]
@@ -425,12 +425,12 @@
{#.doc "The entire list of globals in a module (including the non-exported/private ones)."}
(-> Text (Meta (List [Text Global])))
(function (_ lux)
- (case (plist.value module (get@ #.modules lux))
+ (case (plist.value module (value@ #.modules lux))
#.None
(#try.Failure ($_ text\compose "Unknown module: " module))
(#.Some module)
- (#try.Success [lux (get@ #.definitions module)]))))
+ (#try.Success [lux (value@ #.definitions module)]))))
(def: .public (definitions module)
{#.doc "The entire list of definitions in a module (including the non-exported/private ones)."}
@@ -461,7 +461,7 @@
(Meta (List [Text Module]))
(function (_ lux)
(|> lux
- (get@ #.modules)
+ (value@ #.modules)
[lux]
#try.Success)))
@@ -471,7 +471,7 @@
(do ..monad
[.let [[module name] type_name]
module (..module module)]
- (case (plist.value name (get@ #.types module))
+ (case (plist.value name (value@ #.types module))
(#.Some [tags _])
(in (#.Some tags))
@@ -482,13 +482,13 @@
{#.doc "The location of the current expression being analyzed."}
(Meta Location)
(function (_ lux)
- (#try.Success [lux (get@ #.location lux)])))
+ (#try.Success [lux (value@ #.location lux)])))
(def: .public expected_type
{#.doc "The expected type of the current expression being analyzed."}
(Meta Type)
(function (_ lux)
- (case (get@ #.expected lux)
+ (case (value@ #.expected lux)
(#.Some type)
(#try.Success [lux type])
@@ -512,7 +512,7 @@
{#.doc (example "Checks if the given module has been imported by the current module.")}
(-> Text (Meta Bit))
(\ ..functor map
- (|>> (get@ #.imports) (list.any? (text\= import)))
+ (|>> (value@ #.imports) (list.any? (text\= import)))
..current_module))
(def: .public (tag tag_name)
@@ -523,7 +523,7 @@
=module (..module module)
this_module_name ..current_module_name
imported! (..imported? module)]
- (case (plist.value name (get@ #.tags =module))
+ (case (plist.value name (value@ #.tags =module))
(#.Some [idx tag_list exported? type])
(if (or (text\= this_module_name module)
(and imported! exported?))
@@ -534,9 +534,9 @@
(..failure ($_ text\compose
"Unknown tag: " (name\encode tag_name) text.new_line
" Known tags: " (|> =module
- (get@ #.tags)
+ (value@ #.tags)
(list\map (|>> product.left [module] name\encode (text.prefix text.new_line)))
- text.joined)
+ text.together)
)))))
(def: .public (tag_lists module)
@@ -545,7 +545,7 @@
(do ..monad
[=module (..module module)
this_module_name ..current_module_name]
- (in (|> (get@ #.types =module)
+ (in (|> (value@ #.types =module)
(list.only (function (_ [type_name [tag_list exported? type]])
(or exported?
(text\= this_module_name module))))
@@ -556,13 +556,13 @@
{#.doc "All the local variables currently in scope, separated in different scopes."}
(Meta (List (List [Text Type])))
(function (_ lux)
- (case (list.inits (get@ #.scopes lux))
+ (case (list.inits (value@ #.scopes lux))
#.None
(#try.Failure "No local environment")
(#.Some scopes)
(#try.Success [lux
- (list\map (|>> (get@ [#.locals #.mappings])
+ (list\map (|>> (value@ [#.locals #.mappings])
(list\map (function (_ [name [type _]])
[name type])))
scopes)]))))
@@ -589,7 +589,7 @@
{#.doc (example "The current type-checking context.")}
(Meta Type_Context)
(function (_ lux)
- (#try.Success [lux (get@ #.type_context lux)])))
+ (#try.Success [lux (value@ #.type_context lux)])))
(def: .public (lifted result)
(All [a] (-> (Try a) (Meta a)))
diff --git a/stdlib/source/library/lux/meta/location.lux b/stdlib/source/library/lux/meta/location.lux
index 0c089da36..24511eb26 100644
--- a/stdlib/source/library/lux/meta/location.lux
+++ b/stdlib/source/library/lux/meta/location.lux
@@ -8,9 +8,9 @@
(Equivalence Location)
(def: (= reference subject)
- (and ("lux text =" (get@ #.module reference) (get@ #.module subject))
- ("lux i64 =" (get@ #.line reference) (get@ #.line subject))
- ("lux i64 =" (get@ #.column reference) (get@ #.column subject)))))
+ (and ("lux text =" (value@ #.module reference) (value@ #.module subject))
+ ("lux i64 =" (value@ #.line reference) (value@ #.line subject))
+ ("lux i64 =" (value@ #.column reference) (value@ #.column subject)))))
(def: .public dummy
Location
@@ -23,12 +23,12 @@
(here))}
(case tokens
#.End
- (let [location (get@ #.location compiler)]
+ (let [location (value@ #.location compiler)]
(#.Right [compiler
(list (` (.: .Location
- [(~ [..dummy (#.Text (get@ #.module location))])
- (~ [..dummy (#.Nat (get@ #.line location))])
- (~ [..dummy (#.Nat (get@ #.column location))])])))]))
+ [(~ [..dummy (#.Text (value@ #.module location))])
+ (~ [..dummy (#.Nat (value@ #.line location))])
+ (~ [..dummy (#.Nat (value@ #.column location))])])))]))
_
(#.Left (`` (("lux in-module" (~~ (static .prelude_module)) wrong_syntax_error) (name_of ..here))))))
diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux
index 95c49a200..191b5520a 100644
--- a/stdlib/source/library/lux/target/js.lux
+++ b/stdlib/source/library/lux/target/js.lux
@@ -1,6 +1,6 @@
(.module:
[library
- [lux (#- Location Code or and function if cond undefined for comment not int try)
+ [lux (#- Location Code or and function if cond undefined for comment not int try ++ --)
[control
[pipe (#+ case>)]]
[data
diff --git a/stdlib/source/library/lux/target/jvm/attribute/code.lux b/stdlib/source/library/lux/target/jvm/attribute/code.lux
index 1c1cb95a9..81f487d2d 100644
--- a/stdlib/source/library/lux/target/jvm/attribute/code.lux
+++ b/stdlib/source/library/lux/target/jvm/attribute/code.lux
@@ -37,19 +37,19 @@
... u4 code_length;
///unsigned.bytes/4
... u1 code[code_length];
- (binary.size (get@ #code code))
+ (binary.size (value@ #code code))
... u2 exception_table_length;
///unsigned.bytes/2
... exception_table[exception_table_length];
(|> code
- (get@ #exception_table)
+ (value@ #exception_table)
row.size
(n.* /exception.length))
... u2 attributes_count;
///unsigned.bytes/2
... attribute_info attributes[attributes_count];
(|> code
- (get@ #attributes)
+ (value@ #attributes)
(row\map length)
(row\fold n.+ 0))))
@@ -69,14 +69,14 @@
($_ binaryF\compose
... u2 max_stack;
... u2 max_locals;
- (///limit.writer (get@ #limit code))
+ (///limit.writer (value@ #limit code))
... u4 code_length;
... u1 code[code_length];
- (binaryF.binary/32 (get@ #code code))
+ (binaryF.binary/32 (value@ #code code))
... u2 exception_table_length;
... exception_table[exception_table_length];
- ((binaryF.row/16 /exception.writer) (get@ #exception_table code))
+ ((binaryF.row/16 /exception.writer) (value@ #exception_table code))
... u2 attributes_count;
... attribute_info attributes[attributes_count];
- ((binaryF.row/16 writer) (get@ #attributes code))
+ ((binaryF.row/16 writer) (value@ #attributes code))
))
diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux
index 87b0a75c5..a97f4a1c2 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode.lux
@@ -105,9 +105,9 @@
(function (_ [pool environment tracker])
(#try.Success [[pool
environment
- (update@ #next inc tracker)]
+ (revised@ #next ++ tracker)]
[..relative_identity
- (get@ #next tracker)]])))
+ (value@ #next tracker)]])))
(exception: .public (label_has_already_been_set {label Label})
(exception.report
@@ -127,16 +127,16 @@
(with_expansions [<success> (as_is (in [[pool
environment
- (update@ #known
- (dictionary.has label [actual (#.Some @here)])
- tracker)]
+ (revised@ #known
+ (dictionary.has label [actual (#.Some @here)])
+ tracker)]
[..relative_identity
[]]]))]
(def: .public (set_label label)
(-> Label (Bytecode Any))
(function (_ [pool environment tracker])
- (let [@here (get@ #program_counter tracker)]
- (case (dictionary.value label (get@ #known tracker))
+ (let [@here (value@ #program_counter tracker)]
+ (case (dictionary.value label (value@ #known tracker))
(#.Some [expected (#.Some address)])
(exception.except ..label_has_already_been_set [label])
@@ -148,7 +148,7 @@
#.None
(do try.monad
[[actual environment] (/environment.continue (|> environment
- (get@ #/environment.stack)
+ (value@ #/environment.stack)
(maybe.else /stack.empty))
environment)]
<success>))))))
@@ -175,7 +175,7 @@
(function (_ pool)
(do try.monad
[[[pool environment tracker] [relative output]] (bytecode [pool environment ..fresh])
- [exceptions instruction] (relative (get@ #known tracker))]
+ [exceptions instruction] (relative (value@ #known tracker))]
(in [pool [environment exceptions instruction output]]))))
(def: (step estimator counter)
@@ -188,12 +188,12 @@
(do {! try.monad}
[environment' (|> environment
(/environment.consumes consumption)
- (monad.bind ! (/environment.produces production))
- (monad.bind ! (/environment.has registry)))
- program_counter' (step estimator (get@ #program_counter tracker))]
+ (monad.then ! (/environment.produces production))
+ (monad.then ! (/environment.has registry)))
+ program_counter' (step estimator (value@ #program_counter tracker))]
(in [[pool
environment'
- (set@ #program_counter program_counter' tracker)]
+ (with@ #program_counter program_counter' tracker)]
[(function.constant (in [..no_exceptions (bytecode input)]))
[]]]))))
@@ -721,19 +721,19 @@
(def: (acknowledge_label stack label tracker)
(-> Stack Label Tracker Tracker)
- (case (dictionary.value label (get@ #known tracker))
+ (case (dictionary.value label (value@ #known tracker))
(#.Some _)
tracker
#.None
- (update@ #known (dictionary.has label [stack #.None]) tracker)))
+ (revised@ #known (dictionary.has label [stack #.None]) tracker)))
(template [<consumption> <name> <instruction>]
[(def: .public (<name> label)
(-> Label (Bytecode Any))
(let [[estimator bytecode] <instruction>]
(function (_ [pool environment tracker])
- (let [@here (get@ #program_counter tracker)]
+ (let [@here (value@ #program_counter tracker)]
(do try.monad
[environment' (|> environment
(/environment.consumes <consumption>))
@@ -744,7 +744,7 @@
environment'
(|> tracker
(..acknowledge_label actual label)
- (set@ #program_counter program_counter'))]
+ (with@ #program_counter program_counter'))]
[(function (_ resolver)
(do try.monad
[[expected @to] (..resolve_label label resolver)
@@ -787,14 +787,14 @@
(function (_ [pool environment tracker])
(do try.monad
[actual (/environment.stack environment)
- .let [@here (get@ #program_counter tracker)]
+ .let [@here (value@ #program_counter tracker)]
program_counter' (step estimator @here)]
(in (let [@from @here]
[[pool
(/environment.discontinue environment)
(|> tracker
(..acknowledge_label actual label)
- (set@ #program_counter program_counter'))]
+ (with@ #program_counter program_counter'))]
[(function (_ resolver)
(case (dictionary.value label resolver)
(#.Some [expected (#.Some @to)])
@@ -843,22 +843,22 @@
[environment' (|> environment
(/environment.consumes $1))
actual (/environment.stack environment')
- program_counter' (step (estimator (list.size afterwards)) (get@ #program_counter tracker))]
- (in (let [@from (get@ #program_counter tracker)]
+ program_counter' (step (estimator (list.size afterwards)) (value@ #program_counter tracker))]
+ (in (let [@from (value@ #program_counter tracker)]
[[pool
environment'
(|> (list\fold (..acknowledge_label actual) tracker (list& default at_minimum afterwards))
- (set@ #program_counter program_counter'))]
+ (with@ #program_counter program_counter'))]
[(function (_ resolver)
(let [get (: (-> Label (Maybe [Stack (Maybe Address)]))
(function (_ label)
(dictionary.value label resolver)))]
(case (do {! maybe.monad}
- [@default (|> default get (monad.bind ! product.right))
- @at_minimum (|> at_minimum get (monad.bind ! product.right))
+ [@default (|> default get (monad.then ! product.right))
+ @at_minimum (|> at_minimum get (monad.then ! product.right))
@afterwards (|> afterwards
(monad.map ! get)
- (monad.bind ! (monad.map ! product.right)))]
+ (monad.then ! (monad.map ! product.right)))]
(in [@default @at_minimum @afterwards]))
(#.Some [@default @at_minimum @afterwards])
(do {! try.monad}
@@ -886,21 +886,21 @@
[environment' (|> environment
(/environment.consumes $1))
actual (/environment.stack environment')
- program_counter' (step (estimator (list.size cases)) (get@ #program_counter tracker))]
- (in (let [@from (get@ #program_counter tracker)]
+ program_counter' (step (estimator (list.size cases)) (value@ #program_counter tracker))]
+ (in (let [@from (value@ #program_counter tracker)]
[[pool
environment'
(|> (list\fold (..acknowledge_label actual) tracker (list& default (list\map product.right cases)))
- (set@ #program_counter program_counter'))]
+ (with@ #program_counter program_counter'))]
[(function (_ resolver)
(let [get (: (-> Label (Maybe [Stack (Maybe Address)]))
(function (_ label)
(dictionary.value label resolver)))]
(case (do {! maybe.monad}
- [@default (|> default get (monad.bind ! product.right))
+ [@default (|> default get (monad.then ! product.right))
@cases (|> cases
(monad.map ! (|>> product.right get))
- (monad.bind ! (monad.map ! product.right)))]
+ (monad.then ! (monad.map ! product.right)))]
(in [@default @cases]))
(#.Some [@default @cases])
(do {! try.monad}
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux
index 6a09af8fd..54c754dc5 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux
@@ -51,7 +51,7 @@
(def: .public (stack environment)
(-> Environment (Try Stack))
- (case (get@ #..stack environment)
+ (case (value@ #..stack environment)
(#.Some stack)
(#try.Success stack)
@@ -60,7 +60,7 @@
(def: .public discontinue
(-> Environment Environment)
- (set@ #..stack #.None))
+ (with@ #..stack #.None))
(exception: .public (mismatched_stacks {expected Stack}
{actual Stack})
@@ -70,14 +70,14 @@
(def: .public (continue expected environment)
(-> Stack Environment (Try [Stack Environment]))
- (case (get@ #..stack environment)
+ (case (value@ #..stack environment)
(#.Some actual)
(if (\ /stack.equivalence = expected actual)
(#try.Success [actual environment])
(exception.except ..mismatched_stacks [expected actual]))
#.None
- (#try.Success [expected (set@ #..stack (#.Some expected) environment)])))
+ (#try.Success [expected (with@ #..stack (#.Some expected) environment)])))
(def: .public (consumes amount)
(-> U2 Condition)
@@ -87,7 +87,7 @@
(do try.monad
[previous (..stack environment)
current (/stack.pop amount previous)]
- (in (set@ #..stack (#.Some current) environment)))))
+ (in (with@ #..stack (#.Some current) environment)))))
(def: .public (produces amount)
(-> U2 Condition)
@@ -96,13 +96,13 @@
[previous (..stack environment)
current (/stack.push amount previous)
.let [limit (|> environment
- (get@ [#..limit #/limit.stack])
+ (value@ [#..limit #/limit.stack])
(/stack.max current))]]
(in (|> environment
- (set@ #..stack (#.Some current))
- (set@ [#..limit #/limit.stack] limit))))))
+ (with@ #..stack (#.Some current))
+ (with@ [#..limit #/limit.stack] limit))))))
(def: .public (has registry)
(-> Registry Condition)
- (|>> (update@ [#..limit #/limit.registry] (/registry.has registry))
+ (|>> (revised@ [#..limit #/limit.registry] (/registry.has registry))
#try.Success))
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 48bdffd82..d57c07354 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux
@@ -53,6 +53,6 @@
(def: .public (writer limit)
(Writer Limit)
($_ format\compose
- (/stack.writer (get@ #stack limit))
- (/registry.writer (get@ #registry limit))
+ (/stack.writer (value@ #stack limit))
+ (/registry.writer (value@ #registry limit))
))
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux
index 7f8638dca..2e21d2a8e 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux
@@ -54,7 +54,7 @@
(def: .public result
(-> Instruction Specification)
- (function.apply format.no_op))
+ (function.on format.no_op))
(type: Opcode Nat)
@@ -596,7 +596,7 @@
(///unsigned.value ..integer_size)
(///unsigned.value ..integer_size)
(n.* (///unsigned.value ..big_jump_size)
- (inc amount_of_afterwards)))
+ (++ amount_of_afterwards)))
///unsigned.u2
try.trusted)))]
[estimator
@@ -622,7 +622,7 @@
_ (case padding
3 (do !
[_ (binary.write/8! offset 0 binary)]
- (binary.write/16! (inc offset) 0 binary))
+ (binary.write/16! (++ offset) 0 binary))
2 (binary.write/16! offset 0 binary)
1 (binary.write/8! offset 0 binary)
_ (in binary))
@@ -684,7 +684,7 @@
_ (case padding
3 (do !
[_ (binary.write/8! offset 0 binary)]
- (binary.write/16! (inc offset) 0 binary))
+ (binary.write/16! (++ offset) 0 binary))
2 (binary.write/16! offset 0 binary)
1 (binary.write/8! offset 0 binary)
_ (in binary))
diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux
index b4cb88ec4..586cc2394 100644
--- a/stdlib/source/library/lux/target/jvm/class.lux
+++ b/stdlib/source/library/lux/target/jvm/class.lux
@@ -76,7 +76,7 @@
(monad.fold ! (function (_ interface @interfaces)
(do !
[@interface (//constant/pool.class interface)]
- (in (row.add @interface @interfaces))))
+ (in (row.suffix @interface @interfaces))))
row.empty
interfaces))]
(in [@this @super @interfaces])))
@@ -95,8 +95,8 @@
(<| (state.result' //constant/pool.empty)
(do //constant/pool.monad
[classes (install_classes this super interfaces)
- =fields (monad.seq //constant/pool.monad fields)
- =methods (monad.seq //constant/pool.monad methods)]
+ =fields (monad.all //constant/pool.monad fields)
+ =methods (monad.all //constant/pool.monad methods)]
(in [classes =fields =methods])))]
(in {#magic //magic.code
#minor_version //version.default_minor
@@ -114,7 +114,7 @@
(Writer Class)
(`` ($_ binaryF\compose
(~~ (template [<writer> <slot>]
- [(<writer> (get@ <slot> class))]
+ [(<writer> (value@ <slot> class))]
[//magic.writer #magic]
[//version.writer #minor_version]
@@ -124,7 +124,7 @@
[//index.writer #this]
[//index.writer #super]))
(~~ (template [<writer> <slot>]
- [((binaryF.row/16 <writer>) (get@ <slot> class))]
+ [((binaryF.row/16 <writer>) (value@ <slot> class))]
[//index.writer #interfaces]
[//field.writer #fields]
diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux
index 2278889b8..346dd0f9e 100644
--- a/stdlib/source/library/lux/target/jvm/constant/pool.lux
+++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux
@@ -53,7 +53,7 @@
(template: (!add <tag> <equivalence> <value>)
[(function (_ [current pool])
(let [<value>' <value>]
- (with_expansions [<try_again> (as_is (recur (.inc idx)))]
+ (with_expansions [<try_again> (as_is (recur (.++ idx)))]
(loop [idx 0]
(case (row.item idx pool)
(#try.Success entry)
@@ -77,7 +77,7 @@
(//unsigned.+/2 @new)
(\ ! map //index.index)))]
(in [[next
- (row.add [current new] pool)]
+ (row.suffix [current new] pool)]
current]))))))))])
(template: (!index <index>)
diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux
index 8fed13354..1c03a5c47 100644
--- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux
+++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux
@@ -58,7 +58,7 @@
(def: .public <maximum>
<name>
- (|> <bytes> (n.* i64.bits_per_byte) dec i64.mask :abstraction))
+ (|> <bytes> (n.* i64.bits_per_byte) -- i64.mask :abstraction))
(def: .public <constructor>
(-> Int (Try <name>))
diff --git a/stdlib/source/library/lux/target/jvm/field.lux b/stdlib/source/library/lux/target/jvm/field.lux
index a9d783621..b8d84170d 100644
--- a/stdlib/source/library/lux/target/jvm/field.lux
+++ b/stdlib/source/library/lux/target/jvm/field.lux
@@ -50,7 +50,7 @@
(Writer Field)
(`` ($_ binaryF\compose
(~~ (template [<writer> <slot>]
- [(<writer> (get@ <slot> field))]
+ [(<writer> (value@ <slot> field))]
[modifier.writer #modifier]
[//index.writer #name]
diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux
index 549fb8b01..3d644cf5d 100644
--- a/stdlib/source/library/lux/target/jvm/loader.lux
+++ b/stdlib/source/library/lux/target/jvm/loader.lux
@@ -66,13 +66,13 @@
(def: java/lang/ClassLoader::defineClass
java/lang/reflect/Method
(let [signature (|> (ffi.array <elemT> 4)
- (ffi.array_write 0 (:as <elemT>
- (ffi.class_for java/lang/String)))
- (ffi.array_write 1 (java/lang/Object::getClass (ffi.array byte 0)))
- (ffi.array_write 2 (:as <elemT>
- (java/lang/Integer::TYPE)))
- (ffi.array_write 3 (:as <elemT>
- (java/lang/Integer::TYPE))))]
+ (ffi.write! 0 (:as <elemT>
+ (ffi.class_for java/lang/String)))
+ (ffi.write! 1 (java/lang/Object::getClass (ffi.array byte 0)))
+ (ffi.write! 2 (:as <elemT>
+ (java/lang/Integer::TYPE)))
+ (ffi.write! 3 (:as <elemT>
+ (java/lang/Integer::TYPE))))]
(do_to (java/lang/Class::getDeclaredMethod "defineClass"
signature
(ffi.class_for java/lang/ClassLoader))
diff --git a/stdlib/source/library/lux/target/jvm/method.lux b/stdlib/source/library/lux/target/jvm/method.lux
index 8c42130d1..e604eb3c2 100644
--- a/stdlib/source/library/lux/target/jvm/method.lux
+++ b/stdlib/source/library/lux/target/jvm/method.lux
@@ -54,7 +54,7 @@
[@name (//constant/pool.utf8 name)
@descriptor (//constant/pool.descriptor (//type.descriptor type))
attributes (|> attributes
- (monad.seq !)
+ (monad.all !)
(\ ! map row.of_list))
attributes (case code
(#.Some code)
@@ -69,11 +69,11 @@
(function (_ _) (#try.Failure error)))
[environment exceptions instruction output] (//bytecode.resolve environment code)
.let [bytecode (|> instruction //bytecode/instruction.result format.instance)]
- @code (//attribute.code {#//attribute/code.limit (get@ #//bytecode/environment.limit environment)
+ @code (//attribute.code {#//attribute/code.limit (value@ #//bytecode/environment.limit environment)
#//attribute/code.code bytecode
#//attribute/code.exception_table exceptions
#//attribute/code.attributes (row.row)})]
- (in (row.add @code attributes)))
+ (in (row.suffix @code attributes)))
#.None
(in attributes))]
@@ -95,7 +95,7 @@
(Writer Method)
(`` ($_ format\compose
(~~ (template [<writer> <slot>]
- [(<writer> (get@ <slot> field))]
+ [(<writer> (value@ <slot> field))]
[//modifier.writer #modifier]
[//index.writer #name]
diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux
index f68b6b59d..db554e4fb 100644
--- a/stdlib/source/library/lux/target/jvm/reflection.lux
+++ b/stdlib/source/library/lux/target/jvm/reflection.lux
@@ -132,7 +132,7 @@
(#try.Success class)
(#try.Failure _)
- (exception.except ..unknown_class name)))
+ (exception.except ..unknown_class [name])))
(def: .public (sub? class_loader super sub)
(-> java/lang/ClassLoader External External (Try Bit))
@@ -182,10 +182,10 @@
paramsT)))
_
- (exception.except ..not_a_class raw)))
+ (exception.except ..not_a_class [raw])))
_)
... else
- (exception.except ..cannot_convert_to_a_lux_type reflection)))
+ (exception.except ..cannot_convert_to_a_lux_type [reflection])))
(def: .public (parameter reflection)
(-> java/lang/reflect/Type (Try (/.Type Parameter)))
diff --git a/stdlib/source/library/lux/target/jvm/type/descriptor.lux b/stdlib/source/library/lux/target/jvm/type/descriptor.lux
index 9c0f56021..099a68287 100644
--- a/stdlib/source/library/lux/target/jvm/type/descriptor.lux
+++ b/stdlib/source/library/lux/target/jvm/type/descriptor.lux
@@ -98,7 +98,7 @@
(:abstraction
(format (|> inputs
(list\map ..descriptor)
- text.joined
+ text.together
(text.enclosed ["(" ")"]))
(:representation output))))
diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux
index a9021109b..99845fa7e 100644
--- a/stdlib/source/library/lux/target/jvm/type/lux.lux
+++ b/stdlib/source/library/lux/target/jvm/type/lux.lux
@@ -135,7 +135,7 @@
(<>.before (<text>.this //signature.parameters_end))
(<>.else (list)))]
(in (do {! check.monad}
- [parameters (monad.seq ! parameters)]
+ [parameters (monad.all ! parameters)]
(in (#.Primitive name parameters)))))
(<>.after (<text>.this //descriptor.class_prefix))
(<>.before (<text>.this //descriptor.class_suffix))))
diff --git a/stdlib/source/library/lux/target/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux
index 683ba1432..7195c4918 100644
--- a/stdlib/source/library/lux/target/jvm/type/signature.lux
+++ b/stdlib/source/library/lux/target/jvm/type/signature.lux
@@ -78,8 +78,13 @@
[upper ..upper_prefix]
)
- (def: .public parameters_start "<")
- (def: .public parameters_end ">")
+ (template [<char> <name>]
+ [(def: .public <name>
+ <char>)]
+
+ ["<" parameters_start]
+ [">" parameters_end]
+ )
(def: .public (class name parameters)
(-> External (List (Signature Parameter)) (Signature Class))
@@ -94,7 +99,7 @@
(format ..parameters_start
(|> parameters
(list\map ..signature)
- text.joined)
+ text.together)
..parameters_end))
//descriptor.class_suffix)))
@@ -130,18 +135,18 @@
(|> type_variables
(list\map (|>> ..var_name
(text.suffix ..class_bound)))
- text.joined
+ text.together
(text.enclosed [..parameters_start
..parameters_end])))
(|> inputs
(list\map ..signature)
- text.joined
+ text.together
(text.enclosed [..arguments_start
..arguments_end]))
(:representation output)
(|> exceptions
(list\map (|>> :representation (format ..exception_prefix)))
- text.joined))))
+ text.together))))
(implementation: .public equivalence
(All [category] (Equivalence (Signature category)))
diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux
index b79db8fc4..b70cf80f0 100644
--- a/stdlib/source/library/lux/target/lua.lux
+++ b/stdlib/source/library/lux/target/lua.lux
@@ -374,7 +374,7 @@
(syntax: (arity_inputs [arity <code>.nat])
(in (case arity
0 (.list)
- _ (|> (dec arity)
+ _ (|> (-- arity)
(enum.range n.enum 0)
(list\map (|>> %.nat code.local_identifier))))))
diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux
index 11aea7808..860c33713 100644
--- a/stdlib/source/library/lux/target/php.lux
+++ b/stdlib/source/library/lux/target/php.lux
@@ -230,7 +230,7 @@
(syntax: (arity_inputs [arity <code>.nat])
(in (case arity
0 (.list)
- _ (|> (dec arity)
+ _ (|> (-- arity)
(enum.range n.enum 0)
(list\map (|>> %.nat code.local_identifier))))))
@@ -481,10 +481,10 @@
(def: (catch except)
(-> Except Text)
- (let [declaration (format (:representation (get@ #class except))
- " " (:representation (get@ #exception except)))]
+ (let [declaration (format (:representation (value@ #class except))
+ " " (:representation (value@ #exception except)))]
(format "catch" (..group declaration) " "
- (..block (:representation (get@ #handler except))))))
+ (..block (:representation (value@ #handler except))))))
(def: .public (try body! excepts)
(-> Statement (List Except) Statement)
diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux
index c8a62c58b..06ad85593 100644
--- a/stdlib/source/library/lux/target/python.lux
+++ b/stdlib/source/library/lux/target/python.lux
@@ -243,7 +243,7 @@
(format (:representation func)
(format "(" (|> args
(list\map (function (_ arg) (format (:representation arg) ", ")))
- text.joined)
+ text.together)
(<splat> extra) ")"))))]
[apply_poly splat_poly]
@@ -268,7 +268,7 @@
[do_keyword apply_keyword]
)
- (def: .public (nth idx array)
+ (def: .public (item idx array)
(-> (Expression Any) (Expression Any) Location)
(:abstraction (format (:representation array) "[" (:representation idx) "]")))
@@ -409,7 +409,7 @@
(format text.new_line "except (" (text.interposed ", " (list\map ..code classes))
") as " (:representation exception) ":"
(..nested (:representation catch!)))))
- text.joined))))
+ text.together))))
(template [<name> <keyword> <pre>]
[(def: .public (<name> value)
@@ -460,7 +460,7 @@
(syntax: (arity_inputs [arity <code>.nat])
(in (case arity
0 (.list)
- _ (|> (dec arity)
+ _ (|> (-- arity)
(enum.range n.enum 0)
(list\map (|>> %.nat code.local_identifier))))))
diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux
index 15804b77b..d5344a1c9 100644
--- a/stdlib/source/library/lux/target/r.lux
+++ b/stdlib/source/library/lux/target/r.lux
@@ -170,7 +170,7 @@
(let [func (:representation func)
spacing (|> " "
(list.repeated (text.size func))
- text.joined)]
+ text.together)]
(:abstraction
(format func "("
(|> args
diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux
index 032ebb265..954a91d97 100644
--- a/stdlib/source/library/lux/target/ruby.lux
+++ b/stdlib/source/library/lux/target/ruby.lux
@@ -436,7 +436,7 @@
(syntax: (arity_inputs [arity <code>.nat])
(in (case arity
0 (.list)
- _ (|> (dec arity)
+ _ (|> (-- arity)
(enum.range n.enum 0)
(list\map (|>> %.nat code.local_identifier))))))
diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux
index 7e910a91f..4390d9981 100644
--- a/stdlib/source/library/lux/target/scheme.lux
+++ b/stdlib/source/library/lux/target/scheme.lux
@@ -341,7 +341,7 @@
(-> Var Arguments Expression Computation)
(..form (list (..var "define")
(|> arguments
- (update@ #mandatory (|>> (#.Item name)))
+ (revised@ #mandatory (|>> (#.Item name)))
..arguments)
body)))
diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux
index dbd87627e..29af87345 100644
--- a/stdlib/source/library/lux/test.lux
+++ b/stdlib/source/library/lux/test.lux
@@ -50,12 +50,12 @@
(def: (total parameter subject)
(-> Tally Tally Tally)
- {#successes (n.+ (get@ #successes parameter) (get@ #successes subject))
- #failures (n.+ (get@ #failures parameter) (get@ #failures subject))
- #expected_coverage (set.union (get@ #expected_coverage parameter)
- (get@ #expected_coverage subject))
- #actual_coverage (set.union (get@ #actual_coverage parameter)
- (get@ #actual_coverage subject))})
+ {#successes (n.+ (value@ #successes parameter) (value@ #successes subject))
+ #failures (n.+ (value@ #failures parameter) (value@ #failures subject))
+ #expected_coverage (set.union (value@ #expected_coverage parameter)
+ (value@ #expected_coverage subject))
+ #actual_coverage (set.union (value@ #actual_coverage parameter)
+ (value@ #actual_coverage subject))})
(def: start
Tally
@@ -67,7 +67,7 @@
(template [<name> <category>]
[(def: <name>
Tally
- (update@ <category> .inc ..start))]
+ (revised@ <category> .++ ..start))]
[success_tally #successes]
[failure_tally #failures]
@@ -166,7 +166,7 @@
(def: failed?
(-> Tally Bit)
- (|>> (get@ #failures) (n.> 0)))
+ (|>> (value@ #failures) (n.> 0)))
(def: (times_failure seed documentation)
(-> Seed Text Text)
@@ -193,26 +193,26 @@
(case amount
1 instance
_ (|> test
- (times (dec amount))
+ (times (-- amount))
(random.result prng')
product.right))))])))))
(def: (description duration tally)
(-> Duration Tally Text)
- (let [successes (get@ #successes tally)
- failures (get@ #failures tally)
- missing (set.difference (get@ #actual_coverage tally)
- (get@ #expected_coverage tally))
- unexpected (set.difference (get@ #expected_coverage tally)
- (get@ #actual_coverage tally))
+ (let [successes (value@ #successes tally)
+ failures (value@ #failures tally)
+ missing (set.difference (value@ #actual_coverage tally)
+ (value@ #expected_coverage tally))
+ unexpected (set.difference (value@ #expected_coverage tally)
+ (value@ #actual_coverage tally))
report (: (-> (Set Name) Text)
(|>> set.list
(list.sorted (\ name.order <))
(exception.listing %.name)))
- expected_definitions_to_cover (set.size (get@ #expected_coverage tally))
+ expected_definitions_to_cover (set.size (value@ #expected_coverage tally))
unexpected_definitions_covered (set.size unexpected)
actual_definitions_covered (n.- unexpected_definitions_covered
- (set.size (get@ #actual_coverage tally)))
+ (set.size (value@ #actual_coverage tally)))
coverage (case expected_definitions_to_cover
0 "N/A"
expected (let [missing_ratio (f./ (n.frac expected)
@@ -265,7 +265,7 @@
(..description duration tally)
text.new_line))]]
(async.future (\ program.default exit
- (case (get@ #failures tally)
+ (case (value@ #failures tally)
0 ..success_exit_code
_ ..failure_exit_code)))))
@@ -277,7 +277,7 @@
coverage (set.of_list name.hash coverage)]
(|> (..assertion message condition)
(async\map (function (_ [tally documentation])
- [(update@ #actual_coverage (set.union coverage) tally)
+ [(revised@ #actual_coverage (set.union coverage) tally)
documentation])))))
(def: (|cover| coverage condition)
@@ -292,7 +292,7 @@
(text.interposed " & "))
coverage (set.of_list name.hash coverage)]
(random\map (async\map (function (_ [tally documentation])
- [(update@ #actual_coverage (set.union coverage) tally)
+ [(revised@ #actual_coverage (set.union coverage) tally)
documentation]))
(..context context test))))
@@ -369,7 +369,7 @@
(let [coverage (..decode_coverage module coverage)]
(|> (..context module test)
(random\map (async\map (function (_ [tally documentation])
- [(update@ #expected_coverage (set.union coverage) tally)
+ [(revised@ #expected_coverage (set.union coverage) tally)
documentation]))))))
(syntax: .public (covering [module <code>.identifier
diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux
index eb0928f5c..c6206e167 100644
--- a/stdlib/source/library/lux/time.lux
+++ b/stdlib/source/library/lux/time.lux
@@ -46,7 +46,7 @@
(exception: .public (time_exceeds_a_day {time Nat})
(exception.report
["Time (in milli-seconds)" (n\encode time)]
- ["Maximum (in milli-seconds)" (n\encode (dec limit))]))
+ ["Maximum (in milli-seconds)" (n\encode (-- limit))]))
(def: separator ":")
@@ -66,7 +66,7 @@
(exception.report
["Value" (n\encode value)]
["Minimum" (n\encode 0)]
- ["Maximum" (n\encode (dec <maximum>))]))
+ ["Maximum" (n\encode (-- <maximum>))]))
(def: <parser>
(Parser Nat)
@@ -121,13 +121,13 @@
(def: &order ..order)
(def: succ
- (|>> :representation inc (n.% ..limit) :abstraction))
+ (|>> :representation ++ (n.% ..limit) :abstraction))
(def: pred
(|>> :representation
(case> 0 ..limit
millis millis)
- dec
+ --
:abstraction))))
(def: .public parser
@@ -197,10 +197,10 @@
(def: .public (time clock)
(-> Clock (Try Time))
(|> ($_ duration.merged
- (duration.up (get@ #hour clock) duration.hour)
- (duration.up (get@ #minute clock) duration.minute)
- (duration.up (get@ #second clock) duration.second)
- (duration.of_millis (.int (get@ #milli_second clock))))
+ (duration.up (value@ #hour clock) duration.hour)
+ (duration.up (value@ #minute clock) duration.minute)
+ (duration.up (value@ #second clock) duration.second)
+ (duration.of_millis (.int (value@ #milli_second clock))))
duration.millis
.nat
..of_millis))
diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux
index 75e5609ea..d06910711 100644
--- a/stdlib/source/library/lux/time/date.lux
+++ b/stdlib/source/library/lux/time/date.lux
@@ -95,7 +95,7 @@
(template [<name> <type> <field>]
[(def: .public <name>
(-> Date <type>)
- (|>> :representation (get@ <field>)))]
+ (|>> :representation (value@ <field>)))]
[year Year #year]
[month Month #month]
@@ -109,13 +109,13 @@
(let [reference (:representation reference)
sample (:representation sample)]
(and (\ //year.equivalence =
- (get@ #year reference)
- (get@ #year sample))
+ (value@ #year reference)
+ (value@ #year sample))
(\ //month.equivalence =
- (get@ #month reference)
- (get@ #month sample))
- (n.= (get@ #day reference)
- (get@ #day sample))))))
+ (value@ #month reference)
+ (value@ #month sample))
+ (n.= (value@ #day reference)
+ (value@ #day sample))))))
(implementation: .public order
(Order Date)
@@ -126,19 +126,19 @@
(let [reference (:representation reference)
sample (:representation sample)]
(or (\ //year.order <
- (get@ #year reference)
- (get@ #year sample))
+ (value@ #year reference)
+ (value@ #year sample))
(and (\ //year.equivalence =
- (get@ #year reference)
- (get@ #year sample))
+ (value@ #year reference)
+ (value@ #year sample))
(or (\ //month.order <
- (get@ #month reference)
- (get@ #month sample))
+ (value@ #month reference)
+ (value@ #month sample))
(and (\ //month.order =
- (get@ #month reference)
- (get@ #month sample))
- (n.< (get@ #day reference)
- (get@ #day sample)))))))))
+ (value@ #month reference)
+ (value@ #month sample))
+ (n.< (value@ #day reference)
+ (value@ #day sample)))))))))
)
(def: section_parser
@@ -271,17 +271,17 @@
..civil_month)))
(def: last_era_leap_day
- (.int (dec ..days_per_leap)))
+ (.int (-- ..days_per_leap)))
(def: last_era_day
- (.int (dec ..days_per_era)))
+ (.int (-- ..days_per_era)))
(def: (civil_year utc_month utc_year)
(-> Nat Year Int)
(let [... Coercing, because the year is already in external form.
utc_year (:as Int utc_year)]
(if (n.< ..first_month_of_civil_year utc_month)
- (dec utc_year)
+ (-- utc_year)
utc_year)))
... http://howardhinnant.github.io/date_algorithms.html
@@ -290,7 +290,7 @@
(let [utc_month (|> date ..month //month.number)
civil_year (..civil_year utc_month (..year date))
era (|> (if (i.< +0 civil_year)
- (i.- (.int (dec //year.era))
+ (i.- (.int (-- //year.era))
civil_year)
civil_year)
(i./ (.int //year.era)))
@@ -299,7 +299,7 @@
civil_year)
day_of_year (|> utc_month
..day_of_year_from_month
- (i.+ (.int (dec (..day_of_month date)))))
+ (i.+ (.int (-- (..day_of_month date)))))
day_of_era (|> day_of_year
(i.+ (i.* (.int //year.days) year_of_era))
(i.+ (i./ (.int //year.leap) year_of_era))
@@ -334,7 +334,7 @@
(i.+ +1)
.nat)
year (if (n.< ..first_month_of_civil_year month)
- (inc year)
+ (++ year)
year)]
... Coercing, because the year is already in internal form.
(try.trusted
@@ -348,7 +348,7 @@
(def: &order ..order)
(def: succ
- (|>> ..days inc ..of_days))
+ (|>> ..days ++ ..of_days))
(def: pred
- (|>> ..days dec ..of_days)))
+ (|>> ..days -- ..of_days)))
diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux
index 36e0b2504..f454c1425 100644
--- a/stdlib/source/library/lux/time/instant.lux
+++ b/stdlib/source/library/lux/time/instant.lux
@@ -102,7 +102,7 @@
(let [[days millis] (i./% ..millis_per_day offset)]
(case millis
+0 [days millis]
- _ [(dec days) (i.+ ..millis_per_day millis)]))
+ _ [(-- days) (i.+ ..millis_per_day millis)]))
(i./% ..millis_per_day offset))]
[(date.of_days days)
(duration.of_millis day_time)]))
@@ -214,7 +214,7 @@
day_time (duration.framed duration.day offset)
days (if (and (duration.negative? offset)
(not (duration.neutral? day_time)))
- (dec days)
+ (-- days)
days)
... 1970/01/01 was a Thursday
y1970m0d0 +4]
diff --git a/stdlib/source/library/lux/time/month.lux b/stdlib/source/library/lux/time/month.lux
index d8203e175..07fcc6269 100644
--- a/stdlib/source/library/lux/time/month.lux
+++ b/stdlib/source/library/lux/time/month.lux
@@ -184,7 +184,7 @@
{#.doc (example "The amount of days of a month (in a leap year).")}
(-> Month Nat)
(case month
- #February (inc (..days month))
+ #February (++ (..days month))
_ (..days month)))
(def: .public year
diff --git a/stdlib/source/library/lux/time/year.lux b/stdlib/source/library/lux/time/year.lux
index dd303ed85..3eb12ad90 100644
--- a/stdlib/source/library/lux/time/year.lux
+++ b/stdlib/source/library/lux/time/year.lux
@@ -23,14 +23,14 @@
(def: (internal year)
(-> Int Int)
(if (i.< +0 year)
- (inc year)
+ (++ year)
year))
(def: (external year)
(-> Int Int)
(if (i.> +0 year)
year
- (dec year)))
+ (-- year)))
(exception: .public there_is_no_year_0)
@@ -100,8 +100,8 @@
(-> Year Int)
(let [year (|> year ..value ..internal)
limit (if (i.> +0 year)
- (dec year)
- (inc year))]
+ (-- year)
+ (++ year))]
(`` (|> +0
(~~ (template [<polarity> <years>]
[(<polarity> (i./ (.int <years>) limit))]
diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux
index e8b91db8c..04971dadd 100644
--- a/stdlib/source/library/lux/tool/compiler/default/init.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/init.lux
@@ -107,8 +107,8 @@
(#.Right [source' output])
(let [[location _] output]
(#try.Success [[bundle (|> compiler
- (set@ #.source source')
- (set@ #.location location))]
+ (with@ #.source source')
+ (with@ #.location location))]
[source' output]])))))
(type: (Operation a)
@@ -125,13 +125,13 @@
(///directive.Operation anchor expression directive
[Source (Payload directive)])))
(do ///phase.monad
- [.let [module (get@ #///.module input)]
+ [.let [module (value@ #///.module input)]
_ (///directive.set_current_module module)]
(///directive.lifted_analysis
(do {! ///phase.monad}
[_ (module.create hash module)
_ (monad.map ! module.import dependencies)
- .let [source (///analysis.source (get@ #///.module input) (get@ #///.code input))]
+ .let [source (///analysis.source (value@ #///.module input) (value@ #///.code input))]
_ (///analysis.set_source_code source)]
(in [source [///generation.empty_buffer
artifact.empty]])))))
@@ -220,13 +220,13 @@
(def: (default_dependencies prelude input)
(-> Module ///.Input (List Module))
(list& archive.runtime_module
- (if (text\= prelude (get@ #///.module input))
+ (if (text\= prelude (value@ #///.module input))
(list)
(list prelude))))
(def: module_aliases
(-> .Module Aliases)
- (|>> (get@ #.module_aliases) (dictionary.of_list text.hash)))
+ (|>> (value@ #.module_aliases) (dictionary.of_list text.hash)))
(def: .public (compiler expander prelude write_directive)
(All [anchor expression directive]
@@ -238,10 +238,10 @@
{#///.dependencies dependencies
#///.process (function (_ state archive)
(do {! try.monad}
- [.let [hash (text\hash (get@ #///.code input))]
+ [.let [hash (text\hash (value@ #///.code input))]
[state [source buffer]] (<| (///phase.result' state)
(..begin dependencies hash input))
- .let [module (get@ #///.module input)]]
+ .let [module (value@ #///.module input)]]
(loop [iteration (<| (///phase.result' state)
(..iteration archive expander module source buffer ///syntax.no_aliases))]
(do !
@@ -252,7 +252,7 @@
[[state [analysis_module [final_buffer final_registry]]] (///phase.result' state (..end module))
.let [descriptor {#descriptor.hash hash
#descriptor.name module
- #descriptor.file (get@ #///.file input)
+ #descriptor.file (value@ #///.file input)
#descriptor.references (set.of_list text.hash dependencies)
#descriptor.state #.Compiled
#descriptor.registry final_registry}]]
@@ -267,7 +267,7 @@
(let [[temporary_buffer temporary_registry] temporary_payload]
(in [state
(#.Left {#///.dependencies (|> requirements
- (get@ #///directive.imports)
+ (value@ #///directive.imports)
(list\map product.left))
#///.process (function (_ state archive)
(recur (<| (///phase.result' state)
@@ -281,7 +281,7 @@
_ (///directive.lifted_generation
(///generation.set_registry temporary_registry))
_ (|> requirements
- (get@ #///directive.referrals)
+ (value@ #///directive.referrals)
(monad.map ! (execute! archive)))
temporary_payload (..get_current_payload temporary_payload)]
(..iteration archive expander module source temporary_payload (..module_aliases analysis_module))))))})]))
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index 53cb07e22..1ac28821f 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -97,7 +97,7 @@
(All [<type_vars>]
(-> Static <Platform> archive.ID [Descriptor (Document Any) Output]
(Async (Try Any))))
- (let [system (get@ #&file_system platform)
+ (let [system (value@ #&file_system platform)
write_artifact! (: (-> [artifact.ID (Maybe Text) Binary] (Action Any))
(function (_ [artifact_id custom content])
(ioW.write system static module_id artifact_id content)))]
@@ -129,7 +129,7 @@
(-> <Platform> (///generation.Operation <type_vars> [Registry Output])))
(do ///phase.monad
[_ ..initialize_buffer!]
- (get@ #runtime platform)))
+ (value@ #runtime platform)))
(def: (runtime_descriptor registry)
(-> Registry Descriptor)
@@ -198,7 +198,7 @@
(def: (phase_wrapper archive platform state)
(All [<type_vars>]
(-> Archive <Platform> <State+> (Try [<State+> Phase_Wrapper])))
- (let [phase_wrapper (get@ #phase_wrapper platform)]
+ (let [phase_wrapper (value@ #phase_wrapper platform)]
(|> archive
phase_wrapper
///directive.lifted_generation
@@ -236,15 +236,15 @@
Import (List Context)
(Async (Try [<State+> Archive]))))
(do {! (try.with async.monad)}
- [.let [state (//init.state (get@ #static.host static)
+ [.let [state (//init.state (value@ #static.host static)
module
expander
host_analysis
- (get@ #host platform)
- (get@ #phase platform)
+ (value@ #host platform)
+ (value@ #phase platform)
generation_bundle)]
- _ (ioW.enable (get@ #&file_system platform) static)
- [archive analysis_state bundles] (ioW.thaw (get@ #host platform) (get@ #&file_system platform) static import compilation_sources)
+ _ (ioW.enable (value@ #&file_system platform) static)
+ [archive analysis_state bundles] (ioW.thaw (value@ #host platform) (value@ #&file_system platform) static import compilation_sources)
.let [with_missing_extensions
(: (All [<type_vars>]
(-> <Platform> (Program expression directive) <State+> (Async (Try <State+>))))
@@ -276,11 +276,11 @@
(def: (module_compilation_log module)
(All [<type_vars>]
(-> Module <State+> Text))
- (|>> (get@ [#extension.state
- #///directive.generation
- #///directive.state
- #extension.state
- #///generation.log])
+ (|>> (value@ [#extension.state
+ #///directive.generation
+ #///directive.state
+ #extension.state
+ #///generation.log])
(row\fold (function (_ right left)
(format left ..compilation_log_separator right))
module)))
@@ -288,12 +288,12 @@
(def: with_reset_log
(All [<type_vars>]
(-> <State+> <State+>))
- (set@ [#extension.state
- #///directive.generation
- #///directive.state
- #extension.state
- #///generation.log]
- row.empty))
+ (with@ [#extension.state
+ #///directive.generation
+ #///directive.state
+ #extension.state
+ #///generation.log]
+ row.empty))
(def: empty
(Set Module)
@@ -320,8 +320,8 @@
lens
(dictionary.value module)
(maybe.else ..empty))))
- transitive_depends_on (transitive_dependency (get@ #depends_on) import)
- transitive_depended_by (transitive_dependency (get@ #depended_by) module)
+ transitive_depends_on (transitive_dependency (value@ #depends_on) import)
+ transitive_depended_by (transitive_dependency (value@ #depended_by) module)
update_dependence (: (-> [Module (Set Module)] [Module (Set Module)]
(-> Mapping Mapping))
(function (_ [source forward] [target backward])
@@ -335,14 +335,14 @@
with_dependence+transitives
(set.list backward))))))]
(|> dependence
- (update@ #depends_on
- (update_dependence
- [module transitive_depends_on]
- [import transitive_depended_by]))
- (update@ #depended_by
- ((function.flipped update_dependence)
- [module transitive_depends_on]
- [import transitive_depended_by])))))
+ (revised@ #depends_on
+ (update_dependence
+ [module transitive_depends_on]
+ [import transitive_depended_by]))
+ (revised@ #depended_by
+ ((function.flipped update_dependence)
+ [module transitive_depends_on]
+ [import transitive_depended_by])))))
(def: (circular_dependency? module import dependence)
(-> Module Module Dependence Bit)
@@ -353,8 +353,8 @@
(dictionary.value from)
(maybe.else ..empty))]
(set.member? targets to))))]
- (or (dependence? import (get@ #depends_on) module)
- (dependence? module (get@ #depended_by) import))))
+ (or (dependence? import (value@ #depends_on) module)
+ (dependence? module (value@ #depended_by) import))))
(exception: .public (module_cannot_import_itself {module Module})
(exception.report
@@ -499,21 +499,21 @@
.let [additions (|> modules
(list\map product.left)
(set.of_list text.hash))]]
- (in (update@ [#extension.state
- #///directive.analysis
- #///directive.state
- #extension.state]
- (function (_ analysis_state)
- (|> analysis_state
- (:as .Lux)
- (update@ #.modules (function (_ current)
- (list\compose (list.only (|>> product.left
- (set.member? additions)
- not)
- current)
- modules)))
- :expected))
- state))))
+ (in (revised@ [#extension.state
+ #///directive.analysis
+ #///directive.state
+ #extension.state]
+ (function (_ analysis_state)
+ (|> analysis_state
+ (:as .Lux)
+ (revised@ #.modules (function (_ current)
+ (list\compose (list.only (|>> product.left
+ (set.member? additions)
+ not)
+ current)
+ modules)))
+ :expected))
+ state))))
(def: (set_current_module module state)
(All [<type_vars>]
@@ -533,24 +533,24 @@
(///.Compiler <State+> .Module Any)
(:expected
- ((//init.compiler expander syntax.prelude (get@ #write platform)) $.key (list))))
+ ((//init.compiler expander syntax.prelude (value@ #write platform)) $.key (list))))
compiler (..parallel
context
(function (_ importer import! module_id [archive state] module)
(do {! (try.with async.monad)}
[.let [state (..set_current_module module state)]
- input (context.read (get@ #&file_system platform)
+ input (context.read (value@ #&file_system platform)
importer
import
compilation_sources
- (get@ #static.host_module_extension static)
+ (value@ #static.host_module_extension static)
module)]
(loop [[archive state] [archive state]
compilation (base_compiler (:as ///.Input input))
all_dependencies (: (Set Module)
(set.of_list text.hash (list)))]
(do !
- [.let [new_dependencies (get@ #///.dependencies compilation)
+ [.let [new_dependencies (value@ #///.dependencies compilation)
continue! (:sharing [<type_vars>]
<Platform>
platform
@@ -582,14 +582,14 @@
(do !
[archive,document+ (|> new_dependencies
(list\map (import! module))
- (monad.seq ..monad))
+ (monad.all ..monad))
.let [archive (|> archive,document+
(list\map product.left)
(list\fold archive.merged archive))]]
(in [archive (try.trusted
(..updated_state archive state))])))
(async\in (exception.except ..cannot_import_twice [module duplicates])))]
- (case ((get@ #///.process compilation)
+ (case ((value@ #///.process compilation)
... TODO: The "///directive.set_current_module" below shouldn't be necessary. Remove it ASAP.
... TODO: The context shouldn't need to be re-set either.
(|> (///directive.set_current_module module)
@@ -605,7 +605,7 @@
(#.Right [descriptor document output])
(do !
[.let [_ (debug.log! (..module_compilation_log module state))
- descriptor (set@ #descriptor.references all_dependencies descriptor)]
+ descriptor (with@ #descriptor.references all_dependencies descriptor)]
_ (..cache_module static platform module_id [descriptor document output])]
(case (archive.has module [descriptor document output] archive)
(#try.Success archive)
@@ -617,7 +617,7 @@
(#try.Failure error)
(do !
- [_ (ioW.freeze (get@ #&file_system platform) static archive)]
+ [_ (ioW.freeze (value@ #&file_system platform) static archive)]
(async\in (#try.Failure error)))))))))]
(compiler archive.runtime_module compilation_module)))
)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
index 571185dee..aefd908c4 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
@@ -55,18 +55,18 @@
(def: .public (tag lefts right?)
(-> Nat Bit Nat)
(if right?
- (inc lefts)
+ (++ lefts)
lefts))
(def: (lefts tag right?)
(-> Nat Bit Nat)
(if right?
- (dec tag)
+ (-- tag)
tag))
(def: .public (choice options pick)
(-> Nat Nat [Nat Bit])
- (let [right? (n.= (dec options) pick)]
+ (let [right? (n.= (-- options) pick)]
[(..lefts pick right?)
right?]))
@@ -253,7 +253,7 @@
(def: (last? size tag)
(-> Nat Tag Bit)
- (n.= (dec size) tag))
+ (n.= (-- size) tag))
(template: .public (no_op value)
[(|> 1 #variable.Local #reference.Variable #..Reference
@@ -402,10 +402,10 @@
(def: .public (with_source_code source action)
(All [a] (-> Source (Operation a) (Operation a)))
(function (_ [bundle state])
- (let [old_source (get@ #.source state)]
- (case (action [bundle (set@ #.source source state)])
+ (let [old_source (value@ #.source state)]
+ (case (action [bundle (with@ #.source source state)])
(#try.Success [[bundle' state'] output])
- (#try.Success [[bundle' (set@ #.source old_source state')]
+ (#try.Success [[bundle' (with@ #.source old_source state')]
output])
(#try.Failure error)
@@ -426,11 +426,11 @@
(def: .public (with_scope action)
(All [a] (-> (Operation a) (Operation [Scope a])))
(function (_ [bundle state])
- (case (action [bundle (update@ #.scopes (|>> (#.Item fresh_scope)) state)])
+ (case (action [bundle (revised@ #.scopes (|>> (#.Item fresh_scope)) state)])
(#try.Success [[bundle' state'] output])
- (case (get@ #.scopes state')
+ (case (value@ #.scopes state')
(#.Item head tail)
- (#try.Success [[bundle' (set@ #.scopes tail state')]
+ (#try.Success [[bundle' (with@ #.scopes tail state')]
[head output]])
#.End
@@ -441,8 +441,8 @@
(def: .public (with_current_module name)
(All [a] (-> Text (Operation a) (Operation a)))
- (extension.localized (get@ #.current_module)
- (set@ #.current_module)
+ (extension.localized (value@ #.current_module)
+ (with@ #.current_module)
(function.constant (#.Some name))))
(def: .public (with_location location action)
@@ -450,10 +450,10 @@
(if (text\= "" (product.left location))
action
(function (_ [bundle state])
- (let [old_location (get@ #.location state)]
- (case (action [bundle (set@ #.location location state)])
+ (let [old_location (value@ #.location state)]
+ (case (action [bundle (with@ #.location location state)])
(#try.Success [[bundle' state'] output])
- (#try.Success [[bundle' (set@ #.location old_location state')]
+ (#try.Success [[bundle' (with@ #.location old_location state')]
output])
(#try.Failure error)
@@ -467,7 +467,7 @@
(def: .public (failure error)
(-> Text Operation)
(function (_ [bundle state])
- (#try.Failure (locate_error (get@ #.location state) error))))
+ (#try.Failure (locate_error (value@ #.location state) error))))
(def: .public (except exception parameters)
(All [e] (-> (Exception e) e Operation))
@@ -482,7 +482,7 @@
(def: .public (failure' error)
(-> Text (phase.Operation Lux))
(function (_ state)
- (#try.Failure (locate_error (get@ #.location state) error))))
+ (#try.Failure (locate_error (value@ #.location state) error))))
(def: .public (except' exception parameters)
(All [e] (-> (Exception e) e (phase.Operation Lux)))
@@ -498,7 +498,7 @@
(#try.Failure error)
(let [[bundle state] bundle,state]
- (#try.Failure (locate_error (get@ #.location state) error))))))
+ (#try.Failure (locate_error (value@ #.location state) error))))))
(def: .public (install state)
(-> .Lux (Operation Any))
@@ -509,7 +509,7 @@
(template [<name> <type> <field> <value>]
[(def: .public (<name> value)
(-> <type> (Operation Any))
- (extension.update (set@ <field> <value>)))]
+ (extension.update (with@ <field> <value>)))]
[set_source_code Source #.source value]
[set_current_module Text #.current_module (#.Some value)]
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 478697fd4..5f2770068 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux
@@ -47,8 +47,8 @@
(def: .public (merge_requirements left right)
(-> Requirements Requirements Requirements)
- {#imports (list\compose (get@ #imports left) (get@ #imports right))
- #referrals (list\compose (get@ #referrals left) (get@ #referrals right))})
+ {#imports (list\compose (value@ #imports left) (value@ #imports right))
+ #referrals (list\compose (value@ #referrals left) (value@ #referrals right))})
(template [<special> <general>]
[(type: .public (<special> anchor expression directive)
@@ -66,7 +66,7 @@
(All [anchor expression directive]
(Operation anchor expression directive <phase>))
(function (_ [bundle state])
- (#try.Success [[bundle state] (get@ [<component> #..phase] state)])))]
+ (#try.Success [[bundle state] (value@ [<component> #..phase] state)])))]
[analysis #..analysis analysis.Phase]
[synthesis #..synthesis synthesis.Phase]
@@ -78,8 +78,8 @@
(All [anchor expression directive output]
(-> (<operation> output)
(Operation anchor expression directive output)))
- (|>> (phase.sub [(get@ [<component> #..state])
- (set@ [<component> #..state])])
+ (|>> (phase.sub [(value@ [<component> #..state])
+ (with@ [<component> #..state])])
extension.lifted))]
[lifted_analysis #..analysis analysis.Operation]
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 0a1841ad1..aee61ebc7 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux
@@ -111,9 +111,9 @@
(All [anchor expression directive output] <with_type>)
(function (_ body)
(function (_ [bundle state])
- (case (body [bundle (set@ <tag> (#.Some <with_value>) state)])
+ (case (body [bundle (with@ <tag> (#.Some <with_value>) state)])
(#try.Success [[bundle' state'] output])
- (#try.Success [[bundle' (set@ <tag> (get@ <tag> state) state')]
+ (#try.Success [[bundle' (with@ <tag> (value@ <tag> state) state')]
output])
(#try.Failure error)
@@ -123,7 +123,7 @@
(All [anchor expression directive]
(Operation anchor expression directive <get_type>))
(function (_ (^@ stateE [bundle state]))
- (case (get@ <tag> state)
+ (case (value@ <tag> state)
(#.Some output)
(#try.Success [stateE output])
@@ -134,7 +134,7 @@
(All [anchor expression directive]
(-> <get_type> (Operation anchor expression directive Any)))
(function (_ [bundle state])
- (#try.Success [[bundle (set@ <tag> (#.Some value) state)]
+ (#try.Success [[bundle (with@ <tag> (#.Some value) state)]
[]])))]
[#anchor
@@ -156,21 +156,21 @@
(All [anchor expression directive]
(Operation anchor expression directive artifact.Registry))
(function (_ (^@ stateE [bundle state]))
- (#try.Success [stateE (get@ #registry state)])))
+ (#try.Success [stateE (value@ #registry state)])))
(def: .public (set_registry value)
(All [anchor expression directive]
(-> artifact.Registry (Operation anchor expression directive Any)))
(function (_ [bundle state])
- (#try.Success [[bundle (set@ #registry value state)]
+ (#try.Success [[bundle (with@ #registry value state)]
[]])))
(def: .public next
(All [anchor expression directive]
(Operation anchor expression directive Nat))
(do phase.monad
- [count (extension.read (get@ #counter))
- _ (extension.update (update@ #counter inc))]
+ [count (extension.read (value@ #counter))
+ _ (extension.update (revised@ #counter ++))]
(in count)))
(def: .public (identifier prefix)
@@ -181,18 +181,18 @@
(def: .public (enter_module module)
(All [anchor expression directive]
(-> Module (Operation anchor expression directive Any)))
- (extension.update (set@ #module module)))
+ (extension.update (with@ #module module)))
(def: .public module
(All [anchor expression directive]
(Operation anchor expression directive Module))
- (extension.read (get@ #module)))
+ (extension.read (value@ #module)))
(def: .public (evaluate! label code)
(All [anchor expression directive]
(-> Context expression (Operation anchor expression directive Any)))
(function (_ (^@ state+ [bundle state]))
- (case (\ (get@ #host state) evaluate! label code)
+ (case (\ (value@ #host state) evaluate! label code)
(#try.Success output)
(#try.Success [state+ output])
@@ -203,7 +203,7 @@
(All [anchor expression directive]
(-> directive (Operation anchor expression directive Any)))
(function (_ (^@ state+ [bundle state]))
- (case (\ (get@ #host state) execute! code)
+ (case (\ (value@ #host state) execute! code)
(#try.Success output)
(#try.Success [state+ output])
@@ -214,7 +214,7 @@
(All [anchor expression directive]
(-> Context (Maybe Text) expression (Operation anchor expression directive [Text Any directive])))
(function (_ (^@ stateE [bundle state]))
- (case (\ (get@ #host state) define! context custom code)
+ (case (\ (value@ #host state) define! context custom code)
(#try.Success output)
(#try.Success [stateE output])
@@ -225,13 +225,13 @@
(All [anchor expression directive]
(-> artifact.ID (Maybe Text) directive (Operation anchor expression directive Any)))
(do {! phase.monad}
- [?buffer (extension.read (get@ #buffer))]
+ [?buffer (extension.read (value@ #buffer))]
(case ?buffer
(#.Some buffer)
... TODO: Optimize by no longer checking for overwrites...
(if (row.any? (|>> product.left (n.= artifact_id)) buffer)
(phase.except ..cannot_overwrite_output [artifact_id])
- (extension.update (set@ #buffer (#.Some (row.add [artifact_id custom code] buffer)))))
+ (extension.update (with@ #buffer (#.Some (row.suffix [artifact_id custom code] buffer)))))
#.None
(phase.except ..no_buffer_for_saving_code [artifact_id]))))
@@ -241,8 +241,8 @@
(All [anchor expression directive]
(-> Text (Operation anchor expression directive artifact.ID)))
(function (_ (^@ stateE [bundle state]))
- (let [[id registry'] (<artifact> name (get@ #registry state))]
- (#try.Success [[bundle (set@ #registry registry' state)]
+ (let [[id registry'] (<artifact> name (value@ #registry state))]
+ (#try.Success [[bundle (with@ #registry registry' state)]
id]))))]
[learn artifact.definition]
@@ -267,11 +267,11 @@
(let [[_module _name] name]
(do try.monad
[module_id (archive.id _module archive)
- registry (if (text\= (get@ #module state) _module)
- (#try.Success (get@ #registry state))
+ registry (if (text\= (value@ #module state) _module)
+ (#try.Success (value@ #registry state))
(do try.monad
[[descriptor document] (archive.find _module archive)]
- (#try.Success (get@ #descriptor.registry descriptor))))]
+ (#try.Success (value@ #descriptor.registry descriptor))))]
(case (artifact.remember _name registry)
#.None
(exception.except ..unknown_definition [name (artifact.definitions registry)])
@@ -293,13 +293,13 @@
(All [anchor expression directive]
(-> Archive (Operation anchor expression directive Context)))
(function (_ (^@ stateE [bundle state]))
- (case (get@ #context state)
+ (case (value@ #context state)
#.None
(exception.except ..no_context [])
(#.Some id)
(do try.monad
- [module_id (archive.id (get@ #module state) archive)]
+ [module_id (archive.id (value@ #module state) archive)]
(in [stateE [module_id id]])))))
(def: .public (with_context id body)
@@ -309,8 +309,8 @@
(Operation anchor expression directive a)))
(function (_ [bundle state])
(do try.monad
- [[[bundle' state'] output] (body [bundle (set@ #context (#.Some id) state)])]
- (in [[bundle' (set@ #context (get@ #context state) state')]
+ [[[bundle' state'] output] (body [bundle (with@ #context (#.Some id) state)])]
+ (in [[bundle' (with@ #context (value@ #context state) state')]
output]))))
(def: .public (with_new_context archive body)
@@ -318,13 +318,13 @@
(-> Archive (Operation anchor expression directive a)
(Operation anchor expression directive [Context a])))
(function (_ (^@ stateE [bundle state]))
- (let [[id registry'] (artifact.resource (get@ #registry state))]
+ (let [[id registry'] (artifact.resource (value@ #registry state))]
(do try.monad
[[[bundle' state'] output] (body [bundle (|> state
- (set@ #registry registry')
- (set@ #context (#.Some id)))])
- module_id (archive.id (get@ #module state) archive)]
- (in [[bundle' (set@ #context (get@ #context state) state')]
+ (with@ #registry registry')
+ (with@ #context (#.Some id)))])
+ module_id (archive.id (value@ #module state) archive)]
+ (in [[bundle' (with@ #context (value@ #context state) state')]
[[module_id id]
output]])))))
@@ -333,5 +333,5 @@
(-> Text (Operation anchor expression directive Any)))
(function (_ [bundle state])
(#try.Success [[bundle
- (update@ #log (row.add message) state)]
+ (revised@ #log (row.suffix message) state)]
[]])))
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 c8cfe9c0e..ee12a8bf0 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
@@ -124,10 +124,10 @@
(compile archive expansion))
_
- (/function.apply compile argsC+ functionT functionA archive functionC)))
+ (/function.on compile argsC+ functionT functionA archive functionC)))
_
- (/function.apply compile argsC+ functionT functionA archive functionC)))
+ (/function.on compile argsC+ functionT functionA archive functionC)))
_
(//.except ..unrecognized_syntax [location.dummy code'])))
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 9463eeb8f..b3642f5f3 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
@@ -193,20 +193,28 @@
[inputT' (simplify_case inputT)]
(.case inputT'
(#.Product _)
- (let [subs (type.flat_tuple inputT')
- num_subs (maybe.else (list.size subs)
- num_tags)
- num_sub_patterns (list.size sub_patterns)
- matches (cond (n.< num_subs num_sub_patterns)
- (let [[prefix suffix] (list.split_at (dec num_sub_patterns) subs)]
- (list.zipped/2 (list\compose prefix (list (type.tuple suffix))) sub_patterns))
-
- (n.> num_subs num_sub_patterns)
- (let [[prefix suffix] (list.split_at (dec num_subs) sub_patterns)]
- (list.zipped/2 subs (list\compose prefix (list (code.tuple suffix)))))
-
- ... (n.= num_subs num_sub_patterns)
- (list.zipped/2 subs sub_patterns))]
+ (let [matches (loop [types (type.flat_tuple inputT')
+ patterns sub_patterns
+ output (: (List [Type Code])
+ #.End)]
+ (.case [types patterns]
+ [#.End #.End]
+ output
+
+ [(#.Item headT #.End) (#.Item headP #.End)]
+ (#.Item [headT headP] output)
+
+ [remainingT (#.Item headP #.End)]
+ (#.Item [(type.tuple remainingT) headP] output)
+
+ [(#.Item headT #.End) remainingP]
+ (#.Item [headT (code.tuple remainingP)] output)
+
+ [(#.Item headT tailT) (#.Item headP tailP)]
+ (recur tailT tailP (#.Item [headT headP] output))
+
+ _
+ (undefined)))]
(do !
[[memberP+ thenA] (list\fold (: (All [a]
(-> [Type Code] (Operation [(List Pattern) a])
@@ -220,7 +228,7 @@
(do !
[nextA next]
(in [(list) nextA]))
- (list.reversed matches))]
+ matches)]
(in [(/.pattern/tuple memberP+)
thenA])))
@@ -231,7 +239,7 @@
[location (#.Record record)]
(do ///.monad
[record (//structure.normal record)
- [members recordT] (//structure.order record)
+ [record_size members recordT] (//structure.order record)
_ (.case inputT
(#.Var _id)
(//type.with_env
@@ -239,7 +247,7 @@
_
(in []))]
- (analyse_pattern (#.Some (list.size members)) inputT [location (#.Tuple members)] next))
+ (analyse_pattern (#.Some record_size) inputT [location (#.Tuple members)] next))
[location (#.Tag tag)]
(/.with_location location
@@ -260,9 +268,9 @@
(n.< num_cases idx))
(do ///.monad
[[testP nextA] (if (and (n.> num_cases size_sum)
- (n.= (dec num_cases) idx))
+ (n.= (-- num_cases) idx))
(analyse_pattern #.None
- (type.variant (list.after (dec num_cases) flat_sum))
+ (type.variant (list.after (-- num_cases) flat_sum))
(` [(~+ values)])
next)
(analyse_pattern #.None caseT (` [(~+ values)]) next))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux
index 25c85514e..e7efacf3c 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux
@@ -146,7 +146,7 @@
(do ////.monad
[value_coverage (determine value)
.let [idx (if right?
- (inc lefts)
+ (++ lefts)
lefts)]]
(in (#Variant (if right?
(#.Some idx)
@@ -256,7 +256,7 @@
casesSF (dictionary.entries casesA))]
(in (if (and (or (known_cases? addition_cases)
(known_cases? so_far_cases))
- (n.= (inc (n.max addition_cases so_far_cases))
+ (n.= (++ (n.max addition_cases so_far_cases))
(dictionary.size casesM))
(list.every? exhaustive? (dictionary.values casesM)))
#Exhaustive
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux
index 6282980be..0420b7811 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux
@@ -10,7 +10,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor)]]]
+ ["." list ("#\." functor monoid)]]]
[math
[number
["n" nat]]]
@@ -204,16 +204,16 @@
base)))
... Turns a record type into the kind of function type suitable for inference.
-(def: (record' target originalT inferT)
- (-> Nat Type Type (Operation Type))
+(def: (record' record_size target originalT inferT)
+ (-> Nat Nat Type Type (Operation Type))
(case inferT
(#.Named name unnamedT)
- (record' target originalT unnamedT)
+ (record' record_size target originalT unnamedT)
(^template [<tag>]
[(<tag> env bodyT)
(do ///.monad
- [bodyT+ (record' (n.+ 2 target) originalT bodyT)]
+ [bodyT+ (record' record_size (n.+ 2 target) originalT bodyT)]
(in (<tag> env bodyT+)))])
([#.UnivQ]
[#.ExQ])
@@ -221,22 +221,23 @@
(#.Apply inputT funcT)
(case (type.applied (list inputT) funcT)
(#.Some outputT)
- (record' target originalT outputT)
+ (record' record_size target originalT outputT)
#.None
(/.except ..invalid_type_application inferT))
(#.Product _)
- (///\in (|> inferT
- (type.function (type.flat_tuple inferT))
- (substitute_bound target originalT)))
+ (let [[lefts right] (list.split_at (-- record_size) (type.flat_tuple inferT))]
+ (///\in (|> inferT
+ (type.function (list\compose lefts (list (type.tuple right))))
+ (substitute_bound target originalT))))
_
(/.except ..not_a_record_type inferT)))
-(def: .public (record inferT)
- (-> Type (Operation Type))
- (record' (n.- 2 0) inferT inferT))
+(def: .public (record record_size inferT)
+ (-> Nat Type (Operation Type))
+ (record' record_size (n.- 2 0) inferT inferT))
... Turns a variant type into the kind of function type suitable for inference.
(def: .public (variant tag expected_size inferT)
@@ -252,7 +253,7 @@
(^template [<tag>]
[(<tag> env bodyT)
(do ///.monad
- [bodyT+ (recur (inc depth) bodyT)]
+ [bodyT+ (recur (++ depth) bodyT)]
(in (<tag> env bodyT+)))])
([#.UnivQ]
[#.ExQ])
@@ -260,7 +261,7 @@
(#.Sum _)
(let [cases (type.flat_variant currentT)
actual_size (list.size cases)
- boundary (dec expected_size)]
+ boundary (-- expected_size)]
(cond (or (n.= expected_size actual_size)
(and (n.> expected_size actual_size)
(n.< boundary tag)))
@@ -268,7 +269,7 @@
(#.Some caseT)
(///\in (if (n.= 0 depth)
(type.function (list caseT) currentT)
- (let [replace' (replace (|> depth dec (n.* 2)) inferT)]
+ (let [replace' (replace (|> depth -- (n.* 2)) inferT)]
(type.function (list (replace' caseT))
(replace' currentT)))))
@@ -282,7 +283,7 @@
(let [caseT (type.variant (list.after boundary cases))]
(///\in (if (n.= 0 depth)
(type.function (list caseT) currentT)
- (let [replace' (replace (|> depth dec (n.* 2)) inferT)]
+ (let [replace' (replace (|> depth -- (n.* 2)) inferT)]
(type.function (list (replace' caseT))
(replace' currentT))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux
index d5e2fd691..14e08a4c0 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux
@@ -84,12 +84,12 @@
(do ///.monad
[self_name meta.current_module_name
self meta.current_module]
- (case (get@ #.module_annotations self)
+ (case (value@ #.module_annotations self)
#.None
(function (_ state)
- (#try.Success [(update@ #.modules
- (plist.has self_name (set@ #.module_annotations (#.Some annotations) self))
- state)
+ (#try.Success [(revised@ #.modules
+ (plist.has self_name (with@ #.module_annotations (#.Some annotations) self))
+ state)
[]]))
(#.Some old)
@@ -101,13 +101,13 @@
(do ///.monad
[self_name meta.current_module_name]
(function (_ state)
- (#try.Success [(update@ #.modules
- (plist.revised self_name (update@ #.imports (function (_ current)
- (if (list.any? (text\= module)
- current)
- current
- (#.Item module current)))))
- state)
+ (#try.Success [(revised@ #.modules
+ (plist.revised self_name (revised@ #.imports (function (_ current)
+ (if (list.any? (text\= module)
+ current)
+ current
+ (#.Item module current)))))
+ state)
[]])))))
(def: .public (alias alias module)
@@ -116,10 +116,10 @@
(do ///.monad
[self_name meta.current_module_name]
(function (_ state)
- (#try.Success [(update@ #.modules
- (plist.revised self_name (update@ #.module_aliases (: (-> (List [Text Text]) (List [Text Text]))
- (|>> (#.Item [alias module])))))
- state)
+ (#try.Success [(revised@ #.modules
+ (plist.revised self_name (revised@ #.module_aliases (: (-> (List [Text Text]) (List [Text Text]))
+ (|>> (#.Item [alias module])))))
+ state)
[]])))))
(def: .public (exists? module)
@@ -127,7 +127,7 @@
(///extension.lifted
(function (_ state)
(|> state
- (get@ #.modules)
+ (value@ #.modules)
(plist.value module)
(case> (#.Some _) #1 #.None #0)
[state] #try.Success))))
@@ -139,15 +139,15 @@
[self_name meta.current_module_name
self meta.current_module]
(function (_ state)
- (case (plist.value name (get@ #.definitions self))
+ (case (plist.value name (value@ #.definitions self))
#.None
- (#try.Success [(update@ #.modules
- (plist.has self_name
- (update@ #.definitions
- (: (-> (List [Text Global]) (List [Text Global]))
- (|>> (#.Item [name definition])))
- self))
- state)
+ (#try.Success [(revised@ #.modules
+ (plist.has self_name
+ (revised@ #.definitions
+ (: (-> (List [Text Global]) (List [Text Global]))
+ (|>> (#.Item [name definition])))
+ self))
+ state)
[]])
(#.Some already_existing)
@@ -157,9 +157,9 @@
(-> Nat Text (Operation Any))
(///extension.lifted
(function (_ state)
- (#try.Success [(update@ #.modules
- (plist.has name (..empty hash))
- state)
+ (#try.Success [(revised@ #.modules
+ (plist.has name (..empty hash))
+ state)
[]]))))
(def: .public (with_module hash name action)
@@ -176,15 +176,15 @@
(-> Text (Operation Any))
(///extension.lifted
(function (_ state)
- (case (|> state (get@ #.modules) (plist.value module_name))
+ (case (|> state (value@ #.modules) (plist.value module_name))
(#.Some module)
- (let [active? (case (get@ #.module_state module)
+ (let [active? (case (value@ #.module_state module)
#.Active #1
_ #0)]
(if active?
- (#try.Success [(update@ #.modules
- (plist.has module_name (set@ #.module_state <tag> module))
- state)
+ (#try.Success [(revised@ #.modules
+ (plist.has module_name (with@ #.module_state <tag> module))
+ state)
[]])
((/.except' can_only_change_state_of_active_module [module_name <tag>])
state)))
@@ -196,10 +196,10 @@
(-> Text (Operation Bit))
(///extension.lifted
(function (_ state)
- (case (|> state (get@ #.modules) (plist.value module_name))
+ (case (|> state (value@ #.modules) (plist.value module_name))
(#.Some module)
(#try.Success [state
- (case (get@ #.module_state module)
+ (case (value@ #.module_state module)
<tag> #1
_ #0)])
@@ -216,9 +216,9 @@
(-> Text (Operation <type>))
(///extension.lifted
(function (_ state)
- (case (|> state (get@ #.modules) (plist.value module_name))
+ (case (|> state (value@ #.modules) (plist.value module_name))
(#.Some module)
- (#try.Success [state (get@ <tag> module)])
+ (#try.Success [state (value@ <tag> module)])
#.None
((/.except' unknown_module module_name) state)))))]
@@ -258,18 +258,18 @@
(text\= self_name type_module))]
(///extension.lifted
(function (_ state)
- (case (|> state (get@ #.modules) (plist.value self_name))
+ (case (|> state (value@ #.modules) (plist.value self_name))
(#.Some module)
(let [namespaced_tags (list\map (|>> [self_name]) tags)]
- (#try.Success [(update@ #.modules
- (plist.revised self_name
- (|>> (update@ #.tags (function (_ tag_bindings)
- (list\fold (function (_ [idx tag] table)
- (plist.has tag [idx namespaced_tags exported? type] table))
- tag_bindings
- (list.enumeration tags))))
- (update@ #.types (plist.has type_name [namespaced_tags exported? type]))))
- state)
+ (#try.Success [(revised@ #.modules
+ (plist.revised self_name
+ (|>> (revised@ #.tags (function (_ tag_bindings)
+ (list\fold (function (_ [idx tag] table)
+ (plist.has tag [idx namespaced_tags exported? type] table))
+ tag_bindings
+ (list.enumeration tags))))
+ (revised@ #.types (plist.has type_name [namespaced_tags exported? type]))))
+ state)
[]]))
#.None
((/.except' unknown_module self_name) state))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux
index 052173d1f..44d3b7deb 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux
@@ -32,13 +32,13 @@
(def: (local? name scope)
(-> Text Scope Bit)
(|> scope
- (get@ [#.locals #.mappings])
+ (value@ [#.locals #.mappings])
(plist.contains? name)))
(def: (local name scope)
(-> Text Scope (Maybe [Type Variable]))
(|> scope
- (get@ [#.locals #.mappings])
+ (value@ [#.locals #.mappings])
(plist.value name)
(maybe\map (function (_ [type value])
[type (#variable.Local value)]))))
@@ -46,18 +46,18 @@
(def: (captured? name scope)
(-> Text Scope Bit)
(|> scope
- (get@ [#.captured #.mappings])
+ (value@ [#.captured #.mappings])
(plist.contains? name)))
(def: (captured name scope)
(-> Text Scope (Maybe [Type Variable]))
(loop [idx 0
- mappings (get@ [#.captured #.mappings] scope)]
+ mappings (value@ [#.captured #.mappings] scope)]
(case mappings
(#.Item [_name [_source_type _source_ref]] mappings')
(if (text\= name _name)
(#.Some [_source_type (#variable.Foreign idx)])
- (recur (inc idx) mappings'))
+ (recur (++ idx) mappings'))
#.End
#.None)))
@@ -81,7 +81,7 @@
(///extension.lifted
(function (_ state)
(let [[inner outer] (|> state
- (get@ #.scopes)
+ (value@ #.scopes)
(list.split_when (|>> (reference? name))))]
(case outer
#.End
@@ -92,17 +92,17 @@
(..reference name top_outer))
[ref inner'] (list\fold (: (-> Scope [Variable (List Scope)] [Variable (List Scope)])
(function (_ scope ref+inner)
- [(#variable.Foreign (get@ [#.captured #.counter] scope))
- (#.Item (update@ #.captured
- (: (-> Foreign Foreign)
- (|>> (update@ #.counter inc)
- (update@ #.mappings (plist.has name [ref_type (product.left ref+inner)]))))
- scope)
+ [(#variable.Foreign (value@ [#.captured #.counter] scope))
+ (#.Item (revised@ #.captured
+ (: (-> Foreign Foreign)
+ (|>> (revised@ #.counter ++)
+ (revised@ #.mappings (plist.has name [ref_type (product.left ref+inner)]))))
+ scope)
(product.right ref+inner))]))
[init_ref #.End]
(list.reversed inner))
scopes (list\compose inner' outer)]
- (#.Right [(set@ #.scopes scopes state)
+ (#.Right [(with@ #.scopes scopes state)
(#.Some [ref_type ref])]))
)))))
@@ -112,23 +112,23 @@
(def: .public (with_local [name type] action)
(All [a] (-> [Text Type] (Operation a) (Operation a)))
(function (_ [bundle state])
- (case (get@ #.scopes state)
+ (case (value@ #.scopes state)
(#.Item head tail)
- (let [old_mappings (get@ [#.locals #.mappings] head)
- new_var_id (get@ [#.locals #.counter] head)
- new_head (update@ #.locals
- (: (-> Local Local)
- (|>> (update@ #.counter inc)
- (update@ #.mappings (plist.has name [type new_var_id]))))
- head)]
- (case (///.result' [bundle (set@ #.scopes (#.Item new_head tail) state)]
+ (let [old_mappings (value@ [#.locals #.mappings] head)
+ new_var_id (value@ [#.locals #.counter] head)
+ new_head (revised@ #.locals
+ (: (-> Local Local)
+ (|>> (revised@ #.counter ++)
+ (revised@ #.mappings (plist.has name [type new_var_id]))))
+ head)]
+ (case (///.result' [bundle (with@ #.scopes (#.Item new_head tail) state)]
action)
(#try.Success [[bundle' state'] output])
- (case (get@ #.scopes state')
+ (case (value@ #.scopes state')
(#.Item head' tail')
- (let [scopes' (#.Item (set@ #.locals (get@ #.locals head) head')
+ (let [scopes' (#.Item (with@ #.locals (value@ #.locals head) head')
tail')]
- (#try.Success [[bundle' (set@ #.scopes scopes' state')]
+ (#try.Success [[bundle' (with@ #.scopes scopes' state')]
output]))
_
@@ -161,19 +161,19 @@
(def: .public (with_scope name action)
(All [a] (-> Text (Operation a) (Operation a)))
(function (_ [bundle state])
- (let [parent_name (case (get@ #.scopes state)
+ (let [parent_name (case (value@ #.scopes state)
#.End
(list)
(#.Item top _)
- (get@ #.name top))]
- (case (action [bundle (update@ #.scopes
- (|>> (#.Item (scope parent_name name)))
- state)])
+ (value@ #.name top))]
+ (case (action [bundle (revised@ #.scopes
+ (|>> (#.Item (scope parent_name name)))
+ state)])
(#try.Success [[bundle' state'] output])
- (#try.Success [[bundle' (update@ #.scopes
- (|>> list.tail (maybe.else (list)))
- state')]
+ (#try.Success [[bundle' (revised@ #.scopes
+ (|>> list.tail (maybe.else (list)))
+ state')]
output])
(#try.Failure error)
@@ -185,9 +185,9 @@
(Operation Register)
(///extension.lifted
(function (_ state)
- (case (get@ #.scopes state)
+ (case (value@ #.scopes state)
(#.Item top _)
- (#try.Success [state (get@ [#.locals #.counter] top)])
+ (#try.Success [state (value@ [#.locals #.counter] top)])
#.End
(exception.except ..cannot_get_next_reference_when_there_is_no_scope [])))))
@@ -204,5 +204,5 @@
(def: .public (environment scope)
(-> Scope (List Variable))
(|> scope
- (get@ [#.captured #.mappings])
+ (value@ [#.captured #.mappings])
(list\map (function (_ [_ [_ ref]]) (ref_variable ref)))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
index 56924a102..fe296c83e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
@@ -299,11 +299,11 @@
... re-implementing the same functionality for records makes no sense.
... Records, thus, get transformed into tuples by ordering the elements.
(def: .public (order record)
- (-> (List [Name Code]) (Operation [(List Code) Type]))
+ (-> (List [Name Code]) (Operation [Nat (List Code) Type]))
(case record
- ... empty_record = empty_tuple = unit = []
+ ... empty_record = empty_tuple = unit/any = []
#.End
- (\ ///.monad in [(list) Any])
+ (\ ///.monad in [0 (list) Any])
(#.Item [head_k head_v] _)
(do {! ///.monad}
@@ -334,7 +334,7 @@
.let [ordered_tuple (list\map (function (_ idx)
(maybe.trusted (dictionary.value idx idx->val)))
tuple_range)]]
- (in [ordered_tuple recordT]))
+ (in [size_ts ordered_tuple recordT]))
))
(def: .public (record archive analyse members)
@@ -349,12 +349,12 @@
_
(do {! ///.monad}
[members (normal members)
- [membersC recordT] (order members)
+ [record_size membersC recordT] (..order members)
expectedT (///extension.lifted meta.expected_type)]
(case expectedT
(#.Var _)
(do !
- [inferenceT (//inference.record recordT)
+ [inferenceT (//inference.record record_size recordT)
[inferredT membersA] (//inference.general archive analyse inferenceT membersC)]
(in (/.tuple membersA)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux
index ed980b1e6..f1ffa9026 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux
@@ -18,15 +18,15 @@
(def: .public (with_type expected)
(All [a] (-> Type (Operation a) (Operation a)))
- (///extension.localized (get@ #.expected) (set@ #.expected)
+ (///extension.localized (value@ #.expected) (with@ #.expected)
(function.constant (#.Some expected))))
(def: .public (with_env action)
(All [a] (-> (Check a) (Operation a)))
(function (_ (^@ stateE [bundle state]))
- (case (action (get@ #.type_context state))
+ (case (action (value@ #.type_context state))
(#try.Success [context' output])
- (#try.Success [[bundle (set@ #.type_context context' state)]
+ (#try.Success [[bundle (with@ #.type_context context' state)]
output])
(#try.Failure error)
@@ -34,7 +34,7 @@
(def: .public with_fresh_env
(All [a] (-> (Operation a) (Operation a)))
- (///extension.localized (get@ #.type_context) (set@ #.type_context)
+ (///extension.localized (value@ #.type_context) (with@ #.type_context)
(function.constant check.fresh_context)))
(def: .public (infer actualT)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
index 81fc21caa..cc34e04cf 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
@@ -68,7 +68,7 @@
(case expansion
(^ (list& <lux_def_module> referrals))
(|> (recur archive <lux_def_module>)
- (\ ! map (update@ #/.referrals (list\compose referrals))))
+ (\ ! map (revised@ #/.referrals (list\compose referrals))))
_
(|> expansion
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 aa1730655..508242cd8 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
@@ -1140,24 +1140,22 @@
phase.lifted)]
(in (and (java/lang/Object::equals class (java/lang/reflect/Constructor::getDeclaringClass constructor))
(n.= (list.size inputsJT) (list.size parameters))
- (list\fold (function (_ [expectedJC actualJC] prev)
- (and prev
- (jvm\= expectedJC (: (Type Value)
- (case (jvm_parser.var? actualJC)
- (#.Some name)
- (|> aliasing
- (dictionary.value name)
- (maybe.else name)
- jvm.var)
-
- #.None
- actualJC)))))
- true
- (list.zipped/2 parameters inputsJT))))))
+ (list.every? (function (_ [expectedJC actualJC])
+ (jvm\= expectedJC (: (Type Value)
+ (case (jvm_parser.var? actualJC)
+ (#.Some name)
+ (|> aliasing
+ (dictionary.value name)
+ (maybe.else name)
+ jvm.var)
+
+ #.None
+ actualJC))))
+ (list.zipped/2 parameters inputsJT))))))
(def: index_parameter
(-> Nat .Type)
- (|>> (n.* 2) inc #.Parameter))
+ (|>> (n.* 2) ++ #.Parameter))
(def: (jvm_type_var_mapping owner_tvars method_tvars)
(-> (List Text) (List Text) [(List .Type) Mapping])
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 61f4e3763..0242d94b6 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
@@ -279,9 +279,9 @@
super_classT
super_interfaceT+)]
state (extension.lifted phase.get_state)
- .let [analyse (get@ [#directive.analysis #directive.phase] state)
- synthesize (get@ [#directive.synthesis #directive.phase] state)
- generate (get@ [#directive.generation #directive.phase] state)]
+ .let [analyse (value@ [#directive.analysis #directive.phase] state)
+ synthesize (value@ [#directive.synthesis #directive.phase] state)
+ generate (value@ [#directive.generation #directive.phase] state)]
methods (monad.map ! (..method_definition [mapping selfT] [analyse synthesize generate])
methods)
... _ (directive.lifted_generation
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 604292cdd..329c79611 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
@@ -63,7 +63,7 @@
(def: (context [module_id artifact_id])
(-> Context Context)
... TODO: Find a better way that doesn't rely on clever tricks.
- [module_id (n.- (inc artifact_id) 0)])
+ [module_id (n.- (++ artifact_id) 0)])
... TODO: Inline "evaluate!'" into "evaluate!" ASAP
(def: (evaluate!' archive generate code//type codeS)
@@ -87,9 +87,9 @@
(-> Archive Type Code (Operation anchor expression directive [Type expression Any])))
(do phase.monad
[state (///.lifted phase.get_state)
- .let [analyse (get@ [#/////directive.analysis #/////directive.phase] state)
- synthesize (get@ [#/////directive.synthesis #/////directive.phase] state)
- generate (get@ [#/////directive.generation #/////directive.phase] state)]
+ .let [analyse (value@ [#/////directive.analysis #/////directive.phase] state)
+ synthesize (value@ [#/////directive.synthesis #/////directive.phase] state)
+ generate (value@ [#/////directive.generation #/////directive.phase] state)]
[_ codeA] (/////directive.lifted_analysis
(/////analysis.with_scope
(typeA.with_fresh_env
@@ -123,9 +123,9 @@
(Operation anchor expression directive [Type expression Any])))
(do {! phase.monad}
[state (///.lifted phase.get_state)
- .let [analyse (get@ [#/////directive.analysis #/////directive.phase] state)
- synthesize (get@ [#/////directive.synthesis #/////directive.phase] state)
- generate (get@ [#/////directive.generation #/////directive.phase] state)]
+ .let [analyse (value@ [#/////directive.analysis #/////directive.phase] state)
+ synthesize (value@ [#/////directive.synthesis #/////directive.phase] state)
+ generate (value@ [#/////directive.generation #/////directive.phase] state)]
[_ code//type codeA] (/////directive.lifted_analysis
(/////analysis.with_scope
(typeA.with_fresh_env
@@ -175,9 +175,9 @@
(Operation anchor expression directive [expression Any])))
(do phase.monad
[state (///.lifted phase.get_state)
- .let [analyse (get@ [#/////directive.analysis #/////directive.phase] state)
- synthesize (get@ [#/////directive.synthesis #/////directive.phase] state)
- generate (get@ [#/////directive.generation #/////directive.phase] state)]
+ .let [analyse (value@ [#/////directive.analysis #/////directive.phase] state)
+ synthesize (value@ [#/////directive.synthesis #/////directive.phase] state)
+ generate (value@ [#/////directive.generation #/////directive.phase] state)]
[_ codeA] (/////directive.lifted_analysis
(/////analysis.with_scope
(typeA.with_fresh_env
@@ -199,15 +199,15 @@
(do phase.monad
[[bundle state] phase.get_state
.let [eval (/////analysis/evaluation.evaluator expander
- (get@ [#/////directive.synthesis #/////directive.state] state)
- (get@ [#/////directive.generation #/////directive.state] state)
- (get@ [#/////directive.generation #/////directive.phase] state))]]
+ (value@ [#/////directive.synthesis #/////directive.state] state)
+ (value@ [#/////directive.generation #/////directive.state] state)
+ (value@ [#/////directive.generation #/////directive.phase] state))]]
(phase.set_state [bundle
- (update@ [#/////directive.analysis #/////directive.state]
- (: (-> /////analysis.State+ /////analysis.State+)
- (|>> product.right
- [(///analysis.bundle eval host_analysis)]))
- state)])))
+ (revised@ [#/////directive.analysis #/////directive.state]
+ (: (-> /////analysis.State+ /////analysis.State+)
+ (|>> product.right
+ [(///analysis.bundle eval host_analysis)]))
+ state)])))
(def: (announce_definition! short type)
(All [anchor expression directive]
@@ -310,8 +310,8 @@
(function (_ extension_name phase archive [alias def_name])
(do phase.monad
[_ (///.lifted
- (phase.sub [(get@ [#/////directive.analysis #/////directive.state])
- (set@ [#/////directive.analysis #/////directive.state])]
+ (phase.sub [(value@ [#/////directive.analysis #/////directive.state])
+ (with@ [#/////directive.analysis #/////directive.state])]
(define_alias alias def_name)))]
(in /////directive.no_requirements)))]))
@@ -405,9 +405,9 @@
(^ (list programC))
(do phase.monad
[state (///.lifted phase.get_state)
- .let [analyse (get@ [#/////directive.analysis #/////directive.phase] state)
- synthesize (get@ [#/////directive.synthesis #/////directive.phase] state)
- generate (get@ [#/////directive.generation #/////directive.phase] state)]
+ .let [analyse (value@ [#/////directive.analysis #/////directive.phase] state)
+ synthesize (value@ [#/////directive.synthesis #/////directive.phase] state)
+ generate (value@ [#/////directive.generation #/////directive.phase] state)]
programS (prepare_program archive analyse synthesize programC)
current_module (/////directive.lifted_analysis
(///.lifted meta.current_module_name))
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 a8caf13bf..e18b6d356 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
@@ -128,7 +128,7 @@
list\join)
conditionalsG (|> conditionalsG+
(list\map product.right)
- (monad.seq _.monad))]]
+ (monad.all _.monad))]]
(in (do _.monad
[@else _.new_label]
($_ _.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 a749fb6cd..be90b8876 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
@@ -948,7 +948,7 @@
(monad.map _.monad (.function (_ register)
($_ _.composite
(_.aload 0)
- (_.aload (inc register))
+ (_.aload (++ register))
(_.putfield class (///reference.foreign_name register) $Object)))))]
(method.method method.public "<init>" (anonymous_init_method env)
(list)
@@ -966,7 +966,7 @@
(in ($_ _.composite
(_.new class)
_.dup
- (monad.seq _.monad captureG+)
+ (monad.all _.monad captureG+)
(_.invokespecial class "<init>" (anonymous_init_method env))))))
(def: (returnG returnT)
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 45d6873da..02ddfbd71 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
@@ -84,7 +84,7 @@
.let [foreigns (|> conditionals
(list\map (|>> product.right synthesis.path/then //case.dependencies))
(list& (//case.dependencies (synthesis.path/then else)))
- list.joined
+ list.together
(set.of_list _.hash)
set.list)
@expression (_.constant (reference.artifact [context_module context_artifact]))
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 f683c9b9a..c531d05d9 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
@@ -7,7 +7,7 @@
["." function]
["." try]
["<>" parser
- ["<s>" synthesis (#+ Parser)]]]
+ ["<.>" synthesis (#+ Parser)]]]
[data
["." product]
["." text
@@ -41,7 +41,7 @@
(-> Text (Generator s))]
Handler))
(function (_ extension_name phase archive input)
- (case (<s>.result parser input)
+ (case (<synthesis>.result parser input)
(#try.Success input')
(handler extension_name phase archive input')
@@ -51,11 +51,11 @@
... TODO: Get rid of this ASAP
(def: lux::syntax_char_case!
(..custom [($_ <>.and
- <s>.any
- <s>.any
- (<>.some (<s>.tuple ($_ <>.and
- (<s>.tuple (<>.many <s>.i64))
- <s>.any))))
+ <synthesis>.any
+ <synthesis>.any
+ (<>.some (<synthesis>.tuple ($_ <>.and
+ (<synthesis>.tuple (<>.many <synthesis>.i64))
+ <synthesis>.any))))
(function (_ extension_name phase archive [input else conditionals])
(do {! /////.monad}
[inputG (phase archive input)
@@ -101,9 +101,9 @@
(/.install "and" (binary (product.uncurried //runtime.i64::and)))
(/.install "or" (binary (product.uncurried //runtime.i64::or)))
(/.install "xor" (binary (product.uncurried //runtime.i64::xor)))
- (/.install "left-shift" (binary (product.uncurried //runtime.i64::left_shift)))
- (/.install "right-shift" (binary (product.uncurried //runtime.i64::right_shift)))
-
+ (/.install "left-shift" (binary (product.uncurried //runtime.i64::left_shifted)))
+ (/.install "right-shift" (binary (product.uncurried //runtime.i64::right_shifted)))
+
(/.install "<" (binary (product.uncurried _.<)))
(/.install "=" (binary (product.uncurried _.=)))
(/.install "+" (binary (product.uncurried (..capped _.+))))
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 7bc4f46df..fae91850c 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
@@ -124,7 +124,7 @@
(list))))))]
[left_choice _.nil (<|)]
- [right_choice (_.string "") inc]
+ [right_choice (_.string "") ++]
)
(def: (alternation @otherwise pre! post!)
@@ -248,7 +248,7 @@
pattern_matching! (pattern_matching $output expression archive pathP)
.let [storage (|> pathP
////synthesis/case.storage
- (get@ #////synthesis/case.bindings)
+ (value@ #////synthesis/case.bindings)
set.list
(list\map (function (_ register)
[(..register register)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux
index 917ab8503..41faa95b6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux
@@ -56,7 +56,7 @@
(_.funcall/+ [(_.function/1 @closure) inits]))))))
(def: input
- (|>> inc //case.register))
+ (|>> ++ //case.register))
(def: .public (function expression archive [environment arity bodyS])
(Generator (Abstraction Synthesis))
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 db8c9b18e..7eca077bf 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
@@ -1,6 +1,6 @@
(.module:
[library
- [lux (#- Location inc)
+ [lux (#- Location)
["." meta]
[abstract
["." monad (#+ do)]]
@@ -90,13 +90,13 @@
(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier))
body <code>.any])
(do {! meta.monad}
- [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
(in (list (` (let [(~+ (|> vars
(list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.joined))]
+ list.together))]
(~ body)))))))
(syntax: (runtime: [declaration (<>.or <code>.local_identifier
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux
index df957a3cd..6755b8f33 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux
@@ -31,7 +31,7 @@
(def: .public (variant expression archive [lefts right? valueS])
(Generator (Variant Synthesis))
(let [tag (if right?
- (inc lefts)
+ (++ lefts)
lefts)]
(///////phase\map (|>> [tag right?] //runtime.variant)
(expression archive valueS))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux
index 6a5f40ef7..3802776c8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux
@@ -36,7 +36,7 @@
type <code>.any])
(with_identifiers [g!_ g!extension g!name g!phase g!archive g!inputs g!of g!anchor g!expression g!directive]
(do {! meta.monad}
- [g!input+ (monad.seq ! (list.repeated arity (macro.identifier "input")))]
+ [g!input+ (monad.all ! (list.repeated arity (macro.identifier "input")))]
(in (list (` (def: .public ((~ (code.local_identifier name)) (~ g!extension))
(All [(~ g!anchor) (~ g!expression) (~ g!directive)]
(-> ((~ type) (~ g!expression))
@@ -48,7 +48,7 @@
[(~+ (|> g!input+
(list\map (function (_ g!input)
(list g!input (` ((~ g!phase) (~ g!archive) (~ g!input))))))
- list.joined))]
+ list.together))]
((~' in) ((~ g!extension) [(~+ g!input+)])))
(~' _)
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 b89ca3c5a..9b0431808 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
@@ -144,7 +144,7 @@
(push_cursor! @temp)))))]
[left_choice _.null (<|)]
- [right_choice (_.string "") inc]
+ [right_choice (_.string "") ++]
)
(def: (alternation pre! post!)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
index cccb72dd5..fdfc768a0 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
@@ -56,7 +56,7 @@
(_.var "curried"))
(def: input
- (|>> inc //case.register))
+ (|>> ++ //case.register))
(def: @@arguments
(_.var "arguments"))
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 57916d38a..368c69bb0 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
@@ -68,7 +68,7 @@
(def: .public low
(-> (I64 Any) (I64 Any))
- (let [mask (dec (i64.left_shifted 32 1))]
+ (let [mask (-- (i64.left_shifted 32 1))]
(|>> (i64.and mask))))
(def: .public unit
@@ -88,13 +88,13 @@
(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier))
body <code>.any])
(do {! meta.monad}
- [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
(in (list (` (let [(~+ (|> vars
(list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.joined))]
+ list.together))]
(~ body)))))))
(syntax: (runtime: [declaration (<>.or <code>.local_identifier
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux
index ebaaa7f49..6253b38b5 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux
@@ -31,7 +31,7 @@
(def: .public (variant generate archive [lefts right? valueS])
(Generator (Variant Synthesis))
(let [tag (if right?
- (inc lefts)
+ (++ lefts)
lefts)]
(///////phase\map (//runtime.variant (_.i32 (.int tag))
(//runtime.flag right?))
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 aebb30404..417f74d2d 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
@@ -174,7 +174,7 @@
(#synthesis.Alt leftP rightP)
(do phase.monad
[@alt_else //runtime.forge_label
- left! (path' (inc stack_depth) @alt_else @end phase archive leftP)
+ left! (path' (++ stack_depth) @alt_else @end phase archive leftP)
right! (path' stack_depth @else @end phase archive rightP)]
(in ($_ _.composite
_.dup
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux
index f3938db06..5eafc6556 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux
@@ -74,7 +74,7 @@
(if (arity.multiary? arity)
(|> (n.min arity /arity.maximum)
list.indices
- (list\map (|>> inc (/apply.method classT environment arity @begin body)))
+ (list\map (|>> ++ (/apply.method classT environment arity @begin body)))
(list& (/implementation.method arity @begin body)))
(list (/implementation.method' //runtime.apply::name arity @begin body)))))]
(do phase.monad
@@ -129,7 +129,7 @@
(function (_ batchG)
($_ _.composite
(_.checkcast /abstract.class)
- (monad.seq _.monad batchG)
+ (monad.all _.monad batchG)
(_.invokevirtual /abstract.class //runtime.apply::name (//runtime.apply::type (list.size batchG)))
))))
))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/count.lux
index 30f27def6..1ec854f71 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/count.lux
@@ -6,11 +6,11 @@
[target
[jvm
["_" bytecode (#+ Bytecode)]
+ ["." type]
[encoding
[name (#+ External)]
- ["." signed]]
- ["." type]]]]]
- ["." ///// #_
+ ["." signed]]]]]]
+ ["." //// #_
["#." abstract]])
(def: .public field "partials")
@@ -30,5 +30,5 @@
(Bytecode Any)
($_ _.composite
..this
- (_.getfield /////abstract.class ..field ..type)
+ (_.getfield ////abstract.class ..field ..type)
))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux
index 57d285e8a..19dc23779 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux
@@ -35,7 +35,7 @@
($_ _.composite
(|> _.aconst_null
(list.repeated amount)
- (monad.seq _.monad))
+ (monad.all _.monad))
(_\in [])))
(def: .public (get class register)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux
index da3292be8..1addefe99 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux
@@ -79,7 +79,7 @@
(def: .public (method class environment function_arity @begin body apply_arity)
(-> (Type Class) (Environment Synthesis) Arity Label (Bytecode Any) Arity (Resource Method))
- (let [num_partials (dec function_arity)
+ (let [num_partials (-- function_arity)
over_extent (i.- (.int apply_arity)
(.int function_arity))]
(method.method //.modifier ////runtime.apply::name
@@ -95,15 +95,15 @@
[@default _.new_label
@labelsH _.new_label
@labelsT (|> _.new_label
- (list.repeated (dec num_partials))
- (monad.seq _.monad))
+ (list.repeated (-- num_partials))
+ (monad.all _.monad))
.let [cases (|> (list\compose (#.Item [@labelsH @labelsT])
(list @default))
list.enumeration
(list\map (function (_ [stage @case])
(let [current_partials (|> (list.indices stage)
(list\map (///partial.get class))
- (monad.seq _.monad))
+ (monad.all _.monad))
already_partial? (n.> 0 stage)
exact_match? (i.= over_extent (.int stage))
has_more_than_necessary? (i.> over_extent (.int stage))]
@@ -135,10 +135,10 @@
... (i.< over_extent (.int stage))
(let [current_environment (|> (list.indices (list.size environment))
(list\map (///foreign.get class))
- (monad.seq _.monad))
+ (monad.all _.monad))
missing_partials (|> _.aconst_null
(list.repeated (|> num_partials (n.- apply_arity) (n.- stage)))
- (monad.seq _.monad))]
+ (monad.all _.monad))]
($_ _.composite
(_.new class)
_.dup
@@ -150,7 +150,7 @@
missing_partials
(_.invokevirtual class //init.name (//init.type environment function_arity))
_.areturn)))))))
- (monad.seq _.monad))]]
+ (monad.all _.monad))]]
($_ _.composite
///partial/count.value
(_.tableswitch (try.trusted (signed.s4 +0)) @default [@labelsH @labelsT])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux
index cd92f4aca..3c1922063 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux
@@ -45,7 +45,7 @@
(def: (partials arity)
(-> Arity (List (Type Value)))
- (list.repeated (dec arity) ////type.value))
+ (list.repeated (-- arity) ////type.value))
(def: .public (type environment arity)
(-> (Environment Synthesis) Arity (Type category.Method))
@@ -64,7 +64,7 @@
(def: .public (super environment_size arity)
(-> Nat Arity (Bytecode Any))
- (let [arity_register (inc environment_size)]
+ (let [arity_register (++ environment_size)]
($_ _.composite
(if (arity.unary? arity)
..no_partials
@@ -80,7 +80,7 @@
(list\map (function (_ register)
(put register
(_.aload (offset register)))))
- (monad.seq _.monad)))
+ (monad.all _.monad)))
(def: .public (method class environment arity)
(-> (Type Class) (Environment Synthesis) Arity (Resource Method))
@@ -98,5 +98,5 @@
////reference.this
(..super environment_size arity)
(store_all environment_size (///foreign.put class) offset_foreign)
- (store_all (dec arity) (///partial.put class) offset_partial)
+ (store_all (-- arity) (///partial.put class) offset_partial)
_.return)))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux
index d153b35e9..c126f0296 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux
@@ -47,7 +47,7 @@
($_ _.composite
(_.new class)
_.dup
- (monad.seq _.monad foreign_setup)
+ (monad.all _.monad foreign_setup)
(///partial.new arity)
(_.invokespecial class //init.name (//init.type environment arity))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux
index 6757bc987..9b69ffbae 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux
@@ -64,11 +64,11 @@
... should be the case.
(|> updatesG
(list\map product.left)
- (monad.seq _.monad))
+ (monad.all _.monad))
(|> updatesG
list.reversed
(list\map product.right)
- (monad.seq _.monad))
+ (monad.all _.monad))
(_.goto @begin)))))
(def: .public (scope translate archive [offset initsS+ iterationS])
@@ -83,7 +83,7 @@
($_ _.composite
initG
(_.astore (n.+ offset index)))))
- (monad.seq _.monad))]]
+ (monad.all _.monad))]]
(in ($_ _.composite
initializationG
(_.set_label @begin)
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 f11c871c1..1d414ab77 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
@@ -44,8 +44,7 @@
[constant
["#/." arity]]
[variable
- [partial
- ["#/." count]]]]]
+ ["#/." count]]]]
["//#" /// #_
[//
["." version]
@@ -60,11 +59,14 @@
[io (#+ lux_context)]
[archive (#+ Archive)]]]]]])
-(type: .public Byte_Code Binary)
+(type: .public Byte_Code
+ Binary)
-(type: .public Definition [Text Byte_Code])
+(type: .public Definition
+ [Text Byte_Code])
-(type: .public Anchor [Label Register])
+(type: .public Anchor
+ [Label Register])
(template [<name> <base>]
[(type: .public <name>
@@ -542,7 +544,7 @@
(def: generate_function
(Operation Any)
(let [apply::method+ (|> (enum.range n.enum
- (inc //function/arity.minimum)
+ (++ //function/arity.minimum)
//function/arity.maximum)
(list\map (function (_ arity)
(method.method method.public ..apply::name (..apply::type arity)
@@ -553,7 +555,7 @@
(monad.map _.monad _.aload))]
($_ _.composite
previous_inputs
- (_.invokevirtual //function.class ..apply::name (..apply::type (dec arity)))
+ (_.invokevirtual //function.class ..apply::name (..apply::type (-- arity)))
(_.checkcast //function.class)
(_.aload arity)
(_.invokevirtual //function.class ..apply::name (..apply::type //function/arity.minimum))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux
index 062708388..815c4fca0 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux
@@ -50,12 +50,12 @@
(in (do {! _.monad}
[_ (_.int (.i64 (list.size membersS)))
_ (_.anewarray $Object)]
- (monad.seq ! membersI))))))
+ (monad.all ! membersI))))))
(def: .public (tag lefts right?)
(-> Nat Bit (Bytecode Any))
(case (if right?
- (.inc lefts)
+ (.++ lefts)
lefts)
0 _.iconst_0
1 _.iconst_1
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 d21adc3ef..ef53de88c 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
@@ -145,7 +145,7 @@
(..push! @temp)))))]
[left_choice _.nil (<|)]
- [right_choice (_.string "") inc]
+ [right_choice (_.string "") ++]
)
(def: (alternation pre! post!)
@@ -250,7 +250,7 @@
(def: .public dependencies
(-> Path (List Var))
(|>> ////synthesis/case.storage
- (get@ #////synthesis/case.dependencies)
+ (value@ #////synthesis/case.dependencies)
set.list
(list\map (function (_ variable)
(.case variable
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
index 65930fb75..509808d62 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
@@ -57,7 +57,7 @@
(_.apply/* inits @self)])))
(def: input
- (|>> inc //case.register))
+ (|>> ++ //case.register))
(def: (@scope function_name)
(-> Context Label)
@@ -82,7 +82,7 @@
initialize! (list\fold (.function (_ post pre!)
($_ _.then
pre!
- (_.local/1 (..input post) (_.item (|> post inc .int _.int) @curried))))
+ (_.local/1 (..input post) (_.item (|> post ++ .int _.int) @curried))))
initialize_self!
(list.indices arity))
pack (|>> (list) _.array)
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 a1c3d7ca2..988274333 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
@@ -1,6 +1,6 @@
(.module:
[library
- [lux (#- Location inc)
+ [lux (#- Location)
["." meta]
[abstract
["." monad (#+ do)]]
@@ -105,13 +105,13 @@
(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier))
body <code>.any])
(do {! meta.monad}
- [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
(in (list (` (let [(~+ (|> vars
(list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.joined))]
+ list.together))]
(~ body)))))))
(def: module_id
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux
index 8c78dea65..6bbd167eb 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux
@@ -31,7 +31,7 @@
(def: .public (variant generate archive [lefts right? valueS])
(Generator (Variant Synthesis))
(let [tag (if right?
- (inc lefts)
+ (++ lefts)
lefts)]
(///////phase\map (//runtime.variant tag right?)
(generate archive valueS))))
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 04cce603a..28744fe33 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
@@ -145,7 +145,7 @@
(..push! @temp)))))]
[left_choice _.null (<|)]
- [right_choice (_.string "") inc]
+ [right_choice (_.string "") ++]
)
(def: (alternation pre! post!)
@@ -260,7 +260,7 @@
(def: .public dependencies
(-> Path (List Var))
(|>> ////synthesis/case.storage
- (get@ #////synthesis/case.dependencies)
+ (value@ #////synthesis/case.dependencies)
set.list
(list\map (function (_ variable)
(.case variable
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux
index 5cc25a622..175fadfc3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux
@@ -41,7 +41,7 @@
(|>> (///reference.foreign //reference.system) :expected))
(def: input
- (|>> inc //case.register))
+ (|>> ++ //case.register))
(def: (@scope function_name)
(-> Context Label)
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 6f69ba6e6..bd36c0785 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
@@ -1,6 +1,6 @@
(.module:
[library
- [lux (#- Location inc)
+ [lux (#- Location)
["." meta]
[abstract
["." monad (#+ do)]]
@@ -73,13 +73,13 @@
(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier))
body <code>.any])
(do {! meta.monad}
- [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
(in (list (` (let [(~+ (|> vars
(list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.joined))]
+ list.together))]
(~ body)))))))
(def: module_id
@@ -342,7 +342,7 @@
(def: .public low
(-> (I64 Any) (I64 Any))
- (let [mask (dec (i64.left_shifted 32 1))]
+ (let [mask (-- (i64.left_shifted 32 1))]
(|>> (i64.and mask))))
(runtime: (i64//right_shifted param subject)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux
index 69979afd6..a7fe22f6d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux
@@ -36,7 +36,7 @@
(def: .public (variant expression archive [lefts right? valueS])
(Generator (Variant Synthesis))
(let [tag (if right?
- (inc lefts)
+ (++ lefts)
lefts)]
(///////phase\map (//runtime.variant tag right?)
(expression archive valueS))))
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 df2a1a3fc..5d66730d1 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
@@ -148,7 +148,7 @@
)))]
[left_choice _.none (<|)]
- [right_choice (_.string "") inc]
+ [right_choice (_.string "") ++]
)
(def: (with_looping in_closure? g!once body!)
@@ -298,7 +298,7 @@
(def: .public dependencies
(-> Path (List SVar))
(|>> case.storage
- (get@ #case.dependencies)
+ (value@ #case.dependencies)
set.list
(list\map (function (_ variable)
(.case variable
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
index b1ce3f5c8..eee714ea8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
@@ -19,7 +19,7 @@
["/#" // #_
["#." reference]
["//#" /// #_
- [analysis (#+ Variant Tuple Environment Abstraction Application Analysis)]
+ [analysis (#+ Environment Abstraction Application Analysis)]
[synthesis (#+ Synthesis)]
["#." generation (#+ Context)]
["//#" /// #_
@@ -64,7 +64,7 @@
(in (_.apply/* @function inits)))))
(def: input
- (|>> inc //case.register))
+ (|>> ++ //case.register))
(def: .public (function statement expression archive [environment arity bodyS])
(-> Phase! (Generator (Abstraction Synthesis)))
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 e26aca84a..207b74654 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
@@ -1,6 +1,6 @@
(.module:
[library
- [lux (#- inc)
+ [lux (#- ++)
["." meta]
[abstract
["." monad (#+ do)]]
@@ -112,13 +112,13 @@
(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier))
body <code>.any])
(do {! meta.monad}
- [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
(in (list (` (let [(~+ (|> vars
(list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.joined))]
+ list.together))]
(~ body)))))))
(syntax: (runtime: [declaration (<>.or <code>.local_identifier
@@ -395,7 +395,7 @@
..none
(..some (..i64::64 idx)))))))
-(def: inc
+(def: ++
(|>> (_.+ (_.int +1))))
(def: (within? top value)
@@ -408,7 +408,7 @@
(runtime: (text::char idx text)
(_.if (|> idx (within? (_.len/1 text)))
- (_.return (|> text (_.slice idx (..inc idx)) _.ord/1 ..i64::64))
+ (_.return (|> text (_.slice idx (..++ idx)) _.ord/1 ..i64::64))
(_.raise (_.Exception/1 (_.unicode "[Lux Error] Cannot get char from text.")))))
(def: runtime::text
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux
index 1ab751074..756e3f00d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux
@@ -1,6 +1,6 @@
(.module:
[library
- [lux #*
+ [lux (#- Variant Tuple)
[abstract
["." monad (#+ do)]]
[target
@@ -31,7 +31,7 @@
(def: .public (variant generate archive [lefts right? valueS])
(Generator (Variant Synthesis))
(let [tag (if right?
- (inc lefts)
+ (++ lefts)
lefts)]
(///////phase\map (//runtime.variant tag right?)
(generate archive valueS))))
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 cd41e5f3d..288fdc4bf 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
@@ -187,7 +187,7 @@
..fail!
(..push_cursor! $temp))))])
([/////synthesis.side/left false (<|)]
- [/////synthesis.side/right true inc])
+ [/////synthesis.side/right true ++])
(^ (/////synthesis.member/left 0))
(///////phase\in (_.item (_.int +1) ..peek))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux
index 34334c668..4ae6231c5 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux
@@ -68,8 +68,8 @@
(def: (input_declaration register)
(-> Register Expression)
- (_.set! (|> register inc //case.register)
- (|> $curried (_.item (|> register inc .int _.int)))))
+ (_.set! (|> register ++ //case.register)
+ (|> $curried (_.item (|> register ++ .int _.int)))))
(def: .public (function expression archive [environment arity bodyS])
(Generator (Abstraction Synthesis))
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 e6134cb95..624826639 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
@@ -67,7 +67,7 @@
arity s.nat])
(with_identifiers [g!_ g!proc g!name g!translate g!inputs]
(do {@ macro.monad}
- [g!input+ (monad.seq @ (list.repeated arity (macro.identifier "input")))]
+ [g!input+ (monad.all @ (list.repeated arity (macro.identifier "input")))]
(in (list (` (def: .public ((~ (code.local_identifier name)) (~ g!proc))
(-> (-> (..Vector (~ (code.nat arity)) Expression) Expression)
(-> Text ..Proc))
@@ -79,7 +79,7 @@
[(~+ (|> g!input+
(list/map (function (_ g!input)
(list g!input (` ((~ g!translate) (~ g!input))))))
- list.joined))]
+ list.together))]
((~' in) ((~ g!proc) [(~+ g!input+)])))
(~' _)
@@ -125,7 +125,7 @@
(-> Text Proc)
(function (_ proc_name)
(function (_ translate inputsS)
- (case (s.result inputsS ($_ p.seq s.nat (s.tuple (p.many s.any)) s.any))
+ (case (s.result inputsS ($_ p.and s.nat (s.tuple (p.many s.any)) s.any))
(#e.Success [offset initsS+ bodyS])
(loopT.translate_loop translate offset initsS+ bodyS)
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 36e86df65..21f2ded5a 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
@@ -1,6 +1,6 @@
(.module:
[library
- [lux (#- Location inc i64)
+ [lux (#- Location ++ i64)
["." meta]
[abstract
["." monad (#+ do)]]
@@ -79,13 +79,13 @@
(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier))
body <code>.any])
(do {! meta.monad}
- [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
(in (list (` (let [(~+ (|> vars
(list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.joined))]
+ list.together))]
(~ body)))))))
(syntax: (runtime: [declaration (<>.or <code>.local_identifier
@@ -718,7 +718,7 @@
@frac::decode
))
-(def: inc
+(def: ++
(-> Expression Expression)
(|>> (_.+ (_.int +1))))
@@ -749,8 +749,8 @@
($_ _.then
(_.set! idx (|> (_.apply_kw (list param (_.if (|> startF (_.= (_.int +0)))
subject
- (text_clip (inc startF)
- (inc subjectL)
+ (text_clip (++ startF)
+ (++ subjectL)
subject)))
(list ["fixed" (_.bool #1)])
(_.var "regexpr"))
@@ -766,7 +766,7 @@
(_.set! length (_.length text))
(_.set! to (_.+ additional minimum))
(_.if (within? length to)
- (..some (text_clip (inc minimum) (inc to) text))
+ (..some (text_clip (++ minimum) (++ to) text))
..none))))
(def: (char_at idx text)
@@ -777,7 +777,7 @@
(runtime: (text::char text idx)
(_.if (|> idx (within? (_.length text)))
($_ _.then
- (_.set! idx (inc idx))
+ (_.set! idx (++ idx))
(..some (i64::of_float (char_at idx text))))
..none))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux
index 3c74989df..748f56955 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux
@@ -34,7 +34,7 @@
(def: .public (variant expression archive [lefts right? valueS])
(Generator (Variant Synthesis))
(let [tag (if right?
- (inc lefts)
+ (++ lefts)
lefts)]
(///////phase\map (|>> (//runtime.variant tag right?))
(expression archive valueS))))
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 608bffb04..26ccf116d 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
@@ -1,6 +1,6 @@
(.module:
[library
- [lux #*
+ [lux (#- local)
["@" target]
[data
[text
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 fa95d1ba3..2af4e0dee 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
@@ -151,7 +151,7 @@
(..push! @temp)))))]
[left_choice _.nil (<|)]
- [right_choice (_.string "") inc]
+ [right_choice (_.string "") ++]
)
(def: (with_looping in_closure? g!once g!continue? body!)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
index b64895b0e..192807829 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
@@ -61,7 +61,7 @@
(_.apply/* inits @self)])))
(def: input
- (|>> inc //case.register))
+ (|>> ++ //case.register))
(def: .public (function statement expression archive [environment arity bodyS])
(-> Phase! (Generator (Abstraction Synthesis)))
@@ -73,7 +73,7 @@
.let [function_name (///reference.artifact [function_module function_artifact])
@curried (_.local "curried")
arityO (|> arity .int _.int)
- limitO (|> arity dec .int _.int)
+ limitO (|> arity -- .int _.int)
@num_args (_.local "num_args")
@self (_.local function_name)
initialize_self! (_.set (list (//case.register 0)) @self)
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 1bcb1d528..8a825e466 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
@@ -1,6 +1,6 @@
(.module:
[library
- [lux (#- inc)
+ [lux #*
["." meta]
[abstract
["." monad (#+ do)]]
@@ -74,13 +74,13 @@
(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier))
body <code>.any])
(do {! meta.monad}
- [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
(in (list (` (let [(~+ (|> vars
(list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.local (~ (code.text (format "v" (%.nat id)))))))))
- list.joined))]
+ list.together))]
(~ body)))))))
(def: module_id
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux
index f51cad8bc..57861f7d4 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux
@@ -31,7 +31,7 @@
(def: .public (variant generate archive [lefts right? valueS])
(Generator (Variant Synthesis))
(let [tag (if right?
- (inc lefts)
+ (++ lefts)
lefts)]
(///////phase\map (//runtime.variant tag right?)
(generate archive valueS))))
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 70dfee409..ae841dc5b 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
@@ -180,7 +180,7 @@
..fail!
(push_cursor! @temp))))])
([/////synthesis.side/left false (<|)]
- [/////synthesis.side/right true inc])
+ [/////synthesis.side/right true ++])
(^ (/////synthesis.member/left 0))
(///////phase\in (..push_cursor! (_.vector_ref/2 ..peek (_.int +0))))
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 c52ecd6dd..dc3c75d98 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
@@ -42,7 +42,7 @@
arity <code>.nat])
(with_identifiers [g!_ g!extension g!name g!phase g!inputs]
(do {! macro.monad}
- [g!input+ (monad.seq ! (list.repeated arity (macro.identifier "input")))]
+ [g!input+ (monad.all ! (list.repeated arity (macro.identifier "input")))]
(in (list (` (def: .public ((~ (code.local_identifier name)) (~ g!extension))
(-> (-> (..Vector (~ (code.nat arity)) Expression) Computation)
Handler)
@@ -53,7 +53,7 @@
[(~+ (|> g!input+
(list\map (function (_ g!input)
(list g!input (` ((~ g!phase) (~ g!input))))))
- list.joined))]
+ list.together))]
((~' in) ((~ g!extension) [(~+ g!input+)])))
(~' _)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux
index a36feb036..58d8b55c6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux
@@ -58,7 +58,7 @@
(def: @missing (_.var "missing"))
(def: input
- (|>> inc //case.register))
+ (|>> ++ //case.register))
(def: .public (function expression archive [environment arity bodyS])
(Generator (Abstraction Synthesis))
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 95dfef826..452da33ef 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
@@ -1,6 +1,6 @@
(.module:
[library
- [lux (#- Location inc)
+ [lux (#- Location)
["." meta]
[abstract
["." monad (#+ do)]]
@@ -61,13 +61,13 @@
(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier))
body <code>.any])
(do {! meta.monad}
- [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))]
+ [ids (monad.all ! (list.repeated (list.size vars) meta.seed))]
(in (list (` (let [(~+ (|> vars
(list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
- list.joined))]
+ list.together))]
(~ body)))))))
(syntax: (runtime: [declaration (<>.or <code>.local_identifier
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux
index ebc933d4c..3c21b5e17 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux
@@ -34,7 +34,7 @@
(def: .public (variant expression archive [lefts right? valueS])
(Generator (Variant Synthesis))
(let [tag (if right?
- (inc lefts)
+ (++ lefts)
lefts)]
(///////phase\map (|>> [tag right?] //runtime.variant)
(expression archive valueS))))
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 c234f9902..9e80130aa 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
@@ -59,8 +59,8 @@
(case structure
(#///analysis.Variant variant)
(do phase.monad
- [valueS (optimization' (get@ #///analysis.value variant))]
- (in (/.variant (set@ #///analysis.value valueS variant))))
+ [valueS (optimization' (value@ #///analysis.value variant))]
+ (in (/.variant (with@ #///analysis.value valueS variant))))
(#///analysis.Tuple tuple)
(|> tuple
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 7f2666d8b..1a178900e 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
@@ -71,7 +71,7 @@
thenC)
(#///analysis.Complex (#///analysis.Tuple tuple))
- (let [tuple::last (dec (list.size tuple))]
+ (let [tuple::last (-- (list.size tuple))]
(list\fold (function (_ [tuple::lefts tuple::member] nextC)
(.case tuple::member
(#///analysis.Simple #///analysis.Unit)
@@ -81,7 +81,7 @@
(let [right? (n.= tuple::last tuple::lefts)
end?' (and end? right?)]
(<| (///\map (|>> (#/.Seq (#/.Access (#/.Member (if right?
- (#.Right (dec tuple::lefts))
+ (#.Right (-- tuple::lefts))
(#.Left tuple::lefts)))))))
(path' tuple::member end?')
(when> [(new> (not end?') [])] [(///\map ..clean_up)])
@@ -193,10 +193,10 @@
(loop [lefts 0
patterns patterns]
(with_expansions [<failure> (as_is (list))
- <continue> (as_is (recur (inc lefts)
+ <continue> (as_is (recur (++ lefts)
tail))
<member> (as_is (if (list.empty? tail)
- (#.Right (dec lefts))
+ (#.Right (-- lefts))
(#.Left lefts)))]
(case patterns
#.End
@@ -308,7 +308,7 @@
(case path
(^ (/.path/seq #/.Pop path'))
(let [[pops post_pops] (count_pops path')]
- [(inc pops) post_pops])
+ [(++ pops) post_pops])
_
[0 path]))
@@ -341,8 +341,8 @@
path_storage
(^ (/.path/bind register))
- (update@ #bindings (set.has register)
- path_storage)
+ (revised@ #bindings (set.has register)
+ path_storage)
(#/.Bit_Fork _ default otherwise)
(|> (case otherwise
@@ -376,12 +376,12 @@
(list\fold for_synthesis synthesis_storage members)
(#/.Reference (#///reference.Variable (#///reference/variable.Local register)))
- (if (set.member? (get@ #bindings synthesis_storage) register)
+ (if (set.member? (value@ #bindings synthesis_storage) register)
synthesis_storage
- (update@ #dependencies (set.has (#///reference/variable.Local register)) synthesis_storage))
+ (revised@ #dependencies (set.has (#///reference/variable.Local register)) synthesis_storage))
(#/.Reference (#///reference.Variable var))
- (update@ #dependencies (set.has var) synthesis_storage)
+ (revised@ #dependencies (set.has var) synthesis_storage)
(^ (/.function/apply [functionS argsS]))
(list\fold for_synthesis synthesis_storage (#.Item functionS argsS))
@@ -390,17 +390,17 @@
(list\fold for_synthesis synthesis_storage environment)
(^ (/.branch/case [inputS pathS]))
- (update@ #dependencies
- (set.union (get@ #dependencies (for_path pathS synthesis_storage)))
- (for_synthesis inputS synthesis_storage))
+ (revised@ #dependencies
+ (set.union (value@ #dependencies (for_path pathS synthesis_storage)))
+ (for_synthesis inputS synthesis_storage))
(^ (/.branch/let [inputS register exprS]))
- (update@ #dependencies
- (set.union (|> synthesis_storage
- (update@ #bindings (set.has register))
- (for_synthesis exprS)
- (get@ #dependencies)))
- (for_synthesis inputS synthesis_storage))
+ (revised@ #dependencies
+ (set.union (|> synthesis_storage
+ (revised@ #bindings (set.has register))
+ (for_synthesis exprS)
+ (value@ #dependencies)))
+ (for_synthesis inputS synthesis_storage))
(^ (/.branch/if [testS thenS elseS]))
(list\fold for_synthesis synthesis_storage (list testS thenS elseS))
@@ -409,15 +409,15 @@
(for_synthesis whole synthesis_storage)
(^ (/.loop/scope [start initsS+ iterationS]))
- (update@ #dependencies
- (set.union (|> synthesis_storage
- (update@ #bindings (set.union (|> initsS+
- list.enumeration
- (list\map (|>> product.left (n.+ start)))
- (set.of_list n.hash))))
- (for_synthesis iterationS)
- (get@ #dependencies)))
- (list\fold for_synthesis synthesis_storage initsS+))
+ (revised@ #dependencies
+ (set.union (|> synthesis_storage
+ (revised@ #bindings (set.union (|> initsS+
+ list.enumeration
+ (list\map (|>> product.left (n.+ start)))
+ (set.of_list n.hash))))
+ (for_synthesis iterationS)
+ (value@ #dependencies)))
+ (list\fold for_synthesis synthesis_storage initsS+))
(^ (/.loop/recur replacementsS+))
(list\fold for_synthesis synthesis_storage replacementsS+)
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 7becfbe4d..1e7ca8cc3 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
@@ -55,7 +55,7 @@
(with_expansions [<apply> (as_is (/.function/apply [funcS argsS]))]
(case funcS
(^ (/.function/abstraction functionS))
- (if (n.= (get@ #/.arity functionS)
+ (if (n.= (value@ #/.arity functionS)
(list.size argsS))
(do !
[locals /.locals]
@@ -94,7 +94,7 @@
(-> (-> Synthesis (Operation Synthesis)) Path (Operation Path))
(case path
(#/.Bind register)
- (phase\in (#/.Bind (inc register)))
+ (phase\in (#/.Bind (++ register)))
(^template [<tag>]
[(<tag> left right)
@@ -160,7 +160,7 @@
(#////reference.Variable variable)
(case variable
(#////reference/variable.Local register)
- (phase\in (/.variable/local (inc register)))
+ (phase\in (/.variable/local (++ register)))
(#////reference/variable.Foreign register)
(..find_foreign environment register))
@@ -176,7 +176,7 @@
(do phase.monad
[inputS' (grow environment inputS)
bodyS' (grow environment bodyS)]
- (in (/.branch/let [inputS' (inc register) bodyS'])))
+ (in (/.branch/let [inputS' (++ register) bodyS'])))
(#/.If [testS thenS elseS])
(do phase.monad
@@ -202,7 +202,7 @@
(do {! phase.monad}
[initsS+' (monad.map ! (grow environment) initsS+)
iterationS' (grow environment iterationS)]
- (in (/.loop/scope [(inc start) initsS+' iterationS'])))
+ (in (/.loop/scope [(++ start) initsS+' iterationS'])))
(#/.Recur argumentsS+)
(|> argumentsS+
@@ -258,7 +258,7 @@
(grow env')
(\ ! map (function (_ body)
{#/.environment environment
- #/.arity (inc down_arity')
+ #/.arity (++ down_arity')
#/.body body})))
_
@@ -270,7 +270,7 @@
(case (//loop.optimization false 1 (list) abstraction)
(#.Some [startL initsL bodyL])
(/.function/abstraction {#/.environment environment
- #/.arity (get@ #/.arity abstraction)
+ #/.arity (value@ #/.arity abstraction)
#/.body (/.loop/scope [startL initsL bodyL])})
#.None
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 d9890dbc9..a615c00ef 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
@@ -24,7 +24,7 @@
(def: .public (register_optimization offset)
(-> Register (-> Register Register))
- (|>> dec (n.+ offset)))
+ (|>> -- (n.+ offset)))
(def: (path_optimization body_optimization offset)
(-> (Transform Synthesis) Register (Transform Path))
@@ -86,9 +86,9 @@
(case structure
(#analysis.Variant variant)
(do maybe.monad
- [value' (|> variant (get@ #analysis.value) (recur false))]
+ [value' (|> variant (value@ #analysis.value) (recur false))]
(in (|> variant
- (set@ #analysis.value value')
+ (with@ #analysis.value value')
/.variant)))
(#analysis.Tuple tuple)
@@ -141,10 +141,10 @@
(^ (/.loop/scope scope))
(do {! maybe.monad}
[inits' (|> scope
- (get@ #/.inits)
+ (value@ #/.inits)
(monad.map ! (recur false)))
- iteration' (recur return? (get@ #/.iteration scope))]
- (in (/.loop/scope {#/.start (|> scope (get@ #/.start) (register_optimization offset))
+ iteration' (recur return? (value@ #/.iteration scope))]
+ (in (/.loop/scope {#/.start (|> scope (value@ #/.start) (register_optimization offset))
#/.inits inits'
#/.iteration iteration'})))
@@ -183,6 +183,6 @@
(def: .public (optimization true_loop? offset inits functionS)
(-> Bit Register (List Synthesis) Abstraction (Maybe [Register (List Synthesis) Synthesis]))
- (|> (get@ #/.body functionS)
- (body_optimization true_loop? offset (get@ #/.environment functionS) (get@ #/.arity functionS))
+ (|> (value@ #/.body functionS)
+ (body_optimization true_loop? offset (value@ #/.environment functionS) (value@ #/.arity functionS))
(maybe\map (|>> [offset inits]))))
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 feadf7fa5..cb647c284 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
@@ -29,7 +29,7 @@
(def: (prune redundant register)
(-> Register Register Register)
(if (n.> redundant register)
- (dec register)
+ (-- register)
register))
(type: (Remover a)
@@ -44,7 +44,7 @@
(if (n.= redundant register)
(recur post)
(#/.Seq (#/.Bind (if (n.> redundant register)
- (dec register)
+ (-- register)
register))
(recur post)))
@@ -60,7 +60,7 @@
(recur post)
(#/.Seq (#/.Access (#/.Member member))
(#/.Seq (#/.Bind (if (n.> redundant register)
- (dec register)
+ (-- register)
register))
(recur post))))
@@ -188,7 +188,7 @@
(def: (default arity)
(-> Arity Redundancy)
- (product.right (..extended 0 (inc arity) ..initial)))
+ (product.right (..extended 0 (++ arity) ..initial)))
(type: (Optimization a)
(-> [Redundancy a] (Try [Redundancy a])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux
index 365f9e804..f181fd077 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux
@@ -42,7 +42,7 @@
(do !
[id (archive.id module archive)
[descriptor document] (archive.find module archive)]
- (in [[module id] (get@ #descriptor.registry descriptor)])))))]
+ (in [[module id] (value@ #descriptor.registry descriptor)])))))]
(case (list.one (function (_ [[module module_id] registry])
(do maybe.monad
[program_id (artifact.remember ..name registry)]
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 15539ae10..d4b612bf2 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
@@ -70,13 +70,13 @@
(type: Char
Nat)
-(template [<name> <extension> <diff>]
+(template [<extension> <diff> <name>]
[(template: (<name> value)
[(<extension> <diff> value)])]
- [!inc "lux i64 +" 1]
- [!inc/2 "lux i64 +" 2]
- [!dec "lux i64 -" 1]
+ ["lux i64 +" 1 !++]
+ ["lux i64 +" 2 !++/2]
+ ["lux i64 -" 1 !--]
)
(template: (!clip from to text)
@@ -198,14 +198,14 @@
(:expected <<otherwise>>))])
(template: (!horizontal where offset source_code)
- [[(update@ #.column inc where)
- (!inc offset)
+ [[(revised@ #.column ++ where)
+ (!++ offset)
source_code]])
(inline: (!new_line where)
(-> Location Location)
(let [[where::file where::line where::column] where]
- [where::file (!inc where::line) 0]))
+ [where::file (!++ where::line) 0]))
(inline: (!forward length where)
(-> Nat Location Location)
@@ -214,7 +214,7 @@
(template: (!vertical where offset source_code)
[[(!new_line where)
- (!inc offset)
+ (!++ offset)
source_code]])
(template [<name> <close> <tag>]
@@ -272,8 +272,8 @@
(<| (let [g!content (!clip offset g!end source_code)])
(!guarantee_no_new_lines where offset source_code g!content)
(#.Right [[(let [size (!n/- offset g!end)]
- (update@ #.column (|>> (!n/+ size) (!n/+ 2)) where))
- (!inc g!end)
+ (revised@ #.column (|>> (!n/+ size) (!n/+ 2)) where))
+ (!++ g!end)
source_code]
[where
(#.Text g!content)]]))
@@ -365,11 +365,11 @@
exponent (static ..no_exponent)]
(<| (!with_char+ source_code//size source_code end char/0 <frac_output>)
(!if_digit?+ char/0
- (recur (!inc end) exponent)
+ (recur (!++ end) exponent)
[["e" "E"]
(if (same? (static ..no_exponent) exponent)
- (<| (!with_char+ source_code//size source_code (!inc end) char/1 <failure>)
+ (<| (!with_char+ source_code//size source_code (!++ end) char/1 <failure>)
(`` ("lux syntax char case!" char/1
[[<signs>]
(<| (!with_char+ source_code//size source_code (!n/+ 2 end) char/2 <failure>)
@@ -389,10 +389,10 @@
(loop [end offset]
(<| (!with_char+ source_code//size source_code end char <int_output>)
(!if_digit?+ char
- (recur (!inc end))
+ (recur (!++ end))
[[<frac_separator>]
- (frac_parser source_code//size start where (!inc end) source_code)]
+ (frac_parser source_code//size start where (!++ end) source_code)]
<int_output>))))
)
@@ -404,7 +404,7 @@
(loop [g!end offset]
(<| (!with_char+ source_code//size source_code g!end g!char (!number_output source_code start g!end <codec> <tag>))
(!if_digit?+ g!char
- (recur (!inc g!end))
+ (recur (!++ g!end))
[]
(!number_output source_code start g!end <codec> <tag>)))))]
@@ -413,13 +413,13 @@
)
(template: (!signed_parser source_code//size offset where source_code @aliases @end)
- [(<| (let [g!offset/1 (!inc offset)])
+ [(<| (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 (!inc/2 offset) source_code)
- (!full_name_parser offset [where (!inc offset) source_code] where @aliases #.Identifier)))])
+ (signed_parser source_code//size offset where (!++/2 offset) source_code)
+ (!full_name_parser offset [where (!++ offset) source_code] where @aliases #.Identifier)))])
-(with_expansions [<output> (#.Right [[(update@ #.column (|>> (!n/+ (!n/- start end))) where)
+(with_expansions [<output> (#.Right [[(revised@ #.column (|>> (!n/+ (!n/- start end))) where)
end
source_code]
(!clip start end source_code)])]
@@ -430,12 +430,12 @@
(loop [end offset]
(<| (!with_char+ source_code//size source_code end char <output>)
(!if_name_char?|tail char
- (recur (!inc end))
+ (recur (!++ end))
<output>))))))
(template: (!half_name_parser @offset @char @module)
[(!if_name_char?|head @char
- (!letE [source' name] (..name_part_parser @offset where (!inc @offset) source_code)
+ (!letE [source' name] (..name_part_parser @offset where (!++ @offset) source_code)
(#.Right [source' [@module name]]))
(!failure ..!half_name_parser where @offset source_code))])
@@ -444,7 +444,7 @@
(<| (!with_char+ source_code//size source_code offset/0 char/0
(!end_of_file where offset/0 source_code current_module))
(if (!n/= (char (~~ (static ..name_separator))) char/0)
- (<| (let [offset/1 (!inc offset/0)])
+ (<| (let [offset/1 (!++ offset/0)])
(!with_char+ source_code//size source_code offset/1 char/1
(!end_of_file where offset/1 source_code current_module))
(!half_name_parser offset/1 char/1 current_module))
@@ -462,7 +462,7 @@
(let [[where' offset' source_code'] source'])
(!with_char source_code' offset' char/separator <simple>)
(if (!n/= (char (~~ (static ..name_separator))) char/separator)
- (<| (let [offset'' (!inc offset')])
+ (<| (let [offset'' (!++ offset')])
(!letE [source'' complex] (..name_part_parser offset'' (!forward 1 where') offset'' source_code'))
(if ("lux text =" "" complex)
(let [[where offset source_code] source]
@@ -482,9 +482,9 @@
... [expression ...]
... [form "(" [#* expression] ")"])
-(with_expansions [<consume_1> (as_is where (!inc offset/0) source_code)
- <move_1> (as_is [(!forward 1 where) (!inc offset/0) source_code])
- <move_2> (as_is [(!forward 1 where) (!inc/2 offset/0) source_code])
+(with_expansions [<consume_1> (as_is where (!++ offset/0) source_code)
+ <move_1> (as_is [(!forward 1 where) (!++ offset/0) source_code])
+ <move_2> (as_is [(!forward 1 where) (!++/2 offset/0) source_code])
<recur> (as_is (parse current_module aliases source_code//size))]
(template: (!close closer)
@@ -492,8 +492,8 @@
(def: (bit_syntax value [where offset/0 source_code])
(-> Bit (Parser Code))
- (#.Right [[(update@ #.column (|>> !inc/2) where)
- (!inc/2 offset/0)
+ (#.Right [[(revised@ #.column (|>> !++/2) where)
+ (!++/2 offset/0)
source_code]
[where (#.Bit value)]]))
@@ -530,11 +530,11 @@
... Text
[(~~ (static ..text_delimiter))]
- (text_parser where (!inc offset/0) source_code)
+ (text_parser where (!++ offset/0) source_code)
... Special code
[(~~ (static ..sigil))]
- (<| (let [offset/1 (!inc offset/0)])
+ (<| (let [offset/1 (!++ offset/0)])
(!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
@@ -559,15 +559,15 @@
... (~~ (static ..frac_separator))
]
... It's either a Rev, an identifier, or a comment.
- (with_expansions [<rev_parser> (rev_parser source_code//size offset/0 where (!inc offset/1) source_code)
+ (with_expansions [<rev_parser> (rev_parser source_code//size offset/0 where (!++ offset/1) source_code)
<short_name_parser> (!short_name_parser source_code//size current_module [where offset/1 source_code] where #.Identifier)
- <comment_parser> (case ("lux text index" (!inc offset/1) (static text.new_line) source_code)
+ <comment_parser> (case ("lux text index" (!++ offset/1) (static text.new_line) source_code)
(#.Some end)
(recur (!vertical where end source_code))
_
(!end_of_file where offset/1 source_code current_module))]
- (<| (let [offset/1 (!inc offset/0)])
+ (<| (let [offset/1 (!++ offset/0)])
(!with_char+ source_code//size source_code offset/1 char/1
(!end_of_file where offset/1 source_code current_module))
(!if_digit? char/1
@@ -577,7 +577,7 @@
("lux syntax char case!" char/1
[[(~~ (static ..name_separator))]
... It's either an identifier, or a comment.
- (<| (let [offset/2 (!inc offset/1)])
+ (<| (let [offset/2 (!++ offset/1)])
(!with_char+ source_code//size source_code offset/2 char/2
(!end_of_file where offset/2 source_code current_module))
("lux syntax char case!" char/2
@@ -597,7 +597,7 @@
... else
(!if_digit? char/0
... Natural number
- (nat_parser source_code//size offset/0 where (!inc offset/0) source_code)
+ (nat_parser source_code//size offset/0 where (!++ offset/0) source_code)
... Identifier
(!full_name_parser offset/0 [<consume_1>] where aliases #.Identifier))
)))
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 58dc336dd..7f7d205c3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
@@ -190,11 +190,11 @@
(template [<with> <query> <tag> <type>]
[(def: .public (<with> value)
(-> <type> (All [a] (-> (Operation a) (Operation a))))
- (extension.temporary (set@ <tag> value)))
+ (extension.temporary (with@ <tag> value)))
(def: .public <query>
(Operation <type>)
- (extension.read (get@ <tag>)))]
+ (extension.read (value@ <tag>)))]
[with_locals locals #locals Nat]
[with_currying? currying? #currying? Bit]
@@ -204,7 +204,7 @@
(All [a] (-> (Operation a) (Operation a)))
(<<| (do phase.monad
[locals ..locals])
- (..with_locals (inc locals))))
+ (..with_locals (++ locals))))
(template [<name> <tag>]
[(template: .public (<name> content)
@@ -389,12 +389,12 @@
(#Loop loop)
(case loop
(#Scope scope)
- (|> (format (%.nat (get@ #start scope))
- " " (|> (get@ #inits scope)
+ (|> (format (%.nat (value@ #start scope))
+ " " (|> (value@ #inits scope)
(list\map %synthesis)
(text.interposed " ")
(text.enclosed ["[" "]"]))
- " " (%synthesis (get@ #iteration scope)))
+ " " (%synthesis (value@ #iteration scope)))
(text.enclosed ["(#loop " ")"]))
(#Recur args)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
index 06a2d5ca8..d810d7aca 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
@@ -82,7 +82,7 @@
(def: next
(-> Archive ID)
- (|>> :representation (get@ #next)))
+ (|>> :representation (value@ #next)))
(def: .public empty
Archive
@@ -111,8 +111,8 @@
(#try.Success [next
(|> archive
:representation
- (update@ #..resolver (dictionary.has module [next #.None]))
- (update@ #..next inc)
+ (revised@ #..resolver (dictionary.has module [next #.None]))
+ (revised@ #..next ++)
:abstraction)]))))
(def: .public (has module [descriptor document output] archive)
@@ -122,7 +122,7 @@
(#.Some [id #.None])
(#try.Success (|> archive
:representation
- (update@ #..resolver (dictionary.has module [id (#.Some [descriptor document output])]))
+ (revised@ #..resolver (dictionary.has module [id (#.Some [descriptor document output])]))
:abstraction))
(#.Some [id (#.Some [existing_descriptor existing_document existing_output])])
@@ -160,7 +160,7 @@
(def: .public archived
(-> Archive (List Module))
(|>> :representation
- (get@ #resolver)
+ (value@ #resolver)
dictionary.entries
(list.all (function (_ [module [id descriptor+document]])
(case descriptor+document
@@ -180,13 +180,13 @@
(def: .public reserved
(-> Archive (List Module))
(|>> :representation
- (get@ #resolver)
+ (value@ #resolver)
dictionary.keys))
(def: .public reservations
(-> Archive (List [Module ID]))
(|>> :representation
- (get@ #resolver)
+ (value@ #resolver)
dictionary.entries
(list\map (function (_ [module [id _]])
[module id]))))
@@ -196,17 +196,17 @@
(let [[+next +resolver] (:representation additions)]
(|> archive
:representation
- (update@ #next (n.max +next))
- (update@ #resolver (function (_ resolver)
- (list\fold (function (_ [module [id entry]] resolver)
- (case entry
- (#.Some _)
- (dictionary.has module [id entry] resolver)
-
- #.None
- resolver))
- resolver
- (dictionary.entries +resolver))))
+ (revised@ #next (n.max +next))
+ (revised@ #resolver (function (_ resolver)
+ (list\fold (function (_ [module [id entry]] resolver)
+ (case entry
+ (#.Some _)
+ (dictionary.has module [id entry] resolver)
+
+ #.None
+ resolver))
+ resolver
+ (dictionary.entries +resolver))))
:abstraction)))
(type: Reservation
@@ -281,6 +281,6 @@
{#next next
#resolver (list\fold (function (_ [module id] archive)
(dictionary.has module [id #.None] archive))
- (get@ #resolver (:representation ..empty))
+ (value@ #resolver (:representation ..empty))
reservations)}))))
)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
index de1858b97..e4cc633de 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
@@ -50,7 +50,7 @@
(def: .public artifacts
(-> Registry (Row Artifact))
- (|>> :representation (get@ #artifacts)))
+ (|>> :representation (value@ #artifacts)))
(def: next
(-> Registry ID)
@@ -62,8 +62,8 @@
[id
(|> registry
:representation
- (update@ #artifacts (row.add {#id id
- #category #Anonymous}))
+ (revised@ #artifacts (row.suffix {#id id
+ #category #Anonymous}))
:abstraction)]))
(template [<tag> <create> <fetch>]
@@ -73,18 +73,18 @@
[id
(|> registry
:representation
- (update@ #artifacts (row.add {#id id
- #category (<tag> name)}))
- (update@ #resolver (dictionary.has name id))
+ (revised@ #artifacts (row.suffix {#id id
+ #category (<tag> name)}))
+ (revised@ #resolver (dictionary.has name id))
:abstraction)]))
(def: .public (<fetch> registry)
(-> Registry (List Text))
(|> registry
:representation
- (get@ #artifacts)
+ (value@ #artifacts)
row.list
- (list.all (|>> (get@ #category)
+ (list.all (|>> (value@ #category)
(case> (<tag> name) (#.Some name)
_ #.None)))))]
@@ -99,7 +99,7 @@
(def: .public (remember name registry)
(-> Text Registry (Maybe ID))
(|> (:representation registry)
- (get@ #resolver)
+ (value@ #resolver)
(dictionary.value name)))
(def: .public writer
@@ -119,8 +119,8 @@
artifacts (: (Writer (Row Category))
(binary.row/64 category))]
(|>> :representation
- (get@ #artifacts)
- (row\map (get@ #category))
+ (value@ #artifacts)
+ (row\map (value@ #category))
artifacts)))
(exception: .public (invalid_category {tag Nat})
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux
index 30777c282..a14d708d5 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux
@@ -59,7 +59,7 @@
(def: .public signature
(-> (Document Any) Signature)
- (|>> :representation (get@ #signature)))
+ (|>> :representation (value@ #signature)))
(def: .public (writer content)
(All [d] (-> (Writer d) (Writer (Document d))))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux
index bc413b413..8b4dfedb8 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux
@@ -29,7 +29,7 @@
(def: .public (description signature)
(-> Signature Text)
- (format (%.name (get@ #name signature)) " " (%.nat (get@ #version signature))))
+ (format (%.name (value@ #name signature)) " " (%.nat (value@ #version signature))))
(def: .public writer
(Writer Signature)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
index 2df8c36ec..6ee936f42 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
@@ -57,7 +57,7 @@
(do {! state.monad}
[.let [parents (case (archive.find module archive)
(#try.Success [descriptor document])
- (get@ #descriptor.references descriptor)
+ (value@ #descriptor.references descriptor)
(#try.Failure error)
..fresh)]
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 c5483ac0c..b4fa30d12 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
@@ -61,9 +61,9 @@
(def: (archive fs static)
(All [!] (-> (file.System !) Static file.Path))
- (format (get@ #static.target static)
+ (format (value@ #static.target static)
(\ fs separator)
- (get@ #static.host static)))
+ (value@ #static.host static)))
(def: (unversioned_lux_archive fs static)
(All [!] (-> (file.System !) Static file.Path))
@@ -88,7 +88,7 @@
(format (..module fs static module_id)
(\ fs separator)
(%.nat artifact_id)
- (get@ #static.artifact_extension static)))
+ (value@ #static.artifact_extension static)))
(def: (ensure_directory fs path)
(-> (file.System Async) file.Path (Async (Try Any)))
@@ -125,7 +125,7 @@
(def: .public (enable fs static)
(-> (file.System Async) Static (Async (Try Any)))
(do (try.with async.monad)
- [_ (..ensure_directory fs (get@ #static.target static))]
+ [_ (..ensure_directory fs (value@ #static.target static))]
(..ensure_directory fs (..archive fs static))))
(def: (general_descriptor fs static)
@@ -174,7 +174,7 @@
content (document.read $.key document)]
(in [module content])))
(archive.archived archive)))]
- (in (set@ #.modules modules (fresh_analysis_state host)))))
+ (in (with@ #.modules modules (fresh_analysis_state host)))))
(def: (cached_artifacts fs static module_id)
(-> (file.System Async) Static archive.ID (Async (Try (Dictionary Text Binary))))
@@ -231,7 +231,7 @@
(case artifact_category
#artifact.Anonymous
(do !
- [.let [output (row.add [artifact_id #.None data] output)]
+ [.let [output (row.suffix [artifact_id #.None data] output)]
_ (\ host re_learn context #.None directive)]
(in [definitions
[analysers
@@ -241,7 +241,7 @@
output]))
(#artifact.Definition name)
- (let [output (row.add [artifact_id #.None data] output)]
+ (let [output (row.suffix [artifact_id #.None data] output)]
(if (text\= $/program.name name)
(in [definitions
[analysers
@@ -260,7 +260,7 @@
(#artifact.Analyser extension)
(do !
- [.let [output (row.add [artifact_id #.None data] output)]
+ [.let [output (row.suffix [artifact_id #.None data] output)]
value (\ host re_load context #.None directive)]
(in [definitions
[(dictionary.has extension (:as analysis.Handler value) analysers)
@@ -271,7 +271,7 @@
(#artifact.Synthesizer extension)
(do !
- [.let [output (row.add [artifact_id #.None data] output)]
+ [.let [output (row.suffix [artifact_id #.None data] output)]
value (\ host re_load context #.None directive)]
(in [definitions
[analysers
@@ -282,7 +282,7 @@
(#artifact.Generator extension)
(do !
- [.let [output (row.add [artifact_id #.None data] output)]
+ [.let [output (row.suffix [artifact_id #.None data] output)]
value (\ host re_load context #.None directive)]
(in [definitions
[analysers
@@ -293,7 +293,7 @@
(#artifact.Directive extension)
(do !
- [.let [output (row.add [artifact_id #.None data] output)]
+ [.let [output (row.suffix [artifact_id #.None data] output)]
value (\ host re_load context #.None directive)]
(in [definitions
[analysers
@@ -304,7 +304,7 @@
(#artifact.Custom name)
(do !
- [.let [output (row.add [artifact_id (#.Some name) data] output)]
+ [.let [output (row.suffix [artifact_id (#.Some name) data] output)]
_ (\ host re_learn context (#.Some name) directive)]
(in [definitions
[analysers
@@ -333,8 +333,8 @@
(\ ! map (|>> [exported? type annotations]
#.Definition
[def_name])))))
- (get@ #.definitions content))]
- (in [(document.write $.key (set@ #.definitions definitions content))
+ (value@ #.definitions content))]
+ (in [(document.write $.key (with@ #.definitions definitions content))
bundles])))
(def: (load_definitions fs static module_id host_environment descriptor document)
@@ -345,8 +345,8 @@
Bundles]))))
(do (try.with async.monad)
[actual (cached_artifacts fs static module_id)
- .let [expected (|> descriptor (get@ #descriptor.registry) artifact.artifacts)]
- [document bundles output] (async\in (loaded_document (get@ #static.artifact_extension static) host_environment module_id expected actual document))]
+ .let [expected (|> descriptor (value@ #descriptor.registry) artifact.artifacts)]
+ [document bundles output] (async\in (loaded_document (value@ #static.artifact_extension static) host_environment module_id expected actual document))]
(in [[descriptor document output] bundles])))
(def: (purge! fs static [module_name module_id])
@@ -361,12 +361,12 @@
(def: (valid_cache? expected actual)
(-> Descriptor Input Bit)
- (and (text\= (get@ #descriptor.name expected)
- (get@ #////.module actual))
- (text\= (get@ #descriptor.file expected)
- (get@ #////.file actual))
- (n.= (get@ #descriptor.hash expected)
- (get@ #////.hash actual))))
+ (and (text\= (value@ #descriptor.name expected)
+ (value@ #////.module actual))
+ (text\= (value@ #descriptor.file expected)
+ (value@ #////.file actual))
+ (n.= (value@ #descriptor.hash expected)
+ (value@ #////.hash actual))))
(type: Purge
(Dictionary Module archive.ID))
@@ -390,7 +390,7 @@
(if (purged? module_name)
purge
(if (|> descriptor
- (get@ #descriptor.references)
+ (value@ #descriptor.references)
set.list
(list.any? purged?))
(dictionary.has module_name module_id purge)
@@ -417,7 +417,7 @@
(in [true
[module_name [module_id [descriptor document]]]])
(do !
- [input (//context.read fs ..pseudo_module import contexts (get@ #static.host_module_extension static) module_name)]
+ [input (//context.read fs ..pseudo_module import contexts (value@ #static.host_module_extension static) module_name)]
(in [(..valid_cache? descriptor input)
[module_name [module_id [descriptor document]]]])))))))
load_order (|> pre_loaded_caches
@@ -447,7 +447,7 @@
(archive.has module descriptor,document,output archive))
archive
loaded_caches)
- analysis_state (..analysis_state (get@ #static.host static) archive)]
+ analysis_state (..analysis_state (value@ #static.host static) archive)]
(in [archive
analysis_state
(list\fold (function (_ [_ [+analysers +synthesizers +generators +directives]]
@@ -473,5 +473,5 @@
(#try.Failure error)
(in (#try.Success [archive.empty
- (fresh_analysis_state (get@ #static.host static))
+ (fresh_analysis_state (value@ #static.host static))
..empty_bundles])))))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
index 0c7969507..979edaa76 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
@@ -6,6 +6,7 @@
[predicate (#+ Predicate)]
["." monad (#+ Monad do)]]
[control
+ ["." maybe]
["." try (#+ Try)]
["." exception (#+ exception:)]
[concurrency
@@ -17,7 +18,8 @@
[encoding
["." utf8]]]
[collection
- ["." dictionary (#+ Dictionary)]]]
+ ["." dictionary (#+ Dictionary)]
+ ["." list]]]
[world
["." file]]]]
[program
@@ -138,8 +140,8 @@
(type: .public Enumeration
(Dictionary file.Path Binary))
-(def: (context_listing fs directory enumeration)
- (-> (file.System Async) Context Enumeration (Async (Try Enumeration)))
+(def: (context_listing fs context directory enumeration)
+ (-> (file.System Async) Context file.Path Enumeration (Async (Try Enumeration)))
(do {! (try.with async.monad)}
[enumeration (|> directory
(\ fs directory_files)
@@ -147,23 +149,40 @@
(if (text.ends_with? ..lux_extension file)
(do !
[source_code (\ fs read file)]
- (async\in (dictionary.has' (file.name fs file) source_code enumeration)))
+ (async\in (dictionary.has' (text.replaced context "" file) source_code enumeration)))
(in enumeration)))
enumeration))
(\ ! join))]
(|> directory
(\ fs sub_directories)
- (\ ! map (monad.fold ! (context_listing fs) enumeration))
+ (\ ! map (monad.fold ! (context_listing fs context) enumeration))
(\ ! join))))
(def: Action
(type (All [a] (Async (Try a)))))
+(def: (canonical fs context)
+ (-> (file.System Async) Context (Action Context))
+ (do (try.with async.monad)
+ [subs (\ fs sub_directories context)]
+ (in (|> subs
+ list.head
+ (maybe.else context)
+ (file.parent fs)
+ (maybe.else context)))))
+
(def: .public (listing fs contexts)
(-> (file.System Async) (List Context) (Action Enumeration))
- (monad.fold (: (Monad Action)
- (try.with async.monad))
- (..context_listing fs)
- (: Enumeration
- (dictionary.empty text.hash))
- contexts))
+ (let [! (: (Monad Action)
+ (try.with async.monad))]
+ (monad.fold !
+ (function (_ context enumeration)
+ (do !
+ [context (..canonical fs context)]
+ (..context_listing fs
+ (format context (\ fs separator))
+ context
+ enumeration)))
+ (: Enumeration
+ (dictionary.empty text.hash))
+ contexts)))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager.lux b/stdlib/source/library/lux/tool/compiler/meta/packager.lux
index 21c15d551..744d0ecb9 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager.lux
@@ -35,8 +35,8 @@
(-> dependency.Order Order)
(list\map (function (_ [module [module_id [descriptor document]]])
(|> descriptor
- (get@ #descriptor.registry)
+ (value@ #descriptor.registry)
artifact.artifacts
row.list
- (list\map (|>> (get@ #artifact.id)))
+ (list\map (|>> (value@ #artifact.id)))
[module_id]))))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
index 06ef9b25b..d9707b0c0 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
@@ -143,7 +143,7 @@
(let [class_path (|> custom
(maybe\map (|>> name.internal name.read))
(maybe.else (runtime.class_name [module artifact]))
- (text.suffix (get@ #static.artifact_extension static)))]
+ (text.suffix (value@ #static.artifact_extension static)))]
(do try.monad
[_ (java/util/jar/JarOutputStream::putNextEntry (java/util/jar/JarEntry::new class_path) sink)]
(in (do_to sink
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
index 90d28197a..a229c78a1 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
@@ -104,7 +104,7 @@
(..bundle_module output))
entry_content (: (Try tar.Content)
(|> descriptor
- (get@ #descriptor.references)
+ (value@ #descriptor.references)
set.list
(list.all (function (_ module) (dictionary.value module mapping)))
(list\map (|>> ..module_file _.string _.load_relative/1))
diff --git a/stdlib/source/library/lux/tool/interpreter.lux b/stdlib/source/library/lux/tool/interpreter.lux
index 6e28d5c1a..ee02eacc9 100644
--- a/stdlib/source/library/lux/tool/interpreter.lux
+++ b/stdlib/source/library/lux/tool/interpreter.lux
@@ -75,14 +75,14 @@
(do Monad<!>
[state (platform.initialize platform generation_bundle)
state (platform.compile platform
- (set@ #cli.module syntax.prelude configuration)
- (set@ [#extension.state
- #directive.analysis #directive.state
- #extension.state
- #.info #.mode]
- #.Interpreter
- state))
- [state _] (\ (get@ #platform.file_system platform)
+ (with@ #cli.module syntax.prelude configuration)
+ (with@ [#extension.state
+ #directive.analysis #directive.state
+ #extension.state
+ #.info #.mode]
+ #.Interpreter
+ state))
+ [state _] (\ (value@ #platform.file_system platform)
lift (phase.result' state enter_module))
_ (\ Console<!> write ..welcome_message)]
(in state)))
@@ -102,9 +102,9 @@
(-> Code <Interpretation>))
(do {! phase.monad}
[state (extension.lifted phase.get_state)
- .let [analyse (get@ [#directive.analysis #directive.phase] state)
- synthesize (get@ [#directive.synthesis #directive.phase] state)
- generate (get@ [#directive.generation #directive.phase] state)]
+ .let [analyse (value@ [#directive.analysis #directive.phase] state)
+ synthesize (value@ [#directive.synthesis #directive.phase] state)
+ generate (value@ [#directive.generation #directive.phase] state)]
[_ codeT codeA] (directive.lifted_analysis
(analysis.with_scope
(type.with_fresh_env
@@ -154,10 +154,10 @@
(do phase.monad
[[codeT codeV] (interpret configuration code)
state phase.get_state]
- (in (/type.represent (get@ [#extension.state
- #directive.analysis #directive.state
- #extension.state]
- state)
+ (in (/type.represent (value@ [#extension.state
+ #directive.analysis #directive.state
+ #extension.state]
+ state)
codeT
codeV))))
@@ -171,24 +171,24 @@
(All [anchor expression directive]
(-> <Context> (Try [<Context> Text])))
(do try.monad
- [.let [[_where _offset _code] (get@ #source context)]
- [source' input] (syntax.parse ..module syntax.no_aliases (text.size _code) (get@ #source context))
+ [.let [[_where _offset _code] (value@ #source context)]
+ [source' input] (syntax.parse ..module syntax.no_aliases (text.size _code) (value@ #source context))
[state' representation] (let [... TODO: Simplify ASAP
state (:sharing [anchor expression directive]
{<Context>
context}
{(State+ anchor expression directive)
- (get@ #state context)})]
+ (value@ #state context)})]
(<| (phase.result' state)
... TODO: Simplify ASAP
(:sharing [anchor expression directive]
{<Context>
context}
{(Operation anchor expression directive Text)
- (execute (get@ #configuration context) input)})))]
+ (execute (value@ #configuration context) input)})))]
(in [(|> context
- (set@ #state state')
- (set@ #source source'))
+ (with@ #state state')
+ (with@ #source source'))
representation]))))
(def: .public (run! Monad<!> Console<!> platform configuration generation_bundle)
@@ -212,7 +212,7 @@
(if (and (not multi_line?)
(text\= ..exit_command line))
(\ Console<!> write ..farewell_message)
- (case (read_eval_print (update@ #source (add_line line) context))
+ (case (read_eval_print (revised@ #source (add_line line) context))
(#try.Success [context' representation])
(do !
[_ (\ Console<!> write representation)]
@@ -222,5 +222,5 @@
(if (ex.match? syntax.end_of_file error)
(recur context #1)
(exec (log! (ex.error ..error error))
- (recur (set@ #source ..fresh_source context) #0))))))
+ (recur (with@ #source ..fresh_source context) #0))))))
)))
diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux
index c6be00945..2a99dded3 100644
--- a/stdlib/source/library/lux/type.lux
+++ b/stdlib/source/library/lux/type.lux
@@ -36,7 +36,7 @@
type type]
(case type
(<tag> env sub_type)
- (recur (inc num_args) sub_type)
+ (recur (++ num_args) sub_type)
_
[num_args type])))]
@@ -345,7 +345,7 @@
(-> Nat Type Type)
(case size
0 body
- _ (|> body (<name> (dec size)) (<tag> (list)))))]
+ _ (|> body (<name> (-- size)) (<tag> (list)))))]
[univ_q #.UnivQ]
[ex_q #.ExQ]
@@ -375,7 +375,7 @@
(case depth
0 element_type
_ (|> element_type
- (array (dec depth))
+ (array (-- depth))
(list)
(#.Primitive array.type_name))))
@@ -386,7 +386,7 @@
(^multi (^ (#.Primitive name (list element_type)))
(text\= array.type_name name))
(let [[depth element_type] (flat_array element_type)]
- [(inc depth) element_type])
+ [(++ depth) element_type])
_
[0 type]))
@@ -487,11 +487,11 @@
(bar expression))))}
(macro.with_identifiers [g!_]
(let [shareC (` (: (All [(~+ (list\map code.local_identifier type_vars))]
- (-> (~ (get@ #type exemplar))
- (~ (get@ #type computation))))
+ (-> (~ (value@ #type exemplar))
+ (~ (value@ #type computation))))
(.function ((~ g!_) (~ g!_))
- (~ (get@ #expression computation)))))]
- (in (list (` ((~ shareC) (~ (get@ #expression exemplar)))))))))
+ (~ (value@ #expression computation)))))]
+ (in (list (` ((~ shareC) (~ (value@ #expression exemplar)))))))))
(syntax: .public (:by_example [type_vars ..type_parameters
exemplar ..typed
@@ -509,8 +509,8 @@
(in (list (` (:of ((~! :sharing)
[(~+ (list\map code.local_identifier type_vars))]
- (~ (get@ #type exemplar))
- (~ (get@ #expression exemplar))
+ (~ (value@ #type exemplar))
+ (~ (value@ #expression exemplar))
(~ extraction)
(:expected [])))))))
diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux
index 25c864755..9b657cb19 100644
--- a/stdlib/source/library/lux/type/abstract.lux
+++ b/stdlib/source/library/lux/type/abstract.lux
@@ -69,7 +69,7 @@
(def: (peek_frames reference definition_reference source)
(-> Text Text (List [Text Module]) (Stack Frame))
(!peek source reference
- (peek_frames_definition definition_reference (get@ #.definitions head))))
+ (peek_frames_definition definition_reference (value@ #.definitions head))))
(exception: .public no_active_frames)
@@ -77,7 +77,7 @@
(-> (Maybe Text) (Meta Frame))
(function (_ compiler)
(let [[reference definition_reference] (name_of ..frames)
- current_frames (peek_frames reference definition_reference (get@ #.modules compiler))]
+ current_frames (peek_frames reference definition_reference (value@ #.modules compiler))]
(case (case frame
(#.Some frame)
(list.example (function (_ [actual _])
@@ -131,14 +131,14 @@
(def: (push_frame [module_reference definition_reference] frame source)
(-> Name Frame (List [Text Module]) (List [Text Module]))
(!push source module_reference
- (update@ #.definitions (push_frame_definition definition_reference frame) head)))
+ (revised@ #.definitions (push_frame_definition definition_reference frame) head)))
(def: (push! frame)
(-> Frame (Meta Any))
(function (_ compiler)
- (#.Right [(update@ #.modules
- (..push_frame (name_of ..frames) frame)
- compiler)
+ (#.Right [(revised@ #.modules
+ (..push_frame (name_of ..frames) frame)
+ compiler)
[]])))
(def: (pop_frame_definition reference source)
@@ -163,13 +163,13 @@
(def: (pop_frame [module_reference definition_reference] source)
(-> Name (List [Text Module]) (List [Text Module]))
(!push source module_reference
- (|> head (update@ #.definitions (pop_frame_definition definition_reference)))))
+ (|> head (revised@ #.definitions (pop_frame_definition definition_reference)))))
(syntax: (pop! [])
(function (_ compiler)
- (#.Right [(update@ #.modules
- (..pop_frame (name_of ..frames))
- compiler)
+ (#.Right [(revised@ #.modules
+ (..pop_frame (name_of ..frames))
+ compiler)
(list)])))
(def: cast
diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux
index b4aedaef1..aa8e213af 100644
--- a/stdlib/source/library/lux/type/check.lux
+++ b/stdlib/source/library/lux/type/check.lux
@@ -188,15 +188,15 @@
{#.doc "A brand-new existential type."}
(Check [Nat Type])
(function (_ context)
- (let [id (get@ #.ex_counter context)]
- (#try.Success [(update@ #.ex_counter inc context)
+ (let [id (value@ #.ex_counter context)]
+ (#try.Success [(revised@ #.ex_counter ++ context)
[id (#.Ex id)]]))))
(template [<name> <outputT> <fail> <succeed>]
[(def: .public (<name> id)
(-> Var (Check <outputT>))
(function (_ context)
- (case (|> context (get@ #.var_bindings) (var::get id))
+ (case (|> context (value@ #.var_bindings) (var::get id))
(^or (#.Some (#.Some (#.Var _)))
(#.Some #.None))
(#try.Success [context <fail>])
@@ -208,13 +208,13 @@
(exception.except ..unknown_type_var id))))]
[bound? Bit false true]
- [read (Maybe Type) #.None (#.Some bound)]
+ [read' (Maybe Type) #.None (#.Some bound)]
)
-(def: .public (read! id)
+(def: .public (read id)
(-> Var (Check Type))
(do ..monad
- [?type (read id)]
+ [?type (read' id)]
(case ?type
(#.Some type)
(in type)
@@ -225,7 +225,7 @@
(def: (bound id)
(-> Var (Check Type))
(function (_ context)
- (case (|> context (get@ #.var_bindings) (var::get id))
+ (case (|> context (value@ #.var_bindings) (var::get id))
(#.Some (#.Some bound))
(#try.Success [context bound])
@@ -240,9 +240,9 @@
"Fails if the variable has been bound already.")}
(-> Type Var (Check Any))
(function (_ context)
- (case (|> context (get@ #.var_bindings) (var::get id))
+ (case (|> context (value@ #.var_bindings) (var::get id))
(#.Some #.None)
- (#try.Success [(update@ #.var_bindings (var::put id (#.Some type)) context)
+ (#try.Success [(revised@ #.var_bindings (var::put id (#.Some type)) context)
[]])
(#.Some (#.Some bound))
@@ -251,12 +251,12 @@
_
(exception.except ..unknown_type_var id))))
-(def: (update type id)
+(def: (re_bind type id)
(-> Type Var (Check Any))
(function (_ context)
- (case (|> context (get@ #.var_bindings) (var::get id))
+ (case (|> context (value@ #.var_bindings) (var::get id))
(#.Some _)
- (#try.Success [(update@ #.var_bindings (var::put id (#.Some type)) context)
+ (#try.Success [(revised@ #.var_bindings (var::put id (#.Some type)) context)
[]])
_
@@ -266,29 +266,29 @@
{#.doc (example "A brand-new (unbound) type-variable.")}
(Check [Var Type])
(function (_ context)
- (let [id (get@ #.var_counter context)]
+ (let [id (value@ #.var_counter context)]
(#try.Success [(|> context
- (update@ #.var_counter inc)
- (update@ #.var_bindings (var::new id)))
+ (revised@ #.var_counter ++)
+ (revised@ #.var_bindings (var::new id)))
[id (#.Var id)]]))))
-(def: (apply_type! funcT argT)
+(def: (on argT funcT)
(-> Type Type (Check Type))
(case funcT
(#.Var func_id)
(do ..monad
- [?funcT' (read func_id)]
+ [?funcT' (read' func_id)]
(case ?funcT'
(#.Some funcT')
- (apply_type! funcT' argT)
+ (on argT funcT')
_
(except ..invalid_type_application [funcT argT])))
(#.Apply argT' funcT')
(do ..monad
- [funcT'' (apply_type! funcT' argT')]
- (apply_type! funcT'' argT))
+ [funcT'' (on argT' funcT')]
+ (on argT funcT''))
_
(case (//.applied (list argT) funcT)
@@ -311,7 +311,7 @@
(function (_ context)
(loop [current start
output (set.has start empty_ring)]
- (case (|> context (get@ #.var_bindings) (var::get current))
+ (case (|> context (value@ #.var_bindings) (var::get current))
(#.Some (#.Some type))
(case type
(#.Var post)
@@ -362,12 +362,8 @@
(//\= a a')))
assumptions))
-(def: (assume! assumption assumptions)
- (-> Assumption (List Assumption) (List Assumption))
- (#.Item assumption assumptions))
-
-... TODO: "if_bind" can be optimized...
-(def: (if_bind id type then else)
+... TODO: "if_can_bind" can be optimized...
+(def: (if_can_bind id type then else)
(All [a]
(-> Var Type (Check a) (-> Type (Check a))
(Check a)))
@@ -378,10 +374,10 @@
(do {! ..monad}
[ring (..ring id)
_ (..assertion "" (n.> 1 (set.size ring)))
- _ (monad.map ! (update type) (set.list ring))]
+ _ (monad.map ! (re_bind type) (set.list ring))]
then)
(do ..monad
- [?bound (read id)]
+ [?bound (read' id)]
(else (maybe.else (#.Var id) ?bound)))))
... TODO: "link/2" can be optimized...
@@ -395,8 +391,8 @@
(def: (link/3 interpose to from)
(-> Var Var Var (Check Any))
(do ..monad
- [_ (update (#.Var interpose) from)]
- (update (#.Var to) interpose)))
+ [_ (re_bind (#.Var interpose) from)]
+ (re_bind (#.Var to) interpose)))
... TODO: "check_vars" can be optimized...
(def: (check_vars check' assumptions idE idA)
@@ -457,7 +453,7 @@
[<pattern>
(do !
[ring (..ring <id>)
- _ (monad.map ! (update <type>) (set.list ring))]
+ _ (monad.map ! (re_bind <type>) (set.list ring))]
(in assumptions))])
([[(#.Var _) _] idE atype]
[[_ (#.Var _)] idA etype])
@@ -482,22 +478,22 @@
[(#.UnivQ _ _) (#.Ex _)]
(do ..monad
- [expected' (apply_type! expected_function expected_input)]
+ [expected' (..on expected_input expected_function)]
(check' assumptions expected' (#.Apply actual)))
[(#.Ex _) (#.UnivQ _ _)]
(do ..monad
- [actual' (apply_type! actual_function actual_input)]
+ [actual' (..on actual_input actual_function)]
(check' assumptions (#.Apply expected) actual'))
[(#.Apply [expected_input' expected_function']) (#.Ex _)]
(do ..monad
- [expected_function'' (apply_type! expected_function' expected_input')]
+ [expected_function'' (..on expected_input' expected_function')]
(check' assumptions (#.Apply [expected_input expected_function'']) (#.Apply actual)))
[(#.Ex _) (#.Apply [actual_input' actual_function'])]
(do ..monad
- [actual_function'' (apply_type! actual_function' actual_input')]
+ [actual_function'' (..on actual_input' actual_function')]
(check' assumptions (#.Apply expected) (#.Apply [actual_input actual_function''])))
(^or [(#.Ex _) _] [_ (#.Ex _)])
@@ -508,7 +504,7 @@
[(#.Var id) _]
(function (_ context)
(case ((do ..monad
- [expected_function' (..read! id)]
+ [expected_function' (..read id)]
(check' assumptions (#.Apply expected_input expected_function') (#.Apply actual)))
context)
(#try.Success output)
@@ -518,7 +514,7 @@
(case actual_function
(#.UnivQ _ _)
((do ..monad
- [actual' (apply_type! actual_function actual_input)]
+ [actual' (..on actual_input actual_function)]
(check' assumptions (#.Apply expected) actual'))
context)
@@ -531,15 +527,15 @@
_
((do ..monad
[assumptions (check' assumptions expected_function actual_function)
- expected' (apply_type! actual_function expected_input)
- actual' (apply_type! actual_function actual_input)]
+ expected' (..on expected_input actual_function)
+ actual' (..on actual_input actual_function)]
(check' assumptions expected' actual'))
context))))
[_ (#.Var id)]
(function (_ context)
(case ((do ..monad
- [actual_function' (read! id)]
+ [actual_function' (read id)]
(check' assumptions (#.Apply expected) (#.Apply actual_input actual_function')))
context)
(#try.Success output)
@@ -548,8 +544,8 @@
_
((do ..monad
[assumptions (check' assumptions expected_function actual_function)
- expected' (apply_type! expected_function expected_input)
- actual' (apply_type! expected_function actual_input)]
+ expected' (..on expected_input expected_function)
+ actual' (..on actual_input expected_function)]
(check' assumptions expected' actual'))
context)))
@@ -573,16 +569,16 @@
(check_vars check' assumptions idE idA)
[(#.Var id) _]
- (if_bind id actual
- (check\in assumptions)
- (function (_ bound)
- (check' assumptions bound actual)))
+ (if_can_bind id actual
+ (check\in assumptions)
+ (function (_ bound)
+ (check' assumptions bound actual)))
[_ (#.Var id)]
- (if_bind id expected
- (check\in assumptions)
- (function (_ bound)
- (check' assumptions expected bound)))
+ (if_can_bind id expected
+ (check\in assumptions)
+ (function (_ bound)
+ (check' assumptions expected bound)))
(^template [<fE> <fA>]
[[(#.Apply aE <fE>) (#.Apply aA <fA>)]
@@ -597,12 +593,12 @@
(if (assumed? new_assumption assumptions)
(check\in assumptions)
(do ..monad
- [expected' (apply_type! F A)]
- (check' (assume! new_assumption assumptions) expected' actual))))
+ [expected' (..on A F)]
+ (check' (#.Item new_assumption assumptions) expected' actual))))
[_ (#.Apply A F)]
(do ..monad
- [actual' (apply_type! F A)]
+ [actual' (..on A F)]
(check' assumptions expected actual'))
... TODO: Refactor-away as cold-code
@@ -610,7 +606,7 @@
[[(<tag> _) _]
(do ..monad
[[_ paramT] <instancer>
- expected' (apply_type! expected paramT)]
+ expected' (..on paramT expected)]
(check' assumptions expected' actual))])
([#.UnivQ ..existential]
[#.ExQ ..var])
@@ -620,7 +616,7 @@
[[_ (<tag> _)]
(do ..monad
[[_ paramT] <instancer>
- actual' (apply_type! actual paramT)]
+ actual' (..on paramT actual)]
(check' assumptions expected actual'))])
([#.UnivQ ..var]
[#.ExQ ..existential])
@@ -713,7 +709,7 @@
(#.Var id)
(do ..monad
- [?actualT (read id)]
+ [?actualT (read' id)]
(case ?actualT
(#.Some actualT)
(clean actualT)
diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux
index 99cafdcda..cc54a82a1 100644
--- a/stdlib/source/library/lux/type/implicit.lux
+++ b/stdlib/source/library/lux/type/implicit.lux
@@ -30,7 +30,7 @@
(def: (type_var id env)
(-> Nat Type_Context (Meta Type))
(case (list.example (|>> product.left (n.= id))
- (get@ #.var_bindings env))
+ (value@ #.var_bindings env))
(#.Some [_ (#.Some type)])
(case type
(#.Var id')
@@ -53,7 +53,7 @@
compiler meta.compiler_state]
(case raw_type
(#.Var id)
- (type_var id (get@ #.type_context compiler))
+ (type_var id (value@ #.type_context compiler))
_
(in raw_type))))
@@ -75,7 +75,7 @@
(#.Product left right)
(if (n.= 0 idx)
(\ check.monad in left)
- (member_type (dec idx) right))
+ (member_type (-- idx) right))
_
(if (n.= 0 idx)
@@ -336,7 +336,7 @@
(list.indices 10)
(list.indices 10))
"(Functor List) map"
- (\\ map inc (list.indices 10))
+ (\\ map ++ (list.indices 10))
"Caveat emptor: You need to make sure to import the module of any implementation you want to use."
"Otherwise, this macro will not find it.")}
(case args
@@ -364,7 +364,7 @@
(#.Right [args _])
(do {! meta.monad}
- [labels (|> (macro.identifier "") (list.repeated (list.size args)) (monad.seq !))]
+ [labels (|> (macro.identifier "") (list.repeated (list.size args)) (monad.all !))]
(in (list (` (let [(~+ (|> args (list.zipped/2 labels) (list\map ..pair_list) list\join))]
(..\\ (~ (code.identifier member)) (~+ labels)))))))
))
@@ -373,7 +373,7 @@
(-> Nat (Meta (List Code)))
(|> (macro.identifier "g!implicit")
(list.repeated amount)
- (monad.seq meta.monad)))
+ (monad.all meta.monad)))
(def: implicits
(Parser (List Code))
diff --git a/stdlib/source/library/lux/type/poly.lux b/stdlib/source/library/lux/type/poly.lux
index edd21a88c..51f0b7618 100644
--- a/stdlib/source/library/lux/type/poly.lux
+++ b/stdlib/source/library/lux/type/poly.lux
@@ -86,7 +86,7 @@
(let [idx (<type>.adjusted_idx env idx)]
(if (n.= 0 idx)
(|> (dictionary.value idx env) maybe.trusted product.left (code env))
- (` (.$ (~ (code.nat (dec idx)))))))
+ (` (.$ (~ (code.nat (-- idx)))))))
(#.Apply (#.Named [(~~ (static .prelude_module)) "Nothing"] _) (#.Parameter idx))
(let [idx (<type>.adjusted_idx env idx)]
diff --git a/stdlib/source/library/lux/type/quotient.lux b/stdlib/source/library/lux/type/quotient.lux
index 0006d9dbd..6334d68f3 100644
--- a/stdlib/source/library/lux/type/quotient.lux
+++ b/stdlib/source/library/lux/type/quotient.lux
@@ -40,7 +40,7 @@
(template [<name> <output> <slot>]
[(def: .public <name>
(All [t c %] (-> (Quotient t c %) <output>))
- (|>> :representation (get@ <slot>)))]
+ (|>> :representation (value@ <slot>)))]
[value t #value]
[label c #label]
diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux
index 4e1a88c09..7bb718659 100644
--- a/stdlib/source/library/lux/type/refinement.lux
+++ b/stdlib/source/library/lux/type/refinement.lux
@@ -34,7 +34,7 @@
(template [<name> <output> <slot>]
[(def: .public <name>
(All [t %] (-> (Refined t %) <output>))
- (|>> :representation (get@ <slot>)))]
+ (|>> :representation (value@ <slot>)))]
[value t #value]
[predicate (Predicate t) #predicate]
diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux
index 5ee949bd3..fee4aaf79 100644
--- a/stdlib/source/library/lux/type/resource.lux
+++ b/stdlib/source/library/lux/type/resource.lux
@@ -55,7 +55,7 @@
(function (_ keys)
(\ monad in [keys value])))
- (def: (bind f input)
+ (def: (then f input)
(function (_ keysI)
(do monad
[[keysT value] (input keysI)]
@@ -166,12 +166,12 @@
(#.Item head tail)
(do {! meta.monad}
[.let [max_idx (list\fold n.max head tail)]
- g!inputs (<| (monad.seq !) (list.repeated (inc max_idx)) (macro.identifier "input"))
+ g!inputs (<| (monad.all !) (list.repeated (++ max_idx)) (macro.identifier "input"))
.let [g!outputs (|> (monad.fold maybe.monad
(function (_ from to)
(do maybe.monad
[input (list.item from g!inputs)]
- (in (row.add input to))))
+ (in (row.suffix input to))))
(: (Row Code) row.empty)
swaps)
maybe.trusted
@@ -210,7 +210,7 @@
(do {! meta.monad}
[g!keys (|> (macro.identifier "keys")
(list.repeated amount)
- (monad.seq !))]
+ (monad.all !))]
(in (list (` (: (All [(~ g!!) (~+ g!keys) (~ g!context)]
(-> ((~! monad.Monad) (~ g!!))
(Procedure (~ g!!)
diff --git a/stdlib/source/library/lux/type/unit.lux b/stdlib/source/library/lux/type/unit.lux
index fcbfe0711..e18af25b0 100644
--- a/stdlib/source/library/lux/type/unit.lux
+++ b/stdlib/source/library/lux/type/unit.lux
@@ -217,5 +217,5 @@
(All [unit] (Enum (Qty unit)))
(def: &order ..order)
- (def: succ (|>> ..out inc ..in))
- (def: pred (|>> ..out dec ..in)))
+ (def: succ (|>> ..out ++ ..in))
+ (def: pred (|>> ..out -- ..in)))
diff --git a/stdlib/source/library/lux/world/db/jdbc.lux b/stdlib/source/library/lux/world/db/jdbc.lux
index 2906cebeb..76c1cc17b 100644
--- a/stdlib/source/library/lux/world/db/jdbc.lux
+++ b/stdlib/source/library/lux/world/db/jdbc.lux
@@ -92,10 +92,10 @@
(-> java/sql/PreparedStatement (IO (Try a)))
(IO (Try a))))
(do (try.with io.monad)
- [prepared (io.io (java/sql/Connection::prepareStatement (sql.sql (get@ #sql statement))
+ [prepared (io.io (java/sql/Connection::prepareStatement (sql.sql (value@ #sql statement))
(java/sql/Statement::RETURN_GENERATED_KEYS)
conn))
- _ (io.io ((get@ #input statement) (get@ #value statement) [1 prepared]))
+ _ (io.io ((value@ #input statement) (value@ #value statement) [1 prepared]))
result (action prepared)
_ (java/sql/Statement::close prepared)]
(in result)))
@@ -114,29 +114,29 @@
(def: .public (connect creds)
(-> Credentials (IO (Try (DB IO))))
(do (try.with io.monad)
- [connection (java/sql/DriverManager::getConnection (get@ #url creds)
- (get@ #user creds)
- (get@ #password creds))]
+ [connection (java/sql/DriverManager::getConnection (value@ #url creds)
+ (value@ #user creds)
+ (value@ #password creds))]
(in (: (DB IO)
(implementation
(def: execute
(..can_execute
(function (execute statement)
(with_statement statement connection
- (function (_ prepared)
- (do (try.with io.monad)
- [row_count (java/sql/PreparedStatement::executeUpdate prepared)]
- (in (.nat row_count))))))))
+ (function (_ prepared)
+ (do (try.with io.monad)
+ [row_count (java/sql/PreparedStatement::executeUpdate prepared)]
+ (in (.nat row_count))))))))
(def: insert
(..can_insert
(function (insert statement)
(with_statement statement connection
- (function (_ prepared)
- (do (try.with io.monad)
- [_ (java/sql/PreparedStatement::executeUpdate prepared)
- result_set (io.io (java/sql/Statement::getGeneratedKeys prepared))]
- (/output.rows /output.long result_set)))))))
+ (function (_ prepared)
+ (do (try.with io.monad)
+ [_ (java/sql/PreparedStatement::executeUpdate prepared)
+ result_set (io.io (java/sql/Statement::getGeneratedKeys prepared))]
+ (/output.rows /output.long result_set)))))))
(def: close
(..can_close
@@ -147,10 +147,10 @@
(..can_query
(function (query [statement output])
(with_statement statement connection
- (function (_ prepared)
- (do (try.with io.monad)
- [result_set (java/sql/PreparedStatement::executeQuery prepared)]
- (/output.rows output result_set)))))))
+ (function (_ prepared)
+ (do (try.with io.monad)
+ [result_set (java/sql/PreparedStatement::executeQuery prepared)]
+ (/output.rows output result_set)))))))
)))))
(def: .public (with_db creds action)
diff --git a/stdlib/source/library/lux/world/db/jdbc/input.lux b/stdlib/source/library/lux/world/db/jdbc/input.lux
index fe510ea66..4a2f43507 100644
--- a/stdlib/source/library/lux/world/db/jdbc/input.lux
+++ b/stdlib/source/library/lux/world/db/jdbc/input.lux
@@ -75,7 +75,7 @@
(function (_ value [idx statement])
(do try.monad
[_ (<setter> (.int idx) value statement)]
- (in [(.inc idx) statement]))))]
+ (in [(.++ idx) statement]))))]
[boolean Bit java/sql/PreparedStatement::setBoolean]
@@ -99,7 +99,7 @@
[_ (<setter> (.int idx)
(<constructor> (instant.millis value))
statement)]
- (in [(.inc idx) statement]))))]
+ (in [(.++ idx) statement]))))]
[date java/sql/PreparedStatement::setDate java/sql/Date::new]
[time java/sql/PreparedStatement::setTime java/sql/Time::new]
diff --git a/stdlib/source/library/lux/world/db/jdbc/output.lux b/stdlib/source/library/lux/world/db/jdbc/output.lux
index 08c7354f5..e6e9a8306 100644
--- a/stdlib/source/library/lux/world/db/jdbc/output.lux
+++ b/stdlib/source/library/lux/world/db/jdbc/output.lux
@@ -121,7 +121,7 @@
(#try.Failure error)
(#try.Success value)
- (#try.Success [(inc idx) value]))))]
+ (#try.Success [(++ idx) value]))))]
[boolean java/sql/ResultSet::getBoolean Bit]
@@ -146,7 +146,7 @@
(#try.Failure error)
(#try.Success value)
- (#try.Success [(inc idx)
+ (#try.Success [(++ idx)
(instant.from_millis (java/util/Date::getTime value))]))))]
[date java/sql/ResultSet::getDate]
diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux
index e6c10352f..05925b4e8 100644
--- a/stdlib/source/library/lux/world/file.lux
+++ b/stdlib/source/library/lux/world/file.lux
@@ -1059,8 +1059,8 @@
[(#.Left file) #.End]
(#try.Success (dictionary.has head
(#.Left (|> file
- (set@ #mock_last_modified now)
- (set@ #mock_content content)))
+ (with@ #mock_last_modified now)
+ (with@ #mock_content content)))
directory))
[(#.Right sub_directory) (#.Item _)]
@@ -1239,7 +1239,7 @@
(in (|> |store|
(..retrieve_mock_file! separator path)
(try\map (|>> product.right
- (get@ #mock_content)
+ (value@ #mock_content)
binary.size)))))))
(def: (last_modified path)
@@ -1249,7 +1249,7 @@
(in (|> |store|
(..retrieve_mock_file! separator path)
(try\map (|>> product.right
- (get@ #mock_last_modified))))))))
+ (value@ #mock_last_modified))))))))
(def: (can_execute? path)
(stm.commit!
@@ -1258,7 +1258,7 @@
(in (|> |store|
(..retrieve_mock_file! separator path)
(try\map (|>> product.right
- (get@ #mock_can_execute))))))))
+ (value@ #mock_can_execute))))))))
(def: (read path)
(stm.commit!
@@ -1267,7 +1267,7 @@
(in (|> |store|
(..retrieve_mock_file! separator path)
(try\map (|>> product.right
- (get@ #mock_content))))))))
+ (value@ #mock_content))))))))
(def: (delete path)
(stm.commit!
@@ -1278,7 +1278,7 @@
(..attempt! (function (_ |store|)
(do try.monad
[[name file] (..retrieve_mock_file! separator path |store|)]
- (..update_mock_file! separator path now (get@ #mock_content file) |store|)))
+ (..update_mock_file! separator path now (value@ #mock_content file) |store|)))
store)))
(def: (write content path)
@@ -1296,7 +1296,7 @@
[[name file] (..retrieve_mock_file! separator path |store|)]
(..update_mock_file! separator path now
(\ binary.monoid compose
- (get@ #mock_content file)
+ (value@ #mock_content file)
content)
|store|)))
store))))
@@ -1308,7 +1308,7 @@
(case (do try.monad
[[name file] (..retrieve_mock_file! separator origin |store|)
|store| (..delete_mock_node! separator origin |store|)]
- (..update_mock_file! separator destination (get@ #mock_last_modified file) (get@ #mock_content file) |store|))
+ (..update_mock_file! separator destination (value@ #mock_last_modified file) (value@ #mock_content file) |store|))
(#try.Success |store|)
(do !
[_ (stm.write |store| store)]
diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux
index 3a0b98f86..0e5deec4a 100644
--- a/stdlib/source/library/lux/world/file/watch.lux
+++ b/stdlib/source/library/lux/world/file/watch.lux
@@ -56,7 +56,7 @@
(def: .public <predicate>
(Predicate Concern)
- (|>> :representation (get@ <event>)))]
+ (|>> :representation (value@ <event>)))]
[creation creation? #create
true false false]
@@ -283,7 +283,7 @@
(loop [idx 0
output #.End]
(if (n.< size idx)
- (recur (inc idx)
+ (recur (++ idx)
(#.Item (java/util/List::get (.int idx) list)
output))
output))))
@@ -365,7 +365,7 @@
(def: (default_start watch_events watcher path)
(-> (List Watch_Event) java/nio/file/WatchService //.Path (Async (Try java/nio/file/WatchKey)))
(let [watch_events' (list\fold (function (_ [index watch_event] watch_events')
- (ffi.array_write index watch_event watch_events'))
+ (ffi.write! index watch_event watch_events'))
(ffi.array (java/nio/file/WatchEvent$Kind java/lang/Object)
(list.size watch_events))
(list.enumeration watch_events))]
diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux
index 167d87c88..50a5a2436 100644
--- a/stdlib/source/library/lux/world/net/http/client.lux
+++ b/stdlib/source/library/lux/world/net/http/client.lux
@@ -182,7 +182,7 @@
(#.Some name)
(do !
[?value (java/net/URLConnection::getHeaderField index connection)]
- (recur (inc index)
+ (recur (++ index)
(dictionary.has name (maybe.else "" ?value) headers)))
#.None
@@ -232,10 +232,10 @@
async.future
(\ async.monad map
(|>> (case> (#try.Success [status message])
- (#try.Success [status (update@ #//.body (: (-> (//.Body IO) (//.Body Async))
- (function (_ body)
- (|>> body async.future)))
- message)])
+ (#try.Success [status (revised@ #//.body (: (-> (//.Body IO) (//.Body Async))
+ (function (_ body)
+ (|>> body async.future)))
+ message)])
(#try.Failure error)
(#try.Failure error)))))))
diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux
index 6d9e94b8e..5b0a254e4 100644
--- a/stdlib/source/library/lux/world/net/http/request.lux
+++ b/stdlib/source/library/lux/world/net/http/request.lux
@@ -56,7 +56,7 @@
(All [a] (-> (<json>.Reader a) (-> a Server) Server))
(function (_ (^@ request [identification protocol resource message]))
(do async.monad
- [?raw (read_text_body (get@ #//.body message))]
+ [?raw (read_text_body (value@ #//.body message))]
(case (do try.monad
[raw ?raw
content (\ json.codec decode raw)]
@@ -71,7 +71,7 @@
(-> (-> Text Server) Server)
(function (_ (^@ request [identification protocol resource message]))
(do async.monad
- [?raw (read_text_body (get@ #//.body message))]
+ [?raw (read_text_body (value@ #//.body message))]
(case ?raw
(#try.Success content)
(server content request)
@@ -82,14 +82,14 @@
(def: .public (query property server)
(All [a] (-> (Property a) (-> a Server) Server))
(function (_ [identification protocol resource message])
- (let [full (get@ #//.uri resource)
+ (let [full (value@ #//.uri resource)
[uri query] (|> full
(text.split_by "?")
(maybe.else [full ""]))]
(case (do try.monad
[query (//query.parameters query)
input (context.result query property)]
- (in [[identification protocol (set@ #//.uri uri resource) message]
+ (in [[identification protocol (with@ #//.uri uri resource) message]
input]))
(#try.Success [request input])
(server input request)
@@ -101,7 +101,7 @@
(All [a] (-> (Property a) (-> a Server) Server))
(function (_ (^@ request [identification protocol resource message]))
(do async.monad
- [?body (read_text_body (get@ #//.body message))]
+ [?body (read_text_body (value@ #//.body message))]
(case (do try.monad
[body ?body
form (//query.parameters body)]
@@ -116,7 +116,7 @@
(All [a] (-> (Property a) (-> a Server) Server))
(function (_ (^@ request [identification protocol resource message]))
(case (do try.monad
- [cookies (|> (get@ #//.headers message)
+ [cookies (|> (value@ #//.headers message)
(dictionary.value "Cookie")
(maybe.else "")
//cookie.get)]
diff --git a/stdlib/source/library/lux/world/net/http/response.lux b/stdlib/source/library/lux/world/net/http/response.lux
index 9d74ced0c..b49715c4d 100644
--- a/stdlib/source/library/lux/world/net/http/response.lux
+++ b/stdlib/source/library/lux/world/net/http/response.lux
@@ -40,7 +40,7 @@
(def: .public (temporary_redirect to)
(-> URL Response)
(let [[status message] (..empty status.temporary_redirect)]
- [status (update@ #//.headers (header.location to) message)]))
+ [status (revised@ #//.headers (header.location to) message)]))
(def: .public not_found
Response
diff --git a/stdlib/source/library/lux/world/net/http/route.lux b/stdlib/source/library/lux/world/net/http/route.lux
index a650f53d2..9689e3414 100644
--- a/stdlib/source/library/lux/world/net/http/route.lux
+++ b/stdlib/source/library/lux/world/net/http/route.lux
@@ -18,7 +18,7 @@
[(def: .public (<name> server)
(-> Server Server)
(function (_ (^@ request [identification protocol resource message]))
- (case (get@ #//.scheme protocol)
+ (case (value@ #//.scheme protocol)
<scheme>
(server request)
@@ -33,7 +33,7 @@
[(def: .public (<name> server)
(-> Server Server)
(function (_ (^@ request [identification protocol resource message]))
- (case (get@ #//.method resource)
+ (case (value@ #//.method resource)
<method>
(server request)
@@ -54,12 +54,12 @@
(def: .public (uri path server)
(-> URI Server Server)
(function (_ [identification protocol resource message])
- (if (text.starts_with? path (get@ #//.uri resource))
+ (if (text.starts_with? path (value@ #//.uri resource))
(server [identification
protocol
- (update@ #//.uri
- (|>> (text.clip' (text.size path)) maybe.trusted)
- resource)
+ (revised@ #//.uri
+ (|>> (text.clip' (text.size path)) maybe.trusted)
+ resource)
message])
(async.resolved //response.not_found))))
diff --git a/stdlib/source/library/lux/world/service/journal.lux b/stdlib/source/library/lux/world/service/journal.lux
index 424288cb5..afab93a3e 100644
--- a/stdlib/source/library/lux/world/service/journal.lux
+++ b/stdlib/source/library/lux/world/service/journal.lux
@@ -33,12 +33,12 @@
(implementation: .public (equivalence (^open "_\."))
(All [a] (-> (Equivalence a) (Equivalence (Entry a))))
(def: (= reference sample)
- (and (_\= (get@ #what reference) (get@ #what sample))
- (text\= (get@ #why reference) (get@ #why sample))
- (text\= (get@ #how reference) (get@ #how sample))
- (text\= (get@ #who reference) (get@ #who sample))
- (text\= (get@ #where reference) (get@ #where sample))
- (instant\= (get@ #when reference) (get@ #when sample)))))
+ (and (_\= (value@ #what reference) (value@ #what sample))
+ (text\= (value@ #why reference) (value@ #why sample))
+ (text\= (value@ #how reference) (value@ #how sample))
+ (text\= (value@ #who reference) (value@ #who sample))
+ (text\= (value@ #where reference) (value@ #where sample))
+ (instant\= (value@ #when reference) (value@ #when sample)))))
(capability: .public (Can_Write ! a)
(can_write (Entry a) (! (Try Any))))
diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux
index 429c46897..d59b72786 100644
--- a/stdlib/source/library/lux/world/shell.lux
+++ b/stdlib/source/library/lux/world/shell.lux
@@ -182,9 +182,9 @@
(-> (List Argument) (Array java/lang/String))
(product.right
(list\fold (function (_ argument [idx output])
- [(inc idx) (jvm.array_write idx
- (:as java/lang/String argument)
- output)])
+ [(++ idx) (jvm.write! idx
+ (:as java/lang/String argument)
+ output)])
[0 (jvm.array java/lang/String (list.size arguments))]
arguments)))
@@ -197,9 +197,10 @@
(java/util/Map java/lang/String java/lang/String)
(java/util/Map java/lang/String java/lang/String))
(list\fold (function (_ [key value] target')
- (exec (java/util/Map::put (:as java/lang/String key)
- (:as java/lang/String value)
- target')
+ (exec
+ (java/util/Map::put (:as java/lang/String key)
+ (:as java/lang/String value)
+ target')
target'))
target
(dictionary.entries input)))