diff options
author | Eduardo Julian | 2021-08-07 02:20:09 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-08-07 02:20:09 -0400 |
commit | 17e7566be51df5e428a6b10e6469201a8a9468da (patch) | |
tree | 0d4ed80c9c9d846784b5bf460f6e6f5fc5b96663 /stdlib/source/test | |
parent | eff4c59794868b89d60fdc411f9b544a270b817e (diff) |
Made the be/de macros for (co)monadic expression extensible.
Diffstat (limited to '')
116 files changed, 542 insertions, 512 deletions
diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index 614420fde..07d39f00f 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -54,7 +54,7 @@ (def: profile (Random [Artifact Profile XML]) (random.one (function (_ profile) - (try.to_maybe + (try.maybe (do try.monad [pom (//pom.write profile) identity (try.of_maybe (get@ #//.identity profile))] @@ -82,7 +82,7 @@ (do {! random.monad} [[main_dependency main_package] ..package dependencies (|> (//package.dependencies main_package) - (\ try.monad map set.to_list) + (\ try.monad map set.list) (try.else (list)) (monad.map ! (function (_ dependency) (do ! @@ -91,7 +91,7 @@ (set@ #//.dependencies (set.empty //dependency.hash)) (set@ #//.identity (#.Some (get@ #//dependency.artifact dependency))) //pom.write - try.to_maybe)) + try.maybe)) ..profile) content ..content] (in [dependency @@ -104,7 +104,7 @@ [[dependency expected_package] ..package home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [fs (: (file.System Async) + .let [fs (: (file.System Async) (file.mock (\ file.default separator))) program (program.async (program.mock environment.empty home working_directory))]] (in (do async.monad @@ -125,7 +125,7 @@ [expected ..resolution home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [fs (: (file.System Async) + .let [fs (: (file.System Async) (file.mock (\ file.default separator))) program (program.async (program.mock environment.empty home working_directory))]] (in (do async.monad diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index fd08f541c..a5b598b11 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -68,13 +68,13 @@ (<| (_.covering /._) (do {! random.monad} [end_signal (random.ascii/alpha 5) - #let [/ (\ file.default separator) + .let [/ (\ file.default separator) [fs watcher] (watch.mock /)] program (random.ascii/alpha 5) target (random.ascii/alpha 5) source (random.ascii/alpha 5) - #let [empty_profile (: Profile + .let [empty_profile (: Profile (\ ///.monoid identity)) with_target (: (-> Profile Profile) (set@ #///.target target)) @@ -99,7 +99,7 @@ [verdict (do ///action.monad [_ (\ fs make_directory source) _ (\ fs write (binary.create 0) dummy_path) - #let [[@runs command] (..command expected_runs end_signal fs dummy_path)] + .let [[@runs command] (..command expected_runs end_signal fs dummy_path)] _ (\ watcher poll [])] (do {! async.monad} [no_dangling_process! (|> profile diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 1a1ff7f60..be7c8b55e 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -109,7 +109,7 @@ (Random Dependency) (do random.monad [lux_version (random.ascii/alpha 5) - #let [js_compiler {#///dependency.artifact {#///artifact.group /.lux_group + .let [js_compiler {#///dependency.artifact {#///artifact.group /.lux_group #///artifact.name /.js_compiler_name #///artifact.version lux_version} #///dependency.type ///artifact/type.js_library}]] @@ -142,13 +142,13 @@ (do {! random.monad} [last_read (random.ascii/alpha 5) last_error (random.ascii/alpha 5) - #let [fs (file.mock (\ file.default separator)) + .let [fs (file.mock (\ file.default separator)) shell (shell.async (..good_shell []))] program (random.ascii/alpha 5) target (random.ascii/alpha 5) home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [empty_profile (: Profile + .let [empty_profile (: Profile (\ ///.monoid identity)) with_target (: (-> Profile Profile) (set@ #///.target target)) @@ -179,7 +179,7 @@ (#try.Failure error) (exception.match? /.no_available_compiler error))))) (do ! - [#let [console (@version.echo "")] + [.let [console (@version.echo "")] [compiler resolution] ..resolution] (in (do async.monad [verdict (do ///action.monad @@ -201,7 +201,7 @@ /.success] (try.else false verdict))))) (do ! - [#let [console (@version.echo "")] + [.let [console (@version.echo "")] [compiler resolution] ..resolution] (in (do async.monad [verdict (do ///action.monad diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux index 36ed10b8e..523cf6ccc 100644 --- a/stdlib/source/test/aedifex/command/clean.lux +++ b/stdlib/source/test/aedifex/command/clean.lux @@ -46,7 +46,7 @@ [count (\ ! map (n.% 10) random.nat) names (random.set text.hash count ..node_name) contents (random.list count ($binary.random 100))] - (in (list.zipped/2 (list\map (|>> (format prefix)) (set.to_list names)) + (in (list.zipped/2 (list\map (|>> (format prefix)) (set.list names)) contents)))) (def: (create_file! fs [path content]) @@ -87,7 +87,7 @@ [context ..node_name target ..node_name sub ..node_name - #let [fs (file.mock (\ file.default separator)) + .let [fs (file.mock (\ file.default separator)) / (\ fs separator) target_path (format context / target) sub_path (format target_path / sub)] @@ -96,7 +96,7 @@ dummy @profile.random] (in (do async.monad - [#let [console (@version.echo "")] + [.let [console (@version.echo "")] verdict (do {! (try.with async.monad)} [_ (..create_directory! fs target_path direct_files) _ (..create_directory! fs sub_path sub_files) diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index b34584b19..d315c646c 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -54,7 +54,7 @@ Artifact ///.Profile (Async (Try Text))) (do ///action.monad - [#let [console ($version.echo "")] + [.let [console ($version.echo "")] _ ($install.make_sources! fs (get@ #///.sources profile)) _ (/.do! console repository fs artifact profile)] (\ console read_line []))) @@ -73,7 +73,7 @@ home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [repository (///repository.mock $repository.mock + .let [repository (///repository.mock $repository.mock $repository.empty) fs (file.mock (\ file.default separator)) program (program.async (program.mock environment.empty home working_directory))]] @@ -82,7 +82,7 @@ [logging (..execute! program repository fs artifact profile) expected_library (|> profile (get@ #///.sources) - set.to_list + set.list (export.library fs) (\ ! map (format.run tar.writer))) @@ -99,7 +99,7 @@ [actual_md5 (\ utf8.codec decode actual_md5)] (\ ///hash.md5_codec decode actual_md5))) - #let [succeeded! + .let [succeeded! (text\= /.success logging) deployed_library! diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 165c859b8..0d816ec02 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -67,7 +67,7 @@ [_ dependee_package] $///package.random [_ depender_package] $///package.random - #let [dependee {#///dependency.artifact dependee_artifact + .let [dependee {#///dependency.artifact dependee_artifact #///dependency.type ///artifact/type.lux_library} depender {#///dependency.artifact depender_artifact #///dependency.type ///artifact/type.lux_library} @@ -97,7 +97,7 @@ program (program.async (program.mock environment.empty home working_directory))]] (in (do async.monad [verdict (do ///action.monad - [#let [console (@version.echo "") + [.let [console (@version.echo "") local (///repository/local.repository program fs)] pre (|> ///dependency/resolution.empty (dictionary.put dependee dependee_package) @@ -110,7 +110,7 @@ (function (_ url) (///repository.mock $///dependency/resolution.nope [])))) - #let [had_dependee_before! + .let [had_dependee_before! (set.member? pre dependee_artifact) lacked_depender_before! diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index f68fcb732..ed0a3a7d3 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -44,7 +44,7 @@ (let [/ (\ fs separator) ! ///action.monad] (|> sources - set.to_list + set.list (monad.map ! (function (_ head) (do ! [_ (: (Async (Try Any)) @@ -55,7 +55,7 @@ (def: (execute! program fs sample) (-> (Program Async) (file.System Async) ///.Profile (Async (Try Text))) (do ///action.monad - [#let [console ($version.echo "")] + [.let [console ($version.echo "")] _ (..make_sources! fs (get@ #///.sources sample)) _ (/.do! console fs (///repository/local.repository program fs) sample)] (\ console read_line []))) @@ -69,10 +69,10 @@ $profile.random) home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [/ (\ file.default separator)]] + .let [/ (\ file.default separator)]] ($_ _.and (in (do {! async.monad} - [#let [fs (file.mock /) + [.let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory)) artifact_path (///local.uri (get@ #///artifact.version identity) identity) @@ -95,7 +95,7 @@ (_.cover' [/.do! /.success] (try.else false verdict)))) (in (do {! async.monad} - [#let [fs (file.mock /) + [.let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory))] logging (..execute! program fs (set@ #///.identity #.None sample))] (_.cover' [/.failure] diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index 6578e793f..54a365468 100644 --- a/stdlib/source/test/aedifex/command/pom.lux +++ b/stdlib/source/test/aedifex/command/pom.lux @@ -35,9 +35,9 @@ (<| (_.covering /._) (do random.monad [sample @profile.random - #let [fs (file.mock (\ file.default separator))]] + .let [fs (file.mock (\ file.default separator))]] (in (do {! async.monad} - [#let [console (@version.echo "")] + [.let [console (@version.echo "")] outcome (/.do! console fs sample)] (case outcome (#try.Success _) @@ -53,7 +53,7 @@ (text\= /.success) (\ console read_line [])) - #let [expected_content! + .let [expected_content! (binary\= expected actual)]] (in (and logging! expected_content!)))] diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index b82a32678..52c167ee9 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -47,7 +47,7 @@ target (random.ascii/alpha 5) home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [empty_profile (: Profile + .let [empty_profile (: Profile (\ ///.monoid identity)) with_target (: (-> Profile Profile) (set@ #///.target target)) @@ -81,7 +81,7 @@ console (@version.echo "")] (in (do async.monad [verdict (do ///action.monad - [#let [bad_shell (shell.mock + [.let [bad_shell (shell.mock (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) (#try.Success (: (shell.Mock []) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index b501573d7..aaf320c60 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -69,7 +69,7 @@ (do random.monad [profile @profile.random] (in (do async.monad - [#let [console (..echo "")] + [.let [console (..echo "")] verdict (do (try.with async.monad) [_ (/.do! console profile) logging (\ console read_line [])] diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index 9c575ff53..8c1e2e61a 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -135,7 +135,7 @@ (Random [Dependency Artifact Package]) (do random.monad [[profile package] $///package.random - #let [artifact (|> profile + .let [artifact (|> profile (get@ #profile.identity) maybe.assume) dependency (: Dependency @@ -152,7 +152,7 @@ ($_ _.and (do {! random.monad} [[dependency expected_artifact package] ..bundle - #let [cache (: Cache + .let [cache (: Cache (atom.atom (dictionary.empty text.hash))) http (..http cache) repository (repository.async (remote.repository http #.None address))]] @@ -164,14 +164,14 @@ (try\map (verify_one 1 address package cache expected_artifact)) (try.else false)))))) (do {! random.monad} - [#let [hash (: (Hash [Dependency Artifact Package]) + [.let [hash (: (Hash [Dependency Artifact Package]) (\ hash.functor map (|>> product.right product.left product.left) text.hash))] num_bundles (\ ! map (n.% 10) random.nat) bundles (|> ..bundle (random.set hash num_bundles) - (\ ! map set.to_list)) - #let [resolution (list\fold (function (_ [dependency expected_artifact package] resolution) + (\ ! map set.list)) + .let [resolution (list\fold (function (_ [dependency expected_artifact package] resolution) (dictionary.put dependency package resolution)) resolution.empty bundles) diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index fa0391761..89e16691d 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -254,7 +254,7 @@ (\ ///package.equivalence = expected_package) not) $///package.random) - #let [good (..single expected_artifact expected_package) + .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)]] (`` ($_ _.and @@ -299,12 +299,12 @@ (\ ///package.equivalence = expected_package) not) $///package.random) - #let [good (..single expected_artifact expected_package) + .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)]] ($_ _.and (in (do async.monad - [#let [console ($///version.echo "")] + [.let [console ($///version.echo "")] actual_package (/.any console (list (///repository.mock bad_sha-1 []) (///repository.mock bad_md5 []) @@ -321,7 +321,7 @@ (#try.Failure _) false)))) (in (do async.monad - [#let [console ($///version.echo "")] + [.let [console ($///version.echo "")] actual_package (/.any console (list (///repository.mock bad_sha-1 []) (///repository.mock bad_md5 [])) @@ -358,7 +358,7 @@ [_ depender_package] $///package.random [_ ignored_package] $///package.random - #let [dependee {#///dependency.artifact dependee_artifact + .let [dependee {#///dependency.artifact dependee_artifact #///dependency.type ///artifact/type.lux_library} depender {#///dependency.artifact depender_artifact #///dependency.type ///artifact/type.lux_library} @@ -407,7 +407,7 @@ (..packages [dependee_artifact depender_artifact ignored_artifact])] ($_ _.and (in (do async.monad - [#let [console ($///version.echo "")] + [.let [console ($///version.echo "")] [successes failures resolution] (/.all console (list (///repository.mock (..single dependee_artifact dependee_package) []) (///repository.mock (..single depender_artifact depender_package) []) diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux index e86efa6dd..4b2ee9ea2 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.lux @@ -46,11 +46,11 @@ (<| (_.covering /._) (do {! random.monad} [expected (\ ! map (set@ #//.parents (list)) $profile.random) - #let [fs (: (file.System Async) + .let [fs (: (file.System Async) (file.mock (\ file.default separator)))]] (in (do async.monad [verdict (do //action.monad - [#let [profile (|> expected + [.let [profile (|> expected //format.profile %.code (\ utf8.codec encode))] diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index 0d291d368..95897c212 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -72,7 +72,7 @@ (_.for [/.Metadata]) (do random.monad [expected ..random - #let [artifact {#///artifact.group (get@ #/.group expected) + .let [artifact {#///artifact.group (get@ #/.group expected) #///artifact.name (get@ #/.name expected) #///artifact.version (|> expected (get@ #/.versions) @@ -97,7 +97,7 @@ (do random.monad [home (random.ascii/lower 5) working_directory (random.ascii/lower 5) - #let [program (program.async (program.mock environment.empty home working_directory)) + .let [program (program.async (program.mock environment.empty home working_directory)) fs (file.mock (\ file.default separator)) repository (///repository/local.repository program fs)]] (in (do async.monad diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index ff11ff7ab..4dd751639 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -91,7 +91,7 @@ (_.for [/.Metadata]) (do random.monad [expected ..random - #let [artifact (get@ #/.artifact expected)]] + .let [artifact (get@ #/.artifact expected)]] ($_ _.and (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) @@ -109,7 +109,7 @@ (do random.monad [home (random.ascii/lower 5) working_directory (random.ascii/lower 5) - #let [program (program.async (program.mock environment.empty home working_directory)) + .let [program (program.async (program.mock environment.empty home working_directory)) fs (file.mock (\ file.default separator)) repository (///repository/local.repository program fs)]] (in (do async.monad diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux index 58ee8c577..809bea253 100644 --- a/stdlib/source/test/aedifex/project.lux +++ b/stdlib/source/test/aedifex/project.lux @@ -63,7 +63,7 @@ (not (text\= dummy_name name)) (not (text\= sub_name name)))) (random.ascii/alpha 1)) - #let [project ($_ (\ /.monoid compose) + .let [project ($_ (\ /.monoid compose) (/.project super_name super_profile) (/.project dummy_name dummy_profile) (/.project sub_name (set@ #//.parents (list super_name) sub_profile))) diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux index eab07411f..a63f4c256 100644 --- a/stdlib/source/test/aedifex/repository/local.lux +++ b/stdlib/source/test/aedifex/repository/local.lux @@ -30,7 +30,7 @@ [/ (random.ascii/upper 1) home (random.ascii/lower 10) working_directory (random.ascii/lower 10) - #let [fs (file.mock /) + .let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory)) repo (/.repository program fs)] diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index ca533e853..9d5f719ed 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -232,7 +232,7 @@ Test (do random.monad [expected random.nat - #let [local_returner (: (Returner Nat) + .let [local_returner (: (Returner Nat) (/.implementation (def: (return _) expected)))]] @@ -269,7 +269,7 @@ (do random.monad [start random.nat factor random.nat - #let [expected (n.* factor (inc start))]] + .let [expected (n.* factor (inc start))]] ($_ _.and (_.cover [/.|>] (n.= expected @@ -463,7 +463,7 @@ expected_left random.nat expected_right random.nat - #let [existential_type (\ ! map (|>> #.Ex) random.nat)] + .let [existential_type (\ ! map (|>> #.Ex) random.nat)] expected/0 existential_type expected/1 existential_type] (<| (_.for [/.Type]) @@ -648,7 +648,7 @@ shift/s random.nat shift/b random.nat text (random.ascii/lower 1) - #let [expected/s (n.+ shift/s start/s) + .let [expected/s (n.+ shift/s start/s) expected/b (n.+ shift/b start/b) sample {#big_left start/b @@ -730,7 +730,7 @@ [left (random.ascii/lower 1) mid (random.ascii/lower 1) right (random.ascii/lower 1) - #let [expected (text.join_with "" (list left mid right))]] + .let [expected (text.join_with "" (list left mid right))]] (_.cover [/.$_ /._$] (with_expansions [<left_association> (/._$ format left @@ -751,7 +751,7 @@ [left random.nat right random.nat dummy random.nat - #let [expected (n.+ left right)]] + .let [expected (n.+ left right)]] ($_ _.and (_.cover [/.as_is] (`` (and (~~ (as_is true @@ -985,7 +985,7 @@ (do random.monad [factor (random\map (|>> (n.% 10) (n.max 1)) random.nat) iterations (random\map (n.% 10) random.nat) - #let [expected (n.* factor iterations)]] + .let [expected (n.* factor iterations)]] (_.cover [/.loop] (n.= expected (/.loop [counter 0 @@ -996,7 +996,7 @@ (do random.monad [pre random.nat post (random.only (|>> (n.= pre) not) random.nat) - #let [box (atom.atom pre)]] + .let [box (atom.atom pre)]] (_.cover [/.exec] (and (is? pre (io.run (atom.read box))) (/.exec diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux index 6284381d7..7eb4149a1 100644 --- a/stdlib/source/test/lux/abstract/enum.lux +++ b/stdlib/source/test/lux/abstract/enum.lux @@ -23,7 +23,7 @@ (do random.monad [start limit end limit - #let [[start end] (if (n.< end start) + .let [[start end] (if (n.< end start) [start end] [end start]) range (/.range n.enum start end)]] diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index 10af6891d..bdf24150d 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -26,7 +26,7 @@ rightI random.int sample random.nat different (|> random.nat (random.only (|>> (n.= sample) not))) - #let [equivalence (: (Equivalence (Equivalence Nat)) + .let [equivalence (: (Equivalence (Equivalence Nat)) (implementation (def: (= left right) (and (bit\= (\ left = leftN leftN) diff --git a/stdlib/source/test/lux/abstract/hash.lux b/stdlib/source/test/lux/abstract/hash.lux index 894860935..eecb43227 100644 --- a/stdlib/source/test/lux/abstract/hash.lux +++ b/stdlib/source/test/lux/abstract/hash.lux @@ -23,7 +23,7 @@ (do random.monad [leftN random.nat rightN random.nat - #let [hash (: (Equivalence (/.Hash Nat)) + .let [hash (: (Equivalence (/.Hash Nat)) (implementation (def: (= (^open "left\.") (^open "right\.")) (and (bit\= (left\= (left\hash leftN) (left\hash leftN)) diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index 60eeba3df..40c78df27 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -68,7 +68,7 @@ (do random.monad [bottom random.nat top random.nat - #let [interval (/.between n.enum bottom top)]] + .let [interval (/.between n.enum bottom top)]] ($_ _.and (_.cover [/.between /.within?] (and (/.within? interval bottom) @@ -139,14 +139,14 @@ Test (do {! random.monad} [[l m r] (|> (random.set n.hash 3 random.nat) - (\ ! map (|>> set.to_list + (\ ! map (|>> set.list (list.sort n.<) (case> (^ (list b t1 t2)) [b t1 t2] _ (undefined))))) - #let [left (/.singleton n.enum l) + .let [left (/.singleton n.enum l) right (/.singleton n.enum r)]] ($_ _.and (_.cover [/.precedes? /.succeeds?] @@ -161,14 +161,14 @@ Test (do {! random.monad} [[b t1 t2] (|> (random.set n.hash 3 random.nat) - (\ ! map (|>> set.to_list + (\ ! map (|>> set.list (list.sort n.<) (case> (^ (list b t1 t2)) [b t1 t2] _ (undefined))))) - #let [int_left (/.between n.enum t1 t2) + .let [int_left (/.between n.enum t1 t2) int_right (/.between n.enum b t1)]] ($_ _.and (_.cover [/.meets?] @@ -188,7 +188,7 @@ (do {! random.monad} [some_interval ..interval [x0 x1 x2 x3] (|> (random.set n.hash 4 random.nat) - (\ ! map (|>> set.to_list + (\ ! map (|>> set.list (list.sort n.<) (case> (^ (list x0 x1 x2 x3)) [x0 x1 x2 x3] @@ -221,7 +221,7 @@ (do {! random.monad} [some_interval ..interval [x0 x1 x2 x3] (|> (random.set n.hash 4 random.nat) - (\ ! map (|>> set.to_list + (\ ! map (|>> set.list (list.sort n.<) (case> (^ (list x0 x1 x2 x3)) [x0 x1 x2 x3] diff --git a/stdlib/source/test/lux/abstract/order.lux b/stdlib/source/test/lux/abstract/order.lux index 2974a8c88..1f84914f3 100644 --- a/stdlib/source/test/lux/abstract/order.lux +++ b/stdlib/source/test/lux/abstract/order.lux @@ -24,7 +24,7 @@ (do random.monad [left random.nat right (|> random.nat (random.only (|>> (n.= left) not))) - #let [equivalence (: (Equivalence (/.Order Nat)) + .let [equivalence (: (Equivalence (/.Order Nat)) (implementation (def: (= leftO rightO) (and (bit\= (\ leftO < left left) diff --git a/stdlib/source/test/lux/abstract/predicate.lux b/stdlib/source/test/lux/abstract/predicate.lux index b821865de..f0c7ffbbd 100644 --- a/stdlib/source/test/lux/abstract/predicate.lux +++ b/stdlib/source/test/lux/abstract/predicate.lux @@ -34,7 +34,7 @@ (do {! random.monad} [sample random.nat samples (random.list 10 random.nat) - #let [equivalence (: (Equivalence (/.Predicate Nat)) + .let [equivalence (: (Equivalence (/.Predicate Nat)) (implementation (def: (= left right) (bit\= (left sample) diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux index fe7773eea..4f2774e2b 100644 --- a/stdlib/source/test/lux/control/concatenative.lux +++ b/stdlib/source/test/lux/control/concatenative.lux @@ -141,7 +141,7 @@ [choice random.bit sample random.nat start random.nat - #let [distance 10 + .let [distance 10 |inc| (/.apply/1 inc) |test| (/.apply/1 (|>> (n.- start) (n.< distance)))]] ($_ _.and diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index 6ccc1a7b2..95566db38 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -49,7 +49,7 @@ Test (do {! random.monad} [initial_state random.nat - #let [as_mail (: (All [a] (-> (-> a a) (/.Mail a))) + .let [as_mail (: (All [a] (-> (-> a a) (/.Mail a))) (function (_ transform) (function (_ state actor) (|> state transform #try.Success async\in)))) @@ -201,7 +201,7 @@ [num_events (\ ! map (|>> (n.% 10) inc) random.nat) events (random.list num_events random.nat) num_observations (\ ! map (n.% num_events) random.nat) - #let [expected (list.take num_observations events) + .let [expected (list.take num_observations events) sink (: (Atom (Row Nat)) (atom.atom row.empty))]] (in (do async.monad @@ -224,5 +224,5 @@ _ (/.await agent) actual (async.future (atom.read sink))] (_.cover' [/.Stop /.observe /.await] - (\ (list.equivalence n.equivalence) = expected (row.to_list actual)))))) + (\ (list.equivalence n.equivalence) = expected (row.list actual)))))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 8b7bafff8..063d3a9e0 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -54,10 +54,10 @@ Test (<| (_.covering /._) (do {! random.monad} - [to_wait (|> random.nat (\ ! map (|>> (n.% ..delay) (n.+ ..delay)))) + [waiting_time (|> random.nat (\ ! map (|>> (n.% ..delay) (n.+ ..delay)))) expected random.nat dummy random.nat - #let [not_dummy (|> random.nat (random.only (|>> (n.= dummy) not)))] + .let [not_dummy (|> random.nat (random.only (|>> (n.= dummy) not)))] leftE not_dummy rightE not_dummy] ($_ _.and @@ -69,7 +69,7 @@ ($monad.spec ..injection ..comparison /.monad)) (in (do /.monad - [#let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] + [.let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] (/.async []))] resolved? (/.future (resolver expected)) actual async] @@ -86,19 +86,19 @@ (n.= expected actual)))) (in (do /.monad [pre (/.future instant.now) - actual (/.schedule to_wait (io.io expected)) + actual (/.schedule waiting_time (io.io expected)) post (/.future instant.now)] (_.cover' [/.schedule] (and (n.= expected actual) - (i.>= (.int to_wait) - (duration.to_millis (instant.span pre post))))))) + (i.>= (.int waiting_time) + (duration.millis (instant.span pre post))))))) (in (do /.monad [pre (/.future instant.now) - _ (/.wait to_wait) + _ (/.wait waiting_time) post (/.future instant.now)] (_.cover' [/.wait] - (i.>= (.int to_wait) - (duration.to_millis (instant.span pre post)))))) + (i.>= (.int waiting_time) + (duration.millis (instant.span pre post)))))) (in (do /.monad [[leftA rightA] (/.and (/.future (io.io leftE)) (/.future (io.io rightE)))] @@ -107,16 +107,16 @@ (n.+ leftA rightA))))) (in (do /.monad [pre (/.future instant.now) - actual (/.delay to_wait expected) + actual (/.delay waiting_time expected) post (/.future instant.now)] (_.cover' [/.delay] (and (n.= expected actual) - (i.>= (.int to_wait) - (duration.to_millis (instant.span pre post))))))) + (i.>= (.int waiting_time) + (duration.millis (instant.span pre post))))))) (in (do /.monad [?left (/.or (in leftE) - (/.delay to_wait dummy)) - ?right (/.or (/.delay to_wait dummy) + (/.delay waiting_time dummy)) + ?right (/.or (/.delay waiting_time dummy) (in rightE))] (_.cover' [/.or] (case [?left ?right] @@ -128,15 +128,15 @@ false)))) (in (do /.monad [leftA (/.either (in leftE) - (/.delay to_wait dummy)) - rightA (/.either (/.delay to_wait dummy) + (/.delay waiting_time dummy)) + rightA (/.either (/.delay waiting_time dummy) (in rightE))] (_.cover' [/.either] (n.= (n.+ leftE rightE) (n.+ leftA rightA))))) (in (do /.monad [?actual (/.future (/.poll (/.resolved expected))) - #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] + .let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] (/.async []))] ?never (/.future (/.poll async))] (_.cover' [/.poll] @@ -148,15 +148,15 @@ false)))) (in (do /.monad [yep (/.future (/.resolved? (/.resolved expected))) - #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] + .let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] (/.async []))] nope (/.future (/.resolved? async))] (_.cover' [/.resolved?] (and yep (not nope))))) (in (do /.monad - [?none (/.time_out 0 (/.delay to_wait dummy)) - ?actual (/.time_out to_wait (in expected))] + [?none (/.time_out 0 (/.delay waiting_time dummy)) + ?actual (/.time_out waiting_time (in expected))] (_.cover' [/.time_out] (case [?none ?actual] [#.None (#.Some actual)] @@ -165,7 +165,7 @@ _ false)))) (in (do /.monad - [#let [box (: (Atom Nat) + [.let [box (: (Atom Nat) (atom.atom dummy))] _ (/.future (/.await (function (_ value) (atom.write value box)) diff --git a/stdlib/source/test/lux/control/concurrency/atom.lux b/stdlib/source/test/lux/control/concurrency/atom.lux index d51af0737..49947d2d6 100644 --- a/stdlib/source/test/lux/control/concurrency/atom.lux +++ b/stdlib/source/test/lux/control/concurrency/atom.lux @@ -19,7 +19,7 @@ ($_ _.and (do random.monad [expected random.nat - #let [box (/.atom expected)]] + .let [box (/.atom expected)]] (_.cover [/.Atom /.atom /.read] (io.run (do io.monad @@ -29,7 +29,7 @@ [target random.nat unknown (random.only (|>> (is? target) not) random.nat) expected random.nat - #let [box (/.atom target)]] + .let [box (/.atom target)]] (_.cover [/.compare_and_swap] (io.run (do io.monad @@ -42,7 +42,7 @@ (do random.monad [init random.nat shift random.nat - #let [box (/.atom init)]] + .let [box (/.atom init)]] (_.cover [/.update] (io.run (do io.monad @@ -53,7 +53,7 @@ (do random.monad [pre random.nat post random.nat - #let [box (/.atom pre)]] + .let [box (/.atom pre)]] (_.cover [/.write] (io.run (do io.monad diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index 539ed17f0..f4705f140 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -86,7 +86,7 @@ (_.cover [/.Channel /.Sink /.channel] (case (io.run (do (try.with io.monad) - [#let [[channel sink] (/.channel [])] + [.let [[channel sink] (/.channel [])] _ (\ sink feed sample) _ (\ sink close)] (in channel))) @@ -106,7 +106,7 @@ (_.cover [/.channel_is_already_closed] (case (io.run (do (try.with io.monad) - [#let [[channel sink] (/.channel [])] + [.let [[channel sink] (/.channel [])] _ (\ sink close)] (\ sink feed sample))) (#try.Success _) @@ -138,7 +138,7 @@ (list\= (list.only n.even? inputs) output)))) (in (do {! async.monad} - [#let [[?signal !signal] (: [(async.Async Any) (async.Resolver Any)] + [.let [[?signal !signal] (: [(async.Async Any) (async.Resolver Any)] (async.async [])) sink (: (Atom (Row Nat)) (atom.atom row.empty))] @@ -157,7 +157,7 @@ listened (|> sink atom.read async.future - (\ ! map row.to_list))] + (\ ! map row.list))] (_.cover' [/.Subscriber /.subscribe] (list\= inputs listened)))) (in (do async.monad @@ -194,7 +194,7 @@ ($_ _.and (in (do {! async.monad} [actual (..take_amount amount_of_polls (/.poll polling_delay (: (IO Nat) (io.io sample)))) - #let [correct_values! + .let [correct_values! (list.every? (n.= sample) actual) enough_polls! @@ -207,7 +207,7 @@ (_.cover' [/.periodic] (n.= amount_of_polls (list.size actual))))))) (in (do async.monad - [#let [max_iterations 10] + [.let [max_iterations 10] actual (|> [0 sample] (/.iterations (function (_ [iterations current]) (async.resolved diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index f5b851104..60bd31050 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -40,7 +40,7 @@ ($_ _.and (do {! random.monad} [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) - #let [semaphore (/.semaphore initial_open_positions)]] + .let [semaphore (/.semaphore initial_open_positions)]] (in (do async.monad [result (async.time_out ..delay (/.wait semaphore))] (_.cover' [/.semaphore] @@ -52,7 +52,7 @@ false))))) (do {! random.monad} [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) - #let [semaphore (/.semaphore initial_open_positions)]] + .let [semaphore (/.semaphore initial_open_positions)]] (in (do {! async.monad} [_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore)) result (async.time_out ..delay (/.wait semaphore))] @@ -65,10 +65,10 @@ true))))) (do {! random.monad} [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) - #let [semaphore (/.semaphore initial_open_positions)]] + .let [semaphore (/.semaphore initial_open_positions)]] (in (do {! async.monad} [_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore)) - #let [block (/.wait semaphore)] + .let [block (/.wait semaphore)] result/0 (async.time_out ..delay block) open_positions (/.signal semaphore) result/1 (async.time_out ..delay block)] @@ -81,7 +81,7 @@ false))))) (do {! random.monad} [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) - #let [semaphore (/.semaphore initial_open_positions)]] + .let [semaphore (/.semaphore initial_open_positions)]] (in (do async.monad [outcome (/.signal semaphore)] (_.cover' [/.semaphore_is_maxed_out] @@ -99,7 +99,7 @@ ($_ _.and (do {! random.monad} [repetitions (|> random.nat (\ ! map (|>> (n.% 100) (n.max 10)))) - #let [resource (atom.atom "") + .let [resource (atom.atom "") expected_As (text.join_with "" (list.repeat repetitions "A")) expected_Bs (text.join_with "" (list.repeat repetitions "B")) mutex (/.mutex []) @@ -122,7 +122,7 @@ (in (do async.monad [_ processA _ processB - #let [outcome (io.run (atom.read resource))]] + .let [outcome (io.run (atom.read resource))]] (_.cover' [/.mutex /.synchronize] (or (text\= (format expected_As expected_Bs) outcome) @@ -156,10 +156,10 @@ false))) (do {! random.monad} [limit (\ ! map (|>> (n.% 9) inc) random.nat) - #let [barrier (/.barrier (maybe.assume (/.limit limit))) + .let [barrier (/.barrier (maybe.assume (/.limit limit))) resource (atom.atom "")]] (in (do {! async.monad} - [#let [suffix "_" + [.let [suffix "_" expected_ending (|> suffix (list.repeat limit) (text.join_with "")) @@ -169,7 +169,7 @@ (exec (io.run (atom.update (|>> (format suffix)) resource)) (waiter resource barrier id)))) (monad.seq !)) - #let [outcome (io.run (atom.read resource))]] + .let [outcome (io.run (atom.read resource))]] (_.cover' [/.barrier /.block] (and (text.ends_with? expected_ending outcome) (list.every? (function (_ id) diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux index 67d73d61e..62d912f66 100644 --- a/stdlib/source/test/lux/control/concurrency/stm.lux +++ b/stdlib/source/test/lux/control/concurrency/stm.lux @@ -72,7 +72,7 @@ (and (n.= expected actual) verdict)))) (in (do async.monad - [#let [box (/.var dummy)] + [.let [box (/.var dummy)] output (/.commit (do /.monad [_ (/.update (n.+ expected) box)] (/.read box)))] @@ -80,7 +80,7 @@ (n.= (n.+ expected dummy) output)))) (in (do async.monad - [#let [box (/.var dummy) + [.let [box (/.var dummy) [follower sink] (io.run (/.follow box))] _ (/.commit (/.write expected box)) _ (/.commit (/.update (n.* 2) box)) diff --git a/stdlib/source/test/lux/control/concurrency/thread.lux b/stdlib/source/test/lux/control/concurrency/thread.lux index 0758f48b3..28d751292 100644 --- a/stdlib/source/test/lux/control/concurrency/thread.lux +++ b/stdlib/source/test/lux/control/concurrency/thread.lux @@ -33,7 +33,7 @@ (n.> 0 /.parallelism)) (in (do async.monad [reference_time (async.future instant.now) - #let [box (atom.atom [reference_time dummy])] + .let [box (atom.atom [reference_time dummy])] _ (async.future (/.schedule delay (do io.monad [execution_time instant.now] @@ -43,7 +43,7 @@ (_.cover' [/.schedule] (let [expected_delay! (i.>= (.int delay) - (duration.to_millis (instant.span reference_time execution_time))) + (duration.millis (instant.span reference_time execution_time))) correct_value! (n.= expected actual)] diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux index 4103d1a1f..1e960d947 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -32,7 +32,7 @@ (<| (_.covering /._) (do random.monad [sample random.nat - #let [(^open "_\.") /.apply + .let [(^open "_\.") /.apply (^open "_\.") /.monad] elems (random.list 3 random.nat)]) (_.for [/.Cont]) diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux index 7d1cbcf53..b0a957c21 100644 --- a/stdlib/source/test/lux/control/exception.lux +++ b/stdlib/source/test/lux/control/exception.lux @@ -29,7 +29,7 @@ [expected random.nat wrong (|> random.nat (random.only (|>> (n.= expected) not))) assertion_succeeded? random.bit - #let [report_element (\ ! map %.nat random.nat)] + .let [report_element (\ ! map %.nat random.nat)] field0 report_element value0 report_element field1 report_element diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index dbdeee0f6..d6765a1f1 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -39,7 +39,7 @@ (All [i o] (-> (-> i o) i (IO [Duration o]))) (do io.monad [before instant.now - #let [output (function input)] + .let [output (function input)] after instant.now] (in [(instant.span before after) output]))) @@ -64,11 +64,11 @@ (_.cover [/.closed /.none] (io.run (do io.monad - [#let [slow (/.none n.hash ..fibonacci) + [.let [slow (/.none n.hash ..fibonacci) fast (/.closed n.hash fibonacci)] [slow_time slow_output] (..time slow input) [fast_time fast_output] (..time fast input) - #let [same_output! + .let [same_output! (n.= slow_output fast_output) @@ -80,13 +80,13 @@ (_.cover [/.open] (io.run (do io.monad - [#let [none (/.none n.hash ..fibonacci) + [.let [none (/.none n.hash ..fibonacci) memory (dictionary.empty n.hash) open (/.open fibonacci)] [none_time none_output] (..time none input) [open_time [memory open_output]] (..time open [memory input]) [open_time/+1 _] (..time open [memory (inc input)]) - #let [same_output! + .let [same_output! (n.= none_output open_output) diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 1ebf38e79..3d8299929 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -28,7 +28,7 @@ [input (|> random.nat (\ ! map (|>> (n.% 6) (n.+ 20)))) dummy random.nat shift (|> random.nat (random.only (|>> (n.= dummy) not))) - #let [equivalence (: (Equivalence (/.Mixin Nat Nat)) + .let [equivalence (: (Equivalence (/.Mixin Nat Nat)) (implementation (def: (= left right) (n.= ((/.mixin left) input) diff --git a/stdlib/source/test/lux/control/function/mutual.lux b/stdlib/source/test/lux/control/function/mutual.lux index c9fbfbace..71248a1ee 100644 --- a/stdlib/source/test/lux/control/function/mutual.lux +++ b/stdlib/source/test/lux/control/function/mutual.lux @@ -19,7 +19,7 @@ Test (do {! random.monad} [sample (\ ! map (n.% 10) random.nat) - #let [expected (n.even? sample)]] + .let [expected (n.even? sample)]] (<| (_.cover [/.let]) (/.let [(even? number) (-> Nat Bit) @@ -52,7 +52,7 @@ Test (do {! random.monad} [sample (\ ! map (n.% 10) random.nat) - #let [expected (n.even? sample)]] + .let [expected (n.even? sample)]] (<| (_.cover [/.def:]) (and (bit\= expected (..even? sample)) (bit\= (not expected) (..odd? sample)))))) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 717202488..c222cee77 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -261,7 +261,7 @@ [expected random.nat even (random.only n.even? random.nat) odd (random.only n.odd? random.nat) - #let [nat^ <code>.nat + .let [nat^ <code>.nat even^ (/.only n.even? <code>.nat) odd^ (/.only n.odd? <code>.nat)]] ($_ _.and diff --git a/stdlib/source/test/lux/control/parser/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux index 608ee9675..4f8d6d08f 100644 --- a/stdlib/source/test/lux/control/parser/cli.lux +++ b/stdlib/source/test/lux/control/parser/cli.lux @@ -32,7 +32,7 @@ (_.for [/.Parser]) (do {! random.monad} [expected (\ ! map n\encode random.nat) - #let [random_dummy (random.only (|>> (text\= expected) not) + .let [random_dummy (random.only (|>> (text\= expected) not) (random.unicode 5))] dummy random_dummy short (random.unicode 1) diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux index f0b63bfd5..e3a7189df 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -126,7 +126,7 @@ expected_number ..safe_frac expected_string (random.unicode 1) [boolean_field number_field string_field] (|> (random.set text.hash 3 (random.unicode 3)) - (\ ! map (|>> set.to_list + (\ ! map (|>> set.list (case> (^ (list boolean_field number_field string_field)) [boolean_field number_field string_field] @@ -150,7 +150,7 @@ [size (\ ! map (n.% 10) random.nat) keys (random.list size (random.unicode 1)) values (random.list size (random.unicode 1)) - #let [expected (dictionary.of_list text.hash (list.zipped/2 keys values))]] + .let [expected (dictionary.of_list text.hash (list.zipped/2 keys values))]] (_.cover [/.dictionary] (|> (/.run (/.dictionary /.string) (#json.Object diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index 1285428cd..97c76f0f5 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -74,7 +74,7 @@ (do {! random.monad} [offset (\ ! map (n.% 50) random.nat) range (\ ! map (|>> (n.% 50) (n.+ 10)) random.nat) - #let [limit (n.+ offset range)] + .let [limit (n.+ offset range)] expected (\ ! map (|>> (n.% range) (n.+ offset) text.of_char) random.nat) out_of_range (case offset 0 (\ ! map (|>> (n.% 10) inc (n.+ limit) text.of_char) random.nat) @@ -152,10 +152,10 @@ (and (..should_pass expected /.space) (..should_fail invalid /.space)))) (do {! random.monad} - [#let [num_options 3] + [.let [num_options 3] options (|> (random.char unicode.character) (random.set n.hash num_options) - (\ ! map (|>> set.to_list + (\ ! map (|>> set.list (list\map text.of_char) (text.join_with "")))) expected (\ ! map (function (_ value) @@ -178,10 +178,10 @@ /.character_should_be) ))) (do {! random.monad} - [#let [num_options 3] + [.let [num_options 3] options (|> (random.char unicode.character) (random.set n.hash num_options) - (\ ! map (|>> set.to_list + (\ ! map (|>> set.list (list\map text.of_char) (text.join_with "")))) invalid (\ ! map (function (_ value) @@ -212,7 +212,7 @@ (do {! random.monad} [left (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat) right (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat) - #let [expected (format left right)] + .let [expected (format left right)] invalid (|> random.nat (\ ! map (n.% 16)) (random.only (n.>= 8)) @@ -225,7 +225,7 @@ (do {! random.monad} [left (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat) right (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat) - #let [expected (format left right)] + .let [expected (format left right)] invalid (|> random.nat (\ ! map (n.% 16)) (random.only (n.>= 8)) @@ -238,7 +238,7 @@ (..should_pass! expected (/.some! octal!)) (..should_pass! "" (/.some! octal!))))) (do {! random.monad} - [#let [octal (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)] + [.let [octal (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)] first octal second octal third octal] @@ -251,7 +251,7 @@ (..should_fail (format first second third) (/.exactly! 2 octal!)) (..should_fail (format first) (/.exactly! 2 octal!))))) (do {! random.monad} - [#let [octal (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)] + [.let [octal (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)] first octal second octal third octal] @@ -264,7 +264,7 @@ (..should_pass! (format first) (/.at_most! 2 octal!)) (..should_fail (format first second third) (/.at_most! 2 octal!))))) (do {! random.monad} - [#let [octal (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)] + [.let [octal (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)] first octal second octal third octal] @@ -277,7 +277,7 @@ (..should_pass! (format first second third) (/.at_least! 2 octal!)) (..should_fail (format first) (/.at_least! 2 octal!))))) (do {! random.monad} - [#let [octal (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)] + [.let [octal (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)] first octal second octal third octal] @@ -306,7 +306,7 @@ sample) (!expect (#try.Failure _)))))) (do {! random.monad} - [#let [size 10] + [.let [size 10] expected (random.unicode size) dummy (|> (random.unicode size) (random.only (|>> (text\= expected) not)))] @@ -359,7 +359,7 @@ (do {! random.monad} [left (random.unicode 1) right (random.unicode 1) - #let [input (format left right)]] + .let [input (format left right)]] (_.cover [/.remaining] (|> input (/.run (do <>.monad @@ -400,7 +400,7 @@ expected (random.only (|>> (unicode/block.within? unicode/block.basic_latin/upper) not) (random.char unicode.character)) - #let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]] + .let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]] (_.cover [/.not /.not! /.expected_to_fail] (and (..should_pass (text.of_char expected) (/.not /.upper)) (|> invalid @@ -420,7 +420,7 @@ (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") + .let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ") lower! (/.one_of! "abcdefghijklmnopqrstuvwxyz")]] (_.cover [/.and /.and!] (and (..should_pass (format upper lower) (/.and /.upper /.lower)) diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index 966da9edd..ac3432fee 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -144,14 +144,14 @@ (/.attribute [expected expected])) (#xml.Text expected)]]) (do {! random.monad} - [#let [node (: (-> xml.Tag (List xml.XML) xml.XML) + [.let [node (: (-> xml.Tag (List xml.XML) xml.XML) (function (_ tag children) (#xml.Node tag (dictionary.empty name.hash) children)))] parent ..random_tag right ..random_tag wrong (random.only (|>> (name\= right) not) ..random_tag) - #let [parser (<| (/.node parent) + .let [parser (<| (/.node parent) (do //.monad [_ (<| /.somewhere (/.node right) diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index abda4177c..3e2bc2610 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -100,7 +100,7 @@ (thread.run (do {! thread.monad} [clean_up_counter (thread.box 0) - #let [//@ ! + .let [//@ ! count_clean_up (function (_ value) (do ! [_ (thread.update inc clean_up_counter)] @@ -118,7 +118,7 @@ (thread.run (do {! thread.monad} [clean_up_counter (thread.box 0) - #let [//@ ! + .let [//@ ! count_clean_up (function (_ value) (do ! [_ (thread.update inc clean_up_counter)] @@ -137,7 +137,7 @@ (thread.run (do {! thread.monad} [clean_up_counter (thread.box 0) - #let [//@ ! + .let [//@ ! count_clean_up (function (_ value) (do ! [_ (thread.update inc clean_up_counter)] @@ -156,7 +156,7 @@ (thread.run (do {! thread.monad} [clean_up_counter (thread.box 0) - #let [//@ ! + .let [//@ ! count_clean_up (function (_ value) (do ! [_ (thread.update inc clean_up_counter)] @@ -176,7 +176,7 @@ (thread.run (do {! thread.monad} [clean_up_counter (thread.box 0) - #let [//@ !] + .let [//@ !] outcome (/.run ! (do (/.monad !) [_ (/.lift //@ (thread.write expected_clean_ups clean_up_counter))] diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index 2243f8584..098ecaa28 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -32,7 +32,7 @@ (def: message (Random Text) (random\map %.bit random.bit)) (def: focus (Random Code) (random\map code.bit random.bit)) -(def: (to_remember macro deadline message focus) +(def: (memory macro deadline message focus) (-> Name Date Text (Maybe Code) Code) (` ((~ (code.identifier macro)) (~ (code.text (%.date deadline))) @@ -65,17 +65,17 @@ (syntax: (test_macro {macro <c>.identifier} {extra <c>.text}) (let [now (io.run instant.now) today (instant.date now) - yesterday (instant.date (instant.shift (duration.inverse duration.week) now)) - tomorrow (instant.date (instant.shift duration.week now)) - prng (random.pcg32 [(hex "0123456789ABCDEF") - (instant.to_millis now)]) + yesterday (instant.date (instant.after (duration.inverse duration.week) now)) + tomorrow (instant.date (instant.after duration.week now)) + prng (random.pcg_32 [(hex "0123456789ABCDEF") + (instant.millis now)]) message (product.right (random.run prng ..message)) expected (product.right (random.run prng ..focus))] (do meta.monad - [should_fail0 (..attempt (macro.expansion (to_remember macro yesterday message #.None))) - should_fail1 (..attempt (macro.expansion (to_remember macro yesterday message (#.Some expected)))) - should_succeed0 (..attempt (macro.expansion (to_remember macro tomorrow message #.None))) - should_succeed1 (..attempt (macro.expansion (to_remember macro tomorrow message (#.Some expected))))] + [should_fail0 (..attempt (macro.expansion (..memory macro yesterday message #.None))) + should_fail1 (..attempt (macro.expansion (..memory macro yesterday message (#.Some expected)))) + should_succeed0 (..attempt (macro.expansion (..memory macro tomorrow message #.None))) + should_succeed1 (..attempt (macro.expansion (..memory macro tomorrow message (#.Some expected))))] (in (list (code.bit (and (case should_fail0 (#try.Failure error) (and (test_failure yesterday message #.None error) diff --git a/stdlib/source/test/lux/control/security/capability.lux b/stdlib/source/test/lux/control/security/capability.lux index 008d6e798..6e2e5cd77 100644 --- a/stdlib/source/test/lux/control/security/capability.lux +++ b/stdlib/source/test/lux/control/security/capability.lux @@ -27,7 +27,7 @@ (do random.monad [shift random.nat base random.nat - #let [expected (n.+ shift base)] + .let [expected (n.+ shift base)] pass_through (random.ascii 1)] (_.for [/.Capability] ($_ _.and diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux index 0f6266635..e1cae710a 100644 --- a/stdlib/source/test/lux/control/security/policy.lux +++ b/stdlib/source/test/lux/control/security/policy.lux @@ -72,9 +72,9 @@ (_.for [/.Policy /.Can_Upgrade /.Can_Downgrade]) (do random.monad - [#let [policy_0 (policy [])] + [.let [policy_0 (policy [])] raw_password (random.ascii 10) - #let [password (\ policy_0 password raw_password)]] + .let [password (\ policy_0 password raw_password)]] ($_ _.and (_.for [/.Privacy /.Private /.Can_Conceal /.Can_Reveal /.Safety /.Safe /.Can_Trust /.Can_Distrust] diff --git a/stdlib/source/test/lux/control/state.lux b/stdlib/source/test/lux/control/state.lux index e64833259..6c4bf6dc7 100644 --- a/stdlib/source/test/lux/control/state.lux +++ b/stdlib/source/test/lux/control/state.lux @@ -83,7 +83,7 @@ Test (do {! random.monad} [limit (|> random.nat (\ ! map (n.% 10))) - #let [condition (do /.monad + .let [condition (do /.monad [state /.get] (in (n.< limit state)))]] ($_ _.and diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index 4959014f7..7715dc434 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -44,7 +44,7 @@ [expected random.nat alternative (|> random.nat (random.only (|>> (n.= expected) not))) error (random.unicode 1) - #let [(^open "io\.") io.monad]]) + .let [(^open "io\.") io.monad]]) ($_ _.and (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) (..attempt random.nat))) diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index 2d1a25092..7b5f5fab0 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -79,11 +79,11 @@ Test (<| (_.covering /._) (do {! random.monad} - [#let [gen_size (|> random.nat (\ ! map (|>> (n.% 100) (n.max 8))))] + [.let [gen_size (|> random.nat (\ ! map (|>> (n.% 100) (n.max 8))))] size gen_size sample (..random size) value random.nat - #let [gen_idx (|> random.nat (\ ! map (n.% size)))] + .let [gen_idx (|> random.nat (\ ! map (n.% size)))] offset gen_idx length (\ ! map (n.% (n.- offset size)) random.nat)] (_.for [/.Binary] diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index d5ea9badf..dc8527fdc 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -52,13 +52,13 @@ [size ..bounded_size base random.nat shift random.nat - #let [expected (n.+ base shift)] + .let [expected (n.+ base shift)] the_array (random.array size random.nat)] ($_ _.and (_.cover [/.find] (\ (maybe.equivalence n.equivalence) = (/.find n.even? the_array) - (list.find n.even? (/.to_list the_array)))) + (list.find n.even? (/.list the_array)))) (_.cover [/.find+] (case [(/.find n.even? the_array) (/.find+ (function (_ idx member) @@ -80,11 +80,11 @@ false)) (_.cover [/.every?] (\ bit.equivalence = - (list.every? n.even? (/.to_list the_array)) + (list.every? n.even? (/.list the_array)) (/.every? n.even? the_array))) (_.cover [/.any?] (\ bit.equivalence = - (list.any? n.even? (/.to_list the_array)) + (list.any? n.even? (/.list the_array)) (/.any? n.even? the_array))) ))) @@ -97,7 +97,7 @@ base random.nat shift random.nat dummy (random.only (|>> (n.= base) not) random.nat) - #let [expected (n.+ base shift)] + .let [expected (n.+ base shift)] the_array (random.array size random.nat)] ($_ _.and ..structures @@ -182,10 +182,10 @@ (/.vacancy the_array))))))) (do ! [the_list (random.list size random.nat)] - (_.cover [/.of_list /.to_list] - (and (|> the_list /.of_list /.to_list + (_.cover [/.of_list /.list] + (and (|> the_list /.of_list /.list (\ (list.equivalence n.equivalence) = the_list)) - (|> the_array /.to_list /.of_list + (|> the_array /.list /.of_list (\ (/.equivalence n.equivalence) = the_array))))) (do ! [amount (\ ! map (n.% (inc size)) random.nat)] @@ -194,31 +194,31 @@ (/.empty size))] (exec (/.copy! amount 0 the_array 0 copy) (\ (list.equivalence n.equivalence) = - (list.take amount (/.to_list the_array)) - (/.to_list copy)))))) + (list.take amount (/.list the_array)) + (/.list copy)))))) (_.cover [/.clone] (let [clone (/.clone the_array)] (and (not (is? the_array clone)) (\ (/.equivalence n.equivalence) = the_array clone)))) (let [the_array (/.clone the_array) - evens (|> the_array /.to_list (list.only n.even?)) - odds (|> the_array /.to_list (list.only n.odd?))] + evens (|> the_array /.list (list.only n.even?)) + odds (|> the_array /.list (list.only n.odd?))] (_.cover [/.filter!] (exec (/.filter! n.even? the_array) (and (n.= (list.size evens) (/.occupancy the_array)) (n.= (list.size odds) (/.vacancy the_array)) - (|> the_array /.to_list (\ (list.equivalence n.equivalence) = evens)))))) + (|> the_array /.list (\ (list.equivalence n.equivalence) = evens)))))) (do ! - [#let [the_array (/.clone the_array) - members (|> the_array /.to_list (set.of_list n.hash))] + [.let [the_array (/.clone the_array) + members (|> the_array /.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'] + (_.cover [/.list'] (exec (/.filter! n.even? the_array) (list.every? (function (_ value) (or (n.even? value) (is? default value))) - (/.to_list' default the_array))))) + (/.list' default the_array))))) )))) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 11c4b59cd..fe04241a1 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -31,7 +31,7 @@ (def: for_dictionaries Test (do {! random.monad} - [#let [capped_nat (\ random.monad map (n.% 100) random.nat)] + [.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.only (|>> (/.key? dict) not) @@ -54,7 +54,7 @@ (do ! [constant random.nat - #let [hash (: (Hash Nat) + .let [hash (: (Hash Nat) (implementation (def: &equivalence n.equivalence) (def: (hash _) @@ -133,7 +133,7 @@ (def: for_entries Test (do random.monad - [#let [capped_nat (\ random.monad map (n.% 100) random.nat)] + [.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.only (|>> (/.key? dict) not) @@ -253,7 +253,7 @@ (<| (_.covering /._) (_.for [/.Dictionary]) (do random.monad - [#let [capped_nat (\ random.monad map (n.% 100) random.nat)] + [.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.only (|>> (/.key? dict) not) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 4637d3058..fb57cd70e 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -49,8 +49,8 @@ random.nat) extra_value random.nat shift random.nat - #let [pairs (list.zipped/2 (set.to_list keys) - (set.to_list values)) + .let [pairs (list.zipped/2 (set.list keys) + (set.list values)) sample (/.of_list n.order pairs) sorted_pairs (list.sort (function (_ [left _] [right _]) (n.< left right)) diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux index 5ba785919..316d7c7ce 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux @@ -26,18 +26,18 @@ (do random.monad [keys (random.set text.hash size gen_key) values (random.list size gen_value)] - (in (list.zipped/2 (set.to_list keys) values)))) + (in (list.zipped/2 (set.list keys) values)))) (def: #export test Test (<| (_.covering /._) (_.for [/.PList]) (do {! random.monad} - [#let [gen_key (random.ascii/alpha 10)] + [.let [gen_key (random.ascii/alpha 10)] size (\ ! map (n.% 100) random.nat) sample (..random size gen_key random.nat) - #let [keys (|> sample /.keys (set.of_list text.hash))] + .let [keys (|> sample /.keys (set.of_list text.hash))] extra_key (random.only (|>> (set.member? keys) not) gen_key) extra_value random.nat diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 209dfe143..a0c6fc685 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -43,7 +43,7 @@ [size ..bounded_size] (|> random.nat (random.set n.hash size) - (\ ! map set.to_list)))) + (\ ! map set.list)))) (def: signatures Test @@ -87,8 +87,8 @@ Test (do {! random.monad} [size ..bounded_size - #let [(^open "/\.") (/.equivalence n.equivalence)] - sample (\ ! map set.to_list (random.set n.hash size random.nat))] + .let [(^open "/\.") (/.equivalence n.equivalence)] + sample (\ ! map set.list (random.set n.hash size random.nat))] ($_ _.and (_.cover [/.size] (n.= size (/.size sample))) @@ -133,7 +133,7 @@ (^open "/\.") /.functor] (do {! random.monad} [sample ..random - #let [size (/.size sample)]] + .let [size (/.size sample)]] ($_ _.and (_.cover [/.indices] (let [indices (/.indices size) @@ -183,7 +183,7 @@ (do {! random.monad} [sample (random.only (|>> /.size (n.> 0)) ..random) - #let [size (/.size sample)] + .let [size (/.size sample)] idx (\ ! map (n.% size) random.nat) chunk_size (\ ! map (|>> (n.% size) inc) random.nat)] ($_ _.and @@ -427,4 +427,10 @@ (\ /.fold fold n.+ 0 (/.take index sample))) (/.indices (inc (/.size sample)))) (/.folds n.+ 0 sample))) + (do random.monad + [expected random.nat + .let [(^open "/\.") (/.equivalence n.equivalence)]] + (_.cover [/.when] + (and (/\= (list expected) (/.when true (list expected))) + (/\= (list) (/.when false (list expected)))))) ))))) diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux index b394220ef..36f6ef9a4 100644 --- a/stdlib/source/test/lux/data/collection/queue.lux +++ b/stdlib/source/test/lux/data/collection/queue.lux @@ -32,7 +32,7 @@ members (random.set n.hash size random.nat) non_member (random.only (|>> (set.member? members) not) random.nat) - #let [members (set.to_list members) + .let [members (set.list members) sample (/.of_list members)]] ($_ _.and (_.for [/.equivalence] @@ -40,8 +40,8 @@ (_.for [/.functor] ($functor.spec ..injection /.equivalence /.functor)) - (_.cover [/.of_list /.to_list] - (|> members /.of_list /.to_list + (_.cover [/.of_list /.list] + (|> members /.of_list /.list (\ (list.equivalence n.equivalence) = members))) (_.cover [/.size] (n.= size (/.size sample))) @@ -71,7 +71,7 @@ (_.cover [/.member?] (let [every_member_is_identified! (list.every? (/.member? n.equivalence sample) - (/.to_list sample)) + (/.list sample)) non_member_is_not_identified! (not (/.member? n.equivalence sample non_member))] @@ -88,8 +88,8 @@ has_expected_order! (\ (list.equivalence n.equivalence) = - (list\compose (/.to_list sample) (list non_member)) - (/.to_list pushed))] + (list\compose (/.list sample) (list non_member)) + (/.list pushed))] (and size_increases! new_member_is_identified! has_expected_order!))) @@ -108,7 +108,7 @@ has_expected_order! (\ (list.equivalence n.equivalence) = expected - (/.to_list popped))] + (/.list popped))] (and size_decreases! popped_member_is_not_identified! has_expected_order!)) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index 4eda82b14..343442e91 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -50,8 +50,8 @@ (do {! random.monad} [size (\ ! map (n.% 100) random.nat) sample (random.set n.hash size random.nat) - #let [sample (|> sample set.to_list /.of_list)] - #let [(^open "/\.") (/.equivalence n.equivalence)]] + .let [sample (|> sample set.list /.of_list)] + .let [(^open "/\.") (/.equivalence n.equivalence)]] ($_ _.and (_.cover [/.size] (n.= size (/.size sample))) @@ -59,8 +59,8 @@ (bit\= (/.empty? sample) (n.= 0 (/.size sample)))) (_.cover [/.empty] (/.empty? /.empty)) - (_.cover [/.to_list /.of_list] - (|> sample /.to_list /.of_list (/\= sample))) + (_.cover [/.list /.of_list] + (|> sample /.list /.of_list (/\= sample))) (_.cover [/.reversed] (or (n.< 2 (/.size sample)) (let [not_same! @@ -85,11 +85,11 @@ ($_ _.and (do ! [good_index (|> random.nat (\ ! map (n.% size))) - #let [bad_index (n.+ size good_index)] + .let [bad_index (n.+ size good_index)] sample (random.set n.hash size random.nat) non_member (random.only (|>> (set.member? sample) not) random.nat) - #let [sample (|> sample set.to_list /.of_list)]] + .let [sample (|> sample set.list /.of_list)]] ($_ _.and (_.cover [/.item] (case (/.item good_index sample) @@ -144,8 +144,8 @@ [sample (random.set n.hash size random.nat) non_member (random.only (|>> (set.member? sample) not) random.nat) - #let [sample (|> sample set.to_list /.of_list)] - #let [(^open "/\.") (/.equivalence n.equivalence)]] + .let [sample (|> sample set.list /.of_list)] + .let [(^open "/\.") (/.equivalence n.equivalence)]] ($_ _.and (do ! [value/0 random.nat @@ -156,7 +156,7 @@ (/.row value/0 value/1 value/2)))) (_.cover [/.member?] (and (list.every? (/.member? n.equivalence sample) - (/.to_list sample)) + (/.list sample)) (not (/.member? n.equivalence sample non_member)))) (_.cover [/.add] (let [added (/.add non_member sample) diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index d092dcf6f..df0c653b9 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -67,10 +67,10 @@ (_.cover [/.empty?] (bit\= (/.empty? setL) (n.= 0 (/.size setL)))) - (_.cover [/.to_list /.of_list] - (|> setL /.to_list (/.of_list n.hash) (\= setL))) + (_.cover [/.list /.of_list] + (|> setL /.list (/.of_list n.hash) (\= setL))) (_.cover [/.member?] - (and (list.every? (/.member? setL) (/.to_list setL)) + (and (list.every? (/.member? setL) (/.list setL)) (not (/.member? setL non_memberL)))) (_.cover [/.add] (let [before_addition! @@ -126,8 +126,8 @@ (_.cover [/.difference] (let [setL+R (/.union setR setL) setL_R (/.difference setR setL+R)] - (and (list.every? (/.member? setL+R) (/.to_list setR)) - (not (list.any? (/.member? setL_R) (/.to_list setR)))))) + (and (list.every? (/.member? setL+R) (/.list setR)) + (not (list.any? (/.member? setL_R) (/.list setR)))))) (_.cover [/.predicate] - (list.every? (/.predicate setL) (/.to_list setL))) + (list.every? (/.predicate setL) (/.list setL))) )))))) diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux index 7f23bfe3d..37645cbed 100644 --- a/stdlib/source/test/lux/data/collection/set/multi.lux +++ b/stdlib/source/test/lux/data/collection/set/multi.lux @@ -34,7 +34,7 @@ (/.add count element set)) (/.empty hash) (list.zipped/2 element_counts - (set.to_list elements)))))) + (set.list elements)))))) (def: signature Test @@ -69,16 +69,16 @@ no_left_changes! (list.every? (function (_ member) (n.= (/.multiplicity sample member) (/.multiplicity composed member))) - (set.to_list sample_only)) + (set.list sample_only)) no_right_changes! (list.every? (function (_ member) (n.= (/.multiplicity another member) (/.multiplicity composed member))) - (set.to_list another_only)) + (set.list another_only)) common_changes! (list.every? (function (_ member) (n.= (<composition> (/.multiplicity sample member) (/.multiplicity another member)) (/.multiplicity composed member))) - (set.to_list common))] + (set.list common))] (and no_left_changes! no_right_changes! common_changes!)))] @@ -95,14 +95,14 @@ composed (/.intersection sample another) left_removals! (list.every? (|>> (/.member? composed) not) - (set.to_list sample_only)) + (set.list sample_only)) right_removals! (list.every? (|>> (/.member? composed) not) - (set.to_list another_only)) + (set.list another_only)) common_changes! (list.every? (function (_ member) (n.= (n.min (/.multiplicity sample member) (/.multiplicity another member)) (/.multiplicity composed member))) - (set.to_list common))] + (set.list common))] (and left_removals! right_removals! common_changes!))) @@ -121,13 +121,13 @@ partial_removal_count (\ ! map (n.% addition_count) random.nat) another (..random diversity n.hash ..count random.nat)] ($_ _.and - (_.cover [/.to_list /.of_list] + (_.cover [/.list /.of_list] (|> sample - /.to_list + /.list (/.of_list n.hash) (\ /.equivalence = sample))) (_.cover [/.size] - (n.= (list.size (/.to_list sample)) + (n.= (list.size (/.list sample)) (/.size sample))) (_.cover [/.empty?] (bit\= (/.empty? sample) @@ -136,14 +136,14 @@ (/.empty? (/.empty n.hash))) (_.cover [/.support] (list.every? (set.member? (/.support sample)) - (/.to_list sample))) + (/.list sample))) (_.cover [/.member?] (let [non_member_is_not_identified! (not (/.member? sample non_member)) all_members_are_identified! (list.every? (/.member? sample) - (/.to_list sample))] + (/.list sample))] (and non_member_is_not_identified! all_members_are_identified!))) (_.cover [/.multiplicity] @@ -152,7 +152,7 @@ every_member_has_positive_multiplicity! (list.every? (|>> (/.multiplicity sample) (n.> 0)) - (/.to_list sample))] + (/.list sample))] (and non_members_have_0_multiplicity! every_member_has_positive_multiplicity!))) (_.cover [/.add] @@ -197,7 +197,7 @@ (_.cover [/.of_set] (let [unary (|> sample /.support /.of_set)] (list.every? (|>> (/.multiplicity unary) (n.= 1)) - (/.to_list unary)))) + (/.list unary)))) (_.cover [/.sub?] (let [unary (|> sample /.support /.of_set)] (and (/.sub? sample unary) @@ -217,11 +217,11 @@ composed (/.difference sample another) ommissions! (list.every? (|>> (/.member? composed) not) - (set.to_list sample_only)) + (set.list sample_only)) intact! (list.every? (function (_ member) (n.= (/.multiplicity another member) (/.multiplicity composed member))) - (set.to_list another_only)) + (set.list another_only)) subtractions! (list.every? (function (_ member) (let [sample_multiplicity (/.multiplicity sample member) another_multiplicity (/.multiplicity another member)] @@ -230,7 +230,7 @@ (n.- sample_multiplicity another_multiplicity)) (/.multiplicity composed member)))) - (set.to_list common))] + (set.list common))] (and ommissions! intact! subtractions!))) diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index 89ce681b0..620a63289 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -46,9 +46,9 @@ usetL (random.set n.hash sizeL 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 + .let [listL (//.list usetL)] + listR (|> (random.set n.hash sizeR random.nat) (\ ! map //.list)) + .let [(^open "/\.") /.equivalence setL (/.of_list n.order listL) setR (/.of_list n.order listR) empty (/.empty n.order)]] @@ -63,19 +63,19 @@ (/.empty? setL))) (_.cover [/.empty] (/.empty? (/.empty n.order))) - (_.cover [/.to_list] + (_.cover [/.list] (\ (list.equivalence n.equivalence) = - (/.to_list (/.of_list n.order listL)) + (/.list (/.of_list n.order listL)) (list.sort (\ n.order <) listL))) (_.cover [/.of_list] (|> setL - /.to_list (/.of_list n.order) + /.list (/.of_list n.order) (/\= setL))) (~~ (template [<coverage> <comparison>] [(_.cover [<coverage>] (case (<coverage> setL) (#.Some value) - (|> setL /.to_list (list.every? (<comparison> value))) + (|> setL /.list (list.every? (<comparison> value))) #.None (/.empty? setL)))] @@ -85,7 +85,7 @@ )) (_.cover [/.member?] (let [members_are_identified! - (list.every? (/.member? setL) (/.to_list setL)) + (list.every? (/.member? setL) (/.list setL)) non_members_are_not_identified! (not (/.member? setL non_memberL))] @@ -164,7 +164,7 @@ difference! (not (list.any? (/.member? (/.difference setL setR)) - (/.to_list setL))) + (/.list setL))) idempotence! (\ /.equivalence = diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux index 496c25865..be46b8249 100644 --- a/stdlib/source/test/lux/data/collection/tree/finger.lux +++ b/stdlib/source/test/lux/data/collection/tree/finger.lux @@ -78,7 +78,7 @@ (\ ..builder leaf tag_left expected_left) (\ ..builder leaf tag_right expected_right)))))) (do random.monad - [#let [tags_equivalence (list.equivalence text.equivalence) + [.let [tags_equivalence (list.equivalence text.equivalence) values_equivalence (list.equivalence n.equivalence)] tags/H (random.ascii/alpha_num 1) tags/T (random.list 5 (random.ascii/alpha_num 1)) diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux index 749a8c59b..756318c0b 100644 --- a/stdlib/source/test/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux @@ -159,7 +159,7 @@ [[size sample] (//.tree random.nat) expected random.nat dummy (random.only (|>> (n.= expected) not) random.nat) - #let [(^open "tree\.") (tree.equivalence n.equivalence) + .let [(^open "tree\.") (tree.equivalence n.equivalence) (^open "list\.") (list.equivalence n.equivalence)]] ($_ _.and (_.for [/.equivalence] diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux index 81c45a8e2..990eb6aea 100644 --- a/stdlib/source/test/lux/data/color.lux +++ b/stdlib/source/test/lux/data/color.lux @@ -48,8 +48,8 @@ (def: (distance/3 from to) (-> /.Color /.Color Frac) - (let [[fr fg fb] (/.to_rgb from) - [tr tg tb] (/.to_rgb to)] + (let [[fr fg fb] (/.rgb from) + [tr tg tb] (/.rgb to)] (square_root ($_ f.+ (|> (scale tr) (f.- (scale fr)) square) @@ -61,7 +61,7 @@ (template [<field>] [(def: (<field> color) (-> /.Color Frac) - (let [[hue saturation luminance] (/.to_hsl color)] + (let [[hue saturation luminance] (/.hsl color)] <field>))] [saturation] @@ -71,19 +71,19 @@ (def: (encoding expected) (-> /.Color Test) ($_ _.and - (_.cover [/.RGB /.to_rgb /.of_rgb] - (|> expected /.to_rgb /.of_rgb + (_.cover [/.RGB /.rgb /.of_rgb] + (|> expected /.rgb /.of_rgb (\ /.equivalence = expected))) - (_.cover [/.HSL /.to_hsl /.of_hsl] - (|> expected /.to_hsl /.of_hsl + (_.cover [/.HSL /.hsl /.of_hsl] + (|> expected /.hsl /.of_hsl (distance/3 expected) (f.<= ..rgb_error_margin))) - (_.cover [/.HSB /.to_hsb /.of_hsb] - (|> expected /.to_hsb /.of_hsb + (_.cover [/.HSB /.hsb /.of_hsb] + (|> expected /.hsb /.of_hsb (distance/3 expected) (f.<= ..rgb_error_margin))) - (_.cover [/.CMYK /.to_cmyk /.of_cmyk] - (|> expected /.to_cmyk /.of_cmyk + (_.cover [/.CMYK /.cmyk /.of_cmyk] + (|> expected /.cmyk /.of_cmyk (distance/3 expected) (f.<= ..rgb_error_margin))) )) @@ -133,9 +133,9 @@ (do {! random.monad} [eH (\ ! map (|>> f.abs (f.% +0.9) (f.+ +0.05)) random.safe_frac) - #let [eS +0.5] + .let [eS +0.5] variations (\ ! map (|>> (n.% 3) (n.+ 2)) random.nat) - #let [max_spread (f./ (|> variations inc .int int.frac) + .let [max_spread (f./ (|> variations inc .int int.frac) +1.0) min_spread (f./ +2.0 max_spread) spread_space (f.- min_spread max_spread)] diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 940f22cd8..1c4469df2 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -90,8 +90,8 @@ (do random.monad [keys (random.set text.hash 3 (random.ascii/alpha 1)) values (random.set frac.hash 3 random.safe_frac) - #let [expected (list.zipped/2 (set.to_list keys) - (list\map (|>> #/.Number) (set.to_list values))) + .let [expected (list.zipped/2 (set.list keys) + (list\map (|>> #/.Number) (set.list values))) object (/.object expected)]] ($_ _.and (_.cover [/.object /.fields] @@ -119,7 +119,7 @@ (<| (try.else false) (do try.monad [object (/.set key (#/.Number expected) (/.object (list))) - #let [can_find_known_key! + .let [can_find_known_key! (|> object (/.get key) (try\map (\= (#/.Number expected))) diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index 13c713f7f..34618433b 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -162,7 +162,7 @@ random.nat) chunk (random.ascii/lower chunk_size) chunks (\ ! map (n.% 100) random.nat) - #let [content (|> chunk + .let [content (|> chunk (list.repeat chunks) (text.join_with "") (\ utf8.codec encode))]] @@ -174,7 +174,7 @@ tar (|> (row.row (<tag> expected_path)) (format.run /.writer) (<b>.run /.parser))] - (in (case (row.to_list tar) + (in (case (row.list tar) (^ (list (<tag> actual_path))) (text\= (/.from_path expected_path) (/.from_path actual_path)) @@ -203,7 +203,7 @@ expected_content])) (format.run /.writer) (<b>.run /.parser))] - (in (case (row.to_list tar) + (in (case (row.list tar) (^ (list (<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]))) (let [seconds (: (-> Instant Int) (|>> instant.relative (duration.query duration.second)))] @@ -245,7 +245,7 @@ (do {! random.monad} [path (random.ascii/lower 10) modes (random.list 4 ..random_mode) - #let [expected_mode (list\fold /.and /.none modes)]] + .let [expected_mode (list\fold /.and /.none modes)]] (`` ($_ _.and (_.cover [/.and] (|> (do try.monad @@ -261,7 +261,7 @@ content])) (format.run /.writer) (<b>.run /.parser))] - (in (case (row.to_list tar) + (in (case (row.list tar) (^ (list (#/.Normal [_ _ actual_mode _ _]))) (n.= (/.mode expected_mode) (/.mode actual_mode)) @@ -284,7 +284,7 @@ content])) (format.run /.writer) (<b>.run /.parser))] - (in (case (row.to_list tar) + (in (case (row.list tar) (^ (list (#/.Normal [_ _ actual_mode _ _]))) (n.= (/.mode <expected_mode>) (/.mode actual_mode)) @@ -351,7 +351,7 @@ content])) (format.run /.writer) (<b>.run /.parser))] - (in (case (row.to_list tar) + (in (case (row.list tar) (^ (list (#/.Normal [_ _ _ actual_ownership _]))) (and (text\= (/.from_name expected) (/.from_name (get@ [#/.user #/.name] actual_ownership))) @@ -375,7 +375,7 @@ content])) (format.run /.writer) (<b>.run /.parser))] - (in (case (row.to_list tar) + (in (case (row.list tar) (^ (list (#/.Normal [_ _ _ actual_ownership _]))) (and (text\= (/.from_name /.anonymous) (/.from_name (get@ [#/.user #/.name] actual_ownership))) diff --git a/stdlib/source/test/lux/data/lazy.lux b/stdlib/source/test/lux/data/lazy.lux index 4fb2f6642..c30fd3692 100644 --- a/stdlib/source/test/lux/data/lazy.lux +++ b/stdlib/source/test/lux/data/lazy.lux @@ -40,7 +40,7 @@ (do random.monad [left random.nat right random.nat - #let [expected <eager>]] + .let [expected <eager>]] (_.for [/.Lazy] ($_ _.and (_.for [/.equivalence] diff --git a/stdlib/source/test/lux/data/maybe.lux b/stdlib/source/test/lux/data/maybe.lux index 9aa890d9f..65d405473 100644 --- a/stdlib/source/test/lux/data/maybe.lux +++ b/stdlib/source/test/lux/data/maybe.lux @@ -48,7 +48,7 @@ (do random.monad [left random.nat right random.nat - #let [expected (n.+ left right)]] + .let [expected (n.+ left right)]] (let [lift (/.lift io.monad)] (_.cover [/.with /.lift] (|> (io.run (do (/.with io.monad) @@ -75,8 +75,14 @@ (is? value (/.assume (#.Some value))))) (do random.monad [value random.nat] - (_.cover [/.to_list] + (_.cover [/.list] (\ (list.equivalence n.equivalence) = (list value) - (/.to_list (#.Some value))))) + (/.list (#.Some value))))) + (do random.monad + [expected random.nat + .let [(^open "/\.") (/.equivalence n.equivalence)]] + (_.cover [/.when] + (and (/\= (#.Some expected) (/.when true (#.Some expected))) + (/\= #.None (/.when false (#.Some expected)))))) ))) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 3e063f73a..5d02dbfcf 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -56,7 +56,7 @@ (random.unicode 1)) left (random.unicode 1) right (random.unicode 1) - #let [full (\ /.monoid compose inner outer) + .let [full (\ /.monoid compose inner outer) fake_index (dec 0)]] (`` ($_ _.and (~~ (template [<affix> <predicate>] @@ -83,7 +83,7 @@ [inner (random.unicode 1) outer (random.only (|>> (\ /.equivalence = inner) not) (random.unicode 1)) - #let [fake_index (dec 0)]] + .let [fake_index (dec 0)]] ($_ _.and (_.cover [/.contains?] (let [full (\ /.monoid compose inner outer)] @@ -122,24 +122,6 @@ (|> (/.last_index_of outer full) (maybe.else fake_index) (n.= 2))))) - (_.cover [/.last_index_of'] - (let [full ($_ (\ /.monoid compose) outer inner outer)] - (and (|> (/.last_index_of' 0 inner full) - (maybe.else fake_index) - (n.= 1)) - (|> (/.last_index_of' 2 inner full) - (maybe.else fake_index) - (n.= fake_index)) - - (|> (/.last_index_of' 0 outer full) - (maybe.else fake_index) - (n.= 2)) - (|> (/.last_index_of' 2 outer full) - (maybe.else fake_index) - (n.= 2)) - (|> (/.last_index_of' 3 outer full) - (maybe.else fake_index) - (n.= fake_index))))) ))) (def: char @@ -166,7 +148,7 @@ (do {! random.monad} [size (\ ! map (|>> (n.% 10) inc) random.nat) characters (random.set /.hash size (random.ascii/alpha 1)) - #let [sample (|> characters set.to_list /.concat)] + .let [sample (|> characters set.list /.concat)] expected (\ ! map (n.% size) random.nat)] (_.cover [/.char] (case (/.char expected sample) @@ -200,9 +182,9 @@ characters (random.set /.hash size (random.ascii/alpha 1)) separator (random.only (|>> (set.member? characters) not) (random.ascii/alpha 1)) - #let [with_no_separator (|> characters set.to_list /.concat)] + .let [with_no_separator (|> characters set.list /.concat)] static (random.ascii/alpha 1) - #let [dynamic (random.only (|>> (\ /.equivalence = static) not) + .let [dynamic (random.only (|>> (\ /.equivalence = static) not) (random.ascii/alpha 1))] pre dynamic post dynamic @@ -212,16 +194,16 @@ ($_ _.and (_.cover [/.concat] (n.= (set.size characters) - (/.size (/.concat (set.to_list characters))))) + (/.size (/.concat (set.list characters))))) (_.cover [/.join_with /.split_all_with] - (and (|> (set.to_list characters) + (and (|> (set.list characters) (/.join_with separator) (/.split_all_with separator) (set.of_list /.hash) (\ set.equivalence = characters)) (\ /.equivalence = - (/.concat (set.to_list characters)) - (/.join_with "" (set.to_list characters))))) + (/.concat (set.list characters)) + (/.join_with "" (set.list characters))))) (_.cover [/.replace_once] (\ /.equivalence = (\ /.monoid compose post static) @@ -303,7 +285,7 @@ sampleL (random.unicode sizeL) sampleR (random.unicode sizeR) middle (random.unicode 1) - #let [sample (/.concat (list sampleL sampleR)) + .let [sample (/.concat (list sampleL sampleR)) (^open "/\.") /.equivalence]] ($_ _.and (_.cover [/.split] @@ -332,16 +314,16 @@ (do {! random.monad} [sizeP bounded_size sizeL bounded_size - #let [## The wider unicode charset includes control characters that + .let [## The wider unicode charset includes control characters that ## can make text replacement work improperly. ## Because of that, I restrict the charset. normal_char_gen (|> random.nat (\ ! map (|>> (n.% 128) (n.max 1))))] sep1 (random.text normal_char_gen 1) sep2 (random.text normal_char_gen 1) - #let [part_gen (|> (random.text normal_char_gen sizeP) + .let [part_gen (|> (random.text normal_char_gen sizeP) (random.only (|>> (/.contains? sep1) not)))] parts (random.list sizeL part_gen) - #let [sample1 (/.concat (list.interpose sep1 parts)) + .let [sample1 (/.concat (list.interpose sep1 parts)) sample2 (/.concat (list.interpose sep2 parts)) (^open "/\.") /.equivalence]] (_.cover [/.replace_all] diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index 34f37de58..21266b277 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -72,7 +72,7 @@ (syntax: (static_sample) (do meta.monad [seed meta.seed - #let [[_ expected] (random.run (random.pcg32 [seed seed]) + .let [[_ expected] (random.run (random.pcg_32 [seed seed]) (random.ascii 10))]] (in (list (code.text expected))))) diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux index 9588ce6ce..e2a415abd 100644 --- a/stdlib/source/test/lux/data/text/unicode/block.lux +++ b/stdlib/source/test/lux/data/text/unicode/block.lux @@ -170,12 +170,12 @@ (<| (_.covering /._) (_.for [/.Block]) (do {! random.monad} - [#let [top_start (hex "AC00") + [.let [top_start (hex "AC00") top_end (hex "D7AF") end_range (n.- top_start top_end)] start (\ ! map (|>> (n.% top_start) inc) random.nat) end (\ ! map (|>> (n.% end_range) (n.+ top_start)) random.nat) - #let [additional (n.- start end) + .let [additional (n.- start end) sample (/.block start additional) size (/.size sample)] inside (\ ! map diff --git a/stdlib/source/test/lux/data/text/unicode/set.lux b/stdlib/source/test/lux/data/text/unicode/set.lux index cd74a038c..0f50a1dd7 100644 --- a/stdlib/source/test/lux/data/text/unicode/set.lux +++ b/stdlib/source/test/lux/data/text/unicode/set.lux @@ -42,7 +42,7 @@ random.nat) left //block.random right //block.random - #let [equivalence (product.equivalence n.equivalence + .let [equivalence (product.equivalence n.equivalence n.equivalence)]] (`` ($_ _.and (_.for [/.equivalence] @@ -76,7 +76,7 @@ (~~ (template [<set>] [(do random.monad [char (random.char <set>) - #let [start (/.start <set>) + .let [start (/.start <set>) end (/.end <set>)]] (_.cover [<set>] (and (/.member? <set> char) diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index bab7b9007..76172c10d 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -109,7 +109,7 @@ ## Directive (directive: (..my_directive self phase archive {parameters (<>.some <code>.any)}) (do phase.monad - [#let [_ (debug.log! (format "Successfully installed directive " (%.text self) "!"))]] + [.let [_ (debug.log! (format "Successfully installed directive " (%.text self) "!"))]] (in directive.no_requirements))) (`` ((~~ (static ..my_directive)))) diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index e2d7e4f4d..c5f52200b 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -262,7 +262,7 @@ [expected random.nat left random.int right random.int - #let [object/0 (/.object [] [test/TestInterface0] + .let [object/0 (/.object [] [test/TestInterface0] [] (test/TestInterface0 [] (actual0 self) @@ -491,7 +491,7 @@ left random.int right random.int - #let [object/0 (test/TestClass0::new (.int expected)) + .let [object/0 (test/TestClass0::new (.int expected)) example/0! (n.= expected (:as Nat (test/TestInterface0::actual0 object/0))) @@ -543,13 +543,13 @@ (i.= expected (test/TestInterface4::actual4 left right right object/8)))] - #let [random_long (: (Random java/lang/Long) + .let [random_long (: (Random java/lang/Long) (\ ! map (|>> (:as java/lang/Long)) random.int))] dummy/0 random_long dummy/1 random_long dummy/2 random_long - #let [object/9 (/.do_to (: (test/TestClass9 java/lang/Long) + .let [object/9 (/.do_to (: (test/TestClass9 java/lang/Long) (test/TestClass9::new dummy/0)) (test/TestClass9::set_actual9 dummy/1) (test/TestClass9::set_actual9 dummy/2)) diff --git a/stdlib/source/test/lux/locale.lux b/stdlib/source/test/lux/locale.lux index 298b4cf7d..ea6ac14e2 100644 --- a/stdlib/source/test/lux/locale.lux +++ b/stdlib/source/test/lux/locale.lux @@ -76,11 +76,11 @@ [language ..random_language territory ..random_territory encoding ..random_encoding - #let [l_locale (/.locale language #.None #.None) + .let [l_locale (/.locale language #.None #.None) lt_locale (/.locale language (#.Some territory) #.None) le_locale (/.locale language #.None (#.Some encoding)) lte_locale (/.locale language (#.Some territory) (#.Some encoding))] - #let [language_check (and (text\= (language.code language) + .let [language_check (and (text\= (language.code language) (/.code l_locale)) (list.every? (|>> /.code (text.starts_with? (language.code language))) (list lt_locale le_locale lte_locale))) diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index 3fcda84d7..8577301d8 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -277,7 +277,7 @@ (def: #export random (Random /.Language) (let [options (|> ..languages - (list\map (|>> (get@ #languages) set.to_list)) + (list\map (|>> (get@ #languages) set.list)) list.concat)] (do {! random.monad} [choice (\ ! map (n.% (list.size options)) diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index e03bd8dc6..a0dfbb4ee 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -203,7 +203,7 @@ (def: #export random (Random /.Territory) (let [options (|> ..territories - (list\map (|>> (get@ #territories) set.to_list)) + (list\map (|>> (get@ #territories) set.list)) list.concat)] (do {! random.monad} [choice (\ ! map (n.% (list.size options)) diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux index 248a63400..8dc0c64db 100644 --- a/stdlib/source/test/lux/macro.lux +++ b/stdlib/source/test/lux/macro.lux @@ -61,7 +61,7 @@ (do {! random.monad} [seed random.nat gensym_prefix (random.ascii/upper 1) - #let [macro_module (name.module (name_of /._)) + .let [macro_module (name.module (name_of /._)) current_module (name.module (name_of .._))]] (in [seed gensym_prefix @@ -113,7 +113,7 @@ pow/1 (\ ! map code.nat random.nat) repetitions (\ ! map (nat.% 10) random.nat) - #let [single_expansion (` (..pow/2 (..pow/2 (~ pow/1)))) + .let [single_expansion (` (..pow/2 (..pow/2 (~ pow/1)))) expansion (` (nat.* (..pow/2 (~ pow/1)) (..pow/2 (~ pow/1)))) full_expansion (` (nat.* (nat.* (~ pow/1) (~ pow/1)) diff --git a/stdlib/source/test/lux/macro/poly/equivalence.lux b/stdlib/source/test/lux/macro/poly/equivalence.lux index c14525e7d..ca083482d 100644 --- a/stdlib/source/test/lux/macro/poly/equivalence.lux +++ b/stdlib/source/test/lux/macro/poly/equivalence.lux @@ -55,7 +55,7 @@ (Random Record) (do {! random.monad} [size (\ ! map (n.% 2) random.nat) - #let [gen_int (|> random.int (\ ! map (|>> i.abs (i.% +1,000,000))))]] + .let [gen_int (|> random.int (\ ! map (|>> i.abs (i.% +1,000,000))))]] ($_ random.and random.bit gen_int diff --git a/stdlib/source/test/lux/math.lux b/stdlib/source/test/lux/math.lux index 96ba96e35..8eae10808 100644 --- a/stdlib/source/test/lux/math.lux +++ b/stdlib/source/test/lux/math.lux @@ -36,7 +36,7 @@ (<| (_.covering /._) ($_ _.and (do {! random.monad} - [#let [~= (f.approximately? ..margin_of_error)] + [.let [~= (f.approximately? ..margin_of_error)] angle (|> random.safe_frac (\ ! map (f.* /.tau)))] ($_ _.and (_.cover [/.sin /.asin] @@ -90,7 +90,7 @@ (f.approximately? ..margin_of_error sample))) )) (do {! random.monad} - [#let [~= (f.approximately? ..margin_of_error)] + [.let [~= (f.approximately? ..margin_of_error)] sample (\ ! map (f.* +10.0) random.safe_frac) power (\ ! map (|>> (n.% 10) inc n.frac) random.nat)] ($_ _.and @@ -106,7 +106,7 @@ (~= power)))) )) (do {! random.monad} - [#let [~= (f.approximately? ..margin_of_error)] + [.let [~= (f.approximately? ..margin_of_error)] angle (\ ! map (f.* /.tau) random.safe_frac) sample (\ ! map f.abs random.safe_frac) big (\ ! map (f.* +1,000,000,000.00) random.safe_frac)] @@ -144,7 +144,7 @@ (and (f.>= x h) (f.>= y h))))) (do {! random.monad} - [#let [~= (f.approximately? ..margin_of_error) + [.let [~= (f.approximately? ..margin_of_error) tau/4 (f./ +4.0 /.tau)] x (\ ! map (f.* tau/4) random.safe_frac) y (\ ! map (f.* tau/4) random.safe_frac)] diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index 0beb03ada..bdbc790ac 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -44,7 +44,7 @@ threshold_1 (\ ! map (|>> (r.% .5) (r.+ .5)) random.rev) - #let [bottom (r.min threshold_0 threshold_1) + .let [bottom (r.min threshold_0 threshold_1) top (r.max threshold_0 threshold_1)]] ($_ _.and (_.cover [/.gradient] @@ -89,7 +89,7 @@ [bottom middle_bottom middle_top top] (|> random.rev (random.set r.hash 4) - (\ ! map (|>> set.to_list (list.sort r.<))) + (\ ! map (|>> set.list (list.sort r.<))) (random.one (function (_ thresholds) (case thresholds (^ (list threshold_0 threshold_1 threshold_2 threshold_3)) @@ -98,7 +98,7 @@ _ #.None)))) - #let [bottom_set (/.gradient bottom middle_bottom) + .let [bottom_set (/.gradient bottom middle_bottom) top_set (/.gradient middle_top top)]] ($_ _.and (_.cover [/.union] @@ -173,7 +173,7 @@ [bottom middle_bottom middle_top top] (|> random.rev (random.set r.hash 4) - (\ ! map (|>> set.to_list (list.sort r.<))) + (\ ! map (|>> set.list (list.sort r.<))) (random.one (function (_ thresholds) (case thresholds (^ (list threshold_0 threshold_1 threshold_2 threshold_3)) @@ -291,7 +291,7 @@ Test (do random.monad [threshold random.nat - #let [under? (n.< threshold) + .let [under? (n.< threshold) set (set.of_list n.hash (list threshold))] sample random.nat] ($_ _.and @@ -312,7 +312,7 @@ threshold_0 random.rev threshold_1 random.rev - #let [bottom (r.min threshold_0 threshold_1) + .let [bottom (r.min threshold_0 threshold_1) top (r.max threshold_0 threshold_1)]] (in [[bottom top] (/.gradient bottom top)]))) @@ -324,8 +324,8 @@ threshold random.rev sample random.rev] ($_ _.and - (_.cover [/.to_predicate] - (bit\= (not ((/.to_predicate threshold set) sample)) + (_.cover [/.predicate] + (bit\= (not ((/.predicate threshold set) sample)) (r.< threshold (/.membership set sample)))) (_.cover [/.cut] (bit\= (r.= //.false (/.membership (/.cut threshold set) sample)) @@ -339,7 +339,7 @@ (do random.monad [sample random.rev [_ fuzzy] ..gradient - #let [equivalence (: (Equivalence (/.Fuzzy Rev)) + .let [equivalence (: (Equivalence (/.Fuzzy Rev)) (implementation (def: (= left right) (r.= (left sample) diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux index 2a8e65062..7f59d94af 100644 --- a/stdlib/source/test/lux/math/number/frac.lux +++ b/stdlib/source/test/lux/math/number/frac.lux @@ -191,10 +191,10 @@ (let [test (: (-> Frac Bit) (function (_ value) (n.= (.nat (java/lang/Double::doubleToRawLongBits value)) - (/.to_bits value))))] + (/.bits value))))] (do random.monad [sample random.frac] - (_.cover [/.to_bits] + (_.cover [/.bits] (and (test sample) (test /.biggest) (test /.smallest) @@ -214,13 +214,13 @@ @.jvm <jvm>} (let [test (: (-> Frac Bit) (function (_ expected) - (let [actual (|> expected /.to_bits /.of_bits)] + (let [actual (|> expected /.bits /.of_bits)] (or (/.= expected actual) (and (/.not_a_number? expected) (/.not_a_number? actual))))))] (do random.monad [sample random.frac] - (_.cover [/.to_bits /.of_bits] + (_.cover [/.bits /.of_bits] (and (test sample) (test /.biggest) (test /.smallest) diff --git a/stdlib/source/test/lux/math/number/i16.lux b/stdlib/source/test/lux/math/number/i16.lux index 5a9e36f88..bc1da4832 100644 --- a/stdlib/source/test/lux/math/number/i16.lux +++ b/stdlib/source/test/lux/math/number/i16.lux @@ -23,7 +23,7 @@ (<| (_.covering /._) (_.for [/.I16]) (do {! random.monad} - [#let [limit (|> (dec /.width) + [.let [limit (|> (dec /.width) //i64.mask .int inc)] diff --git a/stdlib/source/test/lux/math/number/i32.lux b/stdlib/source/test/lux/math/number/i32.lux index 4cced31ad..211156ef2 100644 --- a/stdlib/source/test/lux/math/number/i32.lux +++ b/stdlib/source/test/lux/math/number/i32.lux @@ -23,7 +23,7 @@ (<| (_.covering /._) (_.for [/.I32]) (do {! random.monad} - [#let [limit (|> (dec /.width) + [.let [limit (|> (dec /.width) //i64.mask .int inc)] diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux index 1d097ca27..ddc907939 100644 --- a/stdlib/source/test/lux/math/number/i64.lux +++ b/stdlib/source/test/lux/math/number/i64.lux @@ -99,7 +99,7 @@ full!))) (do ! [size (\ ! map (n.% /.width) random.nat) - #let [spare (n.- size /.width)] + .let [spare (n.- size /.width)] offset (\ ! map (n.% spare) random.nat)] (_.cover [/.region] (case size @@ -130,12 +130,12 @@ (#.Some sub) (do {! random.monad} - [#let [limit (|> (dec (\ sub width)) + [.let [limit (|> (dec (\ sub width)) /.mask .int inc)] expected (\ ! map (i.% limit) random.int) - #let [random (: (All [size] + .let [random (: (All [size] (-> (-> I64 (I64 size)) (Random (I64 size)))) (function (_ narrow) (\ random.functor map narrow random.i64)))]] diff --git a/stdlib/source/test/lux/math/number/i8.lux b/stdlib/source/test/lux/math/number/i8.lux index 8b454883d..6bd0a3c9f 100644 --- a/stdlib/source/test/lux/math/number/i8.lux +++ b/stdlib/source/test/lux/math/number/i8.lux @@ -23,7 +23,7 @@ (<| (_.covering /._) (_.for [/.I8]) (do {! random.monad} - [#let [limit (|> (dec /.width) + [.let [limit (|> (dec /.width) //i64.mask .int inc)] diff --git a/stdlib/source/test/lux/math/number/int.lux b/stdlib/source/test/lux/math/number/int.lux index 18f46233a..6d8d2340b 100644 --- a/stdlib/source/test/lux/math/number/int.lux +++ b/stdlib/source/test/lux/math/number/int.lux @@ -135,7 +135,7 @@ (/.mod left right)))))) )) (do {! random.monad} - [#let [random (|> random.int + [.let [random (|> random.int (\ ! map (/.% +1,000)) (random.only (|>> (/.= +0) not)))] left random diff --git a/stdlib/source/test/lux/math/number/nat.lux b/stdlib/source/test/lux/math/number/nat.lux index 05fbfb303..9b2a8d676 100644 --- a/stdlib/source/test/lux/math/number/nat.lux +++ b/stdlib/source/test/lux/math/number/nat.lux @@ -104,7 +104,7 @@ (/.= rem (/.% left right))))) )) (do {! random.monad} - [#let [random (\ ! map (|>> (/.% 1,000) inc) random.nat)] + [.let [random (\ ! map (|>> (/.% 1,000) inc) random.nat)] left random right random] ($_ _.and diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux index 9383f97e3..c30830474 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/ratio.lux @@ -53,7 +53,7 @@ ($codec.spec /.equivalence /.codec ..random)) (do random.monad - [#let [(^open "\.") /.equivalence] + [.let [(^open "\.") /.equivalence] denom/0 ..part denom/1 ..part] (_.cover [/.ratio] diff --git a/stdlib/source/test/lux/math/number/rev.lux b/stdlib/source/test/lux/math/number/rev.lux index 63c8c7135..3c9d07138 100644 --- a/stdlib/source/test/lux/math/number/rev.lux +++ b/stdlib/source/test/lux/math/number/rev.lux @@ -88,7 +88,7 @@ (and (/.< left (/.* left right)) (/.< right (/.* left right))))) (do {! random.monad} - [#let [dividend (\ ! map (i64.and (hex "FFFF")) + [.let [dividend (\ ! map (i64.and (hex "FFFF")) random.rev) divisor (\ ! map (|>> (i64.and (hex "F")) (i64.or (hex "1")) diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 6855ada9a..45a6b5b10 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -50,7 +50,7 @@ expected_seed random.nat expected random.nat dummy (random.only (|>> (n.= expected) not) random.nat) - #let [expected_lux {#.info {#.target target + .let [expected_lux {#.info {#.target target #.version version #.mode #.Build} #.source [location.dummy 0 source_code] @@ -97,7 +97,7 @@ expected random.nat dummy (random.only (|>> (n.= expected) not) random.nat) expected_error (random.ascii/upper 1) - #let [expected_lux {#.info {#.target target + .let [expected_lux {#.info {#.target target #.version version #.mode #.Build} #.source [location.dummy 0 source_code] @@ -177,7 +177,7 @@ (not (or (text\= expected_current_module module) (text\= imported_module_name module)))) (random.ascii/upper 1)) - #let [imported_module {#.module_hash 0 + .let [imported_module {#.module_hash 0 #.module_aliases (list) #.definitions (list) #.imports (list) @@ -294,7 +294,7 @@ expected random.nat dummy (random.only (|>> (n.= expected) not) random.nat) expected_location ..random_location - #let [type_context {#.ex_counter 0 + .let [type_context {#.ex_counter 0 #.var_counter 0 #.var_bindings (list)} expected_lux {#.info {#.target target @@ -350,7 +350,7 @@ (random.ascii/upper 1)) expected_value (random.either (in .def:) (in .macro:)) - #let [expected_lux + .let [expected_lux (: (-> Bit (Maybe Type) [(List [Text .Global]) (List [Text .Global]) @@ -468,10 +468,10 @@ expected_type (\ ! map (function (_ name) (#.Primitive name (list))) (random.ascii/upper 1)) - #let [expected_annotations (' [])] + .let [expected_annotations (' [])] expected_value (random.either (in .def:) (in .macro:)) - #let [expected_lux + .let [expected_lux (: (-> Bit (Maybe Type) [(List [Text .Global]) (List [Text .Global]) @@ -648,12 +648,12 @@ name_1 (random.only (|>> (text\= name_0) not) (random.ascii/upper 1)) - #let [random_tag (\ ! map (|>> [tag_module]) + .let [random_tag (\ ! map (|>> [tag_module]) (random.ascii/upper 1))] all_tags (|> random_tag (random.set name.hash 10) - (\ ! map set.to_list)) - #let [tags_0 (list.take 5 all_tags) + (\ ! map set.list)) + .let [tags_0 (list.take 5 all_tags) tags_1 (list.drop 5 all_tags) type_0 (#.Primitive name_0 (list)) @@ -750,7 +750,7 @@ [current_module (random.ascii/upper 1) [name_0 name_1 name_2 name_3 name_4] (|> (random.ascii/upper 1) (random.set text.hash 5) - (\ ! map set.to_list) + (\ ! map set.list) (random.one (function (_ values) (case values (^ (list name_0 name_1 name_2 name_3 name_4)) @@ -758,7 +758,7 @@ _ #.None)))) - #let [type_0 (#.Primitive name_0 (list)) + .let [type_0 (#.Primitive name_0 (list)) type_1 (#.Primitive name_1 (list)) type_2 (#.Primitive name_2 (list)) type_3 (#.Primitive name_3 (list)) @@ -787,7 +787,7 @@ #.mappings (list [name_0 [type_0 0]])} #.captured {#.counter 0 #.mappings (list)}})] - #let [expected_lux + .let [expected_lux (: Lux {#.info {#.target "" #.version "" @@ -903,7 +903,7 @@ expected random.nat dummy (random.only (|>> (n.= expected) not) random.nat) expected_location ..random_location - #let [expected_lux {#.info {#.target target + .let [expected_lux {#.info {#.target target #.version version #.mode #.Build} #.source [expected_location 0 source_code] diff --git a/stdlib/source/test/lux/meta/annotation.lux b/stdlib/source/test/lux/meta/annotation.lux index 0447e3e6a..55a97ca60 100644 --- a/stdlib/source/test/lux/meta/annotation.lux +++ b/stdlib/source/test/lux/meta/annotation.lux @@ -115,7 +115,7 @@ [/.implementation? #.implementation?] [/.recursive_type? #.type_rec?] - [/.signature? #.sig?] + [/.interface? #.interface?] )) )))) diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index f15340fc4..9d9e17c80 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -121,7 +121,7 @@ [_ bytecode] /.areturn)))) (row.row)) - #let [bytecode (format.run /class.writer class) + .let [bytecode (format.run /class.writer class) loader (/loader.memory (/loader.new_library []))] _ (/loader.define class_name bytecode loader) class (io.run (/loader.load class_name loader)) @@ -498,7 +498,7 @@ (do random.monad [reference ..$Long::random subject ..$Long::random - #let [expected (cond (i.= (:as Int reference) (:as Int subject)) + .let [expected (cond (i.= (:as Int reference) (:as Int subject)) (:as java/lang/Long +0) (i.> (:as Int reference) (:as Int subject)) @@ -590,11 +590,11 @@ comparison (: (-> (Bytecode Any) (-> java/lang/Float java/lang/Float Bit) (Random Bit)) (function (_ instruction standard) (do random.monad - [#let [valid_float (random.only (|>> ffi.float_to_double (:as Frac) f.not_a_number? not) + [.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 + .let [expected (if (for {@.old ("jvm feq" reference subject) @.jvm @@ -688,7 +688,7 @@ (do random.monad [reference ..valid_double subject ..valid_double - #let [expected (if (for {@.old + .let [expected (if (for {@.old ("jvm deq" reference subject) @.jvm @@ -837,7 +837,7 @@ [class_name ..class_name part0 ..$Long::random part1 ..$Long::random - #let [expected (: java/lang/Long + .let [expected (: java/lang/Long (for {@.old ("jvm ladd" part0 part1) @@ -1015,12 +1015,12 @@ (function (_ expected) (|>> (:as Text) (text\= (:as Text expected)))))) (<| (_.context "multi") (do {! random.monad} - [#let [size (\ ! map (|>> (n.% 5) (n.+ 1)) + [.let [size (\ ! map (|>> (n.% 5) (n.+ 1)) random.nat)] dimensions size sizesH size sizesT (random.list (dec dimensions) size) - #let [type (loop [dimensions dimensions + .let [type (loop [dimensions dimensions type (: (Type Object) ..$Object)] (case dimensions @@ -1052,7 +1052,7 @@ (function (_ from to instruction convert test) (do random.monad [input (get@ #random from) - #let [expected (convert input)]] + .let [expected (convert input)]] (..bytecode (test expected) (do /.monad [_ ((get@ #literal from) input) @@ -1154,7 +1154,7 @@ [base ..$Byte::random increment (\ ! map (|>> (n.% 100) /unsigned.u1 try.assumed) random.nat) - #let [expected (: java/lang/Long + .let [expected (: java/lang/Long (for {@.old ("jvm ladd" (ffi.byte_to_long base) @@ -1233,10 +1233,10 @@ Test (do random.monad [expected/1 $String::random - #let [object_test (: (-> Any Bit) + .let [object_test (: (-> Any Bit) (|>> (:as Text) (text\= (:as Text expected/1))))] dummy/1 $String::random - #let [single ($_ _.and + .let [single ($_ _.and (<| (_.lift "DUP & POP") (..bytecode object_test) (do /.monad @@ -1268,10 +1268,10 @@ /.pop)) )] expected/2 $Long::random - #let [long_test (: (-> Any Bit) + .let [long_test (: (-> Any Bit) (|>> (:as Int) (i.= (:as Int expected/2))))] dummy/2 $Long::random - #let [double ($_ _.and + .let [double ($_ _.and (<| (_.lift "DUP2") (..bytecode long_test) (do /.monad @@ -1321,11 +1321,11 @@ (do random.monad [class_name ..class_name primitive_method_name (random.ascii/upper 10) - #let [primitive_method_type (/type.method [(list) (list) (get@ #unboxed primitive) (list)])] + .let [primitive_method_type (/type.method [(list) (list) (get@ #unboxed primitive) (list)])] object_method_name (|> (random.ascii/upper 10) (random.only (|>> (text\= primitive_method_name) not))) expected (get@ #random primitive) - #let [$Self (/type.class class_name (list))]] + .let [$Self (/type.class class_name (list))]] (in (case (do try.monad [class (/class.class /version.v6_0 /class.public (/name.internal class_name) @@ -1354,7 +1354,7 @@ _ (get@ #wrap primitive)] /.areturn)))) (row.row)) - #let [bytecode (format.run /class.writer class) + .let [bytecode (format.run /class.writer class) loader (/loader.memory (/loader.new_library []))] _ (/loader.define class_name bytecode loader) class (io.run (/loader.load class_name loader)) @@ -1388,7 +1388,7 @@ (do random.monad [expected ..$Long::random dummy ..$Long::random - #let [if! (: (-> (-> Label (Bytecode Any)) (Bytecode Any) (Random Bit)) + .let [if! (: (-> (-> Label (Bytecode Any)) (Bytecode Any) (Random Bit)) (function (_ instruction prelude) (<| (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) (do /.monad @@ -1415,7 +1415,7 @@ reference ..$Integer::random subject (|> ..$Integer::random (random.only (|>> ((!::= java/lang/Integer "jvm ieq" "jvm int =") reference) not))) - #let [[lesser greater] (if (for {@.old + .let [[lesser greater] (if (for {@.old ("jvm ilt" reference subject) @.jvm @@ -1450,7 +1450,7 @@ (do random.monad [expected ..$Long::random dummy ..$Long::random - #let [jump (: (-> (-> Label (Bytecode Any)) (Random Bit)) + .let [jump (: (-> (-> Label (Bytecode Any)) (Random Bit)) (function (_ goto) (<| (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) (do /.monad @@ -1501,8 +1501,8 @@ options (|> random.int (\ ! map (|>> (:as java/lang/Long) ffi.long_to_int ffi.int_to_long (:as Int))) (random.set i.hash options) - (\ ! map set.to_list)) - #let [choice (maybe.assume (list.item choice options))] + (\ ! map set.list)) + .let [choice (maybe.assume (list.item choice options))] expected ..$Long::random dummy ..$Long::random]) (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) @@ -1533,7 +1533,7 @@ (<| (_.lift "ATHROW") (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) (do /.monad - [#let [$Exception (/type.class "java.lang.Exception" (list))] + [.let [$Exception (/type.class "java.lang.Exception" (list))] @skipped /.new_label @try /.new_label @handler /.new_label @@ -1596,7 +1596,7 @@ fake_part2 ..$Long::random part3 ..$Long::random part4 ..$Long::random - #let [expected ($_ i.+ + .let [expected ($_ i.+ (:as Int part0) (:as Int part1) (:as Int part2) diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux index 04a4d0734..543eb94cd 100644 --- a/stdlib/source/test/lux/test.lux +++ b/stdlib/source/test/lux/test.lux @@ -65,12 +65,12 @@ /.Test (do {! random.monad} [seed random.nat - #let [[read write] (: [(async.Async Nat) (async.Resolver Nat)] + .let [[read write] (: [(async.Async Nat) (async.Resolver Nat)] (async.async []))] pre (<| (/.seed seed) (do ! [sample random.nat - #let [wrote? (io.run (write sample))]] + .let [wrote? (io.run (write sample))]] (/.test "" wrote?))) post (<| (/.seed seed) (do ! @@ -100,12 +100,12 @@ (n.= 1 (get@ #/.failures tally))))))) (do {! random.monad} [expected (\ ! map (|>> (n.% 10) inc) random.nat) - #let [counter (: (Atom Nat) + .let [counter (: (Atom Nat) (atom.atom 0))] times_assertion (<| (/.times expected) (do ! [_ (in []) - #let [_ (io.run (atom.update inc counter))]] + .let [_ (io.run (atom.update inc counter))]] (/.test "" true)))] (in (do async.monad [[tally error] times_assertion @@ -121,14 +121,14 @@ ($_ /.and (do {! random.monad} [expected (\ ! map (|>> (n.% 10) inc) random.nat) - #let [counter (: (Atom Nat) + .let [counter (: (Atom Nat) (atom.atom 0))] assertion (<| /.in_parallel (list.repeat expected) (: /.Test) (do ! [_ (in []) - #let [_ (io.run (atom.update inc counter))]] + .let [_ (io.run (atom.update inc counter))]] (/.test "" true)))] (in (do async.monad [[tally error] assertion @@ -139,14 +139,14 @@ (n.= 0 (get@ #/.failures tally))))))) (do {! random.monad} [expected (\ ! map (|>> (n.% 10) inc) random.nat) - #let [counter (: (Atom Nat) + .let [counter (: (Atom Nat) (atom.atom 0))] assertion (<| /.in_parallel (list.repeat expected) (: /.Test) (do ! [_ (in []) - #let [_ (undefined) + .let [_ (undefined) _ (io.run (atom.update inc counter))]] (/.test "" true)))] (in (do async.monad diff --git a/stdlib/source/test/lux/time.lux b/stdlib/source/test/lux/time.lux index 593dc0d5c..91711a048 100644 --- a/stdlib/source/test/lux/time.lux +++ b/stdlib/source/test/lux/time.lux @@ -64,7 +64,7 @@ valid_second (\ ! map (|>> (n.% /.seconds) (n.max 10)) random.nat) valid_milli_second (\ ! map (n.% /.milli_seconds) random.nat) - #let [invalid_hour (|> valid_hour (n.+ /.hours)) + .let [invalid_hour (|> valid_hour (n.+ /.hours)) invalid_minute (|> valid_minute (n.+ /.minutes) (n.min 99)) invalid_second (|> valid_second (n.+ /.seconds) (n.min 99))]] (`` ($_ _.and @@ -111,17 +111,17 @@ (<| (_.covering /._) (_.for [/.Time]) (do {! random.monad} - [#let [day (.nat (duration.to_millis duration.day))] + [.let [day (.nat (duration.millis duration.day))] expected random.time - out_of_bounds (\ ! map (|>> /.to_millis (n.+ day)) + out_of_bounds (\ ! map (|>> /.millis (n.+ day)) random.time)] (`` ($_ _.and ..for_implementation - (_.cover [/.to_millis /.of_millis] + (_.cover [/.millis /.of_millis] (|> expected - /.to_millis + /.millis /.of_millis (try\map (\ /.equivalence = expected)) (try.else false))) @@ -134,7 +134,7 @@ (exception.match? /.time_exceeds_a_day error))) (_.cover [/.midnight] (|> /.midnight - /.to_millis + /.millis (n.= 0))) (_.cover [/.parser] (|> expected diff --git a/stdlib/source/test/lux/time/date.lux b/stdlib/source/test/lux/time/date.lux index 0aa6674b6..8e77300da 100644 --- a/stdlib/source/test/lux/time/date.lux +++ b/stdlib/source/test/lux/time/date.lux @@ -60,14 +60,14 @@ false))) (do random.monad [expected random.date] - (_.cover [/.to_days /.of_days] + (_.cover [/.days /.of_days] (|> expected - /.to_days + /.days /.of_days (\ /.equivalence = expected)))) (_.cover [/.epoch] (|> /.epoch - /.to_days + /.days (i.= +0))) (do random.monad [expected random.date] @@ -83,7 +83,7 @@ random.nat) day (\ ! map (|>> (n.% 10) (n.+ 10)) random.nat) - #let [input (format (%.nat year) + .let [input (format (%.nat year) "-" (%.nat month) "-" (%.nat day))]] (_.cover [/.invalid_month] diff --git a/stdlib/source/test/lux/time/day.lux b/stdlib/source/test/lux/time/day.lux index 000b5d6e7..e65759f92 100644 --- a/stdlib/source/test/lux/time/day.lux +++ b/stdlib/source/test/lux/time/day.lux @@ -4,16 +4,24 @@ ["_" test (#+ Test)] [abstract [monad (#+ do)] + ["." predicate] [\\specification ["$." equivalence] + ["$." hash] ["$." order] ["$." enum] ["$." codec]]] [control - ["." try] + ["." try ("#\." functor)] ["." exception]] + [data + [collection + ["." list] + ["." set]]] [math - ["." random (#+ Random) ("#\." monad)]]]] + ["." random (#+ Random) ("#\." monad)] + [number + ["n" nat]]]]] [\\library ["." /]]) @@ -31,23 +39,50 @@ Test (<| (_.covering /._) (_.for [/.Day]) - ($_ _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - (_.for [/.order] - ($order.spec /.order ..random)) - (_.for [/.enum] - ($enum.spec /.enum ..random)) - (_.for [/.codec] - ($codec.spec /.equivalence /.codec ..random)) + (do random.monad + [expected ..random + invalid (random.only (predicate.or (n.< (/.number #/.Sunday)) + (n.> (/.number #/.Saturday))) + random.nat)] + ($_ _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + (_.for [/.hash] + ($hash.spec /.hash ..random)) + (_.for [/.order] + ($order.spec /.order ..random)) + (_.for [/.enum] + ($enum.spec /.enum ..random)) + (_.for [/.codec] + ($codec.spec /.equivalence /.codec ..random)) - (do random.monad - [not_a_day (random.ascii/upper 1)] - (_.cover [/.not_a_day_of_the_week] - (case (\ /.codec decode not_a_day) + (do random.monad + [not_a_day (random.ascii/upper 1)] + (_.cover [/.not_a_day_of_the_week] + (case (\ /.codec decode not_a_day) + (#try.Failure error) + (exception.match? /.not_a_day_of_the_week error) + + (#try.Success _) + false))) + (_.cover [/.number /.by_number] + (|> expected + /.number + /.by_number + (try\map (\ /.equivalence = expected)) + (try.else false))) + (_.cover [/.invalid_day] + (case (/.by_number invalid) (#try.Failure error) - (exception.match? /.not_a_day_of_the_week error) + (exception.match? /.invalid_day error) (#try.Success _) - false))) - ))) + false)) + (_.cover [/.week] + (let [all (list.size /.week) + uniques (set.size (set.of_list /.hash /.week))] + (and (n.= (/.number #/.Saturday) + all) + (n.= all + uniques)))) + )))) diff --git a/stdlib/source/test/lux/time/duration.lux b/stdlib/source/test/lux/time/duration.lux index 5f1f3a74b..1493cfd21 100644 --- a/stdlib/source/test/lux/time/duration.lux +++ b/stdlib/source/test/lux/time/duration.lux @@ -38,10 +38,10 @@ (do random.monad [duration random.duration] - (_.cover [/.of_millis /.to_millis] - (|> duration /.to_millis /.of_millis (\ /.equivalence = duration)))) + (_.cover [/.of_millis /.millis] + (|> duration /.millis /.of_millis (\ /.equivalence = duration)))) (do random.monad - [#let [(^open "\.") /.equivalence] + [.let [(^open "\.") /.equivalence] expected random.duration parameter random.duration] ($_ _.and @@ -59,12 +59,12 @@ (/.neutral? (/.inverse expected))))) )) (do random.monad - [#let [(^open "\.") /.equivalence] + [.let [(^open "\.") /.equivalence] factor random.nat] (_.cover [/.up /.down] (|> /.milli_second (/.up factor) (/.down factor) (\= /.milli_second)))) (do {! random.monad} - [#let [(^open "\.") /.order + [.let [(^open "\.") /.order positive (|> random.duration (random.only (|>> (\= /.empty) not)) (\ ! map (function (_ duration) diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux index c36097fe1..f737f7827 100644 --- a/stdlib/source/test/lux/time/instant.lux +++ b/stdlib/source/test/lux/time/instant.lux @@ -39,11 +39,11 @@ ($codec.spec /.equivalence /.codec random.instant)) (do random.monad - [#let [(^open "\.") /.equivalence] + [.let [(^open "\.") /.equivalence] expected random.instant] ($_ _.and - (_.cover [/.to_millis /.of_millis] - (|> expected /.to_millis /.of_millis (\= expected))) + (_.cover [/.millis /.of_millis] + (|> expected /.millis /.of_millis (\= expected))) (_.cover [/.relative /.absolute] (|> expected /.relative /.absolute (\= expected))) (_.cover [/.date /.time /.of_date_time] @@ -52,22 +52,22 @@ (/.time expected)))) )) (do random.monad - [#let [(^open "\.") /.equivalence + [.let [(^open "\.") /.equivalence (^open "duration\.") duration.equivalence] from random.instant to random.instant] ($_ _.and (_.cover [/.span] (|> from (/.span from) (duration\= duration.empty))) - (_.cover [/.shift] - (|> from (/.shift (/.span from to)) (\= to))) + (_.cover [/.after] + (|> from (/.after (/.span from to)) (\= to))) (_.cover [/.epoch] (duration\= (/.relative to) (/.span /.epoch to))) )) (do random.monad [instant random.instant - #let [d0 (/.day_of_week instant)]] + .let [d0 (/.day_of_week instant)]] (_.cover [/.day_of_week] (let [apply (: (-> (-> Duration Duration) (-> Day Day) Nat Bit) (function (_ polarity move steps) @@ -75,7 +75,7 @@ d0 (list.repeat steps [])) instant_shift (|> instant - (/.shift (polarity (duration.up steps duration.day))) + (/.after (polarity (duration.up steps duration.day))) /.day_of_week)] (day\= day_shift instant_shift))))] 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 425872c1a..752465bd0 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 @@ -1,6 +1,7 @@ (.module: [lux #* - [abstract ["." monad (#+ do)]] + [abstract + ["." monad (#+ do)]] [data ["%" text/format (#+ format)] ["." name]] @@ -93,7 +94,7 @@ [_ (#.Record kvs)] (do {! r.monad} - [#let [ks (list\map product.left kvs) + [.let [ks (list\map product.left kvs) vs (list\map product.right kvs)] member_wise_patterns (monad.map ! (exhaustive_branches allow_literals? variantTC) vs)] (in (|> member_wise_patterns @@ -123,7 +124,7 @@ (r\map product.right _primitive.primitive) (do {! r.monad} [choice (|> r.nat (\ ! map (n.% (list.size variant_tags)))) - #let [choiceT (maybe.assume (list.item choice variant_tags)) + .let [choiceT (maybe.assume (list.item choice variant_tags)) choiceC (maybe.assume (list.item choice primitivesC))]] (in (` ((~ choiceT) (~ choiceC))))) (do {! r.monad} @@ -144,10 +145,10 @@ variant_name (r.unicode 5) 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)) + variant_tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.list)) + record_tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.list)) primitivesTC (r.list size _primitive.primitive) - #let [primitivesT (list\map product.left primitivesTC) + .let [primitivesT (list\map product.left primitivesTC) primitivesC (list\map product.right primitivesTC) code_tag (|>> [module_name] code.tag) variant_tags+ (list\map code_tag variant_tags) @@ -156,7 +157,7 @@ inputC (input variant_tags+ record_tags+ primitivesC) [outputT outputC] (r.only (|>> product.left (is? Any) not) _primitive.primitive) - #let [analyse_pm (function (_ branches) + .let [analyse_pm (function (_ branches) (|> (/.case _primitive.phase branches archive.empty inputC) (//type.with_type outputT) ////analysis.with_scope @@ -169,7 +170,7 @@ (type.tuple primitivesT)))]) (//module.with_module 0 module_name)))] exhaustive_patterns (exhaustive_branches true variantTC inputC) - #let [exhaustive_branchesC (list\map (branch outputC) + .let [exhaustive_branchesC (list\map (branch outputC) exhaustive_patterns)]] ($_ _.and (_.test "Will reject empty pattern-matching (no branches)." @@ -186,7 +187,7 @@ (do ! [redundant_patterns (exhaustive_branches false variantTC inputC) redundancy_idx (|> r.nat (\ ! map (n.% (list.size redundant_patterns)))) - #let [redundant_branchesC (<| (list!map (branch outputC)) + .let [redundant_branchesC (<| (list!map (branch outputC)) list.concat (list (list.take redundancy_idx redundant_patterns) (list (maybe.assume (list.item redundancy_idx redundant_patterns))) @@ -198,7 +199,7 @@ [[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) + .let [heterogeneous_branchesC (list.concat (list (list.take heterogeneous_idx exhaustive_branchesC) (list (let [[_pattern _body] (maybe.assume (list.item heterogeneous_idx exhaustive_branchesC))] [_pattern heterogeneousC])) (list.drop (inc 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 c59de0da6..08bfc6e99 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 @@ -56,7 +56,7 @@ 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)]] + .let [g!arg (code.local_identifier arg_name)]] (<| (_.context (%.name (name_of /.function))) ($_ _.and (_.test "Can analyse function." @@ -85,10 +85,10 @@ 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) + .let [inputsT (list\map product.left inputsTC) inputsC (list\map product.right inputsTC)] [outputT outputC] _primitive.primitive - #let [funcT (type.function inputsT outputT) + .let [funcT (type.function inputsT outputT) partialT (type.function (list.drop partial_args inputsT) outputT) varT (#.Parameter 1) polyT (<| (type.univ_q 1) 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 c4a1a50b9..11ca2b276 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 @@ -123,7 +123,7 @@ primitives (r.list size _primitive.primitive) +choice (|> r.nat (\ ! map (n.% (inc size)))) [_ +valueC] _primitive.primitive - #let [variantT (type.variant (list\map product.left primitives)) + .let [variantT (type.variant (list\map product.left primitives)) [valueT valueC] (maybe.assume (list.item choice primitives)) +size (inc size) +primitives (list.concat (list (list.take choice primitives) @@ -174,7 +174,7 @@ primitives (r.list size _primitive.primitive) choice (|> r.nat (\ ! map (n.% size))) [_ +valueC] _primitive.primitive - #let [tupleT (type.tuple (list\map product.left primitives)) + .let [tupleT (type.tuple (list\map product.left primitives)) [singletonT singletonC] (|> primitives (list.item choice) maybe.assume) +primitives (list.concat (list (list.take choice primitives) (list [(#.Parameter 1) +valueC]) @@ -231,13 +231,13 @@ (def: variant (do {! r.monad} [size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) - tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) + tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.list)) choice (|> r.nat (\ ! map (n.% size))) 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])) + .let [with_name (|>> (#.Named [module_name type_name])) varT (#.Parameter 1) primitivesT (list\map product.left primitives) [choiceT choiceC] (maybe.assume (list.item choice primitives)) @@ -277,12 +277,12 @@ (def: record (do {! r.monad} [size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) - tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) + tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.list)) primitives (r.list size _primitive.primitive) module_name (r.unicode 5) type_name (r.unicode 5) choice (|> r.nat (\ ! map (n.% size))) - #let [varT (#.Parameter 1) + .let [varT (#.Parameter 1) tagsC (list\map (|>> [module_name] code.tag) tags) primitivesT (list\map product.left primitives) primitivesC (list\map product.right primitives) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux index d9dab4854..59cad9258 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -44,7 +44,7 @@ (do {! random.monad} [maskedA //primitive.primitive temp (|> random.nat (\ ! map (n.% 100))) - #let [maskA (analysis.control/case + .let [maskA (analysis.control/case [maskedA [[(#analysis.Bind temp) (#analysis.Reference (////reference.local temp))] @@ -62,7 +62,7 @@ [registerA random.nat inputA //primitive.primitive outputA //primitive.primitive - #let [letA (analysis.control/case + .let [letA (analysis.control/case [inputA [[(#analysis.Bind registerA) outputA] @@ -86,7 +86,7 @@ inputA //primitive.primitive thenA //primitive.primitive elseA //primitive.primitive - #let [thenB (: Branch + .let [thenB (: Branch [(#analysis.Simple (#analysis.Bit true)) thenA]) elseB (: Branch @@ -151,7 +151,7 @@ (\ ! map (|>> analysis.tuple))) pathA ..random_path [pattern @member] (get_pattern pathA) - #let [getA (analysis.control/case [recordA [[pattern + .let [getA (analysis.control/case [recordA [[pattern (#analysis.Reference (////reference.local @member))] (list)]])]] (_.cover [/.synthesize_get] @@ -184,7 +184,7 @@ (All [a] (-> (Hash a) (Random a) (Random [a a a a a]))) (|> random_element (random.set hash 5) - (\ random.monad map (|>> set.to_list + (\ random.monad map (|>> set.list (case> (^ (list s0 s1 s2 s3 s4)) [s0 s1 s2 s3 s4] @@ -233,7 +233,7 @@ [value/0 value/1 value/2 value/3 value/4] (random_five text.hash (random.unicode 1)) last_is_right? random.bit [body/0 body/1 body/2 body/3 body/4] (random_five frac.hash random.frac) - #let [path (: (-> Nat Bit Text Frac Path) + .let [path (: (-> Nat Bit Text Frac Path) (function (_ lefts right? value body) ($_ #synthesis.Seq (synthesis.path/side (if right? @@ -271,7 +271,7 @@ body/first random.frac body/mid (random.list mid_size random.frac) body/last random.frac - #let [path (: (-> Nat Bit Text Frac Path) + .let [path (: (-> Nat Bit Text Frac Path) (function (_ lefts right? value body) (if right? ($_ #synthesis.Seq diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux index dce97193e..60a009be1 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -179,7 +179,7 @@ [loop?_output expected_output actual_output] (random_value output?) lefts (|> random.nat (\ ! map (n.% 10))) right? random.bit - #let [side|member (if right? + .let [side|member (if right? (#.Right lefts) (#.Left lefts))]] (in [(and loop?_input @@ -344,7 +344,7 @@ (do {! random.monad} [[loop?_output expected_output actual_output] (..random_nat output?) arity (|> random.nat (\ ! map (|>> (n.% 5) inc))) - #let [environment ($_ list\compose + .let [environment ($_ list\compose (list\map (|>> #variable.Foreign) (list.indices arity)) (list (#variable.Local 1)))]] diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux index 36d59cfd9..a45c8af9e 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux @@ -37,7 +37,7 @@ (do {! r.monad} [size (|> r.nat (\ ! map (|>> (n.% 10) (n.+ 2)))) tagA (|> r.nat (\ ! map (n.% size))) - #let [right? (n.= (dec size) tagA) + .let [right? (n.= (dec size) tagA) lefts (if right? (dec tagA) tagA)] diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index 9c34b539f..04fb82336 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -70,7 +70,7 @@ (do ! [let? random.bit [expected_input actual_input] (..primitive_scenario context) - #let [fake_register (n.+ (get@ #redundants context) + .let [fake_register (n.+ (get@ #redundants context) (dictionary.size (get@ #necessary context)))] [expected_output actual_output] (scenario (update@ #redundants inc context))] (in [(synthesis.branch/case [expected_input @@ -110,7 +110,7 @@ (do random.monad [_ (in []) [expected_input actual_input] (scenario context) - #let [real_register (dictionary.size (get@ #necessary context)) + .let [real_register (dictionary.size (get@ #necessary context)) fake_register (n.+ (get@ #redundants context) (dictionary.size (get@ #necessary context)))] [expected_output actual_output] (scenario (update@ #necessary (dictionary.put real_register fake_register) context))] @@ -166,7 +166,7 @@ (#synthesis.Then actual_then))])) (do {! random.monad} [_ (in []) - #let [real_register (dictionary.size (get@ #necessary context)) + .let [real_register (dictionary.size (get@ #necessary context)) fake_register (n.+ (get@ #redundants context) (dictionary.size (get@ #necessary context)))] [expected_then actual_then] (scenario (update@ #necessary (dictionary.put real_register fake_register) context))] @@ -238,7 +238,7 @@ (-> (Scenario Synthesis) (Scenario Synthesis)) (do {! random.monad} [_ (in []) - #let [real_start (dictionary.size (get@ #necessary context)) + .let [real_start (dictionary.size (get@ #necessary context)) fake_start (n.+ (get@ #redundants context) real_start)] inits (random.list ..scope_arity (scenario context)) @@ -273,7 +273,7 @@ (-> (Scenario Synthesis) (Scenario Synthesis)) (do {! random.monad} [_ (in []) - #let [registers (dictionary.entries (get@ #necessary context)) + .let [registers (dictionary.entries (get@ #necessary context)) expected_environment (list\map (|>> product.left #variable.Local) registers) actual_environment (list\map (|>> product.right #variable.Local) registers)] [expected_body actual_body] (..primitive_scenario context)] diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 45d263509..f248a2adb 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -75,7 +75,7 @@ ..random) name/0 ..name name/1 ..name - #let [namedT (#.Named name/0 anonymousT) + .let [namedT (#.Named name/0 anonymousT) aliasedT (#.Named name/1 namedT)]] ($_ _.and (_.cover [/.de_aliased] @@ -94,7 +94,7 @@ #1))) (list.repeat size) (monad.seq !)) - #let [(^open "/\.") /.equivalence + .let [(^open "/\.") /.equivalence (^open "list\.") (list.equivalence /.equivalence)]] (`` ($_ _.and (~~ (template [<ctor> <dtor> <unit>] @@ -127,7 +127,7 @@ _ #1)))) - #let [(^open "/\.") /.equivalence + .let [(^open "/\.") /.equivalence (^open "list\.") (list.equivalence /.equivalence)]] ($_ _.and (_.cover [/.function /.flat_function] @@ -148,7 +148,7 @@ _ #1)))) - #let [(^open "/\.") /.equivalence]] + .let [(^open "/\.") /.equivalence]] (`` ($_ _.and (~~ (template [<ctor> <dtor>] [(_.cover [<ctor> <dtor>] @@ -174,7 +174,7 @@ _ #1)))) - #let [(^open "/\.") /.equivalence]] + .let [(^open "/\.") /.equivalence]] ($_ _.and (_.cover [/.array /.flat_array] (let [[flat_depth flat_element] (|> element_type (/.array depth) /.flat_array)] @@ -202,7 +202,7 @@ (do random.monad [left random.nat right (random.ascii/lower 1) - #let [left,right [left right]]] + .let [left,right [left right]]] (_.cover [/.:cast] (|> left,right (/.:cast [l r] (And l r) (Or l r)) diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index 6172608b3..84426d1f7 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -220,7 +220,7 @@ (exception.match? /.unknown_type_var error)))) (do random.monad [nominal (random.ascii/upper 10) - #let [expected (#.Primitive nominal (list))]] + .let [expected (#.Primitive nominal (list))]] (_.cover [/.read] (and (|> (do /.monad [[var_id var_type] /.var] @@ -248,7 +248,7 @@ false))))) (do random.monad [nominal (random.ascii/upper 10) - #let [expected (#.Primitive nominal (list))]] + .let [expected (#.Primitive nominal (list))]] (_.cover [/.read!] (case (/.run /.fresh_context (do /.monad @@ -262,7 +262,7 @@ false))) (do random.monad [nominal (random.ascii/upper 10) - #let [expected (#.Primitive nominal (list))]] + .let [expected (#.Primitive nominal (list))]] (_.cover [/.unbound_type_var] (case (/.run /.fresh_context (do /.monad @@ -451,7 +451,7 @@ [var/head/1 var/tail+/1 var/last/1] (..build_ring tail_size) _ (/.check var/head/0 var/head/1) _ (/.check var/head/0 nominal/0) - #let [all_variables (list\compose (list& var/head/0 var/tail+/0) + .let [all_variables (list\compose (list& var/head/0 var/tail+/0) (list& var/head/1 var/tail+/1))] failures (monad.map ! (|>> (/.check nominal/1) ..verdict) all_variables) successes (monad.map ! (|>> (/.check nominal/0) ..verdict) all_variables)] diff --git a/stdlib/source/test/lux/type/implicit.lux b/stdlib/source/test/lux/type/implicit.lux index bf6db29e6..6795b8aec 100644 --- a/stdlib/source/test/lux/type/implicit.lux +++ b/stdlib/source/test/lux/type/implicit.lux @@ -25,10 +25,10 @@ Test (<| (_.covering /._) (do {! random.monad} - [#let [digit (\ ! map (n.% 10) random.nat)] + [.let [digit (\ ! map (n.% 10) random.nat)] left digit right digit - #let [start (n.min left right) + .let [start (n.min left right) end (n.max left right)] left random.nat diff --git a/stdlib/source/test/lux/type/quotient.lux b/stdlib/source/test/lux/type/quotient.lux index 9a800b92d..b59879ef2 100644 --- a/stdlib/source/test/lux/type/quotient.lux +++ b/stdlib/source/test/lux/type/quotient.lux @@ -31,7 +31,7 @@ (<| (_.covering /._) (do random.monad [modulus (random.only (n.> 0) random.nat) - #let [class (: (-> Nat Text) + .let [class (: (-> Nat Text) (|>> (n.% modulus) %.nat))] value random.nat] ($_ _.and diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux index 80294a765..1dd71a4c6 100644 --- a/stdlib/source/test/lux/type/refinement.lux +++ b/stdlib/source/test/lux/type/refinement.lux @@ -29,7 +29,7 @@ (do {! random.monad} [raw random.nat modulus (\ ! map (|>> (n.% 10) (n.+ 2)) random.nat) - #let [predicate (: (Predicate Nat) + .let [predicate (: (Predicate Nat) (|>> (n.% modulus) (n.= 0)))] total_raws (\ ! map (|>> (n.% 20) inc) random.nat) raws (random.list total_raws random.nat)] diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux index 4bfb49503..791c31e1f 100644 --- a/stdlib/source/test/lux/type/resource.lux +++ b/stdlib/source/test/lux/type/resource.lux @@ -31,7 +31,7 @@ (monad.do {! random.monad} [pre (\ ! map %.nat random.nat) post (\ ! map %.nat random.nat) - #let [! identity.monad]] + .let [! identity.monad]] (_.for [/.Linear /.run /.monad] (`` ($_ _.and (~~ (template [<coverage> <bindings>] @@ -73,7 +73,7 @@ (monad.do {! random.monad} [pre (\ ! map %.nat random.nat) post (\ ! map %.nat random.nat) - #let [! io.monad]] + .let [! io.monad]] (_.for [/.Linear /.run /.monad] (`` ($_ _.and (~~ (template [<coverage> <bindings>] @@ -116,7 +116,7 @@ (monad.do {! random.monad} [pre (\ ! map %.nat random.nat) post (\ ! map %.nat random.nat) - #let [! async.monad]] + .let [! async.monad]] (_.for [/.Linear /.run /.monad] (`` ($_ _.and (~~ (template [<coverage> <bindings>] diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux index 9557d522d..32e2922a6 100644 --- a/stdlib/source/test/lux/type/unit.lux +++ b/stdlib/source/test/lux/type/unit.lux @@ -101,7 +101,7 @@ (\ ! map (i.% +1,000)) (\ ! map (i.* +1,000,000,000)) (\ ! map (\ /.meter in))) - #let [(^open "meter\.") (: (Equivalence (/.Qty /.Meter)) + .let [(^open "meter\.") (: (Equivalence (/.Qty /.Meter)) /.equivalence)] unscaled (|> random.int (\ ! map (i.% +1,000)) @@ -135,11 +135,11 @@ [/.Micro /.micro] [/.Nano /.nano] )) - (_.cover [/.re_scale] + (_.cover [/.re_scaled] (|> large (: (/.Qty /.Meter)) (\ /.kilo scale) (: (/.Qty (/.Kilo /.Meter))) - (/.re_scale /.kilo /.milli) (: (/.Qty (/.Milli /.Meter))) - (/.re_scale /.milli /.kilo) (: (/.Qty (/.Kilo /.Meter))) + (/.re_scaled /.kilo /.milli) (: (/.Qty (/.Milli /.Meter))) + (/.re_scaled /.milli /.kilo) (: (/.Qty (/.Kilo /.Meter))) (\ /.kilo de_scale) (: (/.Qty /.Meter)) (meter\= large))) (_.cover [/.scale:] @@ -155,7 +155,7 @@ (def: arithmetic Test (do random.monad - [#let [zero (\ /.meter in +0) + [.let [zero (\ /.meter in +0) (^open "meter\.") (: (Equivalence (/.Qty /.Meter)) /.equivalence)] left (random.only (|>> (meter\= zero) not) (..meter 1,000)) diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux index 003c20c34..c51cce645 100644 --- a/stdlib/source/test/lux/world/console.lux +++ b/stdlib/source/test/lux/world/console.lux @@ -56,7 +56,7 @@ ($/.spec (io.io (/.async (/.mock ..mock [false ""]))))) (do random.monad [expected (random.ascii/alpha 10) - #let [console (/.mock ..mock [false ""])]] + .let [console (/.mock ..mock [false ""])]] (_.cover [/.write_line] (io.run (do io.monad diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index 88af80fdf..c5b89533b 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -53,7 +53,7 @@ [left ..concern right (random.only (|>> (is? left) not) ..concern) - #let [[left left?] left + .let [[left left?] left [right right?] right]] (_.cover [/.also] (let [composition (/.also left right)] @@ -69,7 +69,7 @@ Test (do {! random.monad} [directory (random.ascii/alpha 5) - #let [[fs watcher] (/.mock "/")]] + .let [[fs watcher] (/.mock "/")]] ($_ _.and (in (do async.monad [?concern (\ watcher concern directory) @@ -159,7 +159,7 @@ (do {! random.monad} [directory (random.ascii/alpha 5) - #let [/ "/" + .let [/ "/" [fs watcher] (/.mock /)] expected_path (\ ! map (|>> (format directory /)) (random.ascii/alpha 5)) @@ -185,7 +185,7 @@ (try.else false verdict))))) (do random.monad [directory (random.ascii/alpha 5) - #let [/ "/" + .let [/ "/" [fs watcher] (/.mock /)]] (in (do async.monad [started? ( \ watcher start /.all directory)] diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index e0064f29b..bfcc0db6c 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -157,7 +157,7 @@ (~~ (template [<pressed?> <function>] [(do random.monad [key ..random - #let [sample (<function> key)]] + .let [sample (<function> key)]] (_.cover [<function>] (and (bit\= <pressed?> (get@ #/.pressed? sample)) (n.= key (get@ #/.input sample)))))] diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index 8a74d3e21..bdfad7989 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -43,7 +43,7 @@ on_trace random.nat num_headers (\ ! map (nat.% 10) random.nat) headers (random.dictionary text.hash num_headers (random.ascii/lower 3) (random.ascii/lower 3)) - #let [mock (: (/.Client IO) + .let [mock (: (/.Client IO) (implementation (def: (request method url headers data) (io.io (let [value (case method diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index ecea6d8b9..0d67c79a0 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -38,8 +38,8 @@ (if dead? (exception.except ..dead []) (do try.monad - [to_echo (try.of_maybe (list.head arguments))] - (in [dead? to_echo])))) + [echo (try.of_maybe (list.head arguments))] + (in [dead? echo])))) (def: (on_error dead?) (if dead? @@ -95,7 +95,7 @@ input (random.ascii/alpha 5) destruction (random.ascii/alpha 5) exit random.int - #let [shell (/.async (..io_shell command oops input destruction exit))]] + .let [shell (/.async (..io_shell command oops input destruction exit))]] (in (do {! async.monad} [verdict (do (try.with !) [process (\ shell execute [environment.empty "~" command (list)]) |