From 62b3abfcc014ca1c19d62aacdd497f6a250b372c Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 25 Jul 2021 03:12:17 -0400 Subject: Better syntax for "library/lux.^multi". --- .../specification/compositor/generation/case.lux | 6 +++--- .../specification/compositor/generation/common.lux | 18 +++++++++--------- stdlib/source/specification/lux/abstract/order.lux | 12 ++++++------ stdlib/source/specification/lux/world/file.lux | 16 ++++++++-------- 4 files changed, 26 insertions(+), 26 deletions(-) (limited to 'stdlib/source/specification') diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index 2424aa330..81e6f5988 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -111,7 +111,7 @@ (-> Runner Test) (do r.monad [on-true r.safe-frac - on-false (|> r.safe-frac (r.filter (|>> (f.= on-true) not))) + on-false (|> r.safe-frac (r.only (|>> (f.= on-true) not))) verdict r.bit] (_.test (%.name (name-of synthesis.branch/if)) (|> (synthesis.branch/if [(synthesis.bit verdict) @@ -125,7 +125,7 @@ (do r.monad [[inputS pathS] ..case on-success r.safe-frac - on-failure (|> r.safe-frac (r.filter (|>> (f.= on-success) not)))] + on-failure (|> r.safe-frac (r.only (|>> (f.= on-success) not)))] (_.test (%.name (name-of synthesis.branch/case)) (|> (synthesis.branch/case [inputS @@ -231,7 +231,7 @@ (def: special-pattern-path Path ($_ synthesis.path/alt - (<| try.assume + (<| try.assumed (phase.run [extension/synthesis.bundle synthesis.init]) (case.path phase/synthesis.phase diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index 3d377b7ca..e14aa8e52 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -75,7 +75,7 @@ (def: (i64 run) (-> Runner Test) (do r.monad - [param (|> r.i64 (r.filter (|>> ("lux i64 =" 0) not))) + [param (|> r.i64 (r.only (|>> ("lux i64 =" 0) not))) subject r.i64] (`` ($_ _.and (~~ (template [ ] @@ -123,7 +123,7 @@ (def: (f64 run) (-> Runner Test) (do r.monad - [param (|> ..simple-frac (r.filter (|>> (f.= +0.0) not))) + [param (|> ..simple-frac (r.only (|>> (f.= +0.0) not))) subject ..simple-frac] (`` ($_ _.and (~~ (template [ ] @@ -179,7 +179,7 @@ sample-lower (r.ascii/lower-alpha sample-size) sample-upper (r.ascii/upper-alpha sample-size) sample-alpha (|> (r.ascii/alpha sample-size) - (r.filter (|>> (text\= sample-upper) not))) + (r.only (|>> (text\= sample-upper) not))) char-idx (|> r.nat (\ ! map (n.% sample-size))) #let [sample-lowerS (synthesis.text sample-lower) sample-upperS (synthesis.text sample-upper) @@ -235,7 +235,7 @@ (synthesis.i64 +0))) (run (..sanitize "lux text index")) (case> (^multi (#try.Success valueV) - [(:as (Maybe Nat) valueV) (#.Some valueV)]) + {(:as (Maybe Nat) valueV) (#.Some valueV)}) (n.= 0 valueV) _ @@ -245,7 +245,7 @@ (synthesis.i64 +0))) (run (..sanitize "lux text index")) (case> (^multi (#try.Success valueV) - [(:as (Maybe Nat) valueV) (#.Some valueV)]) + {(:as (Maybe Nat) valueV) (#.Some valueV)}) (n.= sample-size valueV) _ @@ -258,7 +258,7 @@ (synthesis.i64 length))) (run (..sanitize "lux text clip")) (case> (^multi (#try.Success valueV) - [(:as (Maybe Text) valueV) (#.Some valueV)]) + {(:as (Maybe Text) valueV) (#.Some valueV)}) (text\= expected valueV) _ @@ -272,7 +272,7 @@ (synthesis.i64 char-idx))) (run (..sanitize "lux text char")) (case> (^multi (#try.Success valueV) - [(:as (Maybe Int) valueV) (#.Some valueV)]) + {(:as (Maybe Int) valueV) (#.Some valueV)}) (text.contains? ("lux i64 char" valueV) sample-lower) @@ -303,7 +303,7 @@ (list (synthesis.text message)))}))) (run (..sanitize "lux try")) (case> (^multi (#try.Success valueV) - [(:as (Try Text) valueV) (#try.Failure error)]) + {(:as (Try Text) valueV) (#try.Failure error)}) (text.contains? message error) _ @@ -315,7 +315,7 @@ #synthesis.body (synthesis.text message)}))) (run (..sanitize "lux try")) (case> (^multi (#try.Success valueV) - [(:as (Try Text) valueV) (#try.Success valueV)]) + {(:as (Try Text) valueV) (#try.Success valueV)}) (text\= message valueV) _ diff --git a/stdlib/source/specification/lux/abstract/order.lux b/stdlib/source/specification/lux/abstract/order.lux index 61fc22611..e620fd520 100644 --- a/stdlib/source/specification/lux/abstract/order.lux +++ b/stdlib/source/specification/lux/abstract/order.lux @@ -28,12 +28,12 @@ (@//= parameter subject)))) (do random.monad [parameter generator - subject (random.filter (|>> (@//= parameter) not) - generator) - extra (random.filter (function (_ value) - (not (or (@//= parameter value) - (@//= subject value)))) - generator)] + subject (random.only (|>> (@//= parameter) not) + generator) + extra (random.only (function (_ value) + (not (or (@//= parameter value) + (@//= subject value)))) + generator)] (_.test "Transitive property." (if (@//< parameter subject) (let [greater? (and (@//< subject extra) diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux index 7bdefb173..c70e23441 100644 --- a/stdlib/source/specification/lux/world/file.lux +++ b/stdlib/source/specification/lux/world/file.lux @@ -178,12 +178,12 @@ (<| (do {! random.monad} [parent (random.ascii/numeric 2) child (random.ascii/numeric 2) - sub_dir (random.filter (|>> (text\= child) not) - (random.ascii/numeric 2)) - alternate_child (random.filter (predicate.intersect - (|>> (text\= child) not) - (|>> (text\= sub_dir) not)) - (random.ascii/numeric 2)) + sub_dir (random.only (|>> (text\= child) not) + (random.ascii/numeric 2)) + alternate_child (random.only (predicate.intersect + (|>> (text\= child) not) + (|>> (text\= sub_dir) not)) + (random.ascii/numeric 2)) expected_file_size (\ ! map (|>> (n.% 10) inc) random.nat) content ($binary.random expected_file_size) appendix ($binary.random expected_file_size) @@ -305,8 +305,8 @@ (-> (IO (/.System Promise)) Test) (<| (do {! random.monad} [file (random.ascii/numeric 2) - dir (random.filter (|>> (text\= file) not) - (random.ascii/numeric 2))]) + dir (random.only (|>> (text\= file) not) + (random.ascii/numeric 2))]) wrap (do {! promise.monad} [fs (promise.future fs) -- cgit v1.2.3