From 62b3abfcc014ca1c19d62aacdd497f6a250b372c Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 25 Jul 2021 03:12:17 -0400 Subject: Better syntax for "library/lux.^multi". --- stdlib/source/test/aedifex/artifact/extension.lux | 2 +- stdlib/source/test/aedifex/artifact/time.lux | 4 +- stdlib/source/test/aedifex/artifact/type.lux | 2 +- stdlib/source/test/aedifex/cache.lux | 4 +- stdlib/source/test/aedifex/cli.lux | 28 +-- stdlib/source/test/aedifex/command/auto.lux | 4 +- stdlib/source/test/aedifex/command/deps.lux | 14 +- stdlib/source/test/aedifex/command/version.lux | 4 +- .../source/test/aedifex/dependency/resolution.lux | 42 ++--- stdlib/source/test/aedifex/metadata/artifact.lux | 4 +- stdlib/source/test/aedifex/metadata/snapshot.lux | 4 +- stdlib/source/test/aedifex/parser.lux | 6 +- stdlib/source/test/aedifex/profile.lux | 4 +- stdlib/source/test/aedifex/project.lux | 22 +-- stdlib/source/test/aedifex/runtime.lux | 2 +- stdlib/source/test/lux.lux | 10 +- stdlib/source/test/lux/abstract/equivalence.lux | 2 +- stdlib/source/test/lux/abstract/interval.lux | 4 +- stdlib/source/test/lux/abstract/monad.lux | 6 +- stdlib/source/test/lux/abstract/order.lux | 2 +- stdlib/source/test/lux/abstract/predicate.lux | 6 +- stdlib/source/test/lux/control/concatenative.lux | 8 +- .../source/test/lux/control/concurrency/actor.lux | 3 +- .../source/test/lux/control/concurrency/atom.lux | 2 +- stdlib/source/test/lux/control/concurrency/frp.lux | 20 +-- .../test/lux/control/concurrency/promise.lux | 2 +- stdlib/source/test/lux/control/exception.lux | 2 +- stdlib/source/test/lux/control/function.lux | 2 +- stdlib/source/test/lux/control/function/mixin.lux | 6 +- stdlib/source/test/lux/control/parser.lux | 32 ++-- stdlib/source/test/lux/control/parser/binary.lux | 8 +- stdlib/source/test/lux/control/parser/cli.lux | 12 +- stdlib/source/test/lux/control/parser/code.lux | 2 +- stdlib/source/test/lux/control/parser/json.lux | 22 +-- .../source/test/lux/control/parser/synthesis.lux | 2 +- stdlib/source/test/lux/control/parser/text.lux | 144 +++++++-------- stdlib/source/test/lux/control/parser/tree.lux | 4 +- stdlib/source/test/lux/control/parser/type.lux | 14 +- stdlib/source/test/lux/control/parser/xml.lux | 6 +- stdlib/source/test/lux/control/region.lux | 26 +-- stdlib/source/test/lux/control/try.lux | 43 ++--- stdlib/source/test/lux/data/binary.lux | 4 +- stdlib/source/test/lux/data/collection/array.lux | 24 +-- .../source/test/lux/data/collection/dictionary.lux | 36 ++-- .../lux/data/collection/dictionary/ordered.lux | 14 +- .../test/lux/data/collection/dictionary/plist.lux | 6 +- stdlib/source/test/lux/data/collection/list.lux | 18 +- stdlib/source/test/lux/data/collection/queue.lux | 12 +- .../test/lux/data/collection/queue/priority.lux | 28 +-- stdlib/source/test/lux/data/collection/row.lux | 20 +-- .../source/test/lux/data/collection/sequence.lux | 4 +- stdlib/source/test/lux/data/collection/set.lux | 10 +- .../source/test/lux/data/collection/set/multi.lux | 16 +- .../test/lux/data/collection/set/ordered.lux | 18 +- stdlib/source/test/lux/data/collection/stack.lux | 10 +- .../test/lux/data/collection/tree/finger.lux | 40 ++--- .../test/lux/data/collection/tree/zipper.lux | 4 +- stdlib/source/test/lux/data/color.lux | 38 ++-- stdlib/source/test/lux/data/color/named.lux | 4 +- stdlib/source/test/lux/data/format/json.lux | 4 +- stdlib/source/test/lux/data/format/tar.lux | 10 +- stdlib/source/test/lux/data/product.lux | 4 +- stdlib/source/test/lux/data/sum.lux | 4 +- stdlib/source/test/lux/data/text.lux | 24 +-- stdlib/source/test/lux/data/text/encoding.lux | 4 +- stdlib/source/test/lux/data/text/escape.lux | 40 ++--- stdlib/source/test/lux/data/text/format.lux | 2 +- stdlib/source/test/lux/data/text/regex.lux | 8 +- stdlib/source/test/lux/data/text/unicode/block.lux | 6 +- stdlib/source/test/lux/ffi.jvm.lux | 6 +- stdlib/source/test/lux/ffi.old.lux | 4 +- stdlib/source/test/lux/locale/language.lux | 24 +-- stdlib/source/test/lux/locale/territory.lux | 28 +-- stdlib/source/test/lux/macro/code.lux | 32 ++-- stdlib/source/test/lux/macro/template.lux | 8 +- stdlib/source/test/lux/math/logic/fuzzy.lux | 12 +- stdlib/source/test/lux/math/modular.lux | 6 +- stdlib/source/test/lux/math/modulus.lux | 2 +- stdlib/source/test/lux/math/number/complex.lux | 2 +- stdlib/source/test/lux/math/number/frac.lux | 12 +- stdlib/source/test/lux/math/number/int.lux | 6 +- stdlib/source/test/lux/math/number/nat.lux | 4 +- stdlib/source/test/lux/math/number/ratio.lux | 12 +- stdlib/source/test/lux/math/number/rev.lux | 10 +- stdlib/source/test/lux/meta.lux | 172 +++++++++--------- stdlib/source/test/lux/meta/annotation.lux | 4 +- stdlib/source/test/lux/target.lux | 2 +- stdlib/source/test/lux/target/jvm.lux | 52 +++--- stdlib/source/test/lux/test.lux | 12 +- stdlib/source/test/lux/time.lux | 6 +- stdlib/source/test/lux/time/date.lux | 4 +- stdlib/source/test/lux/time/duration.lux | 6 +- stdlib/source/test/lux/time/instant.lux | 10 +- stdlib/source/test/lux/time/month.lux | 10 +- stdlib/source/test/lux/time/year.lux | 8 +- .../compiler/language/lux/phase/analysis/case.lux | 10 +- .../language/lux/phase/analysis/function.lux | 98 +++++------ .../language/lux/phase/analysis/primitive.lux | 22 +-- .../language/lux/phase/analysis/reference.lux | 60 +++---- .../language/lux/phase/analysis/structure.lux | 194 ++++++++++----------- .../language/lux/phase/extension/analysis/lux.lux | 106 +++++------ .../compiler/language/lux/phase/synthesis/loop.lux | 36 ++-- .../test/lux/tool/compiler/language/lux/syntax.lux | 2 +- stdlib/source/test/lux/type.lux | 102 +++++------ stdlib/source/test/lux/type/check.lux | 2 +- stdlib/source/test/lux/type/quotient.lux | 2 +- stdlib/source/test/lux/type/refinement.lux | 8 +- stdlib/source/test/lux/type/unit.lux | 4 +- stdlib/source/test/lux/world/console.lux | 6 +- stdlib/source/test/lux/world/file/watch.lux | 4 +- stdlib/source/test/lux/world/input/keyboard.lux | 4 +- stdlib/source/test/lux/world/net/http/status.lux | 4 +- .../test/lux/world/output/video/resolution.lux | 2 +- stdlib/source/test/lux/world/shell.lux | 2 +- 114 files changed, 1028 insertions(+), 1042 deletions(-) (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/aedifex/artifact/extension.lux b/stdlib/source/test/aedifex/artifact/extension.lux index b8a2144aa..132293d4f 100644 --- a/stdlib/source/test/aedifex/artifact/extension.lux +++ b/stdlib/source/test/aedifex/artifact/extension.lux @@ -26,7 +26,7 @@ (_.cover [/.lux_library /.jvm_library /.pom /.sha-1 /.md5] (let [options (list /.lux_library /.jvm_library /.pom /.sha-1 /.md5) - uniques (set.from_list text.hash options)] + uniques (set.of_list text.hash options)] (n.= (list.size options) (set.size uniques)))) (_.cover [/.extension /.type] diff --git a/stdlib/source/test/aedifex/artifact/time.lux b/stdlib/source/test/aedifex/artifact/time.lux index 131155500..8873a7f1d 100644 --- a/stdlib/source/test/aedifex/artifact/time.lux +++ b/stdlib/source/test/aedifex/artifact/time.lux @@ -47,10 +47,10 @@ (try.default false)))) (do random.monad [expected ..random] - (_.cover [/.instant /.from_instant] + (_.cover [/.instant /.of_instant] (|> expected /.instant - /.from_instant + /.of_instant (try\map (\ /.equivalence = expected)) (try.default false)))) (_.cover [/.epoch] diff --git a/stdlib/source/test/aedifex/artifact/type.lux b/stdlib/source/test/aedifex/artifact/type.lux index 93a13e26a..017e417cb 100644 --- a/stdlib/source/test/aedifex/artifact/type.lux +++ b/stdlib/source/test/aedifex/artifact/type.lux @@ -37,7 +37,7 @@ /.pom /.md5 /.sha-1] (let [options (list /.lux_library /.jvm_library /.js_library /.pom /.md5 /.sha-1) - uniques (set.from_list text.hash options)] + uniques (set.of_list text.hash options)] (n.= (list.size options) (set.size uniques)))) )))) diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index 20dcf506d..2f52b1d7b 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -57,7 +57,7 @@ (try.to_maybe (do try.monad [pom (//pom.write profile) - identity (try.from_maybe (get@ #//.identity profile))] + identity (try.of_maybe (get@ #//.identity profile))] (wrap [identity profile pom])))) @profile.random)) @@ -96,7 +96,7 @@ content ..content] (wrap [dependency (set@ #//package.origin (#//repository/origin.Remote "") (//package.local pom content))])))))] - (wrap (dictionary.from_list //dependency.hash (list& [main_dependency main_package] dependencies))))) + (wrap (dictionary.of_list //dependency.hash (list& [main_dependency main_package] dependencies))))) (def: singular Test diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index 71ea72b8c..4239644aa 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -48,7 +48,7 @@ ## #Auto ..compilation)) -(def: (format-compilation value) +(def: (format_compilation value) (-> /.Compilation (List Text)) (case value #/.Build (list "build") @@ -63,10 +63,10 @@ #/.Dependencies (list "deps") #/.Install (list "install") (#/.Deploy repository [user password]) (list "deploy" repository user password) - (#/.Compilation compilation) (..format-compilation compilation) - (#/.Auto compilation) (list& "auto" (..format-compilation compilation)))) + (#/.Compilation compilation) (..format_compilation compilation) + (#/.Auto compilation) (list& "auto" (..format_compilation compilation)))) -(def: without-profile +(def: without_profile Test (do random.monad [expected ..command] @@ -81,19 +81,19 @@ (#try.Failure error) false))))) -(def: with-profile +(def: with_profile Test (do random.monad - [expected-profile (random.ascii/alpha 1) - expected-command ..command] + [expected_profile (random.ascii/alpha 1) + expected_command ..command] (_.test "With profile." - (|> expected-command + (|> expected_command ..format - (list& "with" expected-profile) + (list& "with" expected_profile) (cli.run /.command) - (case> (#try.Success [actual-profile actual-command]) - (and (text\= expected-profile actual-profile) - (\ /.equivalence = expected-command actual-command)) + (case> (#try.Success [actual_profile actual_command]) + (and (text\= expected_profile actual_profile) + (\ /.equivalence = expected_command actual_command)) (#try.Failure error) false))))) @@ -108,6 +108,6 @@ (_.for [/.command] ($_ _.and - ..without-profile - ..with-profile + ..without_profile + ..with_profile )))))) diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index a7ea2795b..474a8dd1f 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -59,7 +59,7 @@ (do (try.with !) [_ (\ fs write (\ utf8.codec encode (%.nat actual_runs)) dummy_file) _ (\ fs modify - (|> actual_runs .int instant.from_millis) + (|> actual_runs .int instant.of_millis) dummy_file)] (wrap [shell.normal []])))))])) @@ -84,7 +84,7 @@ profile (|> empty_profile with_program with_target - (set@ #///.sources (set.from_list text.hash (list source))))] + (set@ #///.sources (set.of_list text.hash (list source))))] home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 738cd5090..40645b731 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -60,9 +60,9 @@ working_directory (random.ascii/alpha 5) dependee_artifact $///artifact.random - depender_artifact (random.filter (predicate.complement - (\ ///artifact.equivalence = dependee_artifact)) - $///artifact.random) + depender_artifact (random.only (predicate.complement + (\ ///artifact.equivalence = dependee_artifact)) + $///artifact.random) [_ dependee_package] $///package.random [_ depender_package] $///package.random @@ -75,12 +75,12 @@ dependee_pom (|> (\ ///.monoid identity) (set@ #///.identity (#.Some dependee_artifact)) ///pom.write - try.assume) + try.assumed) depender_pom (|> (\ ///.monoid identity) (set@ #///.identity (#.Some depender_artifact)) - (set@ #///.dependencies (set.from_list ///dependency.hash (list dependee))) + (set@ #///.dependencies (set.of_list ///dependency.hash (list dependee))) ///pom.write - try.assume) + try.assumed) dependee_package (|> dependee_package (set@ #///package.origin (#///repository/origin.Remote "")) @@ -103,7 +103,7 @@ (dictionary.put dependee dependee_package) (///dependency/deployment.all local)) post (|> (\ ///.monoid identity) - (set@ #///.dependencies (set.from_list ///dependency.hash (list dependee depender))) + (set@ #///.dependencies (set.of_list ///dependency.hash (list dependee depender))) (/.do! console local (list (///repository.mock ($///dependency/resolution.single depender_artifact depender_package) [])) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index 4a8ccc1be..d0d172a7a 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -35,7 +35,7 @@ (def: (on_read [open? state]) (if open? - (try.from_maybe + (try.of_maybe (do maybe.monad [head (text.nth 0 state) [_ tail] (text.split 1 state)] @@ -43,7 +43,7 @@ (exception.throw ..console_is_closed! []))) (def: (on_read_line [open? state]) (if open? - (try.from_maybe + (try.of_maybe (do maybe.monad [[output state] (text.split_with text.new_line state)] (wrap [[open? state] output]))) diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index deb74abcd..9d1f287c6 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -249,11 +249,11 @@ (do {! random.monad} [expected_artifact $///artifact.random [_ expected_package] $///package.random - [_ dummy_package] (random.filter (|>> product.right - (set@ #///package.pom (get@ #///package.pom expected_package)) - (\ ///package.equivalence = expected_package) - not) - $///package.random) + [_ dummy_package] (random.only (|>> product.right + (set@ #///package.pom (get@ #///package.pom expected_package)) + (\ ///package.equivalence = expected_package) + not) + $///package.random) #let [good (..single expected_artifact expected_package) bad_sha-1 (..bad_sha-1 expected_artifact expected_package dummy_package) bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]] @@ -296,11 +296,11 @@ (do {! random.monad} [expected_artifact $///artifact.random [_ expected_package] $///package.random - [_ dummy_package] (random.filter (|>> product.right - (set@ #///package.pom (get@ #///package.pom expected_package)) - (\ ///package.equivalence = expected_package) - not) - $///package.random) + [_ dummy_package] (random.only (|>> product.right + (set@ #///package.pom (get@ #///package.pom expected_package)) + (\ ///package.equivalence = expected_package) + not) + $///package.random) #let [good (..single expected_artifact expected_package) bad_sha-1 (..bad_sha-1 expected_artifact expected_package dummy_package) bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]] @@ -344,13 +344,13 @@ (Random [Artifact Artifact Artifact]) (do random.monad [dependee_artifact $///artifact.random - depender_artifact (random.filter (predicate.complement - (\ ///artifact.equivalence = dependee_artifact)) - $///artifact.random) - ignored_artifact (random.filter (predicate.complement - (predicate.unite (\ ///artifact.equivalence = dependee_artifact) - (\ ///artifact.equivalence = depender_artifact))) - $///artifact.random)] + depender_artifact (random.only (predicate.complement + (\ ///artifact.equivalence = dependee_artifact)) + $///artifact.random) + ignored_artifact (random.only (predicate.complement + (predicate.unite (\ ///artifact.equivalence = dependee_artifact) + (\ ///artifact.equivalence = depender_artifact))) + $///artifact.random)] (wrap [dependee_artifact depender_artifact ignored_artifact]))) (def: (packages [dependee_artifact depender_artifact ignored_artifact]) @@ -372,16 +372,16 @@ dependee_pom (|> (\ ///.monoid identity) (set@ #///.identity (#.Some dependee_artifact)) ///pom.write - try.assume) + try.assumed) depender_pom (|> (\ ///.monoid identity) (set@ #///.identity (#.Some depender_artifact)) - (set@ #///.dependencies (set.from_list ///dependency.hash (list dependee))) + (set@ #///.dependencies (set.of_list ///dependency.hash (list dependee))) ///pom.write - try.assume) + try.assumed) ignored_pom (|> (\ ///.monoid identity) (set@ #///.identity (#.Some ignored_artifact)) ///pom.write - try.assume) + try.assumed) dependee_package (set@ #///package.pom [dependee_pom diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index 5ba4bdbe4..cc2d78db7 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -54,7 +54,7 @@ hour (\ ! map (n.% 24) random.nat) minute (\ ! map (n.% 60) random.nat) second (\ ! map (n.% 60) random.nat)] - (wrap (try.assume + (wrap (try.assumed (do try.monad [year (year.year year) month (month.by_number month) @@ -64,7 +64,7 @@ #time.minute minute #time.second second #time.milli_second 0})] - (wrap (instant.from_date_time date time)))))))) + (wrap (instant.of_date_time date time)))))))) (def: #export test Test diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index 431370048..48738522a 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -58,7 +58,7 @@ hour (\ ! map (n.% 24) random.nat) minute (\ ! map (n.% 60) random.nat) second (\ ! map (n.% 60) random.nat)] - (wrap (try.assume + (wrap (try.assumed (do try.monad [year (year.year year) month (month.by_number month) @@ -68,7 +68,7 @@ #time.minute minute #time.second second #time.milli_second 0})] - (wrap (instant.from_date_time date time))))))) + (wrap (instant.of_date_time date time))))))) (def: random_versioning (Random Versioning) diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux index 33beaa7f9..360c30a4a 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -46,7 +46,7 @@ (def: (dictionary_of key_hash key_random value_random) (All [k v] (-> (Hash k) (Random k) (Random v) (Random (Dictionary k v)))) (\ random.functor map - (dictionary.from_list key_hash) + (dictionary.of_list key_hash) (..list_of (random.and key_random value_random)))) (def: random @@ -59,7 +59,7 @@ (: (-> (Set //.Source) (Set //.Source)) (function (_ sources) (if (set.empty? sources) - (set.from_list text.hash (list //.default_source)) + (set.of_list text.hash (list //.default_source)) sources))))) (def: with_default_repository @@ -108,7 +108,7 @@ [name (|> profile ..with_default_sources ..with_default_repository)])) - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (\ //project.equivalence = actual)) (#try.Failure error) diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux index 7163ac780..f29ae7087 100644 --- a/stdlib/source/test/aedifex/profile.lux +++ b/stdlib/source/test/aedifex/profile.lux @@ -80,13 +80,13 @@ (def: (set_of hash random) (All [a] (-> (Hash a) (Random a) (Random (Set a)))) (\ random.functor map - (set.from_list hash) + (set.of_list hash) (..list_of random))) (def: (dictionary_of key_hash key_random value_random) (All [k v] (-> (Hash k) (Random k) (Random v) (Random (Dictionary k v)))) (\ random.functor map - (dictionary.from_list key_hash) + (dictionary.of_list key_hash) (..list_of (random.and key_random value_random)))) (def: info diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux index 5b6de5403..d76d4afb3 100644 --- a/stdlib/source/test/aedifex/project.lux +++ b/stdlib/source/test/aedifex/project.lux @@ -52,17 +52,17 @@ not)) (do random.monad [[super_name super_profile] ..profile - [dummy_name dummy_profile] (random.filter (|>> product.left (text\= super_name) not) - ..profile) - [sub_name sub_profile] (random.filter (function (_ [name profile]) - (and (not (text\= super_name name)) - (not (text\= dummy_name name)))) - ..profile) - fake_name (random.filter (function (_ name) - (and (not (text\= super_name name)) - (not (text\= dummy_name name)) - (not (text\= sub_name name)))) - (random.ascii/alpha 1)) + [dummy_name dummy_profile] (random.only (|>> product.left (text\= super_name) not) + ..profile) + [sub_name sub_profile] (random.only (function (_ [name profile]) + (and (not (text\= super_name name)) + (not (text\= dummy_name name)))) + ..profile) + fake_name (random.only (function (_ name) + (and (not (text\= super_name name)) + (not (text\= dummy_name name)) + (not (text\= sub_name name)))) + (random.ascii/alpha 1)) #let [project ($_ (\ /.monoid compose) (/.project super_name super_profile) (/.project dummy_name dummy_profile) diff --git a/stdlib/source/test/aedifex/runtime.lux b/stdlib/source/test/aedifex/runtime.lux index 7d6d3f98b..f9749c968 100644 --- a/stdlib/source/test/aedifex/runtime.lux +++ b/stdlib/source/test/aedifex/runtime.lux @@ -44,7 +44,7 @@ [(_.cover [/.default_java /.default_js /.default_python /.default_lua /.default_ruby] (let [listing (|> (list /.default_java /.default_js /.default_python /.default_lua /.default_ruby) (list\map (get@ #/.program))) - unique (set.from_list text.hash listing)] + unique (set.of_list text.hash listing)] (n.= (list.size listing) (set.size unique))))] diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index d482d75d5..8cd7a7695 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -570,7 +570,7 @@ _ false)) (_.cover [/.char] (|> (`` (/.char (~~ (/.static static_char)))) - text.from_code + text.of_code (text\= static_char))) ))) @@ -871,16 +871,14 @@ (let [expected_pair (: (Pair Nat Int) {#left expected_nat #right expected_int})] (and (/.case expected_pair - (/.^multi (/.^ (!pair actual_left actual_right)) - [actual_left 0] - [actual_right +0]) + (/.^multi (/.^ (!pair 0 actual_right)) + {actual_right +0}) true _ false) (/.case expected_pair - (/.^multi (/.^ (!pair actual_left actual_right)) - (n.= 0 actual_left) + (/.^multi (/.^ (!pair 0 actual_right)) (i.= +0 actual_right)) true diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index 753494f48..007382e60 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -25,7 +25,7 @@ leftI random.int rightI random.int sample random.nat - different (|> random.nat (random.filter (|>> (n.= sample) not))) + different (|> random.nat (random.only (|>> (n.= sample) not))) #let [equivalence (: (Equivalence (Equivalence Nat)) (implementation (def: (= left right) diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index f5dd14646..deab85fe1 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -25,8 +25,8 @@ (Random (Interval Nat)) (do random.monad [bottom random.nat - top (random.filter (|>> (n.= bottom) not) - random.nat)] + top (random.only (|>> (n.= bottom) not) + random.nat)] (if ( top bottom) (wrap (/.between n.enum bottom top)) (wrap (/.between n.enum top bottom)))))] diff --git a/stdlib/source/test/lux/abstract/monad.lux b/stdlib/source/test/lux/abstract/monad.lux index cc4642e13..2c6fb3ac7 100644 --- a/stdlib/source/test/lux/abstract/monad.lux +++ b/stdlib/source/test/lux/abstract/monad.lux @@ -46,11 +46,11 @@ (|> poly (/.map identity.monad (|>> inc (\ identity.monad wrap))) (: (Identity (List Nat)))))) - (_.cover [/.filter] + (_.cover [/.only] (\ (list.equivalence n.equivalence) = - (list.filter n.even? poly) + (list.only n.even? poly) (|> poly - (/.filter identity.monad (|>> n.even? (\ identity.monad wrap))) + (/.only identity.monad (|>> n.even? (\ identity.monad wrap))) (: (Identity (List Nat)))))) (_.cover [/.fold] (n.= (list\fold n.+ 0 poly) diff --git a/stdlib/source/test/lux/abstract/order.lux b/stdlib/source/test/lux/abstract/order.lux index e9ced25ce..2974a8c88 100644 --- a/stdlib/source/test/lux/abstract/order.lux +++ b/stdlib/source/test/lux/abstract/order.lux @@ -23,7 +23,7 @@ (<| (_.covering /._) (do random.monad [left random.nat - right (|> random.nat (random.filter (|>> (n.= left) not))) + right (|> random.nat (random.only (|>> (n.= left) not))) #let [equivalence (: (Equivalence (/.Order Nat)) (implementation (def: (= leftO rightO) diff --git a/stdlib/source/test/lux/abstract/predicate.lux b/stdlib/source/test/lux/abstract/predicate.lux index 197953c49..d66513b63 100644 --- a/stdlib/source/test/lux/abstract/predicate.lux +++ b/stdlib/source/test/lux/abstract/predicate.lux @@ -45,7 +45,7 @@ ($contravariant.spec equivalence (multiple? 2) /.functor)) (let [generator (: (Random (/.Predicate Nat)) (|> random.nat - (random.filter (|>> (n.= 0) not)) + (random.only (|>> (n.= 0) not)) (\ ! map multiple?)))] ($_ _.and (_.for [/.union] @@ -76,7 +76,7 @@ ((/.difference /3? /2?) sample)))) (_.cover [/.rec] (let [even? (multiple? 2) - any-even? (: (/.Predicate (List Nat)) + any_even? (: (/.Predicate (List Nat)) (/.rec (function (_ recur) (function (_ values) (case values @@ -87,5 +87,5 @@ (or (even? head) (recur tail)))))))] (bit\= (list.any? even? samples) - (any-even? samples)))) + (any_even? samples)))) ))) diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux index 39265aafe..678a8aa99 100644 --- a/stdlib/source/test/lux/control/concatenative.lux +++ b/stdlib/source/test/lux/control/concatenative.lux @@ -92,12 +92,12 @@ /.drop /.drop))) )))) -(template: (!numerical <=> ) +(template: (!numerical <=> ) (: Test - (with_expansions [' (template.splice ) - ' (template.splice )] + (with_expansions [' (template.spliced ) + ' (template.spliced )] (do random.monad - [parameter (|> (random.filter )) + [parameter (|> (random.only )) subject ] (`` ($_ _.and (~~ (template [ ] diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index f229909bd..3ceac0c4b 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -33,7 +33,8 @@ ((on_mail message state self) (message state self)) - (message: (count! {increment Nat} state self Nat) + (message: (count! {increment Nat} state self) + Nat (let [state' (n.+ increment state)] (promise\wrap (#try.Success [state' state'])))) ) diff --git a/stdlib/source/test/lux/control/concurrency/atom.lux b/stdlib/source/test/lux/control/concurrency/atom.lux index 674e7dd3f..567f1c40a 100644 --- a/stdlib/source/test/lux/control/concurrency/atom.lux +++ b/stdlib/source/test/lux/control/concurrency/atom.lux @@ -27,7 +27,7 @@ (wrap (is? expected actual)))))) (do random.monad [target random.nat - unknown (random.filter (|>> (is? target) not) random.nat) + unknown (random.only (|>> (is? target) not) random.nat) expected random.nat #let [box (/.atom target)]] (_.cover [/.compare_and_swap] diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index c23428089..813ceb7ed 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -29,7 +29,7 @@ (def: injection (Injection /.Channel) (|>> promise.resolved - /.from_promise)) + /.of_promise)) (def: comparison (Comparison /.Channel) @@ -70,10 +70,10 @@ [inputs (random.list 5 random.nat) sample random.nat distint/0 random.nat - distint/1 (|> random.nat (random.filter (|>> (n.= distint/0) not))) - distint/2 (|> random.nat (random.filter (function (_ value) - (not (or (n.= distint/0 value) - (n.= distint/1 value)))))) + distint/1 (|> random.nat (random.only (|>> (n.= distint/0) not))) + distint/2 (|> random.nat (random.only (function (_ value) + (not (or (n.= distint/0 value) + (n.= distint/1 value)))))) shift random.nat] ($_ _.and (_.for [/.functor] @@ -117,9 +117,9 @@ (wrap (do promise.monad [output (|> sample promise.resolved - /.from_promise + /.of_promise /.consume)] - (_.cover' [/.from_promise /.consume] + (_.cover' [/.of_promise /.consume] (list\= (list sample) output)))) (wrap (do promise.monad @@ -132,10 +132,10 @@ (wrap (do promise.monad [output (|> inputs (/.sequential 0) - (/.filter n.even?) + (/.only n.even?) /.consume)] - (_.cover' [/.filter] - (list\= (list.filter n.even? inputs) + (_.cover' [/.only] + (list\= (list.only n.even? inputs) output)))) (wrap (do {! promise.monad} [#let [[?signal !signal] (: [(promise.Promise Any) (promise.Resolver Any)] diff --git a/stdlib/source/test/lux/control/concurrency/promise.lux b/stdlib/source/test/lux/control/concurrency/promise.lux index be2655334..3cc1a42c9 100644 --- a/stdlib/source/test/lux/control/concurrency/promise.lux +++ b/stdlib/source/test/lux/control/concurrency/promise.lux @@ -57,7 +57,7 @@ [to_wait (|> random.nat (\ ! map (|>> (n.% ..delay) (n.+ ..delay)))) expected random.nat dummy random.nat - #let [not_dummy (|> random.nat (random.filter (|>> (n.= dummy) not)))] + #let [not_dummy (|> random.nat (random.only (|>> (n.= dummy) not)))] leftE not_dummy rightE not_dummy] ($_ _.and diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux index 534d03252..21d81f014 100644 --- a/stdlib/source/test/lux/control/exception.lux +++ b/stdlib/source/test/lux/control/exception.lux @@ -27,7 +27,7 @@ Test (do {! random.monad} [expected random.nat - wrong (|> random.nat (random.filter (|>> (n.= expected) not))) + wrong (|> random.nat (random.only (|>> (n.= expected) not))) assertion_succeeded? random.bit #let [report_element (\ ! map %.nat random.nat)] field0 report_element diff --git a/stdlib/source/test/lux/control/function.lux b/stdlib/source/test/lux/control/function.lux index 46836db21..def4945cb 100644 --- a/stdlib/source/test/lux/control/function.lux +++ b/stdlib/source/test/lux/control/function.lux @@ -28,7 +28,7 @@ f0 (\ ! map n.+ random.nat) f1 (\ ! map n.* random.nat) dummy random.nat - extra (|> random.nat (random.filter (|>> (n.= expected) not)))] + extra (|> random.nat (random.only (|>> (n.= expected) not)))] (<| (_.covering /._) ($_ _.and (let [equivalence (: (Equivalence (-> Nat Nat)) diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 31b1e338d..38ed0f982 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -27,7 +27,7 @@ (do {! random.monad} [input (|> random.nat (\ ! map (|>> (n.% 6) (n.+ 20)))) dummy random.nat - shift (|> random.nat (random.filter (|>> (n.= dummy) not))) + shift (|> random.nat (random.only (|>> (n.= dummy) not))) #let [equivalence (: (Equivalence (/.Mixin Nat Nat)) (implementation (def: (= left right) @@ -123,9 +123,9 @@ (|> input function (state.run dummy) product.right)))) )) (_.for [/.Recursive] - (_.cover [/.from_recursive] + (_.cover [/.of_recursive] (let [factorial (/.mixin - (/.from_recursive + (/.of_recursive (function (_ recur input) (case input (^or 0 1) 1 diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index e9696fef8..003024197 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -90,8 +90,8 @@ [expected0 random.nat variadic (\ ! map (|>> (n.max 1) (n.min 20)) random.nat) expected+ (random.list variadic random.nat) - even0 (random.filter n.even? random.nat) - odd0 (random.filter n.odd? random.nat) + even0 (random.only n.even? random.nat) + odd0 (random.only n.odd? random.nat) not0 random.bit] ($_ _.and (_.cover [/.maybe] @@ -124,16 +124,16 @@ (|> (list\map (|>> .int code.int) expected+) (/.run (/.many .nat)) fails?))) - (_.cover [/.filter] + (_.cover [/.only] (and (|> (list (code.nat even0)) - (/.run (/.filter n.even? .nat)) + (/.run (/.only n.even? .nat)) (match actual (n.= even0 actual))) (|> (list (code.nat odd0)) - (/.run (/.filter n.even? .nat)) + (/.run (/.only n.even? .nat)) fails?))) (_.cover [/.and] - (let [even (/.filter n.even? .nat) - odd (/.filter n.odd? .nat)] + (let [even (/.only n.even? .nat) + odd (/.only n.odd? .nat)] (and (|> (list (code.nat even0) (code.nat odd0)) (/.run (/.and even odd)) (match [left right] @@ -143,8 +143,8 @@ (/.run (/.and even odd)) fails?)))) (_.cover [/.or] - (let [even (/.filter n.even? .nat) - odd (/.filter n.odd? .nat)] + (let [even (/.only n.even? .nat) + odd (/.only n.odd? .nat)] (and (|> (list (code.nat even0)) (/.run (/.or even odd)) (match (#.Left actual) (n.= even0 actual))) @@ -155,8 +155,8 @@ (/.run (/.or even odd)) fails?)))) (_.cover [/.either] - (let [even (/.filter n.even? .nat) - odd (/.filter n.odd? .nat)] + (let [even (/.only n.even? .nat) + odd (/.only n.odd? .nat)] (and (|> (list (code.nat even0)) (/.run (/.either even odd)) (match actual (n.= even0 actual))) @@ -181,7 +181,7 @@ [variadic (\ ! map (|>> (n.max 1) (n.min 20)) random.nat) times (\ ! map (n.% variadic) random.nat) expected random.nat - wrong (|> random.nat (random.filter (|>> (n.= expected) not))) + wrong (|> random.nat (random.only (|>> (n.= expected) not))) expected+ (random.list variadic random.nat) separator (random.ascii 1)] ($_ _.and @@ -259,11 +259,11 @@ Test (do random.monad [expected random.nat - even (random.filter n.even? random.nat) - odd (random.filter n.odd? random.nat) + even (random.only n.even? random.nat) + odd (random.only n.odd? random.nat) #let [nat^ .nat - even^ (/.filter n.even? .nat) - odd^ (/.filter n.odd? .nat)]] + even^ (/.only n.even? .nat) + odd^ (/.only n.odd? .nat)]] ($_ _.and (_.cover [/.rec] (let [parser (/.rec (function (_ self) diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index 972078a43..d49640f37 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -9,9 +9,9 @@ [monad (#+ do)]] [control [pipe (#+ case>)] + ["<>" parser] ["." try] - ["." exception] - ["<>" parser]] + ["." exception]] [data ["." binary] ["." sum] @@ -64,8 +64,8 @@ (def: random_text (Random Text) - (random.filter ..utf8_conversion_does_not_alter? - (random.unicode ..segment_size))) + (random.only ..utf8_conversion_does_not_alter? + (random.unicode ..segment_size))) (def: random_name (Random Name) diff --git a/stdlib/source/test/lux/control/parser/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux index fbf0a810f..608ee9675 100644 --- a/stdlib/source/test/lux/control/parser/cli.lux +++ b/stdlib/source/test/lux/control/parser/cli.lux @@ -32,13 +32,13 @@ (_.for [/.Parser]) (do {! random.monad} [expected (\ ! map n\encode random.nat) - #let [random-dummy (random.filter (|>> (text\= expected) not) - (random.unicode 5))] - dummy random-dummy + #let [random_dummy (random.only (|>> (text\= expected) not) + (random.unicode 5))] + dummy random_dummy short (random.unicode 1) long (random.unicode 2) - pre-ignore (random.list 5 random-dummy) - post-ignore (random.list 5 random-dummy)] + pre_ignore (random.list 5 random_dummy) + post_ignore (random.list 5 random_dummy)] ($_ _.and (_.cover [/.run /.any] (|> (/.run /.any (list expected)) @@ -57,7 +57,7 @@ (_.cover [/.somewhere] (|> (/.run (|> (/.somewhere (/.this expected)) (<>.before (<>.some /.any))) - (list.concat (list pre-ignore (list expected) post-ignore))) + (list.concat (list pre_ignore (list expected) post_ignore))) (!expect (#try.Success _)))) (_.cover [/.end] (and (|> (/.run /.end (list)) diff --git a/stdlib/source/test/lux/control/parser/code.lux b/stdlib/source/test/lux/control/parser/code.lux index 7bb5d1ddb..38d915243 100644 --- a/stdlib/source/test/lux/control/parser/code.lux +++ b/stdlib/source/test/lux/control/parser/code.lux @@ -54,7 +54,7 @@ (~~ (template [ ] [(do {! random.monad} [expected - dummy (|> (random.filter (|>> (\ = expected) not)))] + dummy (|> (random.only (|>> (\ = expected) not)))] ($_ _.and (_.cover [] (|> (/.run (list ( expected))) diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux index 6b6511e15..142e0cd42 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -38,7 +38,7 @@ (def: safe_frac (Random Frac) - (random.filter (|>> frac.not_a_number? not) random.frac)) + (random.only (|>> frac.not_a_number? not) random.frac)) (def: #export test Test @@ -57,7 +57,7 @@ (~~ (template [ ] [(do {! random.monad} [expected - dummy (|> (random.filter (|>> (\ = expected) not)))] + dummy (|> (random.only (|>> (\ = expected) not)))] ($_ _.and (_.cover [] (|> (/.run ( expected)) @@ -87,7 +87,7 @@ (exception.match? /.unexpected_value error)))))) (do {! random.monad} [expected (random.unicode 1) - dummy (|> (random.unicode 1) (random.filter (|>> (\ text.equivalence = expected) not)))] + dummy (|> (random.unicode 1) (random.only (|>> (\ text.equivalence = expected) not)))] (_.cover [/.value_mismatch] (|> (/.run (/.string! expected) (#json.String dummy)) (!expect (^multi (#try.Failure error) @@ -105,12 +105,12 @@ [size (\ ! map (n.% 10) random.nat) expected (|> (random.unicode 1) (random.list size) - (\ ! map row.from_list))] + (\ ! map row.of_list))] (_.cover [/.array] (|> (/.run (/.array (<>.some /.string)) (#json.Array (row\map (|>> #json.String) expected))) (!expect (^multi (#try.Success actual) - (\ (row.equivalence text.equivalence) = expected (row.from_list actual))))))) + (\ (row.equivalence text.equivalence) = expected (row.of_list actual))))))) (do {! random.monad} [expected (\ ! map (|>> #json.String) (random.unicode 1))] (_.cover [/.unconsumed_input] @@ -138,10 +138,10 @@ (/.field number_field /.number) (/.field string_field /.string))) (#json.Object - (dictionary.from_list text.hash - (list [boolean_field (#json.Boolean expected_boolean)] - [number_field (#json.Number expected_number)] - [string_field (#json.String expected_string)])))) + (dictionary.of_list text.hash + (list [boolean_field (#json.Boolean expected_boolean)] + [number_field (#json.Number expected_number)] + [string_field (#json.String expected_string)])))) (!expect (^multi (#try.Success [actual_boolean actual_number actual_string]) (and (\ bit.equivalence = expected_boolean actual_boolean) (\ frac.equivalence = expected_number actual_number) @@ -150,14 +150,14 @@ [size (\ ! map (n.% 10) random.nat) keys (random.list size (random.unicode 1)) values (random.list size (random.unicode 1)) - #let [expected (dictionary.from_list text.hash (list.zip/2 keys values))]] + #let [expected (dictionary.of_list text.hash (list.zip/2 keys values))]] (_.cover [/.dictionary] (|> (/.run (/.dictionary /.string) (#json.Object (|> values (list\map (|>> #json.String)) (list.zip/2 keys) - (dictionary.from_list text.hash)))) + (dictionary.of_list text.hash)))) (!expect (^multi (#try.Success actual) (\ (dictionary.equivalence text.equivalence) = expected actual)))))) )))) diff --git a/stdlib/source/test/lux/control/parser/synthesis.lux b/stdlib/source/test/lux/control/parser/synthesis.lux index 83211a95f..cd617ff8d 100644 --- a/stdlib/source/test/lux/control/parser/synthesis.lux +++ b/stdlib/source/test/lux/control/parser/synthesis.lux @@ -64,7 +64,7 @@ (~~ (template [ ] [(do {! random.monad} [expected - dummy (|> (random.filter (|>> (\ = expected) not)))] + dummy (|> (random.only (|>> (\ = expected) not)))] ($_ _.and (_.cover [] (|> (/.run (list ( expected))) diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index d00a21d90..46e0d4bda 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -75,64 +75,64 @@ [offset (\ ! map (n.% 50) random.nat) range (\ ! map (|>> (n.% 50) (n.+ 10)) random.nat) #let [limit (n.+ offset range)] - expected (\ ! map (|>> (n.% range) (n.+ offset) text.from_code) random.nat) + expected (\ ! map (|>> (n.% range) (n.+ offset) text.of_code) random.nat) out_of_range (case offset - 0 (\ ! map (|>> (n.% 10) inc (n.+ limit) text.from_code) random.nat) - _ (\ ! map (|>> (n.% offset) text.from_code) random.nat))] + 0 (\ ! map (|>> (n.% 10) inc (n.+ limit) text.of_code) random.nat) + _ (\ ! map (|>> (n.% offset) text.of_code) random.nat))] (_.cover [/.range] (and (..should_pass expected (/.range offset limit)) (..should_fail out_of_range (/.range offset limit))))) (do {! random.monad} [expected (random.char unicode.ascii/upper) - invalid (random.filter (|>> (unicode/block.within? unicode/block.basic_latin/upper) not) - (random.char unicode.character))] + invalid (random.only (|>> (unicode/block.within? unicode/block.basic_latin/upper) not) + (random.char unicode.character))] (_.cover [/.upper] - (and (..should_pass (text.from_code expected) /.upper) - (..should_fail (text.from_code invalid) /.upper)))) + (and (..should_pass (text.of_code expected) /.upper) + (..should_fail (text.of_code invalid) /.upper)))) (do {! random.monad} [expected (random.char unicode.ascii/lower) - invalid (random.filter (|>> (unicode/block.within? unicode/block.basic_latin/lower) not) - (random.char unicode.character))] + invalid (random.only (|>> (unicode/block.within? unicode/block.basic_latin/lower) not) + (random.char unicode.character))] (_.cover [/.lower] - (and (..should_pass (text.from_code expected) /.lower) - (..should_fail (text.from_code invalid) /.lower)))) + (and (..should_pass (text.of_code expected) /.lower) + (..should_fail (text.of_code invalid) /.lower)))) (do {! random.monad} [expected (\ ! map (n.% 10) random.nat) invalid (random.char (unicode.set [unicode/block.number_forms (list)]))] (_.cover [/.decimal] (and (..should_pass (\ n.decimal encode expected) /.decimal) - (..should_fail (text.from_code invalid) /.decimal)))) + (..should_fail (text.of_code invalid) /.decimal)))) (do {! random.monad} [expected (\ ! map (n.% 8) random.nat) invalid (random.char (unicode.set [unicode/block.number_forms (list)]))] (_.cover [/.octal] (and (..should_pass (\ n.octal encode expected) /.octal) - (..should_fail (text.from_code invalid) /.octal)))) + (..should_fail (text.of_code invalid) /.octal)))) (do {! random.monad} [expected (\ ! map (n.% 16) random.nat) invalid (random.char (unicode.set [unicode/block.number_forms (list)]))] (_.cover [/.hexadecimal] (and (..should_pass (\ n.hex encode expected) /.hexadecimal) - (..should_fail (text.from_code invalid) /.hexadecimal)))) + (..should_fail (text.of_code invalid) /.hexadecimal)))) (do {! random.monad} [expected (random.char unicode.ascii/alpha) - invalid (random.filter (function (_ char) - (not (or (unicode/block.within? unicode/block.basic_latin/upper char) - (unicode/block.within? unicode/block.basic_latin/lower char)))) - (random.char unicode.character))] + invalid (random.only (function (_ char) + (not (or (unicode/block.within? unicode/block.basic_latin/upper char) + (unicode/block.within? unicode/block.basic_latin/lower char)))) + (random.char unicode.character))] (_.cover [/.alpha] - (and (..should_pass (text.from_code expected) /.alpha) - (..should_fail (text.from_code invalid) /.alpha)))) + (and (..should_pass (text.of_code expected) /.alpha) + (..should_fail (text.of_code invalid) /.alpha)))) (do {! random.monad} [expected (random.char unicode.ascii/alpha_num) - invalid (random.filter (function (_ char) - (not (or (unicode/block.within? unicode/block.basic_latin/upper char) - (unicode/block.within? unicode/block.basic_latin/lower char) - (unicode/block.within? unicode/block.basic_latin/decimal char)))) - (random.char unicode.character))] + invalid (random.only (function (_ char) + (not (or (unicode/block.within? unicode/block.basic_latin/upper char) + (unicode/block.within? unicode/block.basic_latin/lower char) + (unicode/block.within? unicode/block.basic_latin/decimal char)))) + (random.char unicode.character))] (_.cover [/.alpha_num] - (and (..should_pass (text.from_code expected) /.alpha_num) - (..should_fail (text.from_code invalid) /.alpha_num)))) + (and (..should_pass (text.of_code expected) /.alpha_num) + (..should_fail (text.of_code invalid) /.alpha_num)))) (do {! random.monad} [expected ($_ random.either (wrap text.tab) @@ -141,13 +141,13 @@ (wrap text.new_line) (wrap text.carriage_return) (wrap text.form_feed)) - invalid (|> (random.unicode 1) (random.filter (function (_ char) - (not (or (text\= text.tab char) - (text\= text.vertical_tab char) - (text\= text.space char) - (text\= text.new_line char) - (text\= text.carriage_return char) - (text\= text.form_feed char))))))] + invalid (|> (random.unicode 1) (random.only (function (_ char) + (not (or (text\= text.tab char) + (text\= text.vertical_tab char) + (text\= text.space char) + (text\= text.new_line char) + (text\= text.carriage_return char) + (text\= text.form_feed char))))))] (_.cover [/.space] (and (..should_pass expected /.space) (..should_fail invalid /.space)))) @@ -156,25 +156,25 @@ options (|> (random.char unicode.character) (random.set n.hash num_options) (\ ! map (|>> set.to_list - (list\map text.from_code) + (list\map text.of_code) (text.join_with "")))) expected (\ ! map (function (_ value) (|> options (text.nth (n.% num_options value)) maybe.assume)) random.nat) - invalid (random.filter (function (_ char) - (not (text.contains? (text.from_code char) options))) - (random.char unicode.character))] + invalid (random.only (function (_ char) + (not (text.contains? (text.of_code char) options))) + (random.char unicode.character))] (_.cover [/.one_of /.one_of! /.character_should_be] - (and (..should_pass (text.from_code expected) (/.one_of options)) - (..should_fail (text.from_code invalid) (/.one_of options)) - (..should_fail' (text.from_code invalid) (/.one_of options) + (and (..should_pass (text.of_code expected) (/.one_of options)) + (..should_fail (text.of_code invalid) (/.one_of options)) + (..should_fail' (text.of_code invalid) (/.one_of options) /.character_should_be) - (..should_pass! (text.from_code expected) (/.one_of! options)) - (..should_fail (text.from_code invalid) (/.one_of! options)) - (..should_fail' (text.from_code invalid) (/.one_of! options) + (..should_pass! (text.of_code expected) (/.one_of! options)) + (..should_fail (text.of_code invalid) (/.one_of! options)) + (..should_fail' (text.of_code invalid) (/.one_of! options) /.character_should_be) ))) (do {! random.monad} @@ -182,25 +182,25 @@ options (|> (random.char unicode.character) (random.set n.hash num_options) (\ ! map (|>> set.to_list - (list\map text.from_code) + (list\map text.of_code) (text.join_with "")))) invalid (\ ! map (function (_ value) (|> options (text.nth (n.% num_options value)) maybe.assume)) random.nat) - expected (random.filter (function (_ char) - (not (text.contains? (text.from_code char) options))) - (random.char unicode.character))] + expected (random.only (function (_ char) + (not (text.contains? (text.of_code char) options))) + (random.char unicode.character))] (_.cover [/.none_of /.none_of! /.character_should_not_be] - (and (..should_pass (text.from_code expected) (/.none_of options)) - (..should_fail (text.from_code invalid) (/.none_of options)) - (..should_fail' (text.from_code invalid) (/.none_of options) + (and (..should_pass (text.of_code expected) (/.none_of options)) + (..should_fail (text.of_code invalid) (/.none_of options)) + (..should_fail' (text.of_code invalid) (/.none_of options) /.character_should_not_be) - (..should_pass! (text.from_code expected) (/.none_of! options)) - (..should_fail (text.from_code invalid) (/.none_of! options)) - (..should_fail' (text.from_code invalid) (/.none_of! options) + (..should_pass! (text.of_code expected) (/.none_of! options)) + (..should_fail (text.of_code invalid) (/.none_of! options)) + (..should_fail' (text.of_code invalid) (/.none_of! options) /.character_should_not_be) ))) )) @@ -215,7 +215,7 @@ #let [expected (format left right)] invalid (|> random.nat (\ ! map (n.% 16)) - (random.filter (n.>= 8)) + (random.only (n.>= 8)) (\ ! map (\ n.hex encode)))] (_.cover [/.many /.many!] (and (..should_pass expected (/.many /.octal)) @@ -228,7 +228,7 @@ #let [expected (format left right)] invalid (|> random.nat (\ ! map (n.% 16)) - (random.filter (n.>= 8)) + (random.only (n.>= 8)) (\ ! map (\ n.hex encode)))] (_.cover [/.some /.some!] (and (..should_pass expected (/.some /.octal)) @@ -309,7 +309,7 @@ [#let [size 10] expected (random.unicode size) dummy (|> (random.unicode size) - (random.filter (|>> (text\= expected) not)))] + (random.only (|>> (text\= expected) not)))] (_.cover [/.this /.cannot_match] (and (|> (/.run (/.this expected) expected) @@ -373,8 +373,8 @@ (do {! random.monad} [left (random.unicode 1) right (random.unicode 1) - expected (random.filter (|>> (text\= right) not) - (random.unicode 1))] + expected (random.only (|>> (text\= right) not) + (random.unicode 1))] (_.cover [/.enclosed] (|> (format left expected right) (/.run (/.enclosed [left right] (/.this expected))) @@ -397,18 +397,18 @@ (text\= expected actual)))))) (do {! random.monad} [invalid (random.ascii/upper 1) - expected (random.filter (|>> (unicode/block.within? unicode/block.basic_latin/upper) - not) - (random.char unicode.character)) + expected (random.only (|>> (unicode/block.within? unicode/block.basic_latin/upper) + not) + (random.char unicode.character)) #let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]] (_.cover [/.not /.not! /.expected_to_fail] - (and (..should_pass (text.from_code expected) (/.not /.upper)) + (and (..should_pass (text.of_code expected) (/.not /.upper)) (|> invalid (/.run (/.not /.upper)) (!expect (^multi (#try.Failure error) (exception.match? /.expected_to_fail error)))) - (..should_pass! (text.from_code expected) (/.not! upper!)) + (..should_pass! (text.of_code expected) (/.not! upper!)) (|> invalid (/.run (/.not! upper!)) (!expect (^multi (#try.Failure error) @@ -416,20 +416,20 @@ (do {! random.monad} [upper (random.ascii/upper 1) lower (random.ascii/lower 1) - invalid (random.filter (function (_ char) - (not (or (unicode/block.within? unicode/block.basic_latin/upper char) - (unicode/block.within? unicode/block.basic_latin/lower char)))) - (random.char unicode.character)) + invalid (random.only (function (_ char) + (not (or (unicode/block.within? unicode/block.basic_latin/upper char) + (unicode/block.within? unicode/block.basic_latin/lower char)))) + (random.char unicode.character)) #let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ") lower! (/.one_of! "abcdefghijklmnopqrstuvwxyz")]] (_.cover [/.and /.and!] (and (..should_pass (format upper lower) (/.and /.upper /.lower)) - (..should_fail (format (text.from_code invalid) lower) (/.and /.upper /.lower)) - (..should_fail (format upper (text.from_code invalid)) (/.and /.upper /.lower)) + (..should_fail (format (text.of_code invalid) lower) (/.and /.upper /.lower)) + (..should_fail (format upper (text.of_code invalid)) (/.and /.upper /.lower)) (..should_pass! (format upper lower) (/.and! upper! lower!)) - (..should_fail (format (text.from_code invalid) lower) (/.and! upper! lower!)) - (..should_fail (format upper (text.from_code invalid)) (/.and! upper! lower!))))) + (..should_fail (format (text.of_code invalid) lower) (/.and! upper! lower!)) + (..should_fail (format upper (text.of_code invalid)) (/.and! upper! lower!))))) (do {! random.monad} [expected (random.unicode 1) invalid (random.unicode 1)] diff --git a/stdlib/source/test/lux/control/parser/tree.lux b/stdlib/source/test/lux/control/parser/tree.lux index e330464b4..4b3bf2cad 100644 --- a/stdlib/source/test/lux/control/parser/tree.lux +++ b/stdlib/source/test/lux/control/parser/tree.lux @@ -30,7 +30,7 @@ (template: (!cover ) (do {! random.monad} [dummy random.nat - expected (|> random.nat (random.filter (|>> (n.= dummy) not)))] + expected (|> random.nat (random.only (|>> (n.= dummy) not)))] (_.cover (|> (/.run ) @@ -40,7 +40,7 @@ (template: (!cover/2 ) (do {! random.monad} [dummy random.nat - expected (|> random.nat (random.filter (|>> (n.= dummy) not)))] + expected (|> random.nat (random.only (|>> (n.= dummy) not)))] (_.cover (and (|> (/.run ) (!expect (^multi (#try.Success actual) diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux index 7a8feca69..37be6989c 100644 --- a/stdlib/source/test/lux/control/parser/type.lux +++ b/stdlib/source/test/lux/control/parser/type.lux @@ -39,8 +39,8 @@ (<| (_.for [/.types_do_not_match]) (do {! random.monad} [expected ..primitive - dummy (random.filter (|>> (type\= expected) not) - ..primitive)]) + dummy (random.only (|>> (type\= expected) not) + ..primitive)]) ($_ _.and (_.cover [/.exactly] (and (|> (/.run (/.exactly expected) expected) @@ -105,14 +105,14 @@ (type.variant (list expected_left expected_middle expected_right))) (!expect (^multi (#try.Failure error) (exception.match? /.not_function error)))))) - (_.cover [/.apply /.not_application] - (and (|> (/.run (/.apply ($_ //.and /.any /.any /.any)) + (_.cover [/.applied /.not_application] + (and (|> (/.run (/.applied ($_ //.and /.any /.any /.any)) (type.application (list expected_middle expected_right) expected_left)) (!expect (^multi (#try.Success [actual_left actual_middle actual_right]) (and (type\= expected_left actual_left) (type\= expected_middle actual_middle) (type\= expected_right actual_right))))) - (|> (/.run (/.apply ($_ //.and /.any /.any /.any)) + (|> (/.run (/.applied ($_ //.and /.any /.any /.any)) (type.variant (list expected_left expected_middle expected_right))) (!expect (^multi (#try.Failure error) (exception.match? /.not_application error)))))) @@ -235,8 +235,8 @@ (is? /.fresh environment)))))) (do {! random.monad} [expected ..primitive - dummy (random.filter (|>> (type\= expected) not) - ..primitive)] + dummy (random.only (|>> (type\= expected) not) + ..primitive)] (_.cover [/.local] (|> (/.run (do //.monad [_ /.any] diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index aab371fa9..46d80dcc3 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -35,7 +35,7 @@ false)) (template: (!failure ) - (with_expansions [<> (template.splice )] + (with_expansions [<> (template.spliced )] (do {! random.monad} [expected (random.ascii/alpha 1)] (_.cover [] @@ -149,8 +149,8 @@ (#xml.Node tag (dictionary.new name.hash) children)))] parent ..random_tag right ..random_tag - wrong (random.filter (|>> (name\= right) not) - ..random_tag) + wrong (random.only (|>> (name\= right) not) + ..random_tag) #let [parser (<| (/.node parent) (do //.monad [_ (<| /.somewhere diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index fceb62bc7..bd6351ded 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -1,7 +1,7 @@ (.module: [library [lux #* - [type (#+ :share)] + [type (#+ :sharing)] ["_" test (#+ Test)] [abstract [equivalence (#+ Equivalence)] @@ -58,18 +58,18 @@ (def: comparison (Comparison (All [a] (All [! r] (Region r (Thread !) a)))) (function (_ == left right) - (case [(:share [a] - (Equivalence a) - == - - (Try a) - (thread.run (:assume (/.run thread.monad left)))) - (:share [a] - (Equivalence a) - == - - (Try a) - (thread.run (:assume (/.run thread.monad right))))] + (case [(:sharing [a] + (Equivalence a) + == + + (Try a) + (thread.run (:assume (/.run thread.monad left)))) + (:sharing [a] + (Equivalence a) + == + + (Try a) + (thread.run (:assume (/.run thread.monad right))))] [(#try.Success left) (#try.Success right)] (== left right) diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index 0872db2da..882864ffd 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -42,7 +42,7 @@ (_.for [/.Try]) (do random.monad [expected random.nat - alternative (|> random.nat (random.filter (|>> (n.= expected) not))) + alternative (|> random.nat (random.only (|>> (n.= expected) not))) error (random.unicode 1) #let [(^open "io\.") io.monad]]) ($_ _.and @@ -55,34 +55,20 @@ (_.for [/.monad] ($monad.spec ..injection ..comparison /.monad)) - (_.cover [/.succeed] - (case (/.succeed expected) - (#/.Success actual) - (n.= expected actual) - - _ - false)) - (_.cover [/.fail] - (case (/.fail error) - (#/.Failure message) - (text\= error message) - - _ - false)) - (_.cover [/.assume] + (_.cover [/.assumed] (n.= expected - (/.assume (/.succeed expected)))) - (_.cover [/.from_maybe] - (case [(/.from_maybe (#.Some expected)) - (/.from_maybe #.None)] + (/.assumed (#/.Success expected)))) + (_.cover [/.of_maybe] + (case [(/.of_maybe (#.Some expected)) + (/.of_maybe #.None)] [(#/.Success actual) (#/.Failure _)] (n.= expected actual) _ false)) - (_.cover [/.to_maybe] - (case [(/.to_maybe (/.succeed expected)) - (/.to_maybe (/.fail error))] + (_.cover [/.maybe] + (case [(/.maybe (#/.Success expected)) + (/.maybe (: (/.Try Nat) (#/.Failure error)))] [(#.Some actual) #.None] (n.= expected actual) @@ -90,14 +76,13 @@ false)) (_.cover [/.default] (and (n.= expected - (/.default alternative (/.succeed expected))) + (/.default alternative (#/.Success expected))) (n.= alternative - (/.default alternative (: (Try Nat) - (/.fail error)))))) - (_.cover [/.with /.lift] - (let [lift (/.lift io.monad)] + (/.default alternative (: (Try Nat) (#/.Failure error)))))) + (_.cover [/.with /.lifted] + (let [lifted (/.lifted io.monad)] (|> (do (/.with io.monad) - [a (lift (io\wrap expected)) + [a (lifted (io\wrap expected)) b (wrap alternative)] (wrap (n.+ a b))) io.run diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index 879c0c722..2a8f519fa 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -38,7 +38,7 @@ (if (n.< size idx) (do random.monad [byte random.nat] - (exec (try.assume (/.write/8 idx byte output)) + (exec (try.assumed (/.write/8 idx byte output)) (recur (inc idx)))) (\ random.monad wrap output))))) @@ -113,7 +113,7 @@ (_.cover [/.read/64 /.write/64] (..binary_io 3 /.read/64 /.write/64 value)))) (_.cover [/.slice] - (let [random_slice (try.assume (/.slice offset length sample)) + (let [random_slice (try.assumed (/.slice offset length sample)) idxs (: (List Nat) (case length 0 (list) diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index ccf1d3484..29f0c733a 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -24,7 +24,7 @@ (def: injection (Injection Array) - (|>> list /.from_list)) + (|>> list /.of_list)) (def: bounded_size (Random Nat) @@ -96,7 +96,7 @@ [size ..bounded_size base random.nat shift random.nat - dummy (random.filter (|>> (n.= base) not) random.nat) + dummy (random.only (|>> (n.= base) not) random.nat) #let [expected (n.+ base shift)] the_array (random.array size random.nat)] ($_ _.and @@ -182,10 +182,10 @@ (/.vacancy the_array))))))) (do ! [the_list (random.list size random.nat)] - (_.cover [/.from_list /.to_list] - (and (|> the_list /.from_list /.to_list + (_.cover [/.of_list /.to_list] + (and (|> the_list /.of_list /.to_list (\ (list.equivalence n.equivalence) = the_list)) - (|> the_array /.to_list /.from_list + (|> the_array /.to_list /.of_list (\ (/.equivalence n.equivalence) = the_array))))) (do ! [amount (\ ! map (n.% (inc size)) random.nat)] @@ -201,8 +201,8 @@ (and (not (is? the_array clone)) (\ (/.equivalence n.equivalence) = the_array clone)))) (let [the_array (/.clone the_array) - evens (|> the_array /.to_list (list.filter n.even?)) - odds (|> the_array /.to_list (list.filter n.odd?))] + evens (|> the_array /.to_list (list.only n.even?)) + odds (|> the_array /.to_list (list.only n.odd?))] (_.cover [/.filter!] (exec (/.filter! n.even? the_array) (and (n.= (list.size evens) (/.occupancy the_array)) @@ -210,11 +210,11 @@ (|> the_array /.to_list (\ (list.equivalence n.equivalence) = evens)))))) (do ! [#let [the_array (/.clone the_array) - members (|> the_array /.to_list (set.from_list n.hash))] - default (random.filter (function (_ value) - (not (or (n.even? value) - (set.member? members value)))) - random.nat)] + members (|> the_array /.to_list (set.of_list n.hash))] + default (random.only (function (_ value) + (not (or (n.even? value) + (set.member? members value)))) + random.nat)] (_.cover [/.to_list'] (exec (/.filter! n.even? the_array) (list.every? (function (_ value) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 541092b4e..fb82ed6c9 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -26,7 +26,7 @@ (def: injection (Injection (/.Dictionary Nat)) - (|>> [0] list (/.from_list n.hash))) + (|>> [0] list (/.of_list n.hash))) (def: for_dictionaries Test @@ -34,10 +34,10 @@ [#let [capped_nat (\ random.monad map (n.% 100) random.nat)] size capped_nat dict (random.dictionary n.hash size random.nat capped_nat) - non_key (random.filter (|>> (/.key? dict) not) - random.nat) - test_val (random.filter (|>> (list.member? n.equivalence (/.values dict)) not) - random.nat)] + non_key (random.only (|>> (/.key? dict) not) + random.nat) + test_val (random.only (|>> (list.member? n.equivalence (/.values dict)) not) + random.nat)] ($_ _.and (_.cover [/.size] (n.= size (/.size dict))) @@ -72,7 +72,7 @@ unique_keys! (|> entries (list\map product.left) - (set.from_list n.hash) + (set.of_list n.hash) set.size (n.= (/.size dict))) @@ -95,7 +95,7 @@ unique_keys! (|> keys - (set.from_list n.hash) + (set.of_list n.hash) set.size (n.= (/.size dict))) @@ -113,7 +113,7 @@ (= dict (/.merge dict dict))) overwritting_keys (let [dict' (|> dict /.entries (list\map (function (_ [k v]) [k (inc v)])) - (/.from_list n.hash)) + (/.of_list n.hash)) (^open ".") (/.equivalence n.equivalence)] (= dict' (/.merge dict' dict)))] (and merging_with_oneself @@ -124,10 +124,10 @@ (list.zip/2 (/.values dict) (/.values (/.merge_with n.+ dict dict))))) - (_.cover [/.from_list] + (_.cover [/.of_list] (let [(^open ".") (/.equivalence n.equivalence)] (and (= dict dict) - (|> dict /.entries (/.from_list n.hash) (= dict))))) + (|> dict /.entries (/.of_list n.hash) (= dict))))) ))) (def: for_entries @@ -136,10 +136,10 @@ [#let [capped_nat (\ random.monad map (n.% 100) random.nat)] size capped_nat dict (random.dictionary n.hash size random.nat capped_nat) - non_key (random.filter (|>> (/.key? dict) not) - random.nat) - test_val (random.filter (|>> (list.member? n.equivalence (/.values dict)) not) - random.nat)] + non_key (random.only (|>> (/.key? dict) not) + random.nat) + test_val (random.only (|>> (list.member? n.equivalence (/.values dict)) not) + random.nat)] ($_ _.and (_.cover [/.key?] (list.every? (/.key? dict) @@ -256,10 +256,10 @@ [#let [capped_nat (\ random.monad map (n.% 100) random.nat)] size capped_nat dict (random.dictionary n.hash size random.nat capped_nat) - non_key (random.filter (|>> (/.key? dict) not) - random.nat) - test_val (random.filter (|>> (list.member? n.equivalence (/.values dict)) not) - random.nat)] + non_key (random.only (|>> (/.key? dict) not) + random.nat) + test_val (random.only (|>> (list.member? n.equivalence (/.values dict)) not) + random.nat)] ($_ _.and (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index bfa0175bb..6884c0e28 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -32,8 +32,8 @@ _ (do random.monad [partial (dictionary order gen_key gen_value (dec size)) - key (random.filter (|>> (/.key? partial) not) - gen_key) + key (random.only (|>> (/.key? partial) not) + gen_key) value gen_value] (wrap (/.put key value partial))))) @@ -45,13 +45,13 @@ [size (\ ! map (n.% 100) random.nat) keys (random.set n.hash size random.nat) values (random.set n.hash size random.nat) - extra_key (random.filter (|>> (set.member? keys) not) - random.nat) + extra_key (random.only (|>> (set.member? keys) not) + random.nat) extra_value random.nat shift random.nat #let [pairs (list.zip/2 (set.to_list keys) (set.to_list values)) - sample (/.from_list n.order pairs) + sample (/.of_list n.order pairs) sorted_pairs (list.sort (function (_ [left _] [right _]) (n.< left right)) pairs) @@ -98,9 +98,9 @@ (_.cover [/.keys /.values] (list\= (/.entries sample) (list.zip/2 (/.keys sample) (/.values sample)))) - (_.cover [/.from_list] + (_.cover [/.of_list] (|> sample - /.entries (/.from_list n.order) + /.entries (/.of_list n.order) (/\= sample))) (_.cover [/.key?] (and (list.every? (/.key? sample) diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux index 450d3b733..f86f4c13c 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux @@ -37,9 +37,9 @@ size (\ ! map (n.% 100) random.nat) sample (..random size gen_key random.nat) - #let [keys (|> sample /.keys (set.from_list text.hash))] - extra_key (random.filter (|>> (set.member? keys) not) - gen_key) + #let [keys (|> sample /.keys (set.of_list text.hash))] + extra_key (random.only (|>> (set.member? keys) not) + gen_key) extra_value random.nat shift random.nat] ($_ _.and diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 5f1befd45..a19738802 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -181,15 +181,15 @@ (let [(^open "/\.") (/.equivalence n.equivalence) (^open "/\.") /.monoid] (do {! random.monad} - [sample (random.filter (|>> /.size (n.> 0)) - ..random) + [sample (random.only (|>> /.size (n.> 0)) + ..random) #let [size (/.size sample)] idx (\ ! map (n.% size) random.nat) chunk_size (\ ! map (|>> (n.% size) inc) random.nat)] ($_ _.and - (_.cover [/.filter] - (let [positives (/.filter n.even? sample) - negatives (/.filter (bit.complement n.even?) sample)] + (_.cover [/.only] + (let [positives (/.only n.even? sample) + negatives (/.only (bit.complement n.even?) sample)] (and (/.every? n.even? positives) (not (/.any? n.even? negatives)) @@ -198,9 +198,9 @@ (/.size negatives)))))) (_.cover [/.partition] (let [[positives negatives] (/.partition n.even? sample)] - (and (/\= (/.filter n.even? sample) + (and (/\= (/.only n.even? sample) positives) - (/\= (/.filter (bit.complement n.even?) sample) + (/\= (/.only (bit.complement n.even?) sample) negatives)))) (_.cover [/.split] (let [[left right] (/.split idx sample)] @@ -362,7 +362,7 @@ ($_ _.and (_.cover [/.one] (case [(|> sample - (/.filter n.even?) + (/.only n.even?) (/\map (\ n.decimal encode)) /.head) (/.one choose sample)] @@ -377,7 +377,7 @@ (_.cover [/.all] (\ (/.equivalence text.equivalence) = (|> sample - (/.filter n.even?) + (/.only n.even?) (/\map (\ n.decimal encode))) (/.all choose sample))) (_.cover [/.find] diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux index 3181c9bcc..3bc695aca 100644 --- a/stdlib/source/test/lux/data/collection/queue.lux +++ b/stdlib/source/test/lux/data/collection/queue.lux @@ -21,7 +21,7 @@ (def: injection (Injection /.Queue) - (|>> list /.from_list)) + (|>> list /.of_list)) (def: #export test Test @@ -30,18 +30,18 @@ (do {! random.monad} [size (\ ! map (n.% 100) random.nat) members (random.set n.hash size random.nat) - non_member (random.filter (|>> (set.member? members) not) - random.nat) + non_member (random.only (|>> (set.member? members) not) + random.nat) #let [members (set.to_list members) - sample (/.from_list members)]] + sample (/.of_list members)]] ($_ _.and (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) (random.queue size random.nat))) (_.for [/.functor] ($functor.spec ..injection /.equivalence /.functor)) - (_.cover [/.from_list /.to_list] - (|> members /.from_list /.to_list + (_.cover [/.of_list /.to_list] + (|> members /.of_list /.to_list (\ (list.equivalence n.equivalence) = members))) (_.cover [/.size] (n.= size (/.size sample))) diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux index 55d643aa8..a43b0e278 100644 --- a/stdlib/source/test/lux/data/collection/queue/priority.lux +++ b/stdlib/source/test/lux/data/collection/queue/priority.lux @@ -32,12 +32,12 @@ (do {! random.monad} [size (\ ! map (n.% 100) random.nat) sample (..random size) - non-member-priority random.nat - non-member (random.filter (|>> (/.member? n.equivalence sample) not) - random.nat) + non_member_priority random.nat + non_member (random.only (|>> (/.member? n.equivalence sample) not) + random.nat) - max-member random.nat - min-member random.nat] + max_member random.nat + min_member random.nat] ($_ _.and (_.cover [/.size] (n.= size (/.size sample))) @@ -61,11 +61,11 @@ #.None (/.empty? sample))) (_.cover [/.push] - (let [sample+ (/.push non-member-priority non-member sample)] - (and (not (/.member? n.equivalence sample non-member)) + (let [sample+ (/.push non_member_priority non_member sample)] + (and (not (/.member? n.equivalence sample non_member)) (n.= (inc (/.size sample)) (/.size sample+)) - (/.member? n.equivalence sample+ non-member)))) + (/.member? n.equivalence sample+ non_member)))) (_.cover [/.pop] (let [sample- (/.pop sample)] (or (and (/.empty? sample) @@ -76,18 +76,18 @@ ($_ _.and (_.cover [/.max] (|> /.empty - (/.push /.min min-member) - (/.push /.max max-member) + (/.push /.min min_member) + (/.push /.max max_member) /.peek - (maybe\map (n.= max-member)) + (maybe\map (n.= max_member)) (maybe.default false))) (_.cover [/.min] (|> /.empty - (/.push /.max max-member) - (/.push /.min min-member) + (/.push /.max max_member) + (/.push /.min min_member) /.pop /.peek - (maybe\map (n.= min-member)) + (maybe\map (n.= min_member)) (maybe.default false))) )) )))) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index 6b7b09fdc..fdd2c6276 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -50,7 +50,7 @@ (do {! random.monad} [size (\ ! map (n.% 100) random.nat) sample (random.set n.hash size random.nat) - #let [sample (|> sample set.to_list /.from_list)] + #let [sample (|> sample set.to_list /.of_list)] #let [(^open "/\.") (/.equivalence n.equivalence)]] ($_ _.and (_.cover [/.size] @@ -59,8 +59,8 @@ (bit\= (/.empty? sample) (n.= 0 (/.size sample)))) (_.cover [/.empty] (/.empty? /.empty)) - (_.cover [/.to_list /.from_list] - (|> sample /.to_list /.from_list (/\= sample))) + (_.cover [/.to_list /.of_list] + (|> sample /.to_list /.of_list (/\= sample))) (_.cover [/.reverse] (or (n.< 2 (/.size sample)) (let [not_same! @@ -87,9 +87,9 @@ [good_index (|> random.nat (\ ! map (n.% size))) #let [bad_index (n.+ size good_index)] sample (random.set n.hash size random.nat) - non_member (random.filter (|>> (set.member? sample) not) - random.nat) - #let [sample (|> sample set.to_list /.from_list)]] + non_member (random.only (|>> (set.member? sample) not) + random.nat) + #let [sample (|> sample set.to_list /.of_list)]] ($_ _.and (_.cover [/.nth] (case (/.nth good_index sample) @@ -142,9 +142,9 @@ (do ! [sample (random.set n.hash size random.nat) - non_member (random.filter (|>> (set.member? sample) not) - random.nat) - #let [sample (|> sample set.to_list /.from_list)] + non_member (random.only (|>> (set.member? sample) not) + random.nat) + #let [sample (|> sample set.to_list /.of_list)] #let [(^open "/\.") (/.equivalence n.equivalence)]] ($_ _.and (do ! @@ -152,7 +152,7 @@ value/1 random.nat value/2 random.nat] (_.cover [/.row] - (/\= (/.from_list (list value/0 value/1 value/2)) + (/\= (/.of_list (list value/0 value/1 value/2)) (/.row value/0 value/1 value/2)))) (_.cover [/.member?] (and (list.every? (/.member? n.equivalence sample) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index 8a8adf0a0..5058fae08 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -84,9 +84,9 @@ (_.cover [/.tail] (list\= (enum.range n.enum (inc offset) (n.+ size offset)) (/.take size (/.tail (/.iterate inc offset))))) - (_.cover [/.filter] + (_.cover [/.only] (list\= (list\map (n.* 2) (enum.range n.enum 0 (dec size))) - (/.take size (/.filter n.even? (/.iterate inc 0))))) + (/.take size (/.only n.even? (/.iterate inc 0))))) (_.cover [/.partition] (let [[evens odds] (/.partition n.even? (/.iterate inc 0))] (and (n.= (n.* 2 offset) diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index 021df152d..64556ed63 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -36,7 +36,7 @@ ($equivalence.spec /.equivalence (random.set n.hash size random.nat))) (_.for [/.hash] (|> random.nat - (\ random.monad map (|>> list (/.from_list n.hash))) + (\ random.monad map (|>> list (/.of_list n.hash))) ($hash.spec /.hash))) (_.for [/.monoid] ($monoid.spec /.equivalence (/.monoid n.hash) (random.set n.hash size random.nat))) @@ -46,8 +46,8 @@ sizeR ..gen_nat setL (random.set n.hash sizeL random.nat) setR (random.set n.hash sizeR random.nat) - non_memberL (random.filter (|>> (/.member? setL) not) - random.nat)] + non_memberL (random.only (|>> (/.member? setL) not) + random.nat)] ($_ _.and (_.cover [/.new] (/.empty? (/.new n.hash))) @@ -67,8 +67,8 @@ (_.cover [/.empty?] (bit\= (/.empty? setL) (n.= 0 (/.size setL)))) - (_.cover [/.to_list /.from_list] - (|> setL /.to_list (/.from_list n.hash) (\= setL))) + (_.cover [/.to_list /.of_list] + (|> setL /.to_list (/.of_list n.hash) (\= setL))) (_.cover [/.member?] (and (list.every? (/.member? setL) (/.to_list setL)) (not (/.member? setL non_memberL)))) diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux index 1fd15a14f..aa85116f6 100644 --- a/stdlib/source/test/lux/data/collection/set/multi.lux +++ b/stdlib/source/test/lux/data/collection/set/multi.lux @@ -115,16 +115,16 @@ (do {! random.monad} [diversity (\ ! map (n.% 10) random.nat) sample (..random diversity n.hash ..count random.nat) - non_member (random.filter (predicate.complement (set.member? (/.support sample))) - random.nat) + non_member (random.only (predicate.complement (set.member? (/.support sample))) + random.nat) addition_count ..count partial_removal_count (\ ! map (n.% addition_count) random.nat) another (..random diversity n.hash ..count random.nat)] ($_ _.and - (_.cover [/.to_list /.from_list] + (_.cover [/.to_list /.of_list] (|> sample /.to_list - (/.from_list n.hash) + (/.of_list n.hash) (\ /.equivalence = sample))) (_.cover [/.size] (n.= (list.size (/.to_list sample)) @@ -194,17 +194,17 @@ (and null_scenario! partial_scenario! total_scenario!))) - (_.cover [/.from_set] - (let [unary (|> sample /.support /.from_set)] + (_.cover [/.of_set] + (let [unary (|> sample /.support /.of_set)] (list.every? (|>> (/.multiplicity unary) (n.= 1)) (/.to_list unary)))) (_.cover [/.sub?] - (let [unary (|> sample /.support /.from_set)] + (let [unary (|> sample /.support /.of_set)] (and (/.sub? sample unary) (or (not (/.sub? unary sample)) (\ /.equivalence = sample unary))))) (_.cover [/.super?] - (let [unary (|> sample /.support /.from_set)] + (let [unary (|> sample /.support /.of_set)] (and (/.super? unary sample) (or (not (/.super? sample unary)) (\ /.equivalence = sample unary))))) diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index dd3ba8802..260ab946f 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -32,8 +32,8 @@ _ (do random.monad [partial (random (dec size) &order gen_value) - value (random.filter (|>> (/.member? partial) not) - gen_value)] + value (random.only (|>> (/.member? partial) not) + gen_value)] (wrap (/.add value partial))))) (def: #export test @@ -44,13 +44,13 @@ [sizeL ..size sizeR ..size usetL (random.set n.hash sizeL random.nat) - non_memberL (random.filter (|>> (//.member? usetL) not) - random.nat) + non_memberL (random.only (|>> (//.member? usetL) not) + random.nat) #let [listL (//.to_list usetL)] listR (|> (random.set n.hash sizeR random.nat) (\ ! map //.to_list)) #let [(^open "/\.") /.equivalence - setL (/.from_list n.order listL) - setR (/.from_list n.order listR) + setL (/.of_list n.order listL) + setR (/.of_list n.order listR) empty (/.new n.order)]] (`` ($_ _.and (_.for [/.equivalence] @@ -65,11 +65,11 @@ (/.empty? (/.new n.order))) (_.cover [/.to_list] (\ (list.equivalence n.equivalence) = - (/.to_list (/.from_list n.order listL)) + (/.to_list (/.of_list n.order listL)) (list.sort (\ n.order <) listL))) - (_.cover [/.from_list] + (_.cover [/.of_list] (|> setL - /.to_list (/.from_list n.order) + /.to_list (/.of_list n.order) (/\= setL))) (~~ (template [ ] [(_.cover [] diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux index c007ee050..6340c6fbd 100644 --- a/stdlib/source/test/lux/data/collection/stack.lux +++ b/stdlib/source/test/lux/data/collection/stack.lux @@ -28,7 +28,7 @@ (do random.monad [size (\ random.monad map (n.% 100) random.nat) sample (random.stack size random.nat) - expected-top random.nat] + expected_top random.nat] ($_ _.and (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) (random.stack size random.nat))) @@ -59,10 +59,10 @@ sample (/.push top remaining)))) (_.cover [/.push] - (case (/.pop (/.push expected-top sample)) - (#.Some [actual-top actual-sample]) - (and (is? expected-top actual-top) - (is? sample actual-sample)) + (case (/.pop (/.push expected_top sample)) + (#.Some [actual_top actual_sample]) + (and (is? expected_top actual_top) + (is? sample actual_sample)) #.None false)) diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux index c34449027..f92d75440 100644 --- a/stdlib/source/test/lux/data/collection/tree/finger.lux +++ b/stdlib/source/test/lux/data/collection/tree/finger.lux @@ -33,8 +33,8 @@ (_.for [/.Tree]) (do {! random.monad} [tag_left (random.ascii/alpha_num 1) - tag_right (random.filter (|>> (text\= tag_left) not) - (random.ascii/alpha_num 1)) + tag_right (random.only (|>> (text\= tag_left) not) + (random.ascii/alpha_num 1)) expected_left random.nat expected_right random.nat] ($_ _.and @@ -91,16 +91,16 @@ (list.zip/2 tags/T values/T))] (and (\ tags_equivalence = (list& tags/H tags/T) (/.tags tree)) (\ values_equivalence = (list& values/H values/T) (/.values tree)))))) - (_.cover [/.search] + (_.cover [/.one] (let [can_find_correct_one! (|> (\ ..builder leaf tag_left expected_left) - (/.search (text.contains? tag_left)) + (/.one (text.contains? tag_left)) (maybe\map (n.= expected_left)) (maybe.default false)) cannot_find_incorrect_one! (|> (\ ..builder leaf tag_right expected_right) - (/.search (text.contains? tag_left)) + (/.one (text.contains? tag_left)) (maybe\map (n.= expected_left)) (maybe.default false) not) @@ -109,7 +109,7 @@ (|> (\ ..builder branch (\ ..builder leaf tag_left expected_left) (\ ..builder leaf tag_right expected_right)) - (/.search (text.contains? tag_left)) + (/.one (text.contains? tag_left)) (maybe\map (n.= expected_left)) (maybe.default false)) @@ -117,33 +117,33 @@ (|> (\ ..builder branch (\ ..builder leaf tag_left expected_left) (\ ..builder leaf tag_right expected_right)) - (/.search (text.contains? tag_right)) + (/.one (text.contains? tag_right)) (maybe\map (n.= expected_right)) (maybe.default false))] (and can_find_correct_one! cannot_find_incorrect_one! can_find_left! can_find_right!))) - (_.cover [/.found?] + (_.cover [/.exists?] (let [can_find_correct_one! - (/.found? (text.contains? tag_left) - (\ ..builder leaf tag_left expected_left)) + (/.exists? (text.contains? tag_left) + (\ ..builder leaf tag_left expected_left)) cannot_find_incorrect_one! - (not (/.found? (text.contains? tag_left) - (\ ..builder leaf tag_right expected_right))) + (not (/.exists? (text.contains? tag_left) + (\ ..builder leaf tag_right expected_right))) can_find_left! - (/.found? (text.contains? tag_left) - (\ ..builder branch - (\ ..builder leaf tag_left expected_left) - (\ ..builder leaf tag_right expected_right))) + (/.exists? (text.contains? tag_left) + (\ ..builder branch + (\ ..builder leaf tag_left expected_left) + (\ ..builder leaf tag_right expected_right))) can_find_right! - (/.found? (text.contains? tag_right) - (\ ..builder branch - (\ ..builder leaf tag_left expected_left) - (\ ..builder leaf tag_right expected_right)))] + (/.exists? (text.contains? tag_right) + (\ ..builder branch + (\ ..builder leaf tag_left expected_left) + (\ ..builder leaf tag_right expected_right)))] (and can_find_correct_one! cannot_find_incorrect_one! can_find_left! diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux index d04b3b8e9..6487e5685 100644 --- a/stdlib/source/test/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux @@ -29,7 +29,7 @@ Test (do random.monad [expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat)] + dummy (random.only (|>> (n.= expected) not) random.nat)] ($_ _.and (_.cover [/.down] (|> (tree.branch dummy (list (tree.leaf expected))) @@ -158,7 +158,7 @@ (do {! random.monad} [[size sample] (//.tree random.nat) expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat) + dummy (random.only (|>> (n.= expected) not) random.nat) #let [(^open "tree\.") (tree.equivalence n.equivalence) (^open "list\.") (list.equivalence n.equivalence)]] ($_ _.and diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux index 578771b59..c118a98ad 100644 --- a/stdlib/source/test/lux/data/color.lux +++ b/stdlib/source/test/lux/data/color.lux @@ -26,7 +26,7 @@ (def: #export random (Random /.Color) (|> ($_ random.and random.nat random.nat random.nat) - (\ random.monad map /.from_rgb))) + (\ random.monad map /.of_rgb))) (def: scale (-> Nat Frac) @@ -71,19 +71,19 @@ (def: (encoding expected) (-> /.Color Test) ($_ _.and - (_.cover [/.RGB /.to_rgb /.from_rgb] - (|> expected /.to_rgb /.from_rgb + (_.cover [/.RGB /.to_rgb /.of_rgb] + (|> expected /.to_rgb /.of_rgb (\ /.equivalence = expected))) - (_.cover [/.HSL /.to_hsl /.from_hsl] - (|> expected /.to_hsl /.from_hsl + (_.cover [/.HSL /.to_hsl /.of_hsl] + (|> expected /.to_hsl /.of_hsl (distance/3 expected) (f.<= ..rgb_error_margin))) - (_.cover [/.HSB /.to_hsb /.from_hsb] - (|> expected /.to_hsb /.from_hsb + (_.cover [/.HSB /.to_hsb /.of_hsb] + (|> expected /.to_hsb /.of_hsb (distance/3 expected) (f.<= ..rgb_error_margin))) - (_.cover [/.CMYK /.to_cmyk /.from_cmyk] - (|> expected /.to_cmyk /.from_cmyk + (_.cover [/.CMYK /.to_cmyk /.of_cmyk] + (|> expected /.to_cmyk /.of_cmyk (distance/3 expected) (f.<= ..rgb_error_margin))) )) @@ -92,14 +92,14 @@ Test (do random.monad [colorful (|> ..random - (random.filter (function (_ color) (|> (distance/3 color /.black) (f.>= +100.0)))) - (random.filter (function (_ color) (|> (distance/3 color /.white) (f.>= +100.0))))) + (random.only (function (_ color) (|> (distance/3 color /.black) (f.>= +100.0)))) + (random.only (function (_ color) (|> (distance/3 color /.white) (f.>= +100.0))))) mediocre (|> ..random - (random.filter (|>> saturation - ((function (_ saturation) - (and (f.>= +0.25 saturation) - (f.<= +0.75 saturation))))))) - ratio (|> random.safe_frac (random.filter (f.>= +0.5)))] + (random.only (|>> saturation + ((function (_ saturation) + (and (f.>= +0.25 saturation) + (f.<= +0.75 saturation))))))) + ratio (|> random.safe_frac (random.only (f.>= +0.5)))] ($_ _.and (_.cover [/.darker /.brighter] (and (f.<= (distance/3 colorful /.black) @@ -145,7 +145,7 @@ (~~ (template [ ] [(_.cover [] (let [eB - expected (/.from_hsb [eH eS eB]) + expected (/.of_hsb [eH eS eB]) palette ( spread variations expected)] (and (n.= variations (list.size palette)) (not (list.any? (\ /.equivalence = expected) palette)))))] @@ -154,7 +154,7 @@ )) (~~ (template [] [(_.cover [] - (let [expected (/.from_hsb [eH eS +0.5]) + (let [expected (/.of_hsb [eH eS +0.5]) [c0 c1 c2] ( expected)] (and (\ /.equivalence = expected c0) (not (\ /.equivalence = expected c1)) @@ -165,7 +165,7 @@ [/.split_complement])) (~~ (template [] [(_.cover [] - (let [expected (/.from_hsb [eH eS +0.5]) + (let [expected (/.of_hsb [eH eS +0.5]) [c0 c1 c2 c3] ( expected)] (and (\ /.equivalence = expected c0) (not (\ /.equivalence = expected c1)) diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux index 9e027d74d..11c699932 100644 --- a/stdlib/source/test/lux/data/color/named.lux +++ b/stdlib/source/test/lux/data/color/named.lux @@ -204,13 +204,13 @@ (list.concat (`` (list (~~ (template [ ] [((: (-> Any (List //.Color)) (function (_ _) - (`` (list (~~ (template.splice )))))) + (`` (list (~~ (template.spliced )))))) 123)] )))))) (def: unique_colors - (set.from_list //.hash ..all_colors)) + (set.of_list //.hash ..all_colors)) (def: verdict (n.= (list.size ..all_colors) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 9bd1c09b5..2fe36607d 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -112,8 +112,8 @@ )) (do random.monad [key (random.ascii/alpha 1) - unknown (random.filter (|>> (\ text.equivalence = key) not) - (random.ascii/alpha 1)) + unknown (random.only (|>> (\ text.equivalence = key) not) + (random.ascii/alpha 1)) expected random.safe_frac] (_.cover [/.set] (<| (try.default false) diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index 8b0655555..fedcdd251 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -158,7 +158,7 @@ Test (do {! random.monad} [expected_path (random.ascii/lower (dec /.path_size)) - expected_moment (\ ! map (|>> (n.% 1,0,00,00,00,00,000) .int instant.from_millis) + expected_moment (\ ! map (|>> (n.% 1,0,00,00,00,00,000) .int instant.of_millis) random.nat) chunk (random.ascii/lower chunk_size) chunks (\ ! map (n.% 100) random.nat) @@ -252,7 +252,7 @@ [path (/.path path) content (/.content (binary.create 0)) tar (|> (row.row (#/.Normal [path - (instant.from_millis +0) + (instant.of_millis +0) expected_mode {#/.user {#/.name /.anonymous #/.id /.no_id} @@ -275,7 +275,7 @@ [path (/.path path) content (/.content (binary.create 0)) tar (|> (row.row (#/.Normal [path - (instant.from_millis +0) + (instant.of_millis +0) {#/.user {#/.name /.anonymous #/.id /.no_id} @@ -342,7 +342,7 @@ content (/.content (binary.create 0)) expected (/.name expected) tar (|> (row.row (#/.Normal [path - (instant.from_millis +0) + (instant.of_millis +0) /.none {#/.user {#/.name expected #/.id /.no_id} @@ -366,7 +366,7 @@ [path (/.path path) content (/.content (binary.create 0)) tar (|> (row.row (#/.Normal [path - (instant.from_millis +0) + (instant.of_millis +0) /.none {#/.user {#/.name /.anonymous #/.id /.no_id} diff --git a/stdlib/source/test/lux/data/product.lux b/stdlib/source/test/lux/data/product.lux index fd361c2f6..867d8bb84 100644 --- a/stdlib/source/test/lux/data/product.lux +++ b/stdlib/source/test/lux/data/product.lux @@ -21,8 +21,8 @@ (do random.monad [expected random.nat shift random.nat - dummy (random.filter (|>> (n.= expected) not) - random.nat)] + dummy (random.only (|>> (n.= expected) not) + random.nat)] ($_ _.and (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence i.equivalence) diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux index cff19b801..05a2746f7 100644 --- a/stdlib/source/test/lux/data/sum.lux +++ b/stdlib/source/test/lux/data/sum.lux @@ -100,10 +100,10 @@ (: (List (| Nat Nat))) /.partition)] (and (\ (list.equivalence n.equivalence) = - (list.filter n.even? expected) + (list.only n.even? expected) lefts) (\ (list.equivalence n.equivalence) = - (list.filter (|>> n.even? not) expected) + (list.only (|>> n.even? not) expected) rights)))) )) )))) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 73696ae46..7223497d1 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -52,8 +52,8 @@ Test (do {! random.monad} [inner (random.unicode 1) - outer (random.filter (|>> (\ /.equivalence = inner) not) - (random.unicode 1)) + outer (random.only (|>> (\ /.equivalence = inner) not) + (random.unicode 1)) left (random.unicode 1) right (random.unicode 1) #let [full (\ /.monoid compose inner outer) @@ -81,8 +81,8 @@ Test (do {! random.monad} [inner (random.unicode 1) - outer (random.filter (|>> (\ /.equivalence = inner) not) - (random.unicode 1)) + outer (random.only (|>> (\ /.equivalence = inner) not) + (random.unicode 1)) #let [fake_index (dec 0)]] ($_ _.and (_.cover [/.contains?] @@ -145,7 +145,7 @@ (def: char Test ($_ _.and - (_.for [/.Char /.from_code] + (_.for [/.Char /.of_code] (`` ($_ _.and (~~ (template [ ] [(_.cover [ ] @@ -171,7 +171,7 @@ (_.cover [/.nth] (case (/.nth expected sample) (#.Some char) - (case (/.index_of (/.from_code char) sample) + (case (/.index_of (/.of_code char) sample) (#.Some actual) (n.= expected actual) @@ -198,12 +198,12 @@ (do {! random.monad} [size (\ ! map (|>> (n.% 10) (n.+ 2)) random.nat) characters (random.set /.hash size (random.ascii/alpha 1)) - separator (random.filter (|>> (set.member? characters) not) - (random.ascii/alpha 1)) + separator (random.only (|>> (set.member? characters) not) + (random.ascii/alpha 1)) #let [with_no_separator (|> characters set.to_list /.concat)] static (random.ascii/alpha 1) - #let [dynamic (random.filter (|>> (\ /.equivalence = static) not) - (random.ascii/alpha 1))] + #let [dynamic (random.only (|>> (\ /.equivalence = static) not) + (random.ascii/alpha 1))] pre dynamic post dynamic @@ -217,7 +217,7 @@ (and (|> (set.to_list characters) (/.join_with separator) (/.split_all_with separator) - (set.from_list /.hash) + (set.of_list /.hash) (\ set.equivalence = characters)) (\ /.equivalence = (/.concat (set.to_list characters)) @@ -339,7 +339,7 @@ sep1 (random.text normal_char_gen 1) sep2 (random.text normal_char_gen 1) #let [part_gen (|> (random.text normal_char_gen sizeP) - (random.filter (|>> (/.contains? sep1) not)))] + (random.only (|>> (/.contains? sep1) not)))] parts (random.list sizeL part_gen) #let [sample1 (/.concat (list.interpose sep1 parts)) sample2 (/.concat (list.interpose sep2 parts)) diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index ea8605b82..3b7f83b72 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -185,7 +185,7 @@ (template [ ] [((: (-> Any (List /.Encoding)) (function (_ _) - (`` (list (~~ (template.splice )))))) + (`` (list (~~ (template.spliced )))))) [])] )] @@ -205,7 +205,7 @@ (template [ ] [(def: Test - (`` (_.cover [/.name (~~ (template.splice ))] + (`` (_.cover [/.name (~~ (template.spliced ))] ..verdict)))] ) diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index bee4a7560..203cf9b81 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -56,18 +56,18 @@ (def: valid_sigils (Set Char) - (set.from_list n.hash - (list (debug.private /.\0_sigil) - (debug.private /.\a_sigil) - (debug.private /.\b_sigil) - (debug.private /.\t_sigil) - (debug.private /.\n_sigil) - (debug.private /.\v_sigil) - (debug.private /.\f_sigil) - (debug.private /.\r_sigil) - (debug.private /.\''_sigil) - (debug.private /.\\_sigil) - (debug.private /.\u_sigil)))) + (set.of_list n.hash + (list (debug.private /.\0_sigil) + (debug.private /.\a_sigil) + (debug.private /.\b_sigil) + (debug.private /.\t_sigil) + (debug.private /.\n_sigil) + (debug.private /.\v_sigil) + (debug.private /.\f_sigil) + (debug.private /.\r_sigil) + (debug.private /.\''_sigil) + (debug.private /.\\_sigil) + (debug.private /.\u_sigil)))) (syntax: (static_sample) (do meta.monad @@ -100,7 +100,7 @@ [left (random.char unicode.character) right (random.char unicode.character)] (_.cover [/.escape /.un_escape] - (let [expected (format (text.from_code left) (text.from_code right))] + (let [expected (format (text.of_code left) (text.of_code right))] (if (or (/.escapable? left) (/.escapable? right)) (let [escaped (/.escape expected)] @@ -114,7 +114,7 @@ (text\= expected (/.escape expected)))))) (do {! random.monad} [dummy (|> (random.char unicode.character) - (\ ! map text.from_code))] + (\ ! map text.of_code))] (_.cover [/.dangling_escape] (case (/.un_escape (format (/.escape dummy) "\")) (#try.Success _) @@ -124,8 +124,8 @@ (exception.match? /.dangling_escape error)))) (do {! random.monad} [dummy (|> (random.char unicode.character) - (random.filter (|>> (set.member? ..valid_sigils) not)) - (\ ! map text.from_code))] + (random.only (|>> (set.member? ..valid_sigils) not)) + (\ ! map text.of_code))] (_.cover [/.invalid_escape] (case (/.un_escape (format "\" dummy)) (#try.Success _) @@ -137,10 +137,10 @@ [too_short (|> (random.char unicode.character) (\ ! map (n.% (hex "1000")))) code (|> (random.unicode 4) - (random.filter (function (_ code) - (case (\ n.hex decode code) - (#try.Failure error) true - (#try.Success _) false))))] + (random.only (function (_ code) + (case (\ n.hex decode code) + (#try.Failure error) true + (#try.Success _) false))))] (_.cover [/.invalid_unicode_escape] (template.let [(!invalid ) [(case (/.un_escape (format "\u" )) diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux index e7a34a90c..d339e0717 100644 --- a/stdlib/source/test/lux/data/text/format.lux +++ b/stdlib/source/test/lux/data/text/format.lux @@ -175,7 +175,7 @@ (/.maybe /.nat sample))))) (do {! random.monad} [modulus (random.one (|>> modulus.modulus - try.to_maybe) + try.maybe) random.int) sample (\ ! map (modular.modular modulus) random.int)] diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index cb481b97a..50498f396 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -132,9 +132,9 @@ (should_fail (/.regex "\p{Blank}") "."))) (_.test "ASCII." (and (should_pass (/.regex "\p{ASCII}") text.tab) - (should_fail (/.regex "\p{ASCII}") (text.from_code (hex "1234"))))) + (should_fail (/.regex "\p{ASCII}") (text.of_code (hex "1234"))))) (_.test "Control characters." - (and (should_pass (/.regex "\p{Contrl}") (text.from_code (hex "12"))) + (and (should_pass (/.regex "\p{Contrl}") (text.of_code (hex "12"))) (should_fail (/.regex "\p{Contrl}") "a"))) (_.test "Punctuation." (and (should_pass (/.regex "\p{Punct}") "@") @@ -143,8 +143,8 @@ (and (should_pass (/.regex "\p{Graph}") "@") (should_fail (/.regex "\p{Graph}") " "))) (_.test "Print." - (and (should_pass (/.regex "\p{Print}") (text.from_code (hex "20"))) - (should_fail (/.regex "\p{Print}") (text.from_code (hex "1234"))))) + (and (should_pass (/.regex "\p{Print}") (text.of_code (hex "20"))) + (should_fail (/.regex "\p{Print}") (text.of_code (hex "1234"))))) )) (def: custom_character_classes diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux index 3b1f3866c..b895df0de 100644 --- a/stdlib/source/test/lux/data/text/unicode/block.lux +++ b/stdlib/source/test/lux/data/text/unicode/block.lux @@ -149,16 +149,16 @@ (template [ ] [((: (-> Any (List /.Block)) (function (_ _) - (`` (list (~~ (template.splice )))))) + (`` (list (~~ (template.spliced )))))) [])] )] (template [ ] [(def: Test - (`` (_.cover [(~~ (template.splice ))] + (`` (_.cover [(~~ (template.spliced ))] (let [all (list.concat (list )) - unique (set.from_list /.hash all)] + unique (set.of_list /.hash all)] (n.= (list.size all) (set.size unique))))))] diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 1396e1646..4eb815ff7 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -72,7 +72,7 @@ byte (\ ! map (|>> (:as /.Long) /.long_to_byte) random.int) short (\ ! map (|>> (:as /.Long) /.long_to_short) random.int) float (|> random.frac - (random.filter (|>> f.not_a_number? not)) + (random.only (|>> f.not_a_number? not)) (\ ! map (|>> (:as /.Double) /.double_to_float)))] (`` ($_ _.and (~~ (template [ <=> ] @@ -136,10 +136,10 @@ integer (\ ! map (|>> (:as /.Long) /.long_to_int) random.int) long (\ ! map (|>> (:as /.Long)) random.int) float (|> random.frac - (random.filter (|>> f.not_a_number? not)) + (random.only (|>> f.not_a_number? not)) (\ ! map (|>> (:as /.Double) /.double_to_float))) double (|> random.frac - (random.filter (|>> f.not_a_number? not)) + (random.only (|>> f.not_a_number? not)) (\ ! map (|>> (:as /.Double)))) character (\ ! map (|>> (:as /.Long) /.long_to_int /.int_to_char) random.int) string (\ ! map (|>> (:as java/lang/String)) diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index aa4b73548..0aa631ab8 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -92,9 +92,9 @@ int (\ ! map (|>> /.long_to_int) random.int) char (\ ! map (|>> /.long_to_int /.int_to_char) random.int) double (|> random.frac - (random.filter (|>> f.not_a_number? not))) + (random.only (|>> f.not_a_number? not))) float (|> random.frac - (random.filter (|>> f.not_a_number? not)) + (random.only (|>> f.not_a_number? not)) (\ ! map (|>> /.double_to_float)))] (`` ($_ _.and (~~ (template [<=> ] diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index 19bdd5f25..df8f798c6 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -23,7 +23,7 @@ ["." /]]) (type: Bundle - {#count Nat + {#amount Nat #names (Set Text) #codes (Set Text) #languages (Set /.Language) @@ -32,13 +32,13 @@ (template [ ] [(def: Bundle - (let [count (template.count ) + (let [amount (template.amount ) languages (: (List /.Language) - (`` (list (~~ (template.splice )))))] - {#count count - #names (|> languages (list\map /.name) (set.from_list text.hash)) - #codes (|> languages (list\map /.code) (set.from_list text.hash)) - #languages (set.from_list /.hash languages) + (`` (list (~~ (template.spliced )))))] + {#amount amount + #names (|> languages (list\map /.name) (set.of_list text.hash)) + #codes (|> languages (list\map /.code) (set.of_list text.hash)) + #languages (set.of_list /.hash languages) #test (_.cover true)}))] @@ -187,8 +187,8 @@ (Hash a) (List Bundle) [Nat (Set a)])) - (list\fold (function (_ bundle [count set]) - [(n.+ count (get@ #count bundle)) + (list\fold (function (_ bundle [amount set]) + [(n.+ amount (get@ #amount bundle)) (set.union set (lens bundle))]) [0 (set.new hash)] territories)) @@ -201,9 +201,9 @@ (list\fold _.and (`` ($_ _.and (~~ (template [ ] - [(let [[count set] (..aggregate (get@ ) ..languages)] + [(let [[amount set] (..aggregate (get@ ) ..languages)] (_.cover [] - (n.= count (set.size set))))] + (n.= amount (set.size set))))] [/.name #names text.hash] [/.code #codes text.hash] @@ -214,7 +214,7 @@ (template: (!aliases ) (_.cover (list.every? (\ /.equivalence = ) - (`` (list (~~ (template.splice ))))))) + (`` (list (~~ (template.spliced ))))))) (def: aliases_test/0 Test diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index 0d2b463c6..381c8f673 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -23,7 +23,7 @@ ["." /]]) (type: Bundle - {#count Nat + {#amount Nat #names (Set Text) #shorts (Set Text) #longs (Set Text) @@ -34,14 +34,14 @@ (template [ ] [(def: Bundle - (let [count (template.count ) - territories (`` (list (~~ (template.splice ))))] - {#count count - #names (|> territories (list\map /.name) (set.from_list text.hash)) - #shorts (|> territories (list\map /.short_code) (set.from_list text.hash)) - #longs (|> territories (list\map /.long_code) (set.from_list text.hash)) - #numbers (|> territories (list\map /.numeric_code) (set.from_list n.hash)) - #territories (|> territories (set.from_list /.hash)) + (let [amount (template.amount ) + territories (`` (list (~~ (template.spliced ))))] + {#amount amount + #names (|> territories (list\map /.name) (set.of_list text.hash)) + #shorts (|> territories (list\map /.short_code) (set.of_list text.hash)) + #longs (|> territories (list\map /.long_code) (set.of_list text.hash)) + #numbers (|> territories (list\map /.numeric_code) (set.of_list n.hash)) + #territories (|> territories (set.of_list /.hash)) #test (_.cover true)}))] @@ -142,8 +142,8 @@ (Hash a) (List Bundle) [Nat (Set a)])) - (list\fold (function (_ bundle [count set]) - [(n.+ count (get@ #count bundle)) + (list\fold (function (_ bundle [amount set]) + [(n.+ amount (get@ #amount bundle)) (set.union set (lens bundle))]) [0 (set.new hash)] territories)) @@ -156,9 +156,9 @@ (list\fold _.and (`` ($_ _.and (~~ (template [ ] - [(let [[count set] (..aggregate (get@ ) ..territories)] + [(let [[amount set] (..aggregate (get@ ) ..territories)] (_.cover [] - (n.= count (set.size set))))] + (n.= amount (set.size set))))] [/.name #names text.hash] [/.short_code #shorts text.hash] @@ -171,7 +171,7 @@ (template: (!aliases ) (_.cover (list.every? (\ /.equivalence = ) - (`` (list (~~ (template.splice ))))))) + (`` (list (~~ (template.spliced ))))))) (def: aliases_test Test diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index f0764fda7..2ce231e61 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -92,16 +92,16 @@ ($_ random.either (random\wrap [original substitute]) (do {! random.monad} - [sample (random.filter (|>> (\ /.equivalence = original) not) - ($_ random.either - (random\map /.bit random.bit) - (random\map /.nat random.nat) - (random\map /.int random.int) - (random\map /.rev random.rev) - (random\map /.frac random.safe_frac) - (random\map /.text ..random_text) - (random\map /.identifier ..random_name) - (random\map /.tag ..random_name)))] + [sample (random.only (|>> (\ /.equivalence = original) not) + ($_ random.either + (random\map /.bit random.bit) + (random\map /.nat random.nat) + (random\map /.int random.int) + (random\map /.rev random.rev) + (random\map /.frac random.safe_frac) + (random\map /.text ..random_text) + (random\map /.identifier ..random_name) + (random\map /.tag ..random_name)))] (wrap [sample sample])) (for_sequence /.form) (for_sequence /.tuple) @@ -175,12 +175,12 @@ ..for_format) (do {! random.monad} - [[original substitute] (random.filter (function (_ [original substitute]) - (not (\ /.equivalence = original substitute))) - (random.and ..random ..random)) - [sample expected] (random.filter (function (_ [sample expected]) - (not (\ /.equivalence = sample expected))) - (..replace_simulation [original substitute]))] + [[original substitute] (random.only (function (_ [original substitute]) + (not (\ /.equivalence = original substitute))) + (random.and ..random ..random)) + [sample expected] (random.only (function (_ [sample expected]) + (not (\ /.equivalence = sample expected))) + (..replace_simulation [original substitute]))] (_.cover [/.replace] (\ /.equivalence = expected diff --git a/stdlib/source/test/lux/macro/template.lux b/stdlib/source/test/lux/macro/template.lux index fc1d62f11..c46bb5b8c 100644 --- a/stdlib/source/test/lux/macro/template.lux +++ b/stdlib/source/test/lux/macro/template.lux @@ -47,12 +47,12 @@ (as_is ["a" b #c #0 #1 2 +3 -4 .5]) ' "abc#0#12+3-4.5"] ($_ _.and - (_.cover [/.splice] + (_.cover [/.spliced] (\ (list.equivalence nat.equivalence) = (list left mid right) - (`` (list (~~ (/.splice [left mid right])))))) - (_.cover [/.count] - (case (/.count [left mid right]) + (`` (list (~~ (/.spliced [left mid right])))))) + (_.cover [/.amount] + (case (/.amount [left mid right]) 3 true _ false)) (_.cover [/.text] diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index 657285025..9c7cca0ee 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -292,15 +292,15 @@ (do random.monad [threshold random.nat #let [under? (n.< threshold) - set (set.from_list n.hash (list threshold))] + set (set.of_list n.hash (list threshold))] sample random.nat] ($_ _.and - (_.cover [/.from_predicate] - (bit\= (r.= //.true (/.membership (/.from_predicate under?) sample)) + (_.cover [/.of_predicate] + (bit\= (r.= //.true (/.membership (/.of_predicate under?) sample)) (under? sample))) - (_.cover [/.from_set] - (and (r.= //.true (/.membership (/.from_set set) threshold)) - (bit\= (r.= //.true (/.membership (/.from_set set) sample)) + (_.cover [/.of_set] + (and (r.= //.true (/.membership (/.of_set set) threshold)) + (bit\= (r.= //.true (/.membership (/.of_set set) sample)) (set.member? set sample)))) ))) diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux index 40a091008..3f313bd12 100644 --- a/stdlib/source/test/lux/math/modular.lux +++ b/stdlib/source/test/lux/math/modular.lux @@ -42,9 +42,9 @@ [param\\% ($//.random +1,000,000) param (..random param\\%) - subject\\% (random.filter (predicate.intersect (|>> //.divisor (i.> +2)) - (|>> (//.= param\\%) not)) - ($//.random +1,000,000)) + subject\\% (random.only (predicate.intersect (|>> //.divisor (i.> +2)) + (|>> (//.= param\\%) not)) + ($//.random +1,000,000)) subject (..random subject\\%) another (..random subject\\%)] (`` ($_ _.and diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux index af040b645..8679cdb70 100644 --- a/stdlib/source/test/lux/math/modulus.lux +++ b/stdlib/source/test/lux/math/modulus.lux @@ -29,7 +29,7 @@ (Ex [%] (-> Int (Random (/.Modulus %)))) (|> random.int (\ random.monad map (i.% range)) - (random.one (|>> /.modulus try.to_maybe)))) + (random.one (|>> /.modulus try.maybe)))) (def: #export test Test diff --git a/stdlib/source/test/lux/math/number/complex.lux b/stdlib/source/test/lux/math/number/complex.lux index cd4f1146c..a1ebf331d 100644 --- a/stdlib/source/test/lux/math/number/complex.lux +++ b/stdlib/source/test/lux/math/number/complex.lux @@ -29,7 +29,7 @@ (Random Frac) (do {! random.monad} [factor (|> random.nat (\ ! map (|>> (n.% 1000) (n.max 1)))) - measure (|> random.safe_frac (random.filter (f.> +0.0)))] + measure (|> random.safe_frac (random.only (f.> +0.0)))] (wrap (f.* (|> factor .int int.frac) measure)))) diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux index 9a5133a97..23ede5834 100644 --- a/stdlib/source/test/lux/math/number/frac.lux +++ b/stdlib/source/test/lux/math/number/frac.lux @@ -161,8 +161,8 @@ (/.* (/.signum sample) sample))) )) (do random.monad - [left (random.filter (|>> (/.= +0.0) not) - ..random) + [left (random.only (|>> (/.= +0.0) not) + ..random) right ..random] ($_ _.and (_.cover [/.%] @@ -203,9 +203,9 @@ (test /.negative_infinity))))) (do random.monad [sample random.i64] - (_.cover [/.from_bits] + (_.cover [/.of_bits] (let [expected (java/lang/Double::longBitsToDouble sample) - actual (/.from_bits sample)] + actual (/.of_bits sample)] (or (/.= expected actual) (and (/.not_a_number? expected) (/.not_a_number? actual)))))) @@ -214,13 +214,13 @@ @.jvm } (let [test (: (-> Frac Bit) (function (_ expected) - (let [actual (|> expected /.to_bits /.from_bits)] + (let [actual (|> expected /.to_bits /.of_bits)] (or (/.= expected actual) (and (/.not_a_number? expected) (/.not_a_number? actual))))))] (do random.monad [sample random.frac] - (_.cover [/.to_bits /.from_bits] + (_.cover [/.to_bits /.of_bits] (and (test sample) (test /.biggest) (test /.smallest) diff --git a/stdlib/source/test/lux/math/number/int.lux b/stdlib/source/test/lux/math/number/int.lux index 1d95a10e5..99738824a 100644 --- a/stdlib/source/test/lux/math/number/int.lux +++ b/stdlib/source/test/lux/math/number/int.lux @@ -108,8 +108,8 @@ (/.>= right left))) )) (do random.monad - [left (random.filter (|>> (/.= +0) not) - random.int) + [left (random.only (|>> (/.= +0) not) + random.int) right random.int] ($_ _.and (_.cover [/.%] @@ -137,7 +137,7 @@ (do {! random.monad} [#let [random (|> random.int (\ ! map (/.% +1,000)) - (random.filter (|>> (/.= +0) not)))] + (random.only (|>> (/.= +0) not)))] left random right random] ($_ _.and diff --git a/stdlib/source/test/lux/math/number/nat.lux b/stdlib/source/test/lux/math/number/nat.lux index c9bb2102b..3d553e167 100644 --- a/stdlib/source/test/lux/math/number/nat.lux +++ b/stdlib/source/test/lux/math/number/nat.lux @@ -89,8 +89,8 @@ (/.>= right left))) )) (do random.monad - [left (random.filter (|>> (/.= 0) not) - random.nat) + [left (random.only (|>> (/.= 0) not) + random.nat) right random.nat] ($_ _.and (_.cover [/.%] diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux index 0d67d6f69..c78db2b86 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/ratio.lux @@ -29,8 +29,8 @@ (Random /.Ratio) (do random.monad [numerator ..part - denominator (random.filter (|>> (n.= 0) not) - ..part)] + denominator (random.only (|>> (n.= 0) not) + ..part)] (wrap (/.ratio numerator denominator)))) (def: #export test @@ -61,8 +61,8 @@ (/.ratio 0 denom/1)))) (do random.monad [numerator ..part - denominator (random.filter (|>> (n\= 1) not) - ..part)] + denominator (random.only (|>> (n\= 1) not) + ..part)] (_.cover [/.nat] (let [only_numerator! (|> (/.ratio numerator) @@ -101,8 +101,8 @@ (/.* sample (/.reciprocal sample)))) )) (do random.monad - [left (random.filter (|>> (/.= (/.ratio 0)) not) - ..random) + [left (random.only (|>> (/.= (/.ratio 0)) not) + ..random) right ..random] (_.cover [/.%] (let [rem (/.% left right) diff --git a/stdlib/source/test/lux/math/number/rev.lux b/stdlib/source/test/lux/math/number/rev.lux index 1a2eb29e5..a302b2fc3 100644 --- a/stdlib/source/test/lux/math/number/rev.lux +++ b/stdlib/source/test/lux/math/number/rev.lux @@ -95,10 +95,10 @@ (i64.rotate_right 8) .rev) random.nat)] - dividend (random.filter (/.> .0) dividend) + dividend (random.only (/.> .0) dividend) divisor/0 divisor - divisor/1 (random.filter (|>> (/.= divisor/0) not) - divisor) + divisor/1 (random.only (|>> (/.= divisor/0) not) + divisor) scale (\ ! map (|>> (n.% 10) inc) random.nat)] ($_ _.and @@ -132,8 +132,8 @@ )) (do {! random.monad} [dividend random.rev - divisor (random.filter (|>> (/.= .0) not) - random.rev)] + divisor (random.only (|>> (/.= .0) not) + random.rev)] (_.cover [/./%] (let [[quotient remainder] (/./% divisor dividend)] (and (/.= (/./ divisor dividend) quotient) diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 9276f4a18..67529dcca 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -49,7 +49,7 @@ primitive_type (random.ascii/upper 1) expected_seed random.nat expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat) + dummy (random.only (|>> (n.= expected) not) random.nat) #let [expected_lux {#.info {#.target target #.version version #.mode #.Build} @@ -95,7 +95,7 @@ primitive_type (random.ascii/upper 1) expected_seed random.nat expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat) + dummy (random.only (|>> (n.= expected) not) random.nat) expected_error (random.ascii/upper 1) #let [expected_lux {#.info {#.target target #.version version @@ -166,17 +166,17 @@ version (random.ascii/upper 1) source_code (random.ascii/upper 1) expected_current_module (random.ascii/upper 1) - imported_module_name (random.filter (|>> (text\= expected_current_module) not) - (random.ascii/upper 1)) + imported_module_name (random.only (|>> (text\= expected_current_module) not) + (random.ascii/upper 1)) primitive_type (random.ascii/upper 1) expected_seed random.nat expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat) + dummy (random.only (|>> (n.= expected) not) random.nat) expected_short (random.ascii/upper 1) - dummy_module (random.filter (function (_ module) - (not (or (text\= expected_current_module module) - (text\= imported_module_name module)))) - (random.ascii/upper 1)) + dummy_module (random.only (function (_ module) + (not (or (text\= expected_current_module module) + (text\= imported_module_name module)))) + (random.ascii/upper 1)) #let [imported_module {#.module_hash 0 #.module_aliases (list) #.definitions (list) @@ -213,65 +213,66 @@ #.scope_type_vars (list) #.extensions [] #.host []}]] - ($_ _.and - (_.cover [/.current_module_name] - (|> /.current_module_name - (/.run expected_lux) - (!expect (^multi (#try.Success actual_current_module) - (text\= expected_current_module actual_current_module))))) - (_.cover [/.current_module] - (|> /.current_module - (/.run expected_lux) - (!expect (^multi (#try.Success actual_module) - (is? expected_module actual_module))))) - (_.cover [/.find_module] - (|> (/.find_module expected_current_module) - (/.run expected_lux) - (!expect (^multi (#try.Success actual_module) - (is? expected_module actual_module))))) - (_.cover [/.module_exists?] - (and (|> (/.module_exists? expected_current_module) - (/.run expected_lux) - (!expect (#try.Success #1))) - (|> (/.module_exists? dummy_module) - (/.run expected_lux) - (!expect (#try.Success #0))))) - (_.cover [/.modules] - (|> /.modules - (/.run expected_lux) - (!expect (^multi (#try.Success actual_modules) - (is? expected_modules actual_modules))))) - (_.cover [/.imported_modules] - (and (|> (/.imported_modules expected_current_module) - (/.run expected_lux) - (try\map (\ (list.equivalence text.equivalence) = - (list imported_module_name))) - (try.default false)) - (|> (/.imported_modules imported_module_name) - (/.run expected_lux) - (try\map (\ (list.equivalence text.equivalence) = - (list))) - (try.default false)))) - (_.cover [/.imported_by?] - (|> (/.imported_by? imported_module_name expected_current_module) - (/.run expected_lux) - (try.default false))) - (_.cover [/.imported?] - (|> (/.imported? imported_module_name) - (/.run expected_lux) - (try.default false))) - (_.cover [/.normalize] - (and (|> (/.normalize ["" expected_short]) - (/.run expected_lux) - (!expect (^multi (#try.Success [actual_module actual_short]) - (and (text\= expected_current_module actual_module) - (is? expected_short actual_short))))) - (|> (/.normalize [dummy_module expected_short]) - (/.run expected_lux) - (!expect (^multi (#try.Success [actual_module actual_short]) - (and (text\= dummy_module actual_module) - (is? expected_short actual_short))))))) - ))) + (<| (_.for [.Module]) + ($_ _.and + (_.cover [/.current_module_name] + (|> /.current_module_name + (/.run expected_lux) + (!expect (^multi (#try.Success actual_current_module) + (text\= expected_current_module actual_current_module))))) + (_.cover [/.current_module] + (|> /.current_module + (/.run expected_lux) + (!expect (^multi (#try.Success actual_module) + (is? expected_module actual_module))))) + (_.cover [/.find_module] + (|> (/.find_module expected_current_module) + (/.run expected_lux) + (!expect (^multi (#try.Success actual_module) + (is? expected_module actual_module))))) + (_.cover [/.module_exists?] + (and (|> (/.module_exists? expected_current_module) + (/.run expected_lux) + (!expect (#try.Success #1))) + (|> (/.module_exists? dummy_module) + (/.run expected_lux) + (!expect (#try.Success #0))))) + (_.cover [/.modules] + (|> /.modules + (/.run expected_lux) + (!expect (^multi (#try.Success actual_modules) + (is? expected_modules actual_modules))))) + (_.cover [/.imported_modules] + (and (|> (/.imported_modules expected_current_module) + (/.run expected_lux) + (try\map (\ (list.equivalence text.equivalence) = + (list imported_module_name))) + (try.default false)) + (|> (/.imported_modules imported_module_name) + (/.run expected_lux) + (try\map (\ (list.equivalence text.equivalence) = + (list))) + (try.default false)))) + (_.cover [/.imported_by?] + (|> (/.imported_by? imported_module_name expected_current_module) + (/.run expected_lux) + (try.default false))) + (_.cover [/.imported?] + (|> (/.imported? imported_module_name) + (/.run expected_lux) + (try.default false))) + (_.cover [/.normalize] + (and (|> (/.normalize ["" expected_short]) + (/.run expected_lux) + (!expect (^multi (#try.Success [actual_module actual_short]) + (and (text\= expected_current_module actual_module) + (is? expected_short actual_short))))) + (|> (/.normalize [dummy_module expected_short]) + (/.run expected_lux) + (!expect (^multi (#try.Success [actual_module actual_short]) + (and (text\= dummy_module actual_module) + (is? expected_short actual_short))))))) + )))) (def: random_location (Random Location) @@ -291,7 +292,7 @@ (random.ascii/upper 1)) expected_seed random.nat expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat) + dummy (random.only (|>> (n.= expected) not) random.nat) expected_location ..random_location #let [type_context {#.ex_counter 0 #.var_counter 0 @@ -330,7 +331,7 @@ (/.run expected_lux) (!expect (^multi (#try.Success actual_type) (is? expected_type actual_type))))) - (_.cover [/.type_context] + (_.cover [.Type_Context /.type_context] (|> /.type_context (/.run expected_lux) (try\map (is? type_context)) @@ -341,8 +342,8 @@ Test (do {! random.monad} [expected_current_module (random.ascii/upper 1) - expected_macro_module (random.filter (|>> (text\= expected_current_module) not) - (random.ascii/upper 1)) + expected_macro_module (random.only (|>> (text\= expected_current_module) not) + (random.ascii/upper 1)) expected_short (random.ascii/upper 1) expected_type (\ ! map (function (_ name) (#.Primitive name (list))) @@ -402,7 +403,7 @@ #.extensions [] #.host []}])))]] ($_ _.and - (_.cover [/.globals] + (_.cover [.Global .Alias /.globals] (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro)) @@ -419,7 +420,7 @@ (is? macro_globals actual_globals))))] (and current_globals! macro_globals!))) - (_.cover [/.definitions] + (_.cover [.Definition /.definitions] (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro))] (and (|> (/.definitions expected_current_module) @@ -461,8 +462,8 @@ (do {! random.monad} [expected_exported? random.bit expected_current_module (random.ascii/upper 1) - expected_macro_module (random.filter (|>> (text\= expected_current_module) not) - (random.ascii/upper 1)) + expected_macro_module (random.only (|>> (text\= expected_current_module) not) + (random.ascii/upper 1)) expected_short (random.ascii/upper 1) expected_type (\ ! map (function (_ name) (#.Primitive name (list))) @@ -568,14 +569,14 @@ not_macro! not_found! aliasing!))) - (_.cover [/.un_alias] + (_.cover [/.de_aliased] (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro))] - (and (|> (/.un_alias [expected_macro_module expected_short]) + (and (|> (/.de_aliased [expected_macro_module expected_short]) (/.run expected_lux) (try\map (name\= [expected_macro_module expected_short])) (try.default false)) - (|> (/.un_alias [expected_current_module expected_short]) + (|> (/.de_aliased [expected_current_module expected_short]) (/.run expected_lux) (try\map (name\= [expected_macro_module expected_short])) (try.default false))))) @@ -640,12 +641,12 @@ Test (do {! random.monad} [current_module (random.ascii/upper 1) - tag_module (random.filter (|>> (text\= current_module) not) - (random.ascii/upper 1)) + tag_module (random.only (|>> (text\= current_module) not) + (random.ascii/upper 1)) name_0 (random.ascii/upper 1) - name_1 (random.filter (|>> (text\= name_0) not) - (random.ascii/upper 1)) + name_1 (random.only (|>> (text\= name_0) not) + (random.ascii/upper 1)) #let [random_tag (\ ! map (|>> [tag_module]) (random.ascii/upper 1))] @@ -813,7 +814,7 @@ #.extensions [] #.host []})]] ($_ _.and - (_.cover [/.locals] + (_.cover [.Scope /.locals] (let [equivalence (: (Equivalence (List (List [Text Type]))) (list.equivalence (list.equivalence @@ -888,6 +889,7 @@ (def: #export test Test (<| (_.covering /._) + (_.for [.Meta .Lux]) ($_ _.and (do {! random.monad} [target (random.ascii/upper 1) @@ -899,7 +901,7 @@ (random.ascii/upper 1)) expected_seed random.nat expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat) + dummy (random.only (|>> (n.= expected) not) random.nat) expected_location ..random_location #let [expected_lux {#.info {#.target target #.version version diff --git a/stdlib/source/test/lux/meta/annotation.lux b/stdlib/source/test/lux/meta/annotation.lux index 88ffb18d0..f080ee0c6 100644 --- a/stdlib/source/test/lux/meta/annotation.lux +++ b/stdlib/source/test/lux/meta/annotation.lux @@ -90,8 +90,8 @@ [key ..random_key] (`` ($_ _.and (do ! - [dummy (random.filter (|>> (name\= key) not) - ..random_key) + [dummy (random.only (|>> (name\= key) not) + ..random_key) expected random.bit] (_.cover [/.flagged?] (and (|> expected code.bit diff --git a/stdlib/source/test/lux/target.lux b/stdlib/source/test/lux/target.lux index e9c2594fc..c59dc9025 100644 --- a/stdlib/source/test/lux/target.lux +++ b/stdlib/source/test/lux/target.lux @@ -29,7 +29,7 @@ (def: unique (Set /.Target) - (set.from_list text.hash ..all)) + (set.of_list text.hash ..all)) (def: verdict (n.= (list.size ..all) diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index d7d9030df..5e96a2e02 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -236,8 +236,8 @@ (def: $Float::literal /.float) (def: valid_float (Random java/lang/Float) - (random.filter (|>> ffi.float_to_double (:as Frac) f.not_a_number? not) - ..$Float::random)) + (random.only (|>> ffi.float_to_double (:as Frac) f.not_a_number? not) + ..$Float::random)) (def: $Float::primitive (Primitive java/lang/Float) {#unboxed /type.float @@ -254,8 +254,8 @@ /.double) (def: valid_double (Random java/lang/Double) - (random.filter (|>> (:as Frac) f.not_a_number? not) - ..$Double::random)) + (random.only (|>> (:as Frac) f.not_a_number? not) + ..$Double::random)) (def: $Double::primitive (Primitive java/lang/Double) {#unboxed /type.double @@ -312,7 +312,7 @@ @.jvm (|>> (:as ) "jvm object cast" ("jvm long =" ("jvm object cast" (:as java/lang/Long expected))))})) (do /.monad - [_ ( (|> expected .int try.assume))] + [_ ( (|> expected .int try.assumed))] ))))] [byte 7 java/lang/Byte /.bipush ..$Byte::wrap "BIPUSH" ffi.byte_to_long /signed.s1] @@ -590,8 +590,8 @@ comparison (: (-> (Bytecode Any) (-> java/lang/Float java/lang/Float Bit) (Random Bit)) (function (_ instruction standard) (do random.monad - [#let [valid_float (random.filter (|>> ffi.float_to_double (:as Frac) f.not_a_number? not) - ..$Float::random)] + [#let [valid_float (random.only (|>> ffi.float_to_double (:as Frac) f.not_a_number? not) + ..$Float::random)] reference valid_float subject valid_float #let [expected (if (for {@.old @@ -787,8 +787,8 @@ ($_ _.and (<| (_.lift "INVOKESTATIC") (do random.monad - [expected (random.filter (|>> (:as Frac) f.not_a_number? not) - ..$Double::random)]) + [expected (random.only (|>> (:as Frac) f.not_a_number? not) + ..$Double::random)]) (..bytecode (for {@.old (|>> (:as java/lang/Double) ("jvm deq" expected)) @@ -808,8 +808,8 @@ ..$Boolean::wrap)) (<| (_.lift "INVOKESPECIAL") (do random.monad - [expected (random.filter (|>> (:as Frac) f.not_a_number? not) - ..$Double::random)]) + [expected (random.only (|>> (:as Frac) f.not_a_number? not) + ..$Double::random)]) (..bytecode (for {@.old (|>> (:as java/lang/Double) ("jvm deq" expected)) @@ -886,7 +886,7 @@ _ ..$Long::wrap] /.areturn)))) (row.row)) - try.assume + try.assumed (format.run /class.writer)) loader (/loader.memory (/loader.new_library []))]] (_.test "PUTSTATIC & PUTFIELD & GETFIELD & GETSTATIC" @@ -1031,7 +1031,7 @@ (do {! /.monad} [_ (monad.map ! (|>> (:as java/lang/Long) ffi.long_to_int ..$Integer::literal) (#.Cons sizesH sizesT)) - _ (/.multianewarray type (|> dimensions /unsigned.u1 try.assume)) + _ (/.multianewarray type (|> dimensions /unsigned.u1 try.assumed)) _ ?length] $Long::wrap)))) ))) @@ -1152,7 +1152,7 @@ (_.lift "IINC" (do {! random.monad} [base ..$Byte::random - increment (\ ! map (|>> (n.% 100) /unsigned.u1 try.assume) + increment (\ ! map (|>> (n.% 100) /unsigned.u1 try.assumed) random.nat) #let [expected (: java/lang/Long (for {@.old @@ -1323,7 +1323,7 @@ primitive_method_name (random.ascii/upper 10) #let [primitive_method_type (/type.method [(list) (list) (get@ #unboxed primitive) (list)])] object_method_name (|> (random.ascii/upper 10) - (random.filter (|>> (text\= primitive_method_name) not))) + (random.only (|>> (text\= primitive_method_name) not))) expected (get@ #random primitive) #let [$Self (/type.class class_name (list))]] (wrap (case (do try.monad @@ -1414,7 +1414,7 @@ (_.lift "IFNONNULL" (if! /.ifnonnull (/.string ""))))] reference ..$Integer::random subject (|> ..$Integer::random - (random.filter (|>> ((!::= java/lang/Integer "jvm ieq" "jvm int =") reference) not))) + (random.only (|>> ((!::= java/lang/Integer "jvm ieq" "jvm int =") reference) not))) #let [[lesser greater] (if (for {@.old ("jvm ilt" reference subject) @@ -1476,7 +1476,7 @@ (do {! random.monad} [expected ..$Long::random dummy ..$Long::random - minimum (\ ! map (|>> (n.% 100) .int /signed.s4 try.assume) + minimum (\ ! map (|>> (n.% 100) .int /signed.s4 try.assumed) random.nat) afterwards (\ ! map (n.% 10) random.nat)]) (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) @@ -1484,7 +1484,7 @@ [@right /.new_label @wrong /.new_label @return /.new_label - _ (/.bipush (|> minimum /signed.value .int /signed.s1 try.assume)) + _ (/.bipush (|> minimum /signed.value .int /signed.s1 try.assumed)) _ (/.tableswitch minimum @wrong [@right (list.repeat afterwards @wrong)]) _ (/.set_label @wrong) _ (..$Long::literal dummy) @@ -1512,7 +1512,7 @@ @return /.new_label _ (..$Integer::literal (ffi.long_to_int (:as java/lang/Long choice))) _ (/.lookupswitch @wrong (list\map (function (_ option) - [(|> option /signed.s4 try.assume) + [(|> option /signed.s4 try.assumed) (if (i.= choice option) @right @wrong)]) options)) _ (/.set_label @wrong) @@ -1585,11 +1585,11 @@ (do random.monad [abstract_class ..class_name interface_class (|> ..class_name - (random.filter (|>> (text\= abstract_class) not))) + (random.only (|>> (text\= abstract_class) not))) concrete_class (|> ..class_name - (random.filter (function (_ class) - (not (or (text\= abstract_class class) - (text\= interface_class class)))))) + (random.only (function (_ class) + (not (or (text\= abstract_class class) + (text\= interface_class class)))))) part0 ..$Long::random part1 ..$Long::random part2 ..$Long::random @@ -1634,7 +1634,7 @@ (list (/method.method ($_ /modifier\compose /method.public /method.abstract) interface_method method::type (list) #.None)) (row.row)) - try.assume + try.assumed (format.run /class.writer)) abstract_bytecode (|> (/class.class /version.v6_0 ($_ /modifier\compose /class.public /class.abstract) (/name.internal abstract_class) @@ -1654,7 +1654,7 @@ (/method.method ($_ /modifier\compose /method.public /method.abstract) abstract_method method::type (list) #.None)) (row.row)) - try.assume + try.assumed (format.run /class.writer)) invoke (: (-> (Type Class) Text (Bytecode Any)) (function (_ class method) @@ -1701,7 +1701,7 @@ _ ..$Long::wrap] /.areturn)))) (row.row)) - try.assume + try.assumed (format.run /class.writer)) loader (/loader.memory (/loader.new_library []))]] (_.test "Class & interface inheritance" diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux index d7c05641c..45dc68c97 100644 --- a/stdlib/source/test/lux/test.lux +++ b/stdlib/source/test/lux/test.lux @@ -32,8 +32,8 @@ /.Test (do {! random.monad} [expected_message/0 (random.ascii/lower 5) - expected_message/1 (random.filter (|>> (text\= expected_message/0) not) - (random.ascii/lower 5))] + expected_message/1 (random.only (|>> (text\= expected_message/0) not) + (random.ascii/lower 5))] ($_ /.and (wrap (do promise.monad [[success_tally success_message] (/.assert expected_message/0 true) @@ -221,10 +221,10 @@ (/.for [/.Test]) (do {! random.monad} [expected_context (random.ascii/lower 5) - expected_message/0 (random.filter (|>> (text\= expected_context) not) - (random.ascii/lower 5)) - expected_message/1 (random.filter (|>> (text\= expected_message/0) not) - (random.ascii/lower 5))] + expected_message/0 (random.only (|>> (text\= expected_context) not) + (random.ascii/lower 5)) + expected_message/1 (random.only (|>> (text\= expected_message/0) not) + (random.ascii/lower 5))] ($_ /.and (/.for [/.Assertion] ..assertion) diff --git a/stdlib/source/test/lux/time.lux b/stdlib/source/test/lux/time.lux index 77933544c..86e8ddc45 100644 --- a/stdlib/source/test/lux/time.lux +++ b/stdlib/source/test/lux/time.lux @@ -119,14 +119,14 @@ (`` ($_ _.and ..for_implementation - (_.cover [/.to_millis /.from_millis] + (_.cover [/.to_millis /.of_millis] (|> expected /.to_millis - /.from_millis + /.of_millis (try\map (\ /.equivalence = expected)) (try.default false))) (_.cover [/.time_exceeds_a_day] - (case (/.from_millis out_of_bounds) + (case (/.of_millis out_of_bounds) (#try.Success _) false diff --git a/stdlib/source/test/lux/time/date.lux b/stdlib/source/test/lux/time/date.lux index cb8ab50c8..6f9832198 100644 --- a/stdlib/source/test/lux/time/date.lux +++ b/stdlib/source/test/lux/time/date.lux @@ -60,10 +60,10 @@ false))) (do random.monad [expected random.date] - (_.cover [/.to_days /.from_days] + (_.cover [/.to_days /.of_days] (|> expected /.to_days - /.from_days + /.of_days (\ /.equivalence = expected)))) (_.cover [/.epoch] (|> /.epoch diff --git a/stdlib/source/test/lux/time/duration.lux b/stdlib/source/test/lux/time/duration.lux index 1d2fa1ce7..0aba9b880 100644 --- a/stdlib/source/test/lux/time/duration.lux +++ b/stdlib/source/test/lux/time/duration.lux @@ -38,8 +38,8 @@ (do random.monad [duration random.duration] - (_.cover [/.from_millis /.to_millis] - (|> duration /.to_millis /.from_millis (\ /.equivalence = duration)))) + (_.cover [/.of_millis /.to_millis] + (|> duration /.to_millis /.of_millis (\ /.equivalence = duration)))) (do random.monad [#let [(^open "\.") /.equivalence] expected random.duration @@ -66,7 +66,7 @@ (do {! random.monad} [#let [(^open "\.") /.order positive (|> random.duration - (random.filter (|>> (\= /.empty) not)) + (random.only (|>> (\= /.empty) not)) (\ ! map (function (_ duration) (if (/.positive? duration) duration diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux index 377a47db1..c36097fe1 100644 --- a/stdlib/source/test/lux/time/instant.lux +++ b/stdlib/source/test/lux/time/instant.lux @@ -42,14 +42,14 @@ [#let [(^open "\.") /.equivalence] expected random.instant] ($_ _.and - (_.cover [/.to_millis /.from_millis] - (|> expected /.to_millis /.from_millis (\= expected))) + (_.cover [/.to_millis /.of_millis] + (|> expected /.to_millis /.of_millis (\= expected))) (_.cover [/.relative /.absolute] (|> expected /.relative /.absolute (\= expected))) - (_.cover [/.date /.time /.from_date_time] + (_.cover [/.date /.time /.of_date_time] (\= expected - (/.from_date_time (/.date expected) - (/.time expected)))) + (/.of_date_time (/.date expected) + (/.time expected)))) )) (do random.monad [#let [(^open "\.") /.equivalence diff --git a/stdlib/source/test/lux/time/month.lux b/stdlib/source/test/lux/time/month.lux index d6f124244..317783047 100644 --- a/stdlib/source/test/lux/time/month.lux +++ b/stdlib/source/test/lux/time/month.lux @@ -32,7 +32,7 @@ (let [december (/.number #/.December)] (|> random.nat (\ random.monad map (|>> (n.% december) inc)) - (random.one (|>> /.by_number try.to_maybe))))) + (random.one (|>> /.by_number try.maybe))))) (def: #export test Test @@ -52,9 +52,9 @@ (do random.monad [expected ..random - invalid (random.filter (predicate.unite (n.< (/.number #/.January)) - (n.> (/.number #/.December))) - random.nat)] + invalid (random.only (predicate.unite (n.< (/.number #/.January)) + (n.> (/.number #/.December))) + random.nat)] ($_ _.and (_.cover [/.number /.by_number] (|> expected @@ -71,7 +71,7 @@ false)) (_.cover [/.year] (let [all (list.size /.year) - uniques (set.size (set.from_list /.hash /.year))] + uniques (set.size (set.of_list /.hash /.year))] (and (n.= (/.number #/.December) all) (n.= all diff --git a/stdlib/source/test/lux/time/year.lux b/stdlib/source/test/lux/time/year.lux index d97eb8334..84ed24fc4 100644 --- a/stdlib/source/test/lux/time/year.lux +++ b/stdlib/source/test/lux/time/year.lux @@ -29,7 +29,7 @@ (def: #export random (Random /.Year) - (random.one (|>> /.year try.to_maybe) random.int)) + (random.one (|>> /.year try.maybe) random.int)) (def: #export test Test @@ -79,9 +79,9 @@ (_.for [/.Period] (_.cover [/.leap /.century /.era] (n.= /.leap (n./ /.century /.era)))) - (let [leap (try.assume (/.year (.int /.leap))) - century (try.assume (/.year (.int /.century))) - era (try.assume (/.year (.int /.era)))] + (let [leap (try.assumed (/.year (.int /.leap))) + century (try.assumed (/.year (.int /.century))) + era (try.assumed (/.year (.int /.era)))] ($_ _.and (_.cover [/.leap?] (and (/.leap? leap) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux index 44807af9d..62330114a 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -142,7 +142,7 @@ (do {! r.monad} [module-name (r.unicode 5) variant-name (r.unicode 5) - record-name (|> (r.unicode 5) (r.filter (|>> (text\= variant-name) not))) + record-name (|> (r.unicode 5) (r.only (|>> (text\= variant-name) not))) size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) variant-tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) record-tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) @@ -154,8 +154,8 @@ record-tags+ (list\map code-tag record-tags) variantTC (list.zip/2 variant-tags+ primitivesC)] inputC (input variant-tags+ record-tags+ primitivesC) - [outputT outputC] (r.filter (|>> product.left (is? Any) not) - _primitive.primitive) + [outputT outputC] (r.only (|>> product.left (is? Any) not) + _primitive.primitive) #let [analyse-pm (function (_ branches) (|> (/.case _primitive.phase branches archive.empty inputC) (//type.with-type outputT) @@ -195,8 +195,8 @@ (|> (analyse-pm redundant-branchesC) _structure.check-fails))) (do ! - [[heterogeneousT heterogeneousC] (r.filter (|>> product.left (check.checks? outputT) not) - _primitive.primitive) + [[heterogeneousT heterogeneousC] (r.only (|>> product.left (check.checks? outputT) not) + _primitive.primitive) heterogeneous-idx (|> r.nat (\ ! map (n.% (list.size exhaustive-patterns)))) #let [heterogeneous-branchesC (list.concat (list (list.take heterogeneous-idx exhaustive-branchesC) (list (let [[_pattern _body] (maybe.assume (list.nth heterogeneous-idx exhaustive-branchesC))] diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux index 68b39b8b8..b8a692f07 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -38,94 +38,94 @@ [meta ["." archive]]]]]]]]) -(def: (check-apply expectedT num-args analysis) +(def: (check_apply expectedT num_args analysis) (-> Type Nat (Operation Analysis) Bit) (|> analysis - (//type.with-type expectedT) + (//type.with_type expectedT) (phase.run _primitive.state) (case> (#try.Success applyA) (let [[funcA argsA] (////analysis.application applyA)] - (n.= num-args (list.size argsA))) + (n.= num_args (list.size argsA))) (#try.Failure _) false))) (def: abstraction (do r.monad - [func-name (r.unicode 5) - arg-name (|> (r.unicode 5) (r.filter (|>> (text\= func-name) not))) + [func_name (r.unicode 5) + arg_name (|> (r.unicode 5) (r.only (|>> (text\= func_name) not))) [outputT outputC] _primitive.primitive [inputT _] _primitive.primitive - #let [g!arg (code.local-identifier arg-name)]] - (<| (_.context (%.name (name-of /.function))) + #let [g!arg (code.local_identifier arg_name)]] + (<| (_.context (%.name (name_of /.function))) ($_ _.and (_.test "Can analyse function." - (and (|> (//type.with-type (All [a] (-> a outputT)) - (/.function _primitive.phase func-name arg-name archive.empty outputC)) - _structure.check-succeeds) - (|> (//type.with-type (All [a] (-> a a)) - (/.function _primitive.phase func-name arg-name archive.empty g!arg)) - _structure.check-succeeds))) + (and (|> (//type.with_type (All [a] (-> a outputT)) + (/.function _primitive.phase func_name arg_name archive.empty outputC)) + _structure.check_succeeds) + (|> (//type.with_type (All [a] (-> a a)) + (/.function _primitive.phase func_name arg_name archive.empty g!arg)) + _structure.check_succeeds))) (_.test "Generic functions can always be specialized." - (and (|> (//type.with-type (-> inputT outputT) - (/.function _primitive.phase func-name arg-name archive.empty outputC)) - _structure.check-succeeds) - (|> (//type.with-type (-> inputT inputT) - (/.function _primitive.phase func-name arg-name archive.empty g!arg)) - _structure.check-succeeds))) + (and (|> (//type.with_type (-> inputT outputT) + (/.function _primitive.phase func_name arg_name archive.empty outputC)) + _structure.check_succeeds) + (|> (//type.with_type (-> inputT inputT) + (/.function _primitive.phase func_name arg_name archive.empty g!arg)) + _structure.check_succeeds))) (_.test "The function's name is bound to the function's type." - (|> (//type.with-type (Rec self (-> inputT self)) - (/.function _primitive.phase func-name arg-name archive.empty (code.local-identifier func-name))) - _structure.check-succeeds)) + (|> (//type.with_type (Rec self (-> inputT self)) + (/.function _primitive.phase func_name arg_name archive.empty (code.local_identifier func_name))) + _structure.check_succeeds)) )))) (def: apply (do {! r.monad} - [full-args (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) - partial-args (|> r.nat (\ ! map (n.% full-args))) - var-idx (|> r.nat (\ ! map (|>> (n.% full-args) (n.max 1)))) - inputsTC (r.list full-args _primitive.primitive) + [full_args (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) + partial_args (|> r.nat (\ ! map (n.% full_args))) + var_idx (|> r.nat (\ ! map (|>> (n.% full_args) (n.max 1)))) + inputsTC (r.list full_args _primitive.primitive) #let [inputsT (list\map product.left inputsTC) inputsC (list\map product.right inputsTC)] [outputT outputC] _primitive.primitive #let [funcT (type.function inputsT outputT) - partialT (type.function (list.drop partial-args inputsT) outputT) + partialT (type.function (list.drop partial_args inputsT) outputT) varT (#.Parameter 1) - polyT (<| (type.univ-q 1) - (type.function (list.concat (list (list.take var-idx inputsT) + polyT (<| (type.univ_q 1) + (type.function (list.concat (list (list.take var_idx inputsT) (list varT) - (list.drop (inc var-idx) inputsT)))) + (list.drop (inc var_idx) inputsT)))) varT) - poly-inputT (maybe.assume (list.nth var-idx inputsT)) - partial-poly-inputsT (list.drop (inc var-idx) inputsT) - partial-polyT1 (<| (type.function partial-poly-inputsT) - poly-inputT) - partial-polyT2 (<| (type.univ-q 1) - (type.function (#.Cons varT partial-poly-inputsT)) + poly_inputT (maybe.assume (list.nth var_idx inputsT)) + partial_poly_inputsT (list.drop (inc var_idx) inputsT) + partial_polyT1 (<| (type.function partial_poly_inputsT) + poly_inputT) + partial_polyT2 (<| (type.univ_q 1) + (type.function (#.Cons varT partial_poly_inputsT)) varT) - dummy-function (#////analysis.Function (list) (#////analysis.Reference (////reference.local 1)))]] - (<| (_.context (%.name (name-of /.apply))) + dummy_function (#////analysis.Function (list) (#////analysis.Reference (////reference.local 1)))]] + (<| (_.context (%.name (name_of /.apply))) ($_ _.and (_.test "Can analyse monomorphic type application." - (|> (/.apply _primitive.phase inputsC funcT dummy-function archive.empty (' [])) - (check-apply outputT full-args))) + (|> (/.apply _primitive.phase inputsC funcT dummy_function archive.empty (' [])) + (check_apply outputT full_args))) (_.test "Can partially apply functions." - (|> (/.apply _primitive.phase (list.take partial-args inputsC) funcT dummy-function archive.empty (' [])) - (check-apply partialT partial-args))) + (|> (/.apply _primitive.phase (list.take partial_args inputsC) funcT dummy_function archive.empty (' [])) + (check_apply partialT partial_args))) (_.test "Can apply polymorphic functions." - (|> (/.apply _primitive.phase inputsC polyT dummy-function archive.empty (' [])) - (check-apply poly-inputT full-args))) + (|> (/.apply _primitive.phase inputsC polyT dummy_function archive.empty (' [])) + (check_apply poly_inputT full_args))) (_.test "Polymorphic partial application propagates found type-vars." - (|> (/.apply _primitive.phase (list.take (inc var-idx) inputsC) polyT dummy-function archive.empty (' [])) - (check-apply partial-polyT1 (inc var-idx)))) + (|> (/.apply _primitive.phase (list.take (inc var_idx) inputsC) polyT dummy_function archive.empty (' [])) + (check_apply partial_polyT1 (inc var_idx)))) (_.test "Polymorphic partial application preserves quantification for type-vars." - (|> (/.apply _primitive.phase (list.take var-idx inputsC) polyT dummy-function archive.empty (' [])) - (check-apply partial-polyT2 var-idx))) + (|> (/.apply _primitive.phase (list.take var_idx inputsC) polyT dummy_function archive.empty (' [])) + (check_apply partial_polyT2 var_idx))) )))) (def: #export test Test - (<| (_.context (name.module (name-of /._))) + (<| (_.context (name.module (name_of /._))) ($_ _.and ..abstraction ..apply diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux index aa3382aa5..e3b4ad9ad 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux @@ -53,8 +53,8 @@ (def: #export primitive (Random [Type Code]) (`` ($_ r.either - (~~ (template [ ] - [(r.and (r\wrap ) (r\map ))] + (~~ (template [ ] + [(r.and (r\wrap ) (r\map ))] [Any code.tuple (r.list 0 (r\wrap (' [])))] [Bit code.bit r.bit] @@ -65,28 +65,28 @@ [Text code.text (r.unicode 5)] ))))) -(exception: (wrong-inference {expected Type} {inferred Type}) +(exception: (wrong_inference {expected Type} {inferred Type}) (exception.report ["Expected" (%.type expected)] ["Inferred" (%.type inferred)])) -(def: (infer expected-type analysis) +(def: (infer expected_type analysis) (-> Type (Operation Analysis) (Try Analysis)) (|> analysis - //type.with-inference + //type.with_inference (phase.run ..state) - (case> (#try.Success [inferred-type output]) - (if (is? expected-type inferred-type) + (case> (#try.Success [inferred_type output]) + (if (is? expected_type inferred_type) (#try.Success output) - (exception.throw wrong-inference [expected-type inferred-type])) + (exception.throw wrong_inference [expected_type inferred_type])) (#try.Failure error) (#try.Failure error)))) (def: #export test - (<| (_.context (name.module (name-of /._))) + (<| (_.context (name.module (name_of /._))) (`` ($_ _.and - (_.test (%.name (name-of #////analysis.Unit)) + (_.test (%.name (name_of #////analysis.Unit)) (|> (infer Any (..phase archive.empty (' []))) (case> (^ (#try.Success (#////analysis.Primitive (#////analysis.Unit output)))) (is? [] output) @@ -96,7 +96,7 @@ (~~ (template [ ] [(do r.monad [sample ] - (_.test (%.name (name-of )) + (_.test (%.name (name_of )) (|> (infer (..phase archive.empty ( sample))) (case> (#try.Success (#////analysis.Primitive ( output))) (is? sample output) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux index 4f94ea927..d854d5677 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux @@ -34,49 +34,49 @@ (type: Check (-> (Try Any) Bit)) -(template [ ] +(template [ ] [(def: Check (|>> (case> (#try.Success _) - + (#try.Failure _) - )))] + )))] [success? true false] [failure? false true] ) -(def: (reach-test var-name [export? def-module] [import? dependent-module] check!) +(def: (reach_test var_name [export? def_module] [import? dependent_module] check!) (-> Text [Bit Text] [Bit Text] Check Bit) (|> (do {! phase.monad} - [_ (//module.with-module 0 def-module - (//module.define var-name (#.Right [export? Any (' {}) []])))] - (//module.with-module 0 dependent-module + [_ (//module.with_module 0 def_module + (//module.define var_name (#.Right [export? Any (' {}) []])))] + (//module.with_module 0 dependent_module (do ! [_ (if import? - (//module.import def-module) + (//module.import def_module) (wrap []))] - (//type.with-inference - (_primitive.phase archive.empty (code.identifier [def-module var-name])))))) + (//type.with_inference + (_primitive.phase archive.empty (code.identifier [def_module var_name])))))) (phase.run _primitive.state) check!)) (def: #export test - (<| (_.context (name.module (name-of /._))) + (<| (_.context (name.module (name_of /._))) (do r.monad [[expectedT _] _primitive.primitive - def-module (r.unicode 5) - scope-name (r.unicode 5) - var-name (r.unicode 5) - dependent-module (|> (r.unicode 5) - (r.filter (|>> (text\= def-module) not)))] + def_module (r.unicode 5) + scope_name (r.unicode 5) + var_name (r.unicode 5) + dependent_module (|> (r.unicode 5) + (r.only (|>> (text\= def_module) not)))] ($_ _.and (_.test "Can analyse variable." - (|> (//scope.with-scope scope-name - (//scope.with-local [var-name expectedT] - (//type.with-inference - (_primitive.phase archive.empty (code.local-identifier var-name))))) + (|> (//scope.with_scope scope_name + (//scope.with_local [var_name expectedT] + (//type.with_inference + (_primitive.phase archive.empty (code.local_identifier var_name))))) (phase.run _primitive.state) (case> (^ (#try.Success [inferredT (#////analysis.Reference (////reference.local var))])) (and (type\= expectedT inferredT) @@ -85,23 +85,23 @@ _ false))) (_.test "Can analyse definition (in the same module)." - (let [def-name [def-module var-name]] + (let [def_name [def_module var_name]] (|> (do phase.monad - [_ (//module.define var-name (#.Right [false expectedT (' {}) []]))] - (//type.with-inference - (_primitive.phase archive.empty (code.identifier def-name)))) - (//module.with-module 0 def-module) + [_ (//module.define var_name (#.Right [false expectedT (' {}) []]))] + (//type.with_inference + (_primitive.phase archive.empty (code.identifier def_name)))) + (//module.with_module 0 def_module) (phase.run _primitive.state) - (case> (^ (#try.Success [_ inferredT (#////analysis.Reference (////reference.constant constant-name))])) + (case> (^ (#try.Success [_ inferredT (#////analysis.Reference (////reference.constant constant_name))])) (and (type\= expectedT inferredT) - (name\= def-name constant-name)) + (name\= def_name constant_name)) _ false)))) (_.test "Can analyse definition (if exported from imported module)." - (reach-test var-name [true def-module] [true dependent-module] success?)) + (reach_test var_name [true def_module] [true dependent_module] success?)) (_.test "Cannot analyse definition (if not exported from imported module)." - (reach-test var-name [false def-module] [true dependent-module] failure?)) + (reach_test var_name [false def_module] [true dependent_module] failure?)) (_.test "Cannot analyse definition (if exported from non-imported module)." - (reach-test var-name [true def-module] [false dependent-module] failure?)) + (reach_test var_name [true def_module] [false dependent_module] failure?)) )))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux index d263e3f0d..3782e861f 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -38,21 +38,21 @@ [meta ["." archive]]]]]]]]) -(template [ ] +(template [ ] [(def: #export (All [a] (-> (Operation a) Bit)) (|>> (phase.run _primitive.state) (case> (#try.Success _) - + _ - )))] + )))] - [check-succeeds true false] - [check-fails false true] + [check_succeeds true false] + [check_fails false true] ) -(def: (check-sum' tag size variant) +(def: (check_sum' tag size variant) (-> Tag Nat (Variant Analysis) Bit) (let [expected//right? (n.= (dec size) tag) expected//lefts (if expected//right? @@ -65,36 +65,36 @@ (bit\= expected//right? actual//right?)))) -(def: (check-sum type tag size analysis) +(def: (check_sum type tag size analysis) (-> Type Tag Nat (Operation Analysis) Bit) (|> analysis - (//type.with-type type) + (//type.with_type type) (phase.run _primitive.state) (case> (^ (#try.Success (////analysis.variant variant))) - (check-sum' tag size variant) + (check_sum' tag size variant) _ false))) -(def: (with-tags module tags type) +(def: (with_tags module tags type) (All [a] (-> Text (List //module.Tag) Type (Operation a) (Operation [Module a]))) (|>> (do phase.monad - [_ (//module.declare-tags tags false type)]) - (//module.with-module 0 module))) + [_ (//module.declare_tags tags false type)]) + (//module.with_module 0 module))) -(def: (check-variant module tags expectedT variantT tag analysis) +(def: (check_variant module tags expectedT variantT tag analysis) (-> Text (List //module.Tag) Type Type Tag (Operation Analysis) Bit) (|> analysis - (with-tags module tags variantT) - (//type.with-type expectedT) + (with_tags module tags variantT) + (//type.with_type expectedT) (phase.run _primitive.state) (case> (^ (#try.Success [_ (////analysis.variant variant)])) - (check-sum' tag (list.size tags) variant) + (check_sum' tag (list.size tags) variant) _ false))) -(def: (correct-size? size) +(def: (correct_size? size) (-> Nat (-> Analysis Bit)) (|>> (case> (^ (////analysis.tuple elems)) (|> elems @@ -104,14 +104,14 @@ _ false))) -(def: (check-record module tags expectedT recordT size analysis) +(def: (check_record module tags expectedT recordT size analysis) (-> Text (List //module.Tag) Type Type Nat (Operation Analysis) Bit) (|> analysis - (with-tags module tags recordT) - (//type.with-type expectedT) + (with_tags module tags recordT) + (//type.with_type expectedT) (phase.run _primitive.state) (case> (#try.Success [_ productA]) - (correct-size? size productA) + (correct_size? size productA) _ false))) @@ -131,41 +131,41 @@ (list.drop choice primitives))) [+valueT +valueC] (maybe.assume (list.nth +choice +primitives)) +variantT (type.variant (list\map product.left +primitives))]] - (<| (_.context (%.name (name-of /.sum))) + (<| (_.context (%.name (name_of /.sum))) ($_ _.and (_.test "Can analyse." - (check-sum variantT choice size + (check_sum variantT choice size (/.sum _primitive.phase choice archive.empty valueC))) (_.test "Can analyse through bound type-vars." (|> (do phase.monad - [[_ varT] (//type.with-env check.var) - _ (//type.with-env - (check.check varT variantT))] - (//type.with-type varT - (/.sum _primitive.phase choice archive.empty valueC))) + [[_ varT] (//type.with_env check.var) + _ (//type.with_env + (check.check varT variantT))] + (//type.with_type varT + (/.sum _primitive.phase choice archive.empty valueC))) (phase.run _primitive.state) (case> (^ (#try.Success (////analysis.variant variant))) - (check-sum' choice size variant) + (check_sum' choice size variant) _ false))) (_.test "Cannot analyse through unbound type-vars." (|> (do phase.monad - [[_ varT] (//type.with-env check.var)] - (//type.with-type varT - (/.sum _primitive.phase choice archive.empty valueC))) - check-fails)) + [[_ varT] (//type.with_env check.var)] + (//type.with_type varT + (/.sum _primitive.phase choice archive.empty valueC))) + check_fails)) (_.test "Can analyse through existential quantification." - (|> (//type.with-type (type.ex-q 1 +variantT) - (/.sum _primitive.phase +choice archive.empty +valueC)) - check-succeeds)) + (|> (//type.with_type (type.ex_q 1 +variantT) + (/.sum _primitive.phase +choice archive.empty +valueC)) + check_succeeds)) (_.test "Can analyse through universal quantification." - (let [check-outcome (if (not (n.= choice +choice)) - check-succeeds - check-fails)] - (|> (//type.with-type (type.univ-q 1 +variantT) - (/.sum _primitive.phase +choice archive.empty +valueC)) - check-outcome))) + (let [check_outcome (if (not (n.= choice +choice)) + check_succeeds + check_fails)] + (|> (//type.with_type (type.univ_q 1 +variantT) + (/.sum _primitive.phase +choice archive.empty +valueC)) + check_outcome))) )))) (def: product @@ -180,52 +180,52 @@ (list [(#.Parameter 1) +valueC]) (list.drop choice primitives))) +tupleT (type.tuple (list\map product.left +primitives))]] - (<| (_.context (%.name (name-of /.product))) + (<| (_.context (%.name (name_of /.product))) ($_ _.and (_.test "Can analyse." - (|> (//type.with-type tupleT - (/.product archive.empty _primitive.phase (list\map product.right primitives))) + (|> (//type.with_type tupleT + (/.product archive.empty _primitive.phase (list\map product.right primitives))) (phase.run _primitive.state) (case> (#try.Success tupleA) - (correct-size? size tupleA) + (correct_size? size tupleA) _ false))) (_.test "Can infer." - (|> (//type.with-inference - (/.product archive.empty _primitive.phase (list\map product.right primitives))) + (|> (//type.with_inference + (/.product archive.empty _primitive.phase (list\map product.right primitives))) (phase.run _primitive.state) (case> (#try.Success [_type tupleA]) (and (check.checks? tupleT _type) - (correct-size? size tupleA)) + (correct_size? size tupleA)) _ false))) (_.test "Can analyse singleton." - (|> (//type.with-type singletonT - (_primitive.phase archive.empty (` [(~ singletonC)]))) - check-succeeds)) + (|> (//type.with_type singletonT + (_primitive.phase archive.empty (` [(~ singletonC)]))) + check_succeeds)) (_.test "Can analyse through bound type-vars." (|> (do phase.monad - [[_ varT] (//type.with-env check.var) - _ (//type.with-env - (check.check varT (type.tuple (list\map product.left primitives))))] - (//type.with-type varT - (/.product archive.empty _primitive.phase (list\map product.right primitives)))) + [[_ varT] (//type.with_env check.var) + _ (//type.with_env + (check.check varT (type.tuple (list\map product.left primitives))))] + (//type.with_type varT + (/.product archive.empty _primitive.phase (list\map product.right primitives)))) (phase.run _primitive.state) (case> (#try.Success tupleA) - (correct-size? size tupleA) + (correct_size? size tupleA) _ false))) (_.test "Can analyse through existential quantification." - (|> (//type.with-type (type.ex-q 1 +tupleT) - (/.product archive.empty _primitive.phase (list\map product.right +primitives))) - check-succeeds)) + (|> (//type.with_type (type.ex_q 1 +tupleT) + (/.product archive.empty _primitive.phase (list\map product.right +primitives))) + check_succeeds)) (_.test "Cannot analyse through universal quantification." - (|> (//type.with-type (type.univ-q 1 +tupleT) - (/.product archive.empty _primitive.phase (list\map product.right +primitives))) - check-fails)) + (|> (//type.with_type (type.univ_q 1 +tupleT) + (/.product archive.empty _primitive.phase (list\map product.right +primitives))) + check_fails)) )))) (def: variant @@ -233,44 +233,44 @@ [size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) choice (|> r.nat (\ ! map (n.% size))) - other-choice (|> r.nat (\ ! map (n.% size)) (r.filter (|>> (n.= choice) not))) + other_choice (|> r.nat (\ ! map (n.% size)) (r.only (|>> (n.= choice) not))) primitives (r.list size _primitive.primitive) - module-name (r.unicode 5) - type-name (r.unicode 5) - #let [with-name (|>> (#.Named [module-name type-name])) + module_name (r.unicode 5) + type_name (r.unicode 5) + #let [with_name (|>> (#.Named [module_name type_name])) varT (#.Parameter 1) primitivesT (list\map product.left primitives) [choiceT choiceC] (maybe.assume (list.nth choice primitives)) - [other-choiceT other-choiceC] (maybe.assume (list.nth other-choice primitives)) + [other_choiceT other_choiceC] (maybe.assume (list.nth other_choice primitives)) monoT (type.variant primitivesT) polyT (|> (type.variant (list.concat (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) - (type.univ-q 1)) - choice-tag (maybe.assume (list.nth choice tags)) - other-choice-tag (maybe.assume (list.nth other-choice tags))]] - (<| (_.context (%.name (name-of /.tagged-sum))) + (type.univ_q 1)) + choice_tag (maybe.assume (list.nth choice tags)) + other_choice_tag (maybe.assume (list.nth other_choice tags))]] + (<| (_.context (%.name (name_of /.tagged_sum))) ($_ _.and (_.test "Can infer." - (|> (/.tagged-sum _primitive.phase [module-name choice-tag] archive.empty choiceC) - (check-variant module-name tags - monoT (with-name monoT) + (|> (/.tagged_sum _primitive.phase [module_name choice_tag] archive.empty choiceC) + (check_variant module_name tags + monoT (with_name monoT) choice))) (_.test "Inference retains universal quantification when type-vars are not bound." - (|> (/.tagged-sum _primitive.phase [module-name other-choice-tag] archive.empty other-choiceC) - (check-variant module-name tags - polyT (with-name polyT) - other-choice))) + (|> (/.tagged_sum _primitive.phase [module_name other_choice_tag] archive.empty other_choiceC) + (check_variant module_name tags + polyT (with_name polyT) + other_choice))) (_.test "Can specialize." - (|> (//type.with-type monoT - (/.tagged-sum _primitive.phase [module-name other-choice-tag] archive.empty other-choiceC)) - (check-variant module-name tags - monoT (with-name polyT) - other-choice))) + (|> (//type.with_type monoT + (/.tagged_sum _primitive.phase [module_name other_choice_tag] archive.empty other_choiceC)) + (check_variant module_name tags + monoT (with_name polyT) + other_choice))) (_.test "Specialization when type-vars get bound." - (|> (/.tagged-sum _primitive.phase [module-name choice-tag] archive.empty choiceC) - (check-variant module-name tags - monoT (with-name polyT) + (|> (/.tagged_sum _primitive.phase [module_name choice_tag] archive.empty choiceC) + (check_variant module_name tags + monoT (with_name polyT) choice))) )))) @@ -279,28 +279,28 @@ [size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) primitives (r.list size _primitive.primitive) - module-name (r.unicode 5) - type-name (r.unicode 5) + module_name (r.unicode 5) + type_name (r.unicode 5) choice (|> r.nat (\ ! map (n.% size))) #let [varT (#.Parameter 1) - tagsC (list\map (|>> [module-name] code.tag) tags) + tagsC (list\map (|>> [module_name] code.tag) tags) primitivesT (list\map product.left primitives) primitivesC (list\map product.right primitives) - monoT (#.Named [module-name type-name] (type.tuple primitivesT)) + monoT (#.Named [module_name type_name] (type.tuple primitivesT)) recordC (list.zip/2 tagsC primitivesC) polyT (|> (type.tuple (list.concat (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) - (type.univ-q 1) - (#.Named [module-name type-name]))]] - (<| (_.context (%.name (name-of /.record))) + (type.univ_q 1) + (#.Named [module_name type_name]))]] + (<| (_.context (%.name (name_of /.record))) (_.test "Can infer." (|> (/.record archive.empty _primitive.phase recordC) - (check-record module-name tags monoT monoT size)))))) + (check_record module_name tags monoT monoT size)))))) (def: #export test Test - (<| (_.context (name.module (name-of /._))) + (<| (_.context (name.module (name_of /._))) ($_ _.and ..sum ..product diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index ebcaa3917..a0643cbcd 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -33,11 +33,11 @@ ["." archive]]]]]]) (template [ ] - [(def: ( procedure params output-type) + [(def: ( procedure params output_type) (-> Text (List Code) Type Bit) - (|> (////scope.with-scope "" - (////type.with-type output-type - (_primitive.phase archive.empty (` ((~ (code.text procedure)) (~+ params)))))) + (|> (////scope.with_scope "" + (////type.with_type output_type + (_primitive.phase archive.empty (` ((~ (code.text procedure)) (~+ params)))))) (phase.run _primitive.state) (case> (#try.Success _) @@ -45,27 +45,27 @@ (#try.Failure _) )))] - [check-success+ true false] - [check-failure+ false true] + [check_success+ true false] + [check_failure+ false true] ) (def: primitive (Random [Type Code]) - (r.filter (|>> product.left (is? Any) not) _primitive.primitive)) + (r.only (|>> product.left (is? Any) not) _primitive.primitive)) (def: lux Test (do r.monad [[primT primC] ..primitive [antiT antiC] (|> ..primitive - (r.filter (|>> product.left (type\= primT) not)))] + (r.only (|>> product.left (type\= primT) not)))] ($_ _.and (_.test "Can test for reference equality." - (check-success+ "lux is" (list primC primC) Bit)) + (check_success+ "lux is" (list primC primC) Bit)) (_.test "Reference equality must be done with elements of the same type." - (check-failure+ "lux is" (list primC antiC) Bit)) + (check_failure+ "lux is" (list primC antiC) Bit)) (_.test "Can 'try' risky IO computations." - (check-success+ "lux try" + (check_success+ "lux try" (list (` ("lux io error" "YOLO"))) (type (Either Text primT)))) ))) @@ -78,23 +78,23 @@ paramC (|> r.nat (\ ! map code.nat))] ($_ _.and (_.test "i64 'and'." - (check-success+ "lux i64 and" (list paramC subjectC) Nat)) + (check_success+ "lux i64 and" (list paramC subjectC) Nat)) (_.test "i64 'or'." - (check-success+ "lux i64 or" (list paramC subjectC) Nat)) + (check_success+ "lux i64 or" (list paramC subjectC) Nat)) (_.test "i64 'xor'." - (check-success+ "lux i64 xor" (list paramC subjectC) Nat)) + (check_success+ "lux i64 xor" (list paramC subjectC) Nat)) (_.test "i64 left-shift." - (check-success+ "lux i64 left-shift" (list paramC subjectC) Nat)) + (check_success+ "lux i64 left-shift" (list paramC subjectC) Nat)) (_.test "i64 logical-right-shift." - (check-success+ "lux i64 logical-right-shift" (list paramC subjectC) Nat)) + (check_success+ "lux i64 logical-right-shift" (list paramC subjectC) Nat)) (_.test "i64 arithmetic-right-shift." - (check-success+ "lux i64 arithmetic-right-shift" (list paramC signedC) Int)) + (check_success+ "lux i64 arithmetic-right-shift" (list paramC signedC) Int)) (_.test "i64 equivalence." - (check-success+ "lux i64 =" (list paramC subjectC) Bit)) + (check_success+ "lux i64 =" (list paramC subjectC) Bit)) (_.test "i64 addition." - (check-success+ "lux i64 +" (list paramC subjectC) Int)) + (check_success+ "lux i64 +" (list paramC subjectC) Int)) (_.test "i64 subtraction." - (check-success+ "lux i64 -" (list paramC subjectC) Int)) + (check_success+ "lux i64 -" (list paramC subjectC) Int)) ))) (def: int @@ -104,52 +104,52 @@ paramC (|> r.int (\ ! map code.int))] ($_ _.and (_.test "Can multiply integers." - (check-success+ "lux i64 *" (list paramC subjectC) Int)) + (check_success+ "lux i64 *" (list paramC subjectC) Int)) (_.test "Can divide integers." - (check-success+ "lux i64 /" (list paramC subjectC) Int)) + (check_success+ "lux i64 /" (list paramC subjectC) Int)) (_.test "Can calculate remainder of integers." - (check-success+ "lux i64 %" (list paramC subjectC) Int)) + (check_success+ "lux i64 %" (list paramC subjectC) Int)) (_.test "Can compare integers." - (check-success+ "lux i64 <" (list paramC subjectC) Bit)) + (check_success+ "lux i64 <" (list paramC subjectC) Bit)) (_.test "Can convert integer to text." - (check-success+ "lux i64 char" (list subjectC) Text)) + (check_success+ "lux i64 char" (list subjectC) Text)) (_.test "Can convert integer to fraction." - (check-success+ "lux i64 f64" (list subjectC) Frac)) + (check_success+ "lux i64 f64" (list subjectC) Frac)) ))) (def: frac Test (do {! r.monad} - [subjectC (|> r.safe-frac (\ ! map code.frac)) - paramC (|> r.safe-frac (\ ! map code.frac)) - encodedC (|> r.safe-frac (\ ! map (|>> %.frac code.text)))] + [subjectC (|> r.safe_frac (\ ! map code.frac)) + paramC (|> r.safe_frac (\ ! map code.frac)) + encodedC (|> r.safe_frac (\ ! map (|>> %.frac code.text)))] ($_ _.and (_.test "Can add frac numbers." - (check-success+ "lux f64 +" (list paramC subjectC) Frac)) + (check_success+ "lux f64 +" (list paramC subjectC) Frac)) (_.test "Can subtract frac numbers." - (check-success+ "lux f64 -" (list paramC subjectC) Frac)) + (check_success+ "lux f64 -" (list paramC subjectC) Frac)) (_.test "Can multiply frac numbers." - (check-success+ "lux f64 *" (list paramC subjectC) Frac)) + (check_success+ "lux f64 *" (list paramC subjectC) Frac)) (_.test "Can divide frac numbers." - (check-success+ "lux f64 /" (list paramC subjectC) Frac)) + (check_success+ "lux f64 /" (list paramC subjectC) Frac)) (_.test "Can calculate remainder of frac numbers." - (check-success+ "lux f64 %" (list paramC subjectC) Frac)) + (check_success+ "lux f64 %" (list paramC subjectC) Frac)) (_.test "Can test equivalence of frac numbers." - (check-success+ "lux f64 =" (list paramC subjectC) Bit)) + (check_success+ "lux f64 =" (list paramC subjectC) Bit)) (_.test "Can compare frac numbers." - (check-success+ "lux f64 <" (list paramC subjectC) Bit)) + (check_success+ "lux f64 <" (list paramC subjectC) Bit)) (_.test "Can obtain minimum frac number." - (check-success+ "lux f64 min" (list) Frac)) + (check_success+ "lux f64 min" (list) Frac)) (_.test "Can obtain maximum frac number." - (check-success+ "lux f64 max" (list) Frac)) + (check_success+ "lux f64 max" (list) Frac)) (_.test "Can obtain smallest frac number." - (check-success+ "lux f64 smallest" (list) Frac)) + (check_success+ "lux f64 smallest" (list) Frac)) (_.test "Can convert frac number to integer." - (check-success+ "lux f64 i64" (list subjectC) Int)) + (check_success+ "lux f64 i64" (list subjectC) Int)) (_.test "Can convert frac number to text." - (check-success+ "lux f64 encode" (list subjectC) Text)) + (check_success+ "lux f64 encode" (list subjectC) Text)) (_.test "Can convert text to frac number." - (check-success+ "lux f64 decode" (list encodedC) (type (Maybe Frac)))) + (check_success+ "lux f64 decode" (list encodedC) (type (Maybe Frac)))) ))) (def: text @@ -162,19 +162,19 @@ toC (|> r.nat (\ ! map code.nat))] ($_ _.and (_.test "Can test text equivalence." - (check-success+ "lux text =" (list paramC subjectC) Bit)) + (check_success+ "lux text =" (list paramC subjectC) Bit)) (_.test "Compare texts in lexicographical order." - (check-success+ "lux text <" (list paramC subjectC) Bit)) + (check_success+ "lux text <" (list paramC subjectC) Bit)) (_.test "Can concatenate one text to another." - (check-success+ "lux text concat" (list subjectC paramC) Text)) + (check_success+ "lux text concat" (list subjectC paramC) Text)) (_.test "Can find the index of a piece of text inside a larger one that (may) contain it." - (check-success+ "lux text index" (list fromC paramC subjectC) (type (Maybe Nat)))) + (check_success+ "lux text index" (list fromC paramC subjectC) (type (Maybe Nat)))) (_.test "Can query the size/length of a text." - (check-success+ "lux text size" (list subjectC) Nat)) + (check_success+ "lux text size" (list subjectC) Nat)) (_.test "Can obtain the character code of a text at a given index." - (check-success+ "lux text char" (list fromC subjectC) Nat)) + (check_success+ "lux text char" (list fromC subjectC) Nat)) (_.test "Can clip a piece of text between 2 indices." - (check-success+ "lux text clip" (list fromC toC subjectC) Text)) + (check_success+ "lux text clip" (list fromC toC subjectC) Text)) ))) (def: io @@ -184,16 +184,16 @@ exitC (|> r.int (\ ! map code.int))] ($_ _.and (_.test "Can log messages to standard output." - (check-success+ "lux io log" (list logC) Any)) + (check_success+ "lux io log" (list logC) Any)) (_.test "Can throw a run-time error." - (check-success+ "lux io error" (list logC) Nothing)) + (check_success+ "lux io error" (list logC) Nothing)) (_.test "Can query the current time (as milliseconds since epoch)." - (check-success+ "lux io current-time" (list) Int)) + (check_success+ "lux io current-time" (list) Int)) ))) (def: #export test Test - (<| (_.context (name.module (name-of /._))) + (<| (_.context (name.module (name_of /._))) ($_ _.and ..lux ..i64 diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux index 9b21270a4..7e1ebf587 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux @@ -57,7 +57,7 @@ (let [local (do {! random.monad} [register (\ ! map (|>> (n.% arity) inc) random.nat)] (wrap [next - [(#variable.Local (/.register-optimization offset register)) + [(#variable.Local (/.register_optimization offset register)) (#variable.Local register)]]))] (case offset 0 local @@ -140,7 +140,7 @@ [//.path/member] )) (random\wrap [(inc next) - [(//.path/bind (/.register-optimization offset next)) + [(//.path/bind (/.register_optimization offset next)) (//.path/bind next)]]) )))) sequential (: (Scenario Path) @@ -161,7 +161,7 @@ (def: (branch offset arity next) (Scenario Synthesis) - (let [random-member (: (Random Member) + (let [random_member (: (Random Member) (random.or random.nat random.nat))] ($_ random.either @@ -170,7 +170,7 @@ [[next [inputE inputA]] (..reference offset arity next) [next [bodyE bodyA]] (..reference offset arity next)] (wrap [next - [(//.branch/let [inputE (/.register-optimization offset next) bodyE]) + [(//.branch/let [inputE (/.register_optimization offset next) bodyE]) (//.branch/let [inputA next bodyA])]])) (do {! random.monad} [[next [testE testA]] (..reference offset arity next) @@ -182,8 +182,8 @@ ($_ random.either (do {! random.monad} [[next [recordE recordA]] (..reference offset arity next) - path-length (\ ! map (|>> (n.% 5) inc) random.nat) - path (random.list path-length random-member)] + path_length (\ ! map (|>> (n.% 5) inc) random.nat) + path (random.list path_length random_member)] (wrap [next [(//.branch/get [path recordE]) (//.branch/get [path recordA])]])) @@ -204,7 +204,7 @@ [next [iterationE iterationA]] (..reference offset arity next)] (wrap [next [(//.loop/scope - {#//.start (/.register-optimization offset next) + {#//.start (/.register_optimization offset next) #//.inits (list firstE secondE) #//.iteration iterationE}) (//.loop/scope @@ -266,26 +266,26 @@ (<| (_.covering /._) ($_ _.and (do {! random.monad} - [expected-offset (\ ! map (|>> (n.% 5) (n.+ 2)) random.nat) + [expected_offset (\ ! map (|>> (n.% 5) (n.+ 2)) random.nat) arity (\ ! map (|>> (n.% 5) inc) random.nat) - expected-inits (|> random.nat + expected_inits (|> random.nat (\ ! map (|>> .i64 //.i64)) (random.list arity)) - [_ [expected iteration]] (..scenario expected-offset arity 0)] - (_.cover [/.Transform /.optimization /.register-optimization] - (case (/.optimization true expected-offset expected-inits - {#//.environment (|> expected-offset + [_ [expected iteration]] (..scenario expected_offset arity 0)] + (_.cover [/.Transform /.optimization /.register_optimization] + (case (/.optimization true expected_offset expected_inits + {#//.environment (|> expected_offset list.indices (list\map (|>> #variable.Local))) #//.arity arity #//.body iteration}) - (^ (#.Some (//.loop/scope [actual-offset actual-inits + (^ (#.Some (//.loop/scope [actual_offset actual_inits actual]))) - (and (n.= expected-offset - actual-offset) + (and (n.= expected_offset + actual_offset) (\ (list.equivalence //.equivalence) = - expected-inits - actual-inits) + expected_inits + actual_inits) (\ //.equivalence = expected actual)) _ diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux index cbb463ac3..8a71ed224 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux @@ -108,7 +108,7 @@ (def: comment-text^ (Random Text) - (let [char-gen (|> r.nat (r.filter (|>> (n.= (`` (char (~~ (static text.new-line))))) not)))] + (let [char-gen (|> r.nat (r.only (|>> (n.= (`` (char (~~ (static text.new-line))))) not)))] (do r.monad [size (|> r.nat (r\map (n.% 20)))] (r.text char-gen size)))) diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index b6c24bde2..65c02256b 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -70,28 +70,28 @@ ($equivalence.spec /.equivalence ..random)) (do {! random.monad} - [anonymousT (random.filter (|>> (case> (#.Named _ _) false - _ true)) - ..random) + [anonymousT (random.only (|>> (case> (#.Named _ _) false + _ true)) + ..random) name/0 ..name name/1 ..name #let [namedT (#.Named name/0 anonymousT) aliasedT (#.Named name/1 namedT)]] ($_ _.and - (_.cover [/.un_alias] - (\ /.equivalence = namedT (/.un_alias aliasedT))) - (_.cover [/.un_name] - (\ /.equivalence = anonymousT (/.un_name aliasedT))))) + (_.cover [/.de_aliased] + (\ /.equivalence = namedT (/.de_aliased aliasedT))) + (_.cover [/.anonymous] + (\ /.equivalence = anonymousT (/.anonymous aliasedT))))) (do {! random.monad} [size (|> random.nat (\ ! map (n.% 3))) members (|> ..random - (random.filter (function (_ type) - (case type - (^or (#.Sum _) (#.Product _)) - #0 + (random.only (function (_ type) + (case type + (^or (#.Sum _) (#.Product _)) + #0 - _ - #1))) + _ + #1))) (list.repeat size) (monad.seq !)) #let [(^open "/\.") /.equivalence @@ -104,50 +104,50 @@ (and (list\= (list) members) (list\= (list ) flat)))))] - [/.variant /.flatten_variant Nothing] - [/.tuple /.flatten_tuple Any] + [/.variant /.flat_variant Nothing] + [/.tuple /.flat_tuple Any] )) ))) - (_.cover [/.apply] + (_.cover [/.applied] (and (<| (maybe.default #0) (do maybe.monad - [partial (/.apply (list Bit) Ann) - full (/.apply (list Int) partial)] + [partial (/.applied (list Bit) Ann) + full (/.applied (list Int) partial)] (wrap (\ /.equivalence = full (#.Product Bit Int))))) - (|> (/.apply (list Bit) Text) + (|> (/.applied (list Bit) Text) (case> #.None #1 _ #0)))) (do {! random.monad} [size (|> random.nat (\ ! map (n.% 3))) members (monad.seq ! (list.repeat size ..random)) extra (|> ..random - (random.filter (function (_ type) - (case type - (^or (#.Function _) (#.Apply _)) - #0 + (random.only (function (_ type) + (case type + (^or (#.Function _) (#.Apply _)) + #0 - _ - #1)))) + _ + #1)))) #let [(^open "/\.") /.equivalence (^open "list\.") (list.equivalence /.equivalence)]] ($_ _.and - (_.cover [/.function /.flatten_function] - (let [[inputs output] (|> (/.function members extra) /.flatten_function)] + (_.cover [/.function /.flat_function] + (let [[inputs output] (|> (/.function members extra) /.flat_function)] (and (list\= members inputs) (/\= extra output)))) - (_.cover [/.application /.flatten_application] - (let [[tfunc tparams] (|> extra (/.application members) /.flatten_application)] + (_.cover [/.application /.flat_application] + (let [[tfunc tparams] (|> extra (/.application members) /.flat_application)] (n.= (list.size members) (list.size tparams)))) )) (do {! random.monad} [size (|> random.nat (\ ! map (|>> (n.% 3) inc))) body_type (|> ..random - (random.filter (function (_ type) - (case type - (^or (#.UnivQ _) (#.ExQ _)) - #0 + (random.only (function (_ type) + (case type + (^or (#.UnivQ _) (#.ExQ _)) + #0 - _ - #1)))) + _ + #1)))) #let [(^open "/\.") /.equivalence]] (`` ($_ _.and (~~ (template [ ] @@ -156,8 +156,8 @@ (and (n.= size flat_size) (/\= body_type flat_body))))] - [/.univ_q /.flatten_univ_q] - [/.ex_q /.flatten_ex_q] + [/.univ_q /.flat_univ_q] + [/.ex_q /.flat_ex_q] )) (_.cover [/.quantified?] (and (not (/.quantified? body_type)) @@ -167,17 +167,17 @@ (do {! random.monad} [depth (|> random.nat (\ ! map (|>> (n.% 3) inc))) element_type (|> ..random - (random.filter (function (_ type) - (case type - (^ (#.Primitive name (list element_type))) - (not (text\= array.type_name name)) + (random.only (function (_ type) + (case type + (^ (#.Primitive name (list element_type))) + (not (text\= array.type_name name)) - _ - #1)))) + _ + #1)))) #let [(^open "/\.") /.equivalence]] ($_ _.and - (_.cover [/.array /.flatten_array] - (let [[flat_depth flat_element] (|> element_type (/.array depth) /.flatten_array)] + (_.cover [/.array /.flat_array] + (let [[flat_depth flat_element] (|> element_type (/.array depth) /.flat_array)] (and (n.= depth flat_depth) (/\= element_type flat_element)))) (_.cover [/.array?] @@ -210,14 +210,14 @@ (is? left,right)))) (do random.monad [expected random.nat] - (_.cover [/.:share] + (_.cover [/.:sharing] (n.= expected - (/.:share [a] - (I64 a) - expected + (/.:sharing [a] + (I64 a) + expected - (I64 a) - (.i64 expected))))) + (I64 a) + (.i64 expected))))) /abstract.test /check.test diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index 40079eae9..1807046e5 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -338,7 +338,7 @@ (All [a] (-> (-> a a Bit) (Random a) (Random [a a]))) (do random.monad [left random - right (random.filter (|>> (= left) not) random)] + right (random.only (|>> (= left) not) random)] (wrap [left right]))) (type: Super diff --git a/stdlib/source/test/lux/type/quotient.lux b/stdlib/source/test/lux/type/quotient.lux index 5d39b91f2..9a800b92d 100644 --- a/stdlib/source/test/lux/type/quotient.lux +++ b/stdlib/source/test/lux/type/quotient.lux @@ -30,7 +30,7 @@ Test (<| (_.covering /._) (do random.monad - [modulus (random.filter (n.> 0) random.nat) + [modulus (random.only (n.> 0) random.nat) #let [class (: (-> Nat Text) (|>> (n.% modulus) %.nat))] value random.nat] diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux index 6ee53edcd..52c8fac88 100644 --- a/stdlib/source/test/lux/type/refinement.lux +++ b/stdlib/source/test/lux/type/refinement.lux @@ -64,16 +64,16 @@ (maybe\map (|>> /.un_refine (n.= (n.+ modulus (inc modulus))))) (maybe.default false) not))) - (_.cover [/.filter] - (let [expected (list.filter predicate raws) - actual (/.filter (/.refinement predicate) raws)] + (_.cover [/.only] + (let [expected (list.only predicate raws) + actual (/.only (/.refinement predicate) raws)] (and (n.= (list.size expected) (list.size actual)) (\ (list.equivalence n.equivalence) = expected (list\map /.un_refine actual))))) (_.cover [/.partition] - (let [expected (list.filter predicate raws) + (let [expected (list.only predicate raws) [actual alternative] (/.partition (/.refinement predicate) raws)] (and (n.= (list.size expected) (list.size actual)) diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux index 1bed08707..683bf504c 100644 --- a/stdlib/source/test/lux/type/unit.lux +++ b/stdlib/source/test/lux/type/unit.lux @@ -27,7 +27,7 @@ (-> Nat (Random (/.Qty ))) (|> random.int (\ random.monad map (i.% (.int range))) - (random.filter (|>> (i.= +0) not)) + (random.only (|>> (i.= +0) not)) (\ random.monad map (\ in))))] [meter /.Meter /.meter] @@ -158,7 +158,7 @@ [#let [zero (\ /.meter in +0) (^open "meter\.") (: (Equivalence (/.Qty /.Meter)) /.equivalence)] - left (random.filter (|>> (meter\= zero) not) (..meter 1,000)) + left (random.only (|>> (meter\= zero) not) (..meter 1,000)) right (..meter 1,000) extra (..second 1,000)] (`` ($_ _.and diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux index c34a5c488..e7fd9f42b 100644 --- a/stdlib/source/test/lux/world/console.lux +++ b/stdlib/source/test/lux/world/console.lux @@ -25,15 +25,15 @@ (implementation (def: (on_read [dead? content]) (do try.monad - [char (try.from_maybe (text.nth 0 content)) - [_ content] (try.from_maybe (text.split 1 content))] + [char (try.of_maybe (text.nth 0 content)) + [_ content] (try.of_maybe (text.split 1 content))] (if dead? (exception.throw ..dead []) (wrap [[dead? content] char])))) (def: (on_read_line [dead? content]) (do try.monad - [[line content] (try.from_maybe (text.split_with text.new_line content))] + [[line content] (try.of_maybe (text.split_with text.new_line content))] (if dead? (exception.throw ..dead []) (wrap [[dead? content] line])))) diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index bbbcdf680..ebb9a374d 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -51,8 +51,8 @@ (/.deletion? /.deletion))) (do random.monad [left ..concern - right (random.filter (|>> (is? left) not) - ..concern) + right (random.only (|>> (is? left) not) + ..concern) #let [[left left?] left [right right?] right]] (_.cover [/.also] diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index f75907fad..89c559bb5 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -114,14 +114,14 @@ (list.concat (`` (list (~~ (template [ ] [((: (-> Any (List /.Key)) (function (_ _) - (`` (list (~~ (template.splice )))))) + (`` (list (~~ (template.spliced )))))) [])] )))))) (def: catalogue (Set /.Key) - (set.from_list n.hash ..listing)) + (set.of_list n.hash ..listing)) (def: verdict (n.= (list.size ..listing) diff --git a/stdlib/source/test/lux/world/net/http/status.lux b/stdlib/source/test/lux/world/net/http/status.lux index b051d8e8e..09f8fa86a 100644 --- a/stdlib/source/test/lux/world/net/http/status.lux +++ b/stdlib/source/test/lux/world/net/http/status.lux @@ -87,14 +87,14 @@ (list.concat (`` (list (~~ (template [ ] [((: (-> Any (List //.Status)) (function (_ _) - (`` (list (~~ (template.splice )))))) + (`` (list (~~ (template.spliced )))))) 123)] )))))) (def: unique (Set //.Status) - (set.from_list n.hash ..all)) + (set.of_list n.hash ..all)) (def: verdict (n.= (list.size ..all) diff --git a/stdlib/source/test/lux/world/output/video/resolution.lux b/stdlib/source/test/lux/world/output/video/resolution.lux index a063a23bf..851214fb8 100644 --- a/stdlib/source/test/lux/world/output/video/resolution.lux +++ b/stdlib/source/test/lux/world/output/video/resolution.lux @@ -40,7 +40,7 @@ (def: catalogue (Set /.Resolution) - (set.from_list /.hash ..listing)) + (set.of_list /.hash ..listing)) (def: #export random (Random /.Resolution) diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index 749441a7a..d86683c5f 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -38,7 +38,7 @@ (if dead? (exception.throw ..dead []) (do try.monad - [to_echo (try.from_maybe (list.head arguments))] + [to_echo (try.of_maybe (list.head arguments))] (wrap [dead? to_echo])))) (def: (on_error dead?) -- cgit v1.2.3