diff --git a/aedifex/source/program/aedifex/command/deps.lux b/aedifex/source/program/aedifex/command/deps.lux index a90e96bfe..c1996ed8a 100644 --- a/aedifex/source/program/aedifex/command/deps.lux +++ b/aedifex/source/program/aedifex/command/deps.lux @@ -61,19 +61,19 @@ (///dependency/deployment.all local)) _ (console.write_line (exception.report (list ["Local successes" (|> local_successes - (list.sorted (by ///dependency.order <)) + (list.in_order (by ///dependency.order <)) (exception.listing ..as_text))] ["Local failures" (|> local_failures - (list.sorted (by ///dependency.order <)) + (list.in_order (by ///dependency.order <)) (exception.listing ..as_text))] ["Remote successes" (|> remote_successes (set.of_list ///dependency.hash) (set.difference (set.of_list ///dependency.hash local_successes)) set.as_list - (list.sorted (by ///dependency.order <)) + (list.in_order (by ///dependency.order <)) (exception.listing ..as_text))] ["Remote failures" (|> remote_failures - (list.sorted (by ///dependency.order <)) + (list.in_order (by ///dependency.order <)) (exception.listing ..as_text))])) console)] (pure resolution)))) diff --git a/aedifex/source/test/aedifex/runtime.lux b/aedifex/source/test/aedifex/runtime.lux index 8ded7c42a..4dec917e6 100644 --- a/aedifex/source/test/aedifex/runtime.lux +++ b/aedifex/source/test/aedifex/runtime.lux @@ -67,7 +67,7 @@ (its /.#program runtime')) (|> runtime' (its /.#parameters) - list.reversed + list.in_reverse (list.item 0) (maybe#each (text.= path)) (maybe.else false))))) diff --git a/stdlib/source/documentation/lux/data/collection/sequence.lux b/stdlib/source/documentation/lux/data/collection/sequence.lux index 316c45226..a2c60b5a7 100644 --- a/stdlib/source/documentation/lux/data/collection/sequence.lux +++ b/stdlib/source/documentation/lux/data/collection/sequence.lux @@ -23,7 +23,7 @@ ($.definition /.monoid) ($.definition /.functor) ($.definition /.monad) - ($.definition /.reversed) + ($.definition /.in_reverse) ($.definition /.every?) ($.definition /.any?) diff --git a/stdlib/source/documentation/lux/data/collection/stack.lux b/stdlib/source/documentation/lux/data/collection/stack.lux index 8d6a11fbc..1f4f901b3 100644 --- a/stdlib/source/documentation/lux/data/collection/stack.lux +++ b/stdlib/source/documentation/lux/data/collection/stack.lux @@ -57,9 +57,9 @@ "" ($.example (' (mixes f init inputs)))) - ($.definition /.reversed + ($.definition /.in_reverse "" - ($.example (' (reversed xs)))) + ($.example (' (in_reverse xs)))) ($.definition /.only "A list with only values that satisfy the predicate." @@ -117,9 +117,9 @@ "Fetches the element at the specified index." ($.example (' (item i xs)))) - ($.definition /.sorted + ($.definition /.in_order "A list ordered by a comparison function." - ($.example (' (sorted < xs)))) + ($.example (' (in_order < xs)))) ($.definition /.empty? "" diff --git a/stdlib/source/documentation/lux/math/number/i64.lux b/stdlib/source/documentation/lux/math/number/i64.lux index 9fcb4dc80..715c9171b 100644 --- a/stdlib/source/documentation/lux/math/number/i64.lux +++ b/stdlib/source/documentation/lux/math/number/i64.lux @@ -25,7 +25,7 @@ ($.definition /.hash) ($.definition /.disjunction) ($.definition /.conjunction) - ($.definition /.reversed) + ($.definition /.in_reverse) ($.definition /.left_rotated) ($.definition /.right_rotated) diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index c68d9e5ca..f78f1d977 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -1084,7 +1084,7 @@ (Function {#Parameter ..argument 0} {#Parameter ..argument 0})}}) -(the' .private stack#reversed +(the' .private stack#in_reverse {#Quantification .universal {#Empty} ($ Change ($ Stack {#Parameter ..argument 0}))} (stack#mix (function' (_ head tail) @@ -1246,7 +1246,7 @@ (list#each' (function' (_ address item) (value item)) it)) -(the' .private (list#reversed it) +(the' .private (list#in_reverse it) {#Quantification .universal {#Empty} ($ Change ($ List {#Parameter ..argument 0}))} (list#of_array (.when# (.list_size# it) @@ -1555,7 +1555,7 @@ (the' .public -> Macro (macro (_ tokens) - (.when# (list#split 1 (list#reversed tokens)) + (.when# (list#split 1 (list#in_reverse tokens)) [(.list# output) inputs] (meta#pure (list (list#mix ..'Function output inputs))) @@ -1568,12 +1568,12 @@ (meta#pure (list (list#mix' (function' (_ _ head tail) ('#Top head tail)) '#Empty - (list#reversed it)))))) + (list#in_reverse it)))))) (the' .public Union Macro (macro (_ tokens) - (meta#pure (list (.when# (list#as_stack (list#reversed tokens)) + (meta#pure (list (.when# (list#as_stack (list#in_reverse tokens)) {#Empty} ('prelude "Nothing") @@ -1589,7 +1589,7 @@ (the' .public Tuple Macro (macro (_ tokens) - (meta#pure (list (.when# (list#as_stack (list#reversed tokens)) + (meta#pure (list (.when# (list#as_stack (list#in_reverse tokens)) {#Empty} ('prelude "Any") @@ -1643,7 +1643,7 @@ [label value] ('let label value body)))) body - (stack#reversed bindings)))) + (stack#in_reverse bindings)))) {#None} (failure ..wrong_syntax)) @@ -1696,7 +1696,7 @@ (macro (_ tokens) (.when# (list#split 1 tokens) [(.list# op) tokens'] - (.when# (list#split 1 (list#reversed tokens')) + (.when# (list#split 1 (list#in_reverse tokens')) [(.list# last) prevs] (meta#pure (list (list#mix (right_associativity op) last prevs))) @@ -1798,7 +1798,7 @@ body') value)))))) body - (stack#reversed bindings))] + (stack#in_reverse bindings))] (meta#pure (list ('let (code#tuple (list 'pure 'then)) monad body')))) {#None} @@ -1836,7 +1836,7 @@ (the' .public if Macro (macro (_ tokens) - (.when# (list#as_stack (list#reversed tokens)) + (.when# (list#as_stack (list#in_reverse tokens)) {#Top else then,test/*} (.when# (pairs then,test/*) {#Some then,test/*} @@ -2389,7 +2389,7 @@ _ (expanded_list head tail))) empty_list - (list#reversed elements)) + (list#in_reverse elements)) (with_monad meta#monad [=elements (monad#each meta#monad (untemplated replace? subst) elements)] (pure ('list =elements))))] @@ -2630,7 +2630,7 @@ (the' .public <| Macro (macro (_ tokens) - (.when# (list#split 1 (list#reversed tokens)) + (.when# (list#split 1 (list#in_reverse tokens)) [(.list# init) apps] (meta#pure (list (list#mix (.is# (-> Code Code Code) (function' (_ app acc) @@ -3266,7 +3266,7 @@ (|> it (list#each code#as_text) (list#interposed " ") - list#reversed + list#in_reverse (list#mix text#composite "") (text#enclosed ["(" ")"])) @@ -3274,7 +3274,7 @@ (|> it (list#each code#as_text) (list#interposed " ") - list#reversed + list#in_reverse (list#mix text#composite "") (text#enclosed ["[" "]"])) @@ -3282,7 +3282,7 @@ (|> it (list#each code#as_text) (list#interposed " ") - list#reversed + list#in_reverse (list#mix text#composite "") (text#enclosed ["{" "}"])))) @@ -3330,7 +3330,7 @@ (the' .public exec Macro (macro (_ tokens) - (.when# (?#value (list#reversed tokens) + (.when# (?#value (list#in_reverse tokens) (?#and ?#any ?#rest)) {#Some [value actions]} (let' [dummy (code#local "")] @@ -3629,7 +3629,7 @@ "[" (bit#as_text polarity) " " (type#as_text it) "]")))) - list#reversed + list#in_reverse (list#mix' (function' (_ _ left right) (text left right)) "")) ")") @@ -3661,7 +3661,7 @@ (|> args (list#each type#as_text) (list#interposed " ") - list#reversed + list#in_reverse (list#mix text#composite "")) ")")) @@ -3935,7 +3935,7 @@ (?#value tokens)) {#Some [bindings body]} (|> bindings - list#reversed + list#in_reverse (list#mix (is (-> [Code Code] (Change Code)) (function' (_ lr body') (let' [[l r] lr] @@ -3971,7 +3971,7 @@ (` (.function# (, 'name) (, 'blank) (.when (, 'blank) (, arg) (, body')))))))] (meta#pure (list (nest (code#local 'name) head - (list#mix (nest 'blank) body (list#reversed tail)))))) + (list#mix (nest 'blank) body (list#in_reverse tail)))))) else (failure ..wrong_syntax)))) @@ -4047,7 +4047,7 @@ [(the .public (macro (_ tokens) (meta#pure (list (when (|> (?#and ?#any ?#rest) - (?#value (list#reversed tokens))) + (?#value (list#in_reverse tokens))) {.#Some [last init]} (list#mix (is (-> Code (Change Code)) (function (_ pre post) (`
))) @@ -4724,9 +4724,9 @@ jumps (.i64_-# 1 relatives)] (if (natural#< (.list_size# parts) jumps) (let [prefix (|> parts - list#reversed + list#in_reverse (list#after jumps) - list#reversed + list#in_reverse (text#interposed ..module_delimiter)) clean (.text_clip# relatives (|> module .text_size# (.i64_-# relatives)) module) output (when (.text_size# clean) @@ -4989,7 +4989,7 @@ (stack#mix (function' (_ head tail) {#Top (value head) tail}) {#Empty} - (stack#reversed it))) + (stack#in_reverse it))) (the (clean_type variables it) (-> (List (Maybe Type)) @@ -5307,7 +5307,7 @@ [(list) (list)] implementations)) .let [[pre_defs implementations] pre_defs,implementations]] - (pure (list (` (these (,* (list#reversed pre_defs)) + (pure (list (` (these (,* (list#in_reverse pre_defs)) (..use (, (code#text current_module)) (, (code#text imported_module)) (, (code#text import_alias)) @@ -5434,7 +5434,7 @@ (function (_ [s b] v) (` (..has (, s) (, v) (, b))))) value - (list#reversed pairs)) + (list#in_reverse pairs)) [_ accesses] (list#mix (is (-> [Code Code] (Change [Code (List Code)])) (function (_ [new_slot new_binding] [old_record accesses']) @@ -5595,7 +5595,7 @@ (the 'stack (-> (Stack Code) Code) - (|>> stack#reversed + (|>> stack#in_reverse (stack#mix '#Top '#Empty))) (the (type_code type) @@ -6009,7 +6009,7 @@ [(with_monad meta#monad [<*>' (monad#each meta#monad embedded_expansions <*>)] (pure [(|> <*>' - list#reversed + list#in_reverse (list#each product#left) list#conjoint) { <@> (list#each product#right <*>')}]))])) @@ -6202,7 +6202,7 @@ ... https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science) (the .public <- (macro (_ parameters) - (meta#pure (list (` (.-> (,* (list#reversed parameters)))))))) + (meta#pure (list (` (.-> (,* (list#in_reverse parameters)))))))) ... https://en.wikipedia.org/wiki/Number#Classification (alias [N Nat] diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux index 4e027ec84..43cb7c2af 100644 --- a/stdlib/source/library/lux/abstract/comonad.lux +++ b/stdlib/source/library/lux/abstract/comonad.lux @@ -78,7 +78,7 @@ _ ))))) body - (list.reversed bindings))] + (list.in_reverse bindings))] (pure (list (when ?name {.#Some name} (.let [name {.#Name provenance.dummy ["" name]}] diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index ba4141f27..15c96b888 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -27,7 +27,7 @@ (the _meta#monad (.in_module# .prelude meta#monad)) (the _failure (.in_module# .prelude failure)) (the _expansion#let (.in_module# .prelude expansion#let)) -(the list#reversed (.in_module# .prelude list#reversed)) +(the list#in_reverse (.in_module# .prelude list#in_reverse)) (the list#mix (.in_module# .prelude list#mix)) (the ?#value (.in_module# .prelude ?#value)) @@ -77,7 +77,7 @@ _ ))))) body - (list#reversed bindings))] + (list#in_reverse bindings))] (pure (list (when ?name {.#Some name} (.let [name {.#Name provenance.dummy ["" name]}] diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux index 3dd855d0a..172d2ae21 100644 --- a/stdlib/source/library/lux/abstract/monad/indexed.lux +++ b/stdlib/source/library/lux/abstract/monad/indexed.lux @@ -83,7 +83,7 @@ (, next)) (, value))))) expression - (list.reversed context))] + (list.in_reverse context))] (pure (list (when ?name {.#Some name} (.let [name (code.local name)] diff --git a/stdlib/source/library/lux/compiler/language/lux/analysis/coverage.lux b/stdlib/source/library/lux/compiler/language/lux/analysis/coverage.lux index 5c60e3cea..f4acb5043 100644 --- a/stdlib/source/library/lux/compiler/language/lux/analysis/coverage.lux +++ b/stdlib/source/library/lux/compiler/language/lux/analysis/coverage.lux @@ -223,7 +223,7 @@ ... Tuple patterns can be exhaustive if there is exhaustiveness for all of ... their sub-patterns. {@type.#Complex_Pattern {@type.#Complex_Tuple membersP+}} - (when (list.reversed membersP+) + (when (list.in_reverse membersP+) (^.or (list) (list _)) (exception.except ..invalid_tuple [(list.size membersP+)]) @@ -458,7 +458,7 @@ (again addition' possibilitiesSF') {.#None} - (when (stack.reversed possibilitiesSF') + (when (stack.in_reverse possibilitiesSF') {.#Top last prevs} (pure (stack.mix (function (_ left right) {#Alt left right}) last diff --git a/stdlib/source/library/lux/compiler/language/lux/analysis/inference.lux b/stdlib/source/library/lux/compiler/language/lux/analysis/inference.lux index 045075916..510c57d25 100644 --- a/stdlib/source/library/lux/compiler/language/lux/analysis/inference.lux +++ b/stdlib/source/library/lux/compiler/language/lux/analysis/inference.lux @@ -210,7 +210,7 @@ (List Type)) (|>> list.indices (list#each (|>> {.#Parameter .argument})) - list.reversed)) + list.in_reverse)) (template.with [ ] [(`` (the .public ( (,, (template.spliced )) complex) diff --git a/stdlib/source/library/lux/compiler/language/lux/analysis/scope.lux b/stdlib/source/library/lux/compiler/language/lux/analysis/scope.lux index fe67ab57d..715a61e01 100644 --- a/stdlib/source/library/lux/compiler/language/lux/analysis/scope.lux +++ b/stdlib/source/library/lux/compiler/language/lux/analysis/scope.lux @@ -111,7 +111,7 @@ scope) (product.right ref+inner)}])) [init_ref {.#Empty}] - (stack.reversed inner)) + (stack.in_reverse inner)) scopes (stack#composite inner' outer)] {.#Right [(has @type.#scopes scopes state) {.#Some [(@type.old ref_type) ref]}]}) diff --git a/stdlib/source/library/lux/compiler/language/lux/phase.lux b/stdlib/source/library/lux/compiler/language/lux/phase.lux index 9b947a402..4dcbc5f52 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase.lux @@ -326,7 +326,7 @@ (-> (List module.Name) Text) (|>> ..without_lux_runtime - (list.sorted text.<) + (list.in_order text.<) (text.interposed ..listing_delimiter))) (the (not_known lux name) @@ -354,7 +354,7 @@ {.#Some (name#as [module_name def_name])} {.#None})))))) list#conjoint - (list.sorted text.<) + (list.in_order text.<) (text.interposed ..listing_delimiter)) imports (|> this_module (its @type.#imports) @@ -362,7 +362,7 @@ aliases (|> this_module (its @type.#module_aliases) (list#each (function (_ [alias real]) (text alias " => " real))) - (list.sorted text.<) + (list.in_order text.<) (text.interposed ..listing_delimiter))] (text "" " All known modules: " every_known \n " Aliases: " aliases diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/library/lux/compiler/language/lux/phase/analysis/complex.lux index 17675cf77..17434f1b9 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/analysis/complex.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/analysis/complex.lux @@ -392,19 +392,19 @@ _ false))) -(the sorted_record +(the record_in_order (Change (Stack [@type.Label @type.Code])) (|>> (view.of list.stack) - (list.sorted (function (_ left right) - (when [left right] - [[[{.#Some [leftsL right?L familyL]} typeL] valueL] - [[{.#Some [leftsR right?R familyR]} typeR] valueR]] - (if (n.= leftsL leftsR) - (not right?R) - (n.< leftsL leftsR)) - - _ - false))) + (list.in_order (function (_ left right) + (when [left right] + [[[{.#Some [leftsL right?L familyL]} typeL] valueL] + [[{.#Some [leftsR right?R familyR]} typeR] valueR]] + (if (n.= leftsL leftsR) + (not right?R) + (n.< leftsL leftsR)) + + _ + false))) (view.as list.stack))) ... Lux already possesses the means to analyse tuples, so @@ -423,7 +423,7 @@ (when record {try.#Success record} (monad.let ! - [.let [record (sorted_record record)] + [.let [record (record_in_order record)] here phase.name_of_current_module _ (phase.assertion ..cannot_order_record [here (` ..same_record?) (view.of list.stack original_record)] (same_record? record)) diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/analysis/when.lux b/stdlib/source/library/lux/compiler/language/lux/phase/analysis/when.lux index ce63ad75e..ca8c6baf1 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/analysis/when.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/analysis/when.lux @@ -320,7 +320,7 @@ (monad.let ! [nextA next] (pure [(stack) nextA])) - (stack.reversed sub_patterns))] + (stack.in_reverse sub_patterns))] (pure [(/pattern.list (view.of list.stack sub_patterns)) thenA])) diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/compiler/language/lux/phase/extension/analysis/jvm.lux index 15b12946f..f7482b3ab 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -1292,11 +1292,11 @@ [(List .Type) Mapping]) (let [jvm_tvars (list#composite owner_tvars method_tvars) lux_tvars (|> jvm_tvars - list.reversed + list.in_reverse list.enumeration (list#each (function (_ [idx name]) [name (index_parameter idx)])) - list.reversed) + list.in_reverse) num_owner_tvars (list.size owner_tvars) owner_tvarsT (|> lux_tvars (list.first num_owner_tvars) @@ -2177,7 +2177,7 @@ arguments) [scope bodyA] (|> arguments' (list#composite (list [self_name selfT])) - list.reversed + list.in_reverse (list#mix scope.with_local (analyse archive body)) (typeA.with .Any) scope.with) @@ -2281,7 +2281,7 @@ arguments) [scope bodyA] (|> arguments' (list#composite (list [self_name selfT])) - list.reversed + list.in_reverse (list#mix scope.with_local (analyse archive body)) (typeA.with :return:) scope.with) @@ -2361,7 +2361,7 @@ (pure [name luxT]))) arguments) [scope bodyA] (|> arguments' - list.reversed + list.in_reverse (list#mix scope.with_local (analyse archive body)) (typeA.with :return:) scope.with) @@ -2491,7 +2491,7 @@ :return: (boxed_reflection_return mapping return) [scope bodyA] (|> arguments' (list#composite (list [self_name selfT])) - list.reversed + list.in_reverse (list#mix scope.with_local (analyse archive body)) (typeA.with :return:) scope.with) diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/compiler/language/lux/phase/extension/analysis/lux.lux index 5c29a600b..38288ccf0 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/extension/analysis/lux.lux @@ -530,7 +530,7 @@ (list ["Choice" (%.text name)] ["Each option" (|> (property.keys @type.each_name) (list#composite (property.keys @type.each_type)) - (list.sorted text.<) + (list.in_order text.<) (exception.listing %.text))]))) (the type::name diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/extension/declaration/jvm.lux b/stdlib/source/library/lux/compiler/language/lux/phase/extension/declaration/jvm.lux index 29b55f5e6..a2b1f5a04 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/extension/declaration/jvm.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/extension/declaration/jvm.lux @@ -426,7 +426,7 @@ (the composite (-> (List (Bytecode Any)) (Bytecode Any)) - (|>> list.reversed + (|>> list.in_reverse (list#mix _.composite (_#pure [])))) (the constructor_name diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/extension/translation/jvm/common.lux b/stdlib/source/library/lux/compiler/language/lux/phase/extension/translation/jvm/common.lux index 9061f2eb0..6d5b52810 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/extension/translation/jvm/common.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/extension/translation/jvm/common.lux @@ -385,7 +385,7 @@ (add_part! it) update_size! ))) - (list.reversed parts)) + (list.in_reverse parts)) _ new_StringBuilder _ (list.each' ! (function.constant compose_part!) parts)] diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/extension/translation/jvm/host.lux b/stdlib/source/library/lux/compiler/language/lux/phase/extension/translation/jvm/host.lux index 31197c36f..b6cba4f2d 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/extension/translation/jvm/host.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/extension/translation/jvm/host.lux @@ -1065,7 +1065,7 @@ (all _.composite (_.aload (++ register)) then!)))) - list.reversed + list.in_reverse (list#mix _.composite (_#pure []))) store_captured! (|> env list.size @@ -1095,7 +1095,7 @@ _.dup (|> inputsTI (list#each product.right) - list.reversed + list.in_reverse (list#mix _.composite (_#pure []))) (list.complete _.monad captureG+) (_.invokespecial class "" (anonymous_init_method env inputsTI)))))) diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/extension/translation/lua/common.lux b/stdlib/source/library/lux/compiler/language/lux/phase/extension/translation/lua/common.lux index 2169a84f4..0a42e3f80 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/extension/translation/lua/common.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/extension/translation/lua/common.lux @@ -160,7 +160,7 @@ [char {synthesis.#Pop}]) (view.of list.stack tail))}) {synthesis.#Then branch}})) - list.reversed + list.in_reverse (list#mix (function (_ pre post) {synthesis.#Alt pre post}) {synthesis.#Then else}) diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/library/lux/compiler/language/lux/phase/synthesis/variable.lux index 7b55d1c73..14a95d320 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/synthesis/variable.lux @@ -315,7 +315,7 @@ (list#each product.left))]] (pure [(list#mix dictionary.lacks redundancy (set.as_list bindings)) (|> redundants - (list.sorted n.>) + (list.in_order n.>) (list#mix (..remove_local_from_path ..remove_local) {/.#Seq pre post}))])) {/.#Then then} diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/synthesis/when.lux b/stdlib/source/library/lux/compiler/language/lux/phase/synthesis/when.lux index b454a8c45..43c915483 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/synthesis/when.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/synthesis/when.lux @@ -114,7 +114,7 @@ []) nextC)))) thenC - (list.reversed (list.enumeration tuple)))) + (list.in_reverse (list.enumeration tuple)))) {@type.#List_Pattern it} (let [size (list.size it) @@ -135,7 +135,7 @@ []) nextC)))) thenC - (list.reversed (list.enumeration it))) + (list.in_reverse (list.enumeration it))) (phase#each (|>> {/.#Seq {/.#List size}})))) )) diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/translation/c++/statement/loop.lux b/stdlib/source/library/lux/compiler/language/lux/phase/translation/c++/statement/loop.lux index 7a81240c1..d03b4ded8 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/translation/c++/statement/loop.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/translation/c++/statement/loop.lux @@ -70,7 +70,7 @@ (if initial? (_.variable variable runtime.value_type value) (_.; (_.:= variable value))))))) - list.reversed + list.in_reverse (list#mix _.then body) (_.then (_.constant_array $iteration_parameters runtime.value_type diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/translation/c++/when.lux b/stdlib/source/library/lux/compiler/language/lux/phase/translation/c++/when.lux index 1ca1c7ec0..b27887505 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/translation/c++/when.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/translation/c++/when.lux @@ -66,7 +66,7 @@ {.#Some runtime.value_type} (list#mix _.then (_.return body) - (list.reversed bindings)) + (list.in_reverse bindings)) ))))) ... https://en.wikipedia.org/wiki/Comma_operator diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/translation/js/loop.lux b/stdlib/source/library/lux/compiler/language/lux/phase/translation/js/loop.lux index 62f1c3954..c189ee6d3 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/translation/js/loop.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/translation/js/loop.lux @@ -60,7 +60,7 @@ (if initial? (_.define variable (_.at (_.i32 (.integer register)) $iteration)) (_.; (_.set variable (_.at (_.i32 (.integer register)) $iteration))))))) - list.reversed + list.in_reverse (list#mix _.then body) (_.then (_.define $iteration (_.array bindings)))))) diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/translation/js/when.lux b/stdlib/source/library/lux/compiler/language/lux/phase/translation/js/when.lux index 43cbe3ec1..a4fee76ed 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/translation/js/when.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/translation/js/when.lux @@ -76,12 +76,12 @@ (list#composite (list [head_binding head_value]) tail)) body (next archive body)] - ... (pure (list#mix _., body (list.reversed bindings))) + ... (pure (list#mix _., body (list.in_reverse bindings))) (pure (<| (_.of (list)) (_.closure (list)) (list#mix _.then (_.return body) - (list.reversed bindings)))) + (list.in_reverse bindings)))) )) (the .public (let! statement expression archive [register valueS bodyS]) @@ -307,7 +307,7 @@ (list#mix (function (_ [when then] else) (_.if when then else)) ..fail_pm! - (list.reversed clauses))))) + (list.in_reverse clauses))))) (,, (template.with [ ] [{ [head tail]} @@ -316,7 +316,7 @@ (by ! each (|>> [(list ( match))]) (again then))) (list#composite (list head) tail))] (pure (_.switch ..peek_cursor - (list.reversed cases) + (list.in_reverse cases) {.#Some ..fail_pm!})))] [[synthesis.#F64_Fork //primitive.f64] @@ -430,7 +430,7 @@ clauses) else (statement expression archive else)] (pure (_.switch input - (list.reversed clauses) + (list.in_reverse clauses) {.#Some else})))) (the .public (,expression statement expression archive) @@ -462,7 +462,7 @@ then else)) else - (list.reversed clauses)))))) + (list.in_reverse clauses)))))) (the .public (,expression expression archive [input clauses else]) (Expression [synthesis.Term (List [,type synthesis.Term]) synthesis.Term]) @@ -482,7 +482,7 @@ then else)) else - (list.reversed clauses))))))] + (list.in_reverse clauses))))))] [[when_i64 when_i64! I64 //primitive.i64]] ) diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/translation/jvm/loop.lux b/stdlib/source/library/lux/compiler/language/lux/phase/translation/jvm/loop.lux index 1a88ca8f0..2b3c1c66b 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/translation/jvm/loop.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/translation/jvm/loop.lux @@ -70,7 +70,7 @@ (list#each product.left) (list.complete _.monad)) (|> updatesG - list.reversed + list.in_reverse (list#each product.right) (list.complete _.monad)) (_.goto @begin))))) @@ -90,7 +90,7 @@ (list#each product.left) (list.complete _.monad)) (|> initializationG - list.reversed + list.in_reverse (list#each product.right) (list.complete _.monad)) (_.set_label @begin) diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/translation/jvm/when.lux b/stdlib/source/library/lux/compiler/language/lux/phase/translation/jvm/when.lux index 636f2d4f0..eb78d9ea6 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/translation/jvm/when.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/translation/jvm/when.lux @@ -147,7 +147,7 @@ (all _.composite (_.goto @else)) - (list.reversed (list#composite (list head) tail)))] + (list.in_reverse (list#composite (list head) tail)))] (pure (all _.composite ..peek @@ -414,7 +414,7 @@ else (<| (_.when_acknowledged @end) (_.set_label @end))) - (list.reversed cases)))))))] + (list.in_reverse cases)))))))] [[when_i64 I64 (//value.primitive type.long) //primitive.i64' _.dup2 _.pop2 _.lcmp _.ifne] [when_f64 F64 (//value.primitive type.double) //primitive.f64' _.dup2 _.pop2 _.dcmpl _.ifne] diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/translation/lua/when.lux b/stdlib/source/library/lux/compiler/language/lux/phase/translation/lua/when.lux index 755d83898..ecf91ad09 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/translation/lua/when.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/translation/lua/when.lux @@ -85,7 +85,7 @@ (_.closure (list)) (list#mix _.then (_.return body) - (list.reversed bindings)))))) + (list.in_reverse bindings)))))) (the .public (let! statement next archive [register valueS bodyS]) (Statement synthesis.Let) @@ -246,7 +246,7 @@ (list#mix (function (_ [when then!] else!) (_.if when then! else!)) ..fail! - (list.reversed clauses)))))] + (list.in_reverse clauses)))))] [[synthesis.#I64_Fork //primitive.i64] [synthesis.#F64_Fork //primitive.f64] @@ -396,7 +396,7 @@ then else)) else - (list.reversed clauses)))))) + (list.in_reverse clauses)))))) (the .public (,expression statement expression archive) (-> Phase! diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/translation/php/loop.lux b/stdlib/source/library/lux/compiler/language/lux/phase/translation/php/loop.lux index d5a9bdb19..417d3e4a7 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/translation/php/loop.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/translation/php/loop.lux @@ -51,7 +51,7 @@ (list#each (function (_ [register value]) (let [variable (//when.register (n.+ offset register))] (_.set! variable value)))) - list.reversed + list.in_reverse (list#mix _.then body))) (the .public (scope! statement expression archive [start initsS+ bodyS]) diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/translation/python/when.lux b/stdlib/source/library/lux/compiler/language/lux/phase/translation/python/when.lux index a31d2d480..3910d0a58 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/translation/python/when.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/translation/python/when.lux @@ -252,7 +252,7 @@ then else)) ..fail_pm! - (list.reversed clauses)))))] + (list.in_reverse clauses)))))] [[synthesis.#I64_Fork //primitive.i64] [synthesis.#F64_Fork //primitive.f64] @@ -432,7 +432,7 @@ then else)) else - (list.reversed clauses)))))) + (list.in_reverse clauses)))))) (the .public (,expression expression archive [input clauses else]) (Expression [synthesis.Term (List [,type synthesis.Term]) synthesis.Term]) @@ -449,7 +449,7 @@ then else)) else - (list.reversed clauses)) + (list.in_reverse clauses)) (_.lambda (list 'input)) (_.of (list input))))))] diff --git a/stdlib/source/library/lux/compiler/language/lux/phase/translation/ruby/when.lux b/stdlib/source/library/lux/compiler/language/lux/phase/translation/ruby/when.lux index 501e01522..0d075dcba 100644 --- a/stdlib/source/library/lux/compiler/language/lux/phase/translation/ruby/when.lux +++ b/stdlib/source/library/lux/compiler/language/lux/phase/translation/ruby/when.lux @@ -100,7 +100,7 @@ [(list) (list#mix _.then (_.return body) - (list.reversed bindings))])) + (list.in_reverse bindings))])) )) (the .public (let! statement expression archive [register valueS bodyS]) @@ -268,7 +268,7 @@ (again then))) (list#composite (list head) tail))] (pure (_.case ..peek - (list.reversed clauses) + (list.in_reverse clauses) ..fail!)))] [... [synthesis.#I64_Fork //primitive.i64] @@ -289,7 +289,7 @@ then else)) ..fail! - (list.reversed clauses))))) + (list.in_reverse clauses))))) (,, (template.with [ ] [( idx) @@ -428,7 +428,7 @@ (by ! each (|>> [(,injection when)]) (statement expression archive then))) clauses) else (statement expression archive else)] - (pure (_.case input (list.reversed clauses) else)))) + (pure (_.case input (list.in_reverse clauses) else)))) (the .public (,expression statement expression archive) (-> Phase! @@ -460,7 +460,7 @@ then else)) else - (list.reversed clauses)))))) + (list.in_reverse clauses)))))) (the .public (when_i64 statement expression archive) (-> Phase! diff --git a/stdlib/source/library/lux/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/compiler/language/lux/syntax.lux index 2adbbc7ec..a200530a6 100644 --- a/stdlib/source/library/lux/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/compiler/language/lux/syntax.lux @@ -706,7 +706,7 @@ (..failure source' error) (if (same? error) - (..success source' { where (list.reversed (view.of list.stack composite))}) + (..success source' { where (list.in_reverse (view.of list.stack composite))}) (..failure source' error)))))] ... Form and tuple syntax is mostly the same, differing only in the diff --git a/stdlib/source/library/lux/compiler/meta/cache/dependency/module.lux b/stdlib/source/library/lux/compiler/meta/cache/dependency/module.lux index 83762d642..fb7f6056d 100644 --- a/stdlib/source/library/lux/compiler/meta/cache/dependency/module.lux +++ b/stdlib/source/library/lux/compiler/meta/cache/dependency/module.lux @@ -97,7 +97,7 @@ (let [ancestry (..ancestry archive)] (|> ancestry dictionary.keys - (list.sorted (..dependency? ancestry)) + (list.in_order (..dependency? ancestry)) (list.each' try.monad (function (_ module) (monad.let try.monad diff --git a/stdlib/source/library/lux/compiler/meta/io/archive.lux b/stdlib/source/library/lux/compiler/meta/io/archive.lux index 729aeb8d3..0a5392c33 100644 --- a/stdlib/source/library/lux/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/compiler/meta/io/archive.lux @@ -211,27 +211,32 @@ (the (valid_cache customs fs context import contexts [module_name @module]) (-> (List Custom) (file.System Future) Context Import (List //.Context) [descriptor.Module module.ID] - (Future (Try Cache))) + (Future (Try (Maybe Cache)))) (expansion.let [ (these module_name @module module registry)] - (monad.let [! (try.with future.monad)] + (monad.let [! future.monad] [data (is (Future (Try Binary)) - (cache/module.cache fs @module)) - [module registry] (future#pure (.value (..cache_of customs) data))] - (if (text.= descriptor.runtime module_name) - (pure [true ]) - (monad.let ! - [input (//context.read fs ..pseudo_module import contexts (its context.#host_module_extension context) module_name)] - (pure [(cache/purge.valid? (its module.#descriptor module) input) ])))))) + (cache/module.cache fs @module))] + (when data + {try.#Failure _} + (pure {try.#Success {.#None}}) + + {try.#Success data} + (monad.let [! (try.with !)] + [[module registry] (future#pure (.value (..cache_of customs) data))] + (if (text.= descriptor.runtime module_name) + (pure {.#Some [true ]}) + (monad.let ! + [input (//context.read fs ..pseudo_module import contexts (its context.#host_module_extension context) module_name)] + (pure {.#Some [(cache/purge.valid? (its module.#descriptor module) input) ]})))))))) (the (pre_loaded_caches customs fs context import contexts archive) (-> (List Custom) (file.System Future) Context Import (List //.Context) Archive (Future (Try (List Cache)))) - (monad.let [! (try.with future.monad)] - [... TODO: Stop needing to wrap this expression in an unnecessary "do" expression. - it (|> archive - archive.reservations - (list.each' ! (..valid_cache customs fs context import contexts)))] - (pure it))) + (let [! (try.with future.monad)] + (|> archive + archive.reservations + (list.each' ! (..valid_cache customs fs context import contexts)) + (by ! each (list.all (|>>)))))) (the (load_order archive pre_loaded_caches) (-> Archive (List Cache) diff --git a/stdlib/source/library/lux/compiler/meta/packager/ruby.lux b/stdlib/source/library/lux/compiler/meta/packager/ruby.lux index 6ee89934a..dc8844eab 100644 --- a/stdlib/source/library/lux/compiler/meta/packager/ruby.lux +++ b/stdlib/source/library/lux/compiler/meta/packager/ruby.lux @@ -134,7 +134,7 @@ .let [included_modules (..included_modules entries) imports (|> order (list.only (|>> product.right product.left (set.member? included_modules))) - list.reversed + list.in_reverse (list#each (function (_ [module [module_id entry]]) (let [relative_path (_.do "gsub" (list (_.string main_file) (_.string (..module_file module_id))) diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux index 7222bfd2d..236f7aa42 100644 --- a/stdlib/source/library/lux/control/pipe.lux +++ b/stdlib/source/library/lux/control/pipe.lux @@ -42,14 +42,14 @@ (pure (list (` (.let [(, binding) (, prev)] (, body))))))) -(the _reversed_ +(the _in_reverse_ (Projection Any) (function (_ [so_far tape]) - {try.#Success [[so_far (list.reversed tape)] + {try.#Success [[so_far (list.in_reverse tape)] []]})) (the .public if - (syntax.macro (_ [_ _reversed_ + (syntax.macro (_ [_ _in_reverse_ prev ?list.any else ..body branches (<>.some (all <>.and @@ -58,7 +58,7 @@ (with_names ['temp] (pure (list (` (.let [(, 'temp) (, prev)] (.if (,* (monad.let list.monad - [[then test] (list.reversed branches)] + [[then test] (list.in_reverse branches)] (list (` (|> (, 'temp) (,* test))) (` (|> (, 'temp) (,* then)))))) (|> (, 'temp) @@ -81,10 +81,10 @@ steps (<>.some ..body) prev ?list.any]) (with_names ['temp] - (.when (list.split 1 (list.reversed steps)) + (.when (list.split 1 (list.in_reverse steps)) [(list last_step) prev_steps] (.let [step_bindings (monad.let list.monad - [step (list.reversed prev_steps)] + [step (list.in_reverse prev_steps)] (list 'temp (` (|> (, 'temp) (,* step)))))] (pure (list (` (monad.let (, monad) [.let [(, 'temp) (, prev)] diff --git a/stdlib/source/library/lux/control/scope/dynamic.lux b/stdlib/source/library/lux/control/scope/dynamic.lux index 5bad9faf1..11e74fc70 100644 --- a/stdlib/source/library/lux/control/scope/dynamic.lux +++ b/stdlib/source/library/lux/control/scope/dynamic.lux @@ -92,5 +92,5 @@ (, 'name) (, term))))) term - (list.reversed bindings))))))) + (list.in_reverse bindings))))))) ) diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index 55a222f4c..98427343c 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -180,7 +180,7 @@ ..of)) ..empty)))) -(the .public (reversed it) +(the .public (in_reverse it) (for_any (_ it) (Change (List it))) (..of (let [size (.list_size# it) @@ -560,7 +560,7 @@ (for_any (_ it) (-> (List it) (Stack it))) - (|>> ..reversed + (|>> ..in_reverse (..mix (function (_ head tail) {.#Top head tail}) {.#Empty}))) @@ -607,12 +607,12 @@ (-> (-> it it Bit) Natural Natural (Change (.Array it)))))) -(the (in_order in_range < first last it) +(the (in_order' in_range < first last it) (for_any (_ it) (Change (Order it))) - (loop (in_order [less first - more last - it it]) + (loop (in_order' [less first + more last + it it]) (if (n.< more less) (let [next (++ less) @less (/.item less it) @@ -621,11 +621,11 @@ (|> it (/.has! less @next) (/.has! next @less) - (in_order next more)) + (in_order' next more)) (|> it (/.has! next (/.item more it)) (/.has! more @next) - (in_order less (-- more))))) + (in_order' less (-- more))))) (if (n.= first less) (in_range < (++ first) last it) @@ -648,9 +648,9 @@ (/.has! first @last) (/.has! last @first)) it)) - _ (in_order in_range < first last it))) + _ (in_order' in_range < first last it))) -(the .public (sorted < it) +(the .public (in_order < it) (for_any (_ it) (-> (-> it it Bit) (Change (List it)))) diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux index 63ef4b8c7..705f02816 100644 --- a/stdlib/source/library/lux/data/collection/queue.lux +++ b/stdlib/source/library/lux/data/collection/queue.lux @@ -43,7 +43,7 @@ (List it))) (let [(open "/[0]") queue] (list#composite (view.of list.stack /#front) - (list.reversed (view.of list.stack /#rear))))) + (list.in_reverse (view.of list.stack /#rear))))) (the .public list (for_any (_ it) @@ -94,7 +94,7 @@ ... Front has dried up... (stack _) (|> queue - (has #front (stack.reversed (its #rear queue))) + (has #front (stack.in_reverse (its #rear queue))) (has #rear (stack))) ... Consume front! diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index bdb6fa0e4..5d894d295 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -533,11 +533,11 @@ (open "[0]") ..monoid] (mix (function (_ post pre) (composite pre post)) identity))))) -(the .public reversed +(the .public in_reverse (for_any (_ it) (Change (Sequence it))) (|>> ..as_list - list.reversed + list.in_reverse ..of_list)) (template.with [ ,for_array ] diff --git a/stdlib/source/library/lux/data/collection/stack.lux b/stdlib/source/library/lux/data/collection/stack.lux index ec1055afa..963030017 100644 --- a/stdlib/source/library/lux/data/collection/stack.lux +++ b/stdlib/source/library/lux/data/collection/stack.lux @@ -42,7 +42,7 @@ end init)))) -(the .public (reversed it) +(the .public (in_reverse it) (for_any (_ it) (-> (Stack it) (Stack it))) @@ -68,7 +68,7 @@ (the .public partial (macro (_ tokens state) - (.when (reversed (list#as_stack tokens)) + (.when (in_reverse (list#as_stack tokens)) {.#Top pop tops} {.#Right [state (list (..mix (function (_ top pop) (` {.#Top (, top) (, pop)})) @@ -96,7 +96,7 @@ (-> (Predicate it) (Stack it) [(Stack it) (Stack it)])) (let [[ys' xs'] (split_when' predicate {.#Empty} xs)] - [(reversed ys') xs'])) + [(in_reverse ys') xs'])) (the .public (one check xs) (for_any (_ input output) @@ -203,7 +203,7 @@ (mix (function (_ top pop) {.#Top top pop}) right - (reversed left))))) + (in_reverse left))))) (the .public functor (Functor Stack) @@ -213,7 +213,7 @@ (mix (function (_ top pop) {.#Top (f top) pop}) (stack) - (reversed it))))) + (in_reverse it))))) (the .public (empty? xs) (for_any (_ it) diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux index 6bcf6a24d..8dc587b53 100644 --- a/stdlib/source/library/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux @@ -137,7 +137,7 @@ [family (its #family zipper)] (pure (let [(open "_[0]") family] (has [#node //.#children] - (list#composite (list.reversed (view.of list.stack _#lefts)) + (list#composite (list.in_reverse (view.of list.stack _#lefts)) (view.of list.stack {.#Top (its #node zipper) _#rights})) _#parent)))))) @@ -173,7 +173,7 @@ (Try (Zipper it)))) (when (its #family zipper) {.#Some family} - (when (stack.reversed (its family)) + (when (stack.in_reverse (its family)) {.#Top last prevs} {try.#Success (let [move (is (for_any (_ it) diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index 946e0c766..ac8571978 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -355,7 +355,7 @@ (-> (List Text) Text) (with ..monoid - (|>> list.reversed + (|>> list.in_reverse (list#mix composite identity)))) (the .public (interposed delimiter texts) diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux index 767cb1465..b92f7fd28 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -356,7 +356,7 @@ (` (monad.let <>.monad [.let [(, 'total) ""] (,* steps)] - ((, (' pure)) [(, 'total) (,* (list.reversed (view.of list.stack names)))])))]) + ((, (' pure)) [(, 'total) (,* (list.in_reverse (view.of list.stack names)))])))]) )) (the (alternative lexer) diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index 662be334c..4f9538fa0 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -617,7 +617,7 @@ list#conjoint ... 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 + list.in_reverse (dictionary.of_list text.hash))] targets (is (Meta (List Target)) (when targets diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux index c3fcb0ceb..aa67de341 100644 --- a/stdlib/source/library/lux/documentation.lux +++ b/stdlib/source/library/lux/documentation.lux @@ -685,7 +685,7 @@ (the definitions_documentation (-> (List Definition) (Markdown Block)) - (|>> (list.sorted ..definition#<) + (|>> (list.in_order ..definition#<) (list#each (its #documentation)) (list#mix md.then md.empty))) @@ -733,7 +733,7 @@ (the listing (-> (List Text) (Markdown Block)) - (|>> (list.sorted text#<) + (|>> (list.in_order text#<) (list#each (function (_ definition) [(md.snippet definition) {.#None}])) @@ -748,7 +748,7 @@ (md.heading/3 (md.text heading)) (|> (set.as_list it) (list.only (|>> (text.= descriptor.runtime) not)) - (list.sorted text#<) + (list.in_order text#<) (list#each (function (_ it) [(md.link (md.text it) (text "#" it)) {.#None}])) @@ -833,7 +833,7 @@ (md.heading/5 (let [it (its #module module)] (md.link (md.text it) (text "#" it)))) (|> defs - (list.sorted ..definition#<) + (list.in_order ..definition#<) (list#each (function (_ it) (let [[module proper] (its #global it)] [(md.link (md.text proper) (..link (its #global it))) @@ -871,9 +871,9 @@ ..dependers) it (|> with_definitions dictionary.values - (list.sorted (function (_ left right) - (text#< (its #module (product.left right)) - (its #module (product.left left))))))] + (list.in_order (function (_ left right) + (text#< (its #module (product.left right)) + (its #module (product.left left))))))] (md.markdown (all md.then (index it) diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux index b01db57a0..30d670ecf 100644 --- a/stdlib/source/library/lux/ffi.lux +++ b/stdlib/source/library/lux/ffi.lux @@ -284,7 +284,7 @@ [state (is (List [Text js.Expression]) (list))] (pairs it))] - (pure [state (js.object (list.reversed output))]))) + (pure [state (js.object (list.in_reverse output))]))) (analysis object|analysis [phase archive state] @@ -306,7 +306,7 @@ (list))] it)] (pure [state (extension_analysis (name ..object|translation) - (list.reversed output))]))) + (list.in_reverse output))]))) (the .public object (syntax.macro (_ [it (<>.some ?list.any)]) diff --git a/stdlib/source/library/lux/function/poly/morph/subject.lux b/stdlib/source/library/lux/function/poly/morph/subject.lux index 141cf92a2..85bdaf135 100644 --- a/stdlib/source/library/lux/function/poly/morph/subject.lux +++ b/stdlib/source/library/lux/function/poly/morph/subject.lux @@ -101,7 +101,7 @@ (, 'name) (, term))))) term - (list.reversed bindings))))))) + (list.in_reverse bindings))))))) (.the .public the (syntax.macro (_ [[policy name input] (export.with (?code.form (?.and ?code.local ?list.any))) diff --git a/stdlib/source/library/lux/function/variadic.lux b/stdlib/source/library/lux/function/variadic.lux index b786dc1e8..469a71053 100644 --- a/stdlib/source/library/lux/function/variadic.lux +++ b/stdlib/source/library/lux/function/variadic.lux @@ -52,9 +52,9 @@ (if (n.= (list.size parameters) (set.size (set.of_list text.hash parameters))) (with_names ['function] - (when (list.split 1 (list.reversed parameters)) + (when (list.split 1 (list.in_reverse parameters)) [(list &rest) mandatory] - (let [mandatory (list#each code.local (list.reversed mandatory)) + (let [mandatory (list#each code.local (list.in_reverse mandatory)) &rest (code.local &rest)] (pure (list (` (.the (, exported?) ((, 'function) (,* mandatory) (, &rest)) (, type) diff --git a/stdlib/source/library/lux/macro/pattern.lux b/stdlib/source/library/lux/macro/pattern.lux index 486b41716..d7ae25628 100644 --- a/stdlib/source/library/lux/macro/pattern.lux +++ b/stdlib/source/library/lux/macro/pattern.lux @@ -102,7 +102,7 @@ (-> Code (List Code) Code Code) (.|> levels - list.reversed + list.in_reverse (list#each ..level) (list.mix (function (_ [calculation pattern] success) (` (when (, calculation) diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux index 19c19caea..38542037d 100644 --- a/stdlib/source/library/lux/math.lux +++ b/stdlib/source/library/lux/math.lux @@ -140,7 +140,7 @@ operands) _ (typeA.inference :it:) :it: (typeA.check (check.identity (list) $it))] - (when (view.as list.stack (list.reversed operands)) + (when (view.as list.stack (list.in_reverse operands)) (stack single) (pure single) diff --git a/stdlib/source/library/lux/math/number/64.lux b/stdlib/source/library/lux/math/number/64.lux index bf81c978d..26eeb0f4b 100644 --- a/stdlib/source/library/lux/math/number/64.lux +++ b/stdlib/source/library/lux/math/number/64.lux @@ -199,7 +199,7 @@ [[disjunction ..false ..or] [conjunction ..true ..and]]) -(the .public reversed +(the .public in_reverse (for_any (_ it) (Change (I64 it))) (let [swapper (is (-> Natural diff --git a/stdlib/source/library/lux/math/number/64/revolution.lux b/stdlib/source/library/lux/math/number/64/revolution.lux index ebb33ac35..f7ce7f2fe 100644 --- a/stdlib/source/library/lux/math/number/64/revolution.lux +++ b/stdlib/source/library/lux/math/number/64/revolution.lux @@ -106,10 +106,10 @@ (the .public (x param subject) (-> Revolution Revolution Revolution) - (|> (natural.x (.natural (/64.reversed param)) - (.natural (/64.reversed subject))) + (|> (natural.x (.natural (/64.in_reverse param)) + (.natural (/64.in_reverse subject))) (/64.<< 1) - /64.reversed + /64.in_reverse .revolution)) (the even_one (/64.right_rotated 1 1)) diff --git a/stdlib/source/library/lux/math/number/big/natural.lux b/stdlib/source/library/lux/math/number/big/natural.lux index cf6a4d5f4..6fdb94f86 100644 --- a/stdlib/source/library/lux/math/number/big/natural.lux +++ b/stdlib/source/library/lux/math/number/big/natural.lux @@ -350,7 +350,7 @@ (the as_text (-> It Text) - (|>> list.reversed + (|>> list.in_reverse (list.as_text (by //.base_10 as)))) (the .public (/ scale it) @@ -601,7 +601,7 @@ else (|> it (list#each (|>> (by ,// as) ,padding)) - list.reversed + list.in_reverse (text.interposed "") ..with_no_padding))) diff --git a/stdlib/source/library/lux/meta/binding.lux b/stdlib/source/library/lux/meta/binding.lux index d7069b391..c4fc136e8 100644 --- a/stdlib/source/library/lux/meta/binding.lux +++ b/stdlib/source/library/lux/meta/binding.lux @@ -84,7 +84,7 @@ (-> (List module.Name) Text) (|>> ..without_lux_runtime - (list.sorted text.<) + (list.in_order text.<) (text.interposed ..listing_delimiter))) (the (not_known lux name) @@ -112,7 +112,7 @@ {.#Some (name#as [module_name def_name])} {.#None})))))) list#conjoint - (list.sorted text.<) + (list.in_order text.<) (text.interposed ..listing_delimiter)) imports (|> this_module (its .#imports) @@ -120,7 +120,7 @@ aliases (|> this_module (its .#module_aliases) (list#each (function (_ [alias real]) (text alias " => " real))) - (list.sorted text.<) + (list.in_order text.<) (text.interposed ..listing_delimiter))] (text "" " All known modules: " every_known \n " Aliases: " aliases diff --git a/stdlib/source/library/lux/meta/binding/global.lux b/stdlib/source/library/lux/meta/binding/global.lux index aded5323e..55f6bf4ac 100644 --- a/stdlib/source/library/lux/meta/binding/global.lux +++ b/stdlib/source/library/lux/meta/binding/global.lux @@ -78,7 +78,7 @@ (the .public with (syntax.macro (_ [replacements (?code.tuple (?.some (?.and ?code.global ?list.any))) declarations (?.some ?list.any)]) - (when (list.reversed replacements) + (when (list.in_reverse replacements) (list) (pure declarations) diff --git a/stdlib/source/library/lux/music/chord.lux b/stdlib/source/library/lux/music/chord.lux index ab1a9183b..2ba39da51 100644 --- a/stdlib/source/library/lux/music/chord.lux +++ b/stdlib/source/library/lux/music/chord.lux @@ -171,7 +171,7 @@ Chord) (|> it sequence.as_list - (list.sorted natural.<) + (list.in_order natural.<) (list#mix (function (_ pitch [chord first? offset]) [(if first? chord diff --git a/stdlib/source/library/lux/music/mode.lux b/stdlib/source/library/lux/music/mode.lux index 8c1773b89..3767d6154 100644 --- a/stdlib/source/library/lux/music/mode.lux +++ b/stdlib/source/library/lux/music/mode.lux @@ -34,11 +34,11 @@ (the .public (previous it) Mode - (let [it (list.reversed (scale.intervals it))] + (let [it (list.in_reverse (scale.intervals it))] (|> (all list#composite (list.after 1 it) (list.first 1 it)) - list.reversed + list.in_reverse scale.scale try.trusted))) diff --git a/stdlib/source/library/lux/proof.lux b/stdlib/source/library/lux/proof.lux index d9a4af005..a6156c3c5 100644 --- a/stdlib/source/library/lux/proof.lux +++ b/stdlib/source/library/lux/proof.lux @@ -224,7 +224,7 @@ (scope.with_local [variable type_of_variable]) it)) (analysis archive body) - (list.reversed each_variable)))) + (list.in_reverse each_variable)))) (the current_module (name.module (name .._))) diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index 8656c557e..f4aac1b2f 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -74,10 +74,10 @@ (every .public Label Natural) -(every .public Resolver +(every Resolver (Dictionary Label [Stack (Maybe Address)])) -(every .public Tracker +(every Tracker (Record [#program_counter Address #next Label @@ -91,7 +91,7 @@ #known (dictionary.empty n.hash) #line_number_table line_number_table.empty]) -(every .public Relative +(every Relative (-> Resolver (Try [(Sequence Exception) Instruction]))) @@ -902,8 +902,8 @@ (exception.except ..unknown_label [label]))) (the (acknowledge_label stack label tracker) - (-> Stack Label Tracker - Tracker) + (-> Stack Label + (Change Tracker)) (when (dictionary.value label (its #known tracker)) {try.#Success _} tracker @@ -1057,10 +1057,10 @@ (the .public (lookupswitch default cases) (-> Label (List [Integer Label]) (Bytecode Any)) - (let [cases (list.sorted (function (_ [left _] [right _]) - (i.< (/32.as left) - (/32.as right))) - cases) + (let [cases (list.in_order (function (_ [left _] [right _]) + (i.< (/32.as left) + (/32.as right))) + cases) [estimator bytecode] /.lookupswitch] (function (_ [pool environment tracker]) (<| (try|do environment' (|> environment diff --git a/stdlib/source/library/lux/test/property.lux b/stdlib/source/library/lux/test/property.lux index 71955180d..1facb0028 100644 --- a/stdlib/source/library/lux/test/property.lux +++ b/stdlib/source/library/lux/test/property.lux @@ -166,7 +166,7 @@ (its tally.#actual tally)) report (is (-> Coverage Text) (|>> set.as_list - (list.sorted (by name.order <)) + (list.in_order (by name.order <)) (exception.listing name.as_text))) expected_coverage (set.size (its tally.#expected tally)) unexpected_coverage (set.size unexpected) diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux index ff6a79918..33d4c7b9a 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -97,7 +97,7 @@ _ {.#None})) it)] - [abstraction (list.reversed parameters)])) + [abstraction (list.in_reverse parameters)])) (the sum_type (.type_name# "sum")) (the product_type (.type_name# "product")) @@ -144,7 +144,7 @@ (text (|> ( type) (list#each (as_text' name_format)) - list.reversed + list.in_reverse (list.interposed " ") (list#mix text#composite "")) )] @@ -157,7 +157,7 @@ (text "(-> " (|> ins (list#each (as_text' name_format)) - list.reversed + list.in_reverse (list.interposed " ") (list#mix text#composite "")) " " (as_text' name_format out) ")")) @@ -190,7 +190,7 @@ {.#Reification param fun} (.let [[type_func type_args] (flat_reification type)] - (text "(" (as_text' name_format type_func) " " (|> type_args (list#each (as_text' name_format)) list.reversed (list.interposed " ") (list#mix text#composite "")) ")")) + (text "(" (as_text' name_format type_func) " " (|> type_args (list#each (as_text' name_format)) list.in_reverse (list.interposed " ") (list#mix text#composite "")) ")")) (,, (with_template [ ] [{.#Quantification env body} @@ -403,7 +403,7 @@ (-> (List Type) Type) (when (|> types - list.reversed + list.in_reverse (view.as list.stack)) (.stack) @@ -426,7 +426,7 @@ (list#mix (.function (_ cause effect) (..Function cause effect)) output - (list.reversed inputs))) + (list.in_reverse inputs))) (the .public (reification parameters abstraction) (-> (List Type) diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index 101d16062..a53feeed8 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/type/check.lux @@ -572,7 +572,7 @@ (function (_ [super sub] hypotheses) (complete [hypotheses super sub])) hypotheses - (list.reversed (list.zipped_2 super_parameters sub_parameters))) + (list.in_reverse (list.zipped_2 super_parameters sub_parameters))) ..silent_failure!))) (`` (the when_reification diff --git a/stdlib/source/library/lux/type/environment.lux b/stdlib/source/library/lux/type/environment.lux index e4c642ac1..8b06e7f2f 100644 --- a/stdlib/source/library/lux/type/environment.lux +++ b/stdlib/source/library/lux/type/environment.lux @@ -50,16 +50,6 @@ (template.macro (_ ,type) [{.#Some ,type}])) -(template.with [,name] - [(exception.the .public (,name [it]) - (Exception //.Variable) - (exception.report - (list ["Variable" (natural#as it)])))] - - [[not_known] - [not_bound] - [already_exists]]) - (every .public Environment (List Binding)) @@ -104,6 +94,11 @@ bound bound))) +(exception.the .public (not_bound [it]) + (Exception //.Variable) + (exception.report + (list ["Variable" (natural#as it)]))) + (the .public (type variable it) (-> //.Variable (Query Type)) diff --git a/stdlib/source/library/lux/type/row.lux b/stdlib/source/library/lux/type/row.lux index 44f3b7e64..b1a31c08d 100644 --- a/stdlib/source/library/lux/type/row.lux +++ b/stdlib/source/library/lux/type/row.lux @@ -224,5 +224,5 @@ (` []) (|> (dictionary.size levels) list.indices - list.reversed))] + list.in_reverse))] (pure (list row))))) diff --git a/stdlib/source/projection/lux/type.lux b/stdlib/source/projection/lux/type.lux index 7e5d5eb02..f53b2086c 100644 --- a/stdlib/source/projection/lux/type.lux +++ b/stdlib/source/projection/lux/type.lux @@ -238,7 +238,7 @@ 'partial_var (partial_var current_arg) partialC (` ((, funcL) (,* (|> (list.indices num_args) (list#each partial_var) - list.reversed))))] + list.in_reverse))))] (again (++ current_arg) (|> env' (dictionary.has partial_argument [[(recursion_parameter) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 8c10e8ba0..fa60c5657 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -406,13 +406,11 @@ example_natural random.natural example_integer random.integer] (all _.and - (_.for [/.Code - /.#Bit /.#Natural /.#Integer /.#Revolution /.#Decimal /.#Text /.#Name /.#Form /.#Variant /.#Tuple] - (all _.and - ..for_code/' - ..for_code/` - ..for_code/`' - )) + (all _.and + ..for_code/' + ..for_code/` + ..for_code/`' + ) (_.coverage [/., /.but] (expansion.let [ (code.natural example_natural)] (and (not (code.= @@ -610,64 +608,61 @@ .let [existential_type (by ! each (|>> {/.#Variable .special}) random.natural)] expected/0 existential_type expected/1 existential_type] - (<| (_.for [/.Type - /.#Nominal /.#Variable /.#Reification /.#Named - /.#Parameter /.#Quantification]) - (all _.and - (_.coverage [/.is] - (|> expected - (/.is Any) - (same? (/.is Any expected)))) - (_.coverage [/.as] - (|> expected - (/.as (-> Any /.Natural)) - (same? expected))) - (_.coverage [/.as_expected] - (|> expected - (/.is Any) - /.as_expected - (/.is /.Natural) - (same? expected))) - (_.coverage [/.type_of] - (same? /.Natural (/.type_of expected))) - (_.coverage [/.Nominal] - (when (/.Nominal "foo" [[1b expected/0] - [1b expected/1]]) - {.#Nominal "foo" (list [1b actual/0] [1b actual/1])} - (and (same? expected/0 actual/0) - (same? expected/1 actual/1)) - - _ - false)) - (_.coverage [/.every] - (exec - (is /.Type ..for_type/variant) - (is /.Type ..for_type/record) - (is /.Type ..for_type/all) - true)) - (_.coverage [/.Variant] - (exec - (is for_type/variant - {#Case/1 expected_left}) - true)) - (_.coverage [/.Record] - (exec - (is for_type/record - [#slot/0 (n.= expected_left expected_right) - #slot/1 (.revolution expected_right)]) - true)) - (_.coverage [/.type] - (and (type.= expected/0 - (/.type expected/0)) - (type.= (type.Sum expected/0 expected/1) - (/.type (Or expected/0 expected/1))) - (type.= (type.Product expected/0 expected/1) - (/.type [expected/0 expected/1])) - (type.= (type.Function expected/0 expected/1) - (/.type (-> expected/0 expected/1))) - (type.= {.#Reification expected/1 expected/0} - (/.type (expected/0 expected/1))))) - )))) + (all _.and + (_.coverage [/.is] + (|> expected + (/.is Any) + (same? (/.is Any expected)))) + (_.coverage [/.as] + (|> expected + (/.as (-> Any /.Natural)) + (same? expected))) + (_.coverage [/.as_expected] + (|> expected + (/.is Any) + /.as_expected + (/.is /.Natural) + (same? expected))) + (_.coverage [/.type_of] + (same? /.Natural (/.type_of expected))) + (_.coverage [/.Nominal] + (when (/.Nominal "foo" [[1b expected/0] + [1b expected/1]]) + {.#Nominal "foo" (list [1b actual/0] [1b actual/1])} + (and (same? expected/0 actual/0) + (same? expected/1 actual/1)) + + _ + false)) + (_.coverage [/.every] + (exec + (is /.Type ..for_type/variant) + (is /.Type ..for_type/record) + (is /.Type ..for_type/all) + true)) + (_.coverage [/.Variant] + (exec + (is for_type/variant + {#Case/1 expected_left}) + true)) + (_.coverage [/.Record] + (exec + (is for_type/record + [#slot/0 (n.= expected_left expected_right) + #slot/1 (.revolution expected_right)]) + true)) + (_.coverage [/.type] + (and (type.= expected/0 + (/.type expected/0)) + (type.= (type.Sum expected/0 expected/1) + (/.type (Or expected/0 expected/1))) + (type.= (type.Product expected/0 expected/1) + (/.type [expected/0 expected/1])) + (type.= (type.Function expected/0 expected/1) + (/.type (-> expected/0 expected/1))) + (type.= {.#Reification expected/1 expected/0} + (/.type (expected/0 expected/1))))) + ))) (the for_i64 Test diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux index 398c858b4..bd60f37a6 100644 --- a/stdlib/source/test/lux/abstract/enum.lux +++ b/stdlib/source/test/lux/abstract/enum.lux @@ -42,10 +42,10 @@ (_.coverage [/.range] (let [expected_size (|> end (n.- start) ++) expected_start? (|> range (list.item 0) (try#each (n.= start)) (try.else false)) - expected_end? (|> range list.reversed (list.item 0) (try#each (n.= end)) (try.else false)) + expected_end? (|> range list.in_reverse (list.item 0) (try#each (n.= end)) (try.else false)) can_be_backwards? (by (list.equivalence n.equivalence) = (/.range n.enum start end) - (list.reversed (/.range n.enum end start))) + (list.in_reverse (/.range n.enum end start))) every_element_is_a_successor? (when (view.as list.stack range) {.#Top head tail} (|> (list#mix (function (_ next [verdict prev]) diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index 52ec920d2..dd4293c5c 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -184,6 +184,9 @@ (_.for [/.functor] (contravariantT.spec equivalence n.equivalence /.functor)) + (_.coverage [/.class] + (bit.= (by n.equivalence = leftN rightN) + ((/.class n.equivalence leftN) rightN))) (_.coverage [/.sum] (let [both (/.sum n.equivalence i.equivalence)] (and (bit.= (by both = {.#Left leftN} {.#Left rightN}) diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index 3a6cdaa99..3791993bb 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -172,7 +172,7 @@ (monad.let [! random.monad] [[l m r] (|> (random.set n.hash 3 random.natural) (by ! each (|>> set.as_list - (list.sorted n.<) + (list.in_order n.<) (pipe.when (list b t1 t2) [b t1 t2] @@ -195,7 +195,7 @@ (monad.let [! random.monad] [[b t1 t2] (|> (random.set n.hash 3 random.natural) (by ! each (|>> set.as_list - (list.sorted n.<) + (list.in_order n.<) (pipe.when (list b t1 t2) [b t1 t2] @@ -223,7 +223,7 @@ [some_interval ..interval [x0 x1 x2 x3] (|> (random.set n.hash 4 random.natural) (by ! each (|>> set.as_list - (list.sorted n.<) + (list.in_order n.<) (pipe.when (list x0 x1 x2 x3) [x0 x1 x2 x3] @@ -257,7 +257,7 @@ [some_interval ..interval [x0 x1 x2 x3] (|> (random.set n.hash 4 random.natural) (by ! each (|>> set.as_list - (list.sorted n.<) + (list.in_order n.<) (pipe.when (list x0 x1 x2 x3) [x0 x1 x2 x3] diff --git a/stdlib/source/test/lux/abstract/order.lux b/stdlib/source/test/lux/abstract/order.lux index b576b7fc6..7db9e39e0 100644 --- a/stdlib/source/test/lux/abstract/order.lux +++ b/stdlib/source/test/lux/abstract/order.lux @@ -172,6 +172,10 @@ (all _.and (_.for [/.functor] (contravariantT.spec equivalence n.order /.functor)) + + (_.coverage [/.boundary] + (bit.= (by n.order < left right) + ((/.boundary n.order left) right))) (_.coverage [/.Choice /.minor /.major] (n.< (/.major n.order left right) (/.minor n.order left right))) diff --git a/stdlib/source/test/lux/aspect/case.lux b/stdlib/source/test/lux/aspect/case.lux index 67b493a51..410dfab37 100644 --- a/stdlib/source/test/lux/aspect/case.lux +++ b/stdlib/source/test/lux/aspect/case.lux @@ -54,14 +54,15 @@ (the .public test Test - (monad.let [! random.monad] - [sample random.natural] - (all _.and - (_.coverage [/.when] - (/.when sample - {#Impossible _} - false + (<| (_.covering /._) + (monad.let [! random.monad] + [sample random.natural]) + (all _.and + (_.coverage [/.when] + (/.when sample + {#Impossible _} + false - else - true)) - ))) + else + true)) + ))) diff --git a/stdlib/source/test/lux/compiler/language/lux/analysis/coverage.lux b/stdlib/source/test/lux/compiler/language/lux/analysis/coverage.lux index a4a907598..83806fbfb 100644 --- a/stdlib/source/test/lux/compiler/language/lux/analysis/coverage.lux +++ b/stdlib/source/test/lux/compiler/language/lux/analysis/coverage.lux @@ -123,7 +123,7 @@ it (random.list arity again)] (pure [(when (|> it (list#each product.left) - list.reversed + list.in_reverse (list.until (|>> /.exhaustive? not))) {.#Empty} {/.#Exhaustive} diff --git a/stdlib/source/test/lux/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/test/lux/compiler/language/lux/phase/analysis/complex.lux index 60abeddd3..57f9c5d98 100644 --- a/stdlib/source/test/lux/compiler/language/lux/phase/analysis/complex.lux +++ b/stdlib/source/test/lux/compiler/language/lux/phase/analysis/complex.lux @@ -500,7 +500,7 @@ (pipe.when {try.#Success {.#Some actual}} (let [(open "list#[0]") (list.equivalence (product.equivalence name.equivalence code.equivalence))] - (list#= expected (list.reversed actual))) + (list#= expected (list.in_reverse actual))) _ false))))] @@ -546,14 +546,14 @@ _ false))))] (and (ordered? false global_record) - (ordered? false (list.reversed global_record)) + (ordered? false (list.in_reverse global_record)) (ordered? false local_record) - (ordered? false (list.reversed local_record)) + (ordered? false (list.in_reverse local_record)) (ordered? true global_record) - (ordered? true (list.reversed global_record)) + (ordered? true (list.in_reverse global_record)) (not (ordered? true local_record)) - (not (ordered? true (list.reversed local_record))) + (not (ordered? true (list.in_reverse local_record))) (unit? false) (unit? true) diff --git a/stdlib/source/test/lux/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/compiler/language/lux/phase/synthesis/function.lux index f1d8737cb..b3e8f323d 100644 --- a/stdlib/source/test/lux/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/test/lux/compiler/language/lux/phase/synthesis/function.lux @@ -66,7 +66,7 @@ (list {variable.#Local 1})) body})) body - (list.reversed (list.indices arity)))) + (list.in_reverse (list.indices arity)))) (the !expect (template.macro (_ ) diff --git a/stdlib/source/test/lux/compiler/language/lux/phase/synthesis/when.lux b/stdlib/source/test/lux/compiler/language/lux/phase/synthesis/when.lux index a84a1083c..f110c5831 100644 --- a/stdlib/source/test/lux/compiler/language/lux/phase/synthesis/when.lux +++ b/stdlib/source/test/lux/compiler/language/lux/phase/synthesis/when.lux @@ -149,7 +149,7 @@ (list#composite (list.repeated (++ lefts) (analysis.pattern/unit)) (list inner))))) {analysis.#Bind @member} - (list.reversed path)) + (list.in_reverse path)) @member]))) (the get_test @@ -318,7 +318,7 @@ list.enumeration (list#each (function (_ [lefts' [value body]]) (path lefts' false value body))) - list.reversed)) + list.in_reverse)) [(branch 0 false value/first body/first) (list#composite (|> (list.zipped_2 value/mid body/mid) list.enumeration diff --git a/stdlib/source/test/lux/concurrency/frp.lux b/stdlib/source/test/lux/concurrency/frp.lux index 22aecb7c6..9a876f6c9 100644 --- a/stdlib/source/test/lux/concurrency/frp.lux +++ b/stdlib/source/test/lux/concurrency/frp.lux @@ -89,7 +89,11 @@ (_.for [/.monad] (monadT.spec ..injection ..comparison /.monad)) - (_.coverage [/.Channel /.Sink /.channel] + (_.coverage [/.Sink + /.close /.feed + + /.Channel + /.channel] (when (io.value (monad.let (try.with io.monad) [.let [[channel sink] (is [(/.Channel Natural) (/.Sink Natural)] diff --git a/stdlib/source/test/lux/concurrency/structured.lux b/stdlib/source/test/lux/concurrency/structured.lux index 53350747c..2914680af 100644 --- a/stdlib/source/test/lux/concurrency/structured.lux +++ b/stdlib/source/test/lux/concurrency/structured.lux @@ -24,7 +24,9 @@ ["n" natural]]]] [test ["_" property (.only Test)] - ["[0]" unit]]]] + ["[0]" unit]] + [logic + ["[0]" bit]]]] [\\library ["[0]" / (.only) [// @@ -95,6 +97,30 @@ (/.schedule! scope short (function (_ _) (io#pure {.#Some true}))))] (unit.coverage [/.schedule!] (maybe.else false ?)))) + (<| (_.for [/.Scope]) + (all _.and + (pure (monad.let future.monad + [? (<| /.future + /.with_scope + (function (_ scope)) + (/.schedule! scope short (function (_ _) + (monad.let io.monad + [? (/.close! scope)] + (pure {.#Some ?})))))] + (unit.coverage [/.close!] + (with (maybe.equivalence bit.equivalence) + (= {.#None} ?))))) + (pure (monad.let future.monad + [? (<| /.future + /.with_scope + (function (_ scope)) + (/.schedule! scope short (function (_ _) + (monad.let io.monad + [? (/.closed? scope)] + (pure {.#Some (not ?)})))))] + (unit.coverage [/.closed?] + (maybe.else false ?)))) + )) (pure (monad.let future.monad [_ (<| /.future /.with_scope diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index b6103d915..7d28a334f 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -610,7 +610,7 @@ (and (by /.equivalence = sample (/.after 0 sample)) (by /.equivalence = (/.empty 0) (/.after size sample)) (n.= (n.- offset size) (/.size (/.after offset sample))) - (when (stack.reversed (..as_stack sample)) + (when (stack.in_reverse (..as_stack sample)) {.#Empty} false diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 67e61f84c..754c7de12 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -61,10 +61,10 @@ .let [pairs (list.zipped_2 (set.as_list keys) (set.as_list values)) sample (/.of_list n.order pairs) - sorted_pairs (list.sorted (function (_ [left _] [right _]) - (n.< left right)) - pairs) - sorted_values (list#each product.right sorted_pairs) + pairs_in_order (list.in_order (function (_ [left _] [right _]) + (n.< left right)) + pairs) + values_in_order (list#each product.right pairs_in_order) (open "list#[0]") (list.equivalence (is (Equivalence [Natural Natural]) (function (_ [kr vr] [ks vs]) (and (n.= kr ks) @@ -82,7 +82,7 @@ (_.coverage [/.empty] (/.empty? (/.empty n.order))) (_.coverage [/.minor] - (when [(/.minor sample) (list.item 0 sorted_values)] + (when [(/.minor sample) (list.item 0 values_in_order)] [{try.#Failure _} {try.#Failure _}] true @@ -92,7 +92,7 @@ _ false)) (_.coverage [/.major] - (when [(/.major sample) (list.item (-- size) sorted_values)] + (when [(/.major sample) (list.item (-- size) values_in_order)] [{try.#Failure _} {try.#Failure _}] true @@ -103,7 +103,7 @@ false)) (_.coverage [/.entries] (list#= (/.entries sample) - sorted_pairs)) + pairs_in_order)) (_.coverage [/.keys /.values] (list#= (/.entries sample) (list.zipped_2 (/.keys sample) diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 89b6c2c0f..62c53a268 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -146,15 +146,15 @@ (/.empty? expected_list))) (_.coverage [/.empty] (/.empty? /.empty)) - (_.coverage [/.reversed] + (_.coverage [/.in_reverse] (and (|> expected_list - /.reversed - /.reversed + /.in_reverse + /.in_reverse (= expected_list)) (bit.= (n.< 2 (/.size expected_list)) (by (/.equivalence n.equivalence) = expected_list - (/.reversed expected_list))))) + (/.in_reverse expected_list))))) (_.coverage [/.first /.after /.split] (let [before (/.first cut_off expected_list) after (/.after cut_off expected_list) @@ -217,9 +217,9 @@ _ (and (/.every? (|>> /.size (n.<= size_of_complete_segment)) it) (= expected_list (by /.monad conjoint it)))))) - (_.coverage [/.sorted] - (let [less_up_to_more (/.sorted n.< expected_list) - more_up_to_less (/.sorted n.> expected_list)] + (_.coverage [/.in_order] + (let [less_up_to_more (/.in_order n.< expected_list) + more_up_to_less (/.in_order n.> expected_list)] (and (n.= (/.size expected_list) (/.size less_up_to_more)) (set.= (set.of_list n.hash expected_list) @@ -236,7 +236,7 @@ [true reference] terms))) (= less_up_to_more - (/.reversed more_up_to_less))))) + (/.in_reverse more_up_to_less))))) (_.coverage [/.has] (let [can_change! (|> expected_list diff --git a/stdlib/source/test/lux/data/collection/list/slice.lux b/stdlib/source/test/lux/data/collection/list/slice.lux index 3e62fd5ec..fbe71a1df 100644 --- a/stdlib/source/test/lux/data/collection/list/slice.lux +++ b/stdlib/source/test/lux/data/collection/list/slice.lux @@ -113,18 +113,18 @@ [(all equivalence.product n.equivalence n.equivalence /#equivalence) (all random.and random.natural random.natural random_slice)])) (_.coverage [/.#Pair] - (let [reversed (is (for_any (_ it) - (Change (/.Slice Natural))) - (function (reversed it) - (case.when it - {/.#Pair start end it'} - (case.some /.#Pair [end start (reversed it')]) - - else - it)))] + (let [in_reverse (is (for_any (_ it) + (Change (/.Slice Natural))) + (function (in_reverse it) + (case.when it + {/.#Pair start end it'} + (case.some /.#Pair [end start (in_reverse it')]) + + else + it)))] (/#equivalence (|> expected_slice (view.as /.list) - //.reversed + //.in_reverse (view.of /.list)) - (reversed expected_slice)))))) + (in_reverse expected_slice)))))) ))) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index 18a8f4d74..c9adb8a14 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -80,15 +80,15 @@ /.as_array /.of_array (/#= sample))) - (_.coverage [/.reversed] + (_.coverage [/.in_reverse] (or (n.< 2 (/.size sample)) (let [not_same! (not (/#= sample - (/.reversed sample))) + (/.in_reverse sample))) self_symmetry! (/#= sample - (/.reversed (/.reversed sample)))] + (/.in_reverse (/.in_reverse sample)))] (and not_same! self_symmetry!)))) (_.coverage [/.every? /.any?] diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index 6ca0603eb..e591da2f0 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -79,7 +79,7 @@ (_.coverage [/.as_list] (by (list.equivalence n.equivalence) = (/.as_list (/.of_list n.order listL)) - (list.sorted (by n.order <) listL))) + (list.in_order (by n.order <) listL))) (_.coverage [/.of_list] (|> setL /.as_list (/.of_list n.order) diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux index 5e3b47920..6dd5afd3d 100644 --- a/stdlib/source/test/lux/data/collection/stack.lux +++ b/stdlib/source/test/lux/data/collection/stack.lux @@ -98,15 +98,15 @@ (by bit.equivalence = (/.empty? sample) (n.= 0 (/.size sample)))) - (_.coverage [/.reversed] + (_.coverage [/.in_reverse] (or (n.< 2 (/.size sample)) (let [not_same! (not (/#= sample - (/.reversed sample))) + (/.in_reverse sample))) self_symmetry! (/#= sample - (/.reversed (/.reversed sample)))] + (/.in_reverse (/.in_reverse sample)))] (and not_same! self_symmetry!)))) (_.coverage [/.every? /.any?] diff --git a/stdlib/source/test/lux/logic/fuzzy.lux b/stdlib/source/test/lux/logic/fuzzy.lux index 97c409b8b..22af2bbec 100644 --- a/stdlib/source/test/lux/logic/fuzzy.lux +++ b/stdlib/source/test/lux/logic/fuzzy.lux @@ -95,7 +95,7 @@ [minimum middle_minimum middle_maximum maximum] (|> random.revolution (random.set r.hash 4) - (by ! each (|>> set.as_list (list.sorted r.<))) + (by ! each (|>> set.as_list (list.in_order r.<))) (random.one (function (_ thresholds) (when thresholds (list threshold_0 threshold_1 threshold_2 threshold_3) @@ -179,7 +179,7 @@ [minimum middle_minimum middle_maximum maximum] (|> random.revolution (random.set r.hash 4) - (by ! each (|>> set.as_list (list.sorted r.<))) + (by ! each (|>> set.as_list (list.in_order r.<))) (random.one (function (_ thresholds) (when thresholds (list threshold_0 threshold_1 threshold_2 threshold_3) diff --git a/stdlib/source/test/lux/macro/expansion.lux b/stdlib/source/test/lux/macro/expansion.lux index 899ec46bd..88f0b5aaf 100644 --- a/stdlib/source/test/lux/macro/expansion.lux +++ b/stdlib/source/test/lux/macro/expansion.lux @@ -63,20 +63,21 @@ [/.complete [] (list (` [])) (list (` []) (` []))] [/.total (..dup 0 []) (list (` [])) (list (` []) (` []))]])) (_.coverage [/.one] - (and (<| static.expansion - (monad.let meta.monad - [it (/.one (` (..dup 0 [])))] - (pure (list (code.bit (code.= (` []) - it)))))) - (<| static.expansion - (monad.let meta.monad - [it (meta.try (/.one (` (..dup 1 []))))] - (pure (list (code.bit (when it - {try.#Failure _} - true - - {try.#Success _} - false)))))))) + (<| static.expansion + (monad.let meta.monad + [it (/.one (` (..dup 0 [])))] + (pure (list (code.bit (code.= (` []) + it))))))) + (_.coverage [/.cannot_expand_to_more_than_1] + (<| static.expansion + (monad.let meta.monad + [it (meta.try (/.one (` (..dup 1 []))))] + (pure (list (code.bit (when it + {try.#Failure error} + (text.= /.cannot_expand_to_more_than_1 error) + + {try.#Success _} + false))))))) (_.coverage [/.log_single!] (exec (,, (/.log_single! "omit" (..dup 0 []))) diff --git a/stdlib/source/test/lux/math/number/64.lux b/stdlib/source/test/lux/math/number/64.lux index 72af51af5..94ab9b869 100644 --- a/stdlib/source/test/lux/math/number/64.lux +++ b/stdlib/source/test/lux/math/number/64.lux @@ -257,14 +257,14 @@ inverse! nullity! futility!))) - (_.coverage [/.reversed] - (and (|> pattern /.reversed /.reversed (/.= pattern)) - (or (|> pattern /.reversed (/.= pattern) not) + (_.coverage [/.in_reverse] + (and (|> pattern /.in_reverse /.in_reverse (/.= pattern)) + (or (|> pattern /.in_reverse (/.= pattern) not) (let [high (/.and (number.base_16 "FFFFFFFF00000000") pattern) low (/.and (number.base_16 "00000000FFFFFFFF") pattern)] - (/.= (/.reversed high) + (/.= (/.in_reverse high) low))))) (_.coverage [/.decrement /.less /.previous /.before] (and (same? .-- /.decrement) diff --git a/stdlib/source/test/lux/math/number/big/natural.lux b/stdlib/source/test/lux/math/number/big/natural.lux index fc9d3f732..2c5dfa4d0 100644 --- a/stdlib/source/test/lux/math/number/big/natural.lux +++ b/stdlib/source/test/lux/math/number/big/natural.lux @@ -47,7 +47,7 @@ (the number_as_text (-> /.Number Text) - (|>> list.reversed + (|>> list.in_reverse (list.as_text (by natural.base_10 as)))) (the test_for_every_interface diff --git a/stdlib/source/test/lux/math/unit.lux b/stdlib/source/test/lux/math/unit.lux index b7347e232..23e44890f 100644 --- a/stdlib/source/test/lux/math/unit.lux +++ b/stdlib/source/test/lux/math/unit.lux @@ -15,9 +15,12 @@ ["[0]" random (.only Random)] [number [/64 - ["[0]" natural]]]] + ["[0]" natural] + ["[0]" decimal]]]] [test - ["_" property (.only Test)]]]] + ["_" property (.only Test)]] + [macro + ["[0]" expansion]]]] [\\library ["[0]" /]]) @@ -26,15 +29,22 @@ (<| (_.covering /._) (monad.let [! random.monad] []) + (expansion.let [,every_natural (these /.degree /.gradian /.per_cent /.per_mille /.per_myriad) + ,every_decimal (these /.radian /.turn) + ,every_unit (these ,every_natural ,every_decimal)]) (_.for [/.Unit - /.#factor /.#suffix]) + ,every_unit]) (all _.and - (_.coverage [/.degree /.gradian /.per_cent /.per_mille /.per_myriad] - (let [values (list /.degree /.gradian /.per_cent /.per_mille /.per_myriad) - every_factor (set.of_list natural.hash (list#each (its /.#factor) values)) - every_suffix (set.of_list text.hash (list#each (its /.#suffix) values))] - (and (natural.= (list.size values) - (set.size every_factor)) - (natural.= (list.size values) - (set.size every_suffix))))) - ))) + (_.coverage [/.#factor] + (let [values (is (List (for_some (_ it) (/.Unit it))) + (list ,every_unit))] + (natural.= (list.size values) + (set.size (set.union (set.of_list decimal.hash (list#each (|>> (its /.#factor) natural.decimal) (list ,every_natural))) + (set.of_list decimal.hash (list#each (its /.#factor) (list ,every_decimal)))))))) + (_.coverage [/.#suffix] + (let [values (is (List (for_some (_ it) (/.Unit it))) + (list ,every_unit))] + (natural.= (list.size values) + (set.size (set.of_list text.hash (list#each (its /.#suffix) values)))))) + ) + )) diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 25f3ffd69..30a9d906d 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -312,6 +312,9 @@ (_.coverage [.Type_Context .#there_exists .#for_all + @type.Type_Context + @type.#there_exists @type.#for_all + /.type_context] (|> /.type_context (/.value (expected_lux {.#Some expected_type})) diff --git a/stdlib/source/test/lux/meta/code.lux b/stdlib/source/test/lux/meta/code.lux index adfd4d851..cacd6c297 100644 --- a/stdlib/source/test/lux/meta/code.lux +++ b/stdlib/source/test/lux/meta/code.lux @@ -37,6 +37,7 @@ ["[0]" provenance (.only) ["[1]T" \\test]]] [compiler + ["@[0]" type] [language [lux ["[0]" syntax]]]] @@ -289,6 +290,11 @@ (monad.let [! random.monad] [expected_provenance provenanceT.random expected ..random]) + (_.for [.Code + .#Bit .#Natural .#Integer .#Revolution .#Decimal .#Text .#Name .#Form .#Variant .#Tuple + + @type.Code + @type.#Bit @type.#Natural @type.#Integer @type.#Revolution @type.#Decimal @type.#Text @type.#Name @type.#Form @type.#Variant @type.#Tuple]) (all _.and (_.for [/.equivalence /.=] (static.when (same? /.equivalence /.=) diff --git a/stdlib/source/test/lux/meta/static.lux b/stdlib/source/test/lux/meta/static.lux index c9c42e2ad..d4b78e049 100644 --- a/stdlib/source/test/lux/meta/static.lux +++ b/stdlib/source/test/lux/meta/static.lux @@ -22,7 +22,7 @@ [macro ["[0]" expansion] ["[0]" template]] - ["[0]" meta (.only) + ["[0]" meta (.use "[1]#[0]" monad) ["[0]" code]] [test ["_" property (.only Test)]]]] @@ -115,4 +115,8 @@ (_.coverage [/.seed] (not (n.= (/.seed) (/.seed)))) + (_.coverage [/.expansion] + (expansion.let [,expected (/.random_natural)] + (n.= ,expected + (/.expansion (meta#pure (list (code.natural ,expected))))))) )))) diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index dfe85ac67..45aea487f 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -124,7 +124,7 @@ arg/4 \\projection.any] (io.io (list arg/4 arg/3 arg/2 arg/1 arg/0)))) (view.as list.stack inputs))] - (list#= (list.reversed inputs) + (list#= (list.in_reverse inputs) (as (-> Any (List Text)) (io.value outcome)))) (let [outcome ((is /.Program (/.program [all_arguments (<>.many \\projection.any)] diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 9abba37c4..dd09cc13b 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -864,6 +864,13 @@ _ /.dup] (/.invokespecial ..$Object "" (type.method [(.list) (.list) type.void (.list)]))))] (all _.and + (<| (..coverage [/.string]) + (monad.let [! random.monad] + [expected (by ! each (|>> (as (-> java/lang/String Text))) + ..$String::random)]) + (..bytecode (|>> (as (-> Any Text)) + (text.= expected))) + (/.string expected)) (<| (..coverage [/.aconst_null]) (..bytecode (|>> (as (-> Any Bit)) not)) @@ -1879,6 +1886,7 @@ (the .public test Test (<| (_.covering /._) + (_.for [/.Bytecode]) (all _.and (_.for [/.functor] (functorT.spec /#pure ..equivalence /.functor)) diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 66bb64398..763da76ac 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -40,7 +40,8 @@ ["_" property (.only Test)]]]] ["[0]" \\projection] [\\library - ["[0]" /]] + ["[0]" / (.only) + ["[0]" check]]] ["[0]" / ["[1][0]" nominal] ["[1][0]" check] @@ -399,11 +400,20 @@ (the .public test Test (<| (_.covering /._) + (_.for [.Type + .#Nominal .#Variable .#Reification .#Named + .#Parameter .#Quantification + + @type.Type + @type.#Nominal @type.#Variable @type.#Reification @type.#Named + @type.#Parameter @type.#Quantification]) (`` (all _.and (_.for [/.equivalence /.=] (static.when (same? /.equivalence /.=) (equivalenceT.spec /.equivalence (..random 0)))) - + + (_.coverage [/.Variable] + (check.< /.Variable .Natural)) (monad.let [! random.monad] [anonymousT (random.only (|>> (pipe.when {.#Named _ _} false _ true)) diff --git a/stdlib/source/test/lux/type/environment.lux b/stdlib/source/test/lux/type/environment.lux index 098e0b2e9..b110bbb9d 100644 --- a/stdlib/source/test/lux/type/environment.lux +++ b/stdlib/source/test/lux/type/environment.lux @@ -7,7 +7,7 @@ [abstract ["[0]" monad]] [error - ["[0]" try] + ["[0]" try (.use "[1]#[0]" functor)] ["[0]" exception]] [data [collection @@ -69,14 +69,9 @@ else false)) - (_.coverage [/.not_known] - (when (|> /.empty - (/.its variable_0)) - {try.#Failure error} - (exception.is? /.not_known error) - - else - false)) + (_.coverage [/.bound?] + (and (try.else false (try#each not (/.bound? variable_0 (list (/.un_bound))))) + (try.else false (/.bound? variable_0 (list (/.bound expected_0)))))) )) (<| (_.for [/.Change]) (all _.and diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index 92e8ec494..7ce4149ef 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -581,7 +581,11 @@ (<| (_.covering /._) (monad.let [! random.monad] [/ (random.upper_cased 1) - file (random.lower_cased 1)] + + file (random.lower_cased 1) + copy (random.lower_cased 2) + + content (by ! each utf8#as (random.unicode 1))] (all _.and (_.for [/.memory] (..spec (io.io (/.memory /)))) @@ -620,6 +624,18 @@ _ false)))) + (pure (monad.let [! future.monad] + [.let [fs (/.memory /)] + it (monad.let (try.with !) + [_ (by fs write file content) + _ (is (Future (Try Any)) + (/.copy ! fs file copy)) + + expected (by fs read file) + actual (by fs read copy)] + (pure (binary.= expected actual)))] + (unit.coverage [/.copy] + (try.else false it)))) /watch.test /extension.test diff --git a/stdlib/source/test/lux/world/locale/language.lux b/stdlib/source/test/lux/world/locale/language.lux index 1108e52bb..bb1913603 100644 --- a/stdlib/source/test/lux/world/locale/language.lux +++ b/stdlib/source/test/lux/world/locale/language.lux @@ -206,7 +206,7 @@ (the languages_test Test (|> ..languages - list.reversed + list.in_reverse (list#each (its #test)) (list#mix _.and (`` (all _.and diff --git a/stdlib/source/test/lux/world/locale/territory.lux b/stdlib/source/test/lux/world/locale/territory.lux index 953ab59a5..77caccd9f 100644 --- a/stdlib/source/test/lux/world/locale/territory.lux +++ b/stdlib/source/test/lux/world/locale/territory.lux @@ -161,7 +161,7 @@ (the territories_test Test (|> ..territories - list.reversed + list.in_reverse (list#each (its #test)) (list#mix _.and (`` (all _.and