diff options
author | Eduardo Julian | 2018-07-28 15:39:06 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-07-28 15:39:06 -0400 |
commit | e6db62dbd6529938dace0e1cf5743f4e985efb81 (patch) | |
tree | 1117a8e1d45a109e0d982a3927ebff38e0aca17b /stdlib/test | |
parent | 15e71e57b688f5079fe606b2fee5e3efd2a5d5a7 (diff) |
Removed temporary "|" prefix on Nat.
Diffstat (limited to '')
74 files changed, 578 insertions, 578 deletions
diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index f52b7764e..61a0299ea 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -15,9 +15,9 @@ test]) (context: "Value identity." - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) + [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) x (r.unicode size) y (r.unicode size)] ($_ seq @@ -31,14 +31,14 @@ (do-template [category rand-gen even? odd? = < >] [(context: (format "[" category "] " "Simple operations.") - (<| (times |100) + (<| (times 100) (do @ [value rand-gen] ($_ seq (test (format "[" category "] " "Moving up-down or down-up should result in same value.") (and (|> value inc dec (= value)) (|> value dec inc (= value)))) - (test (format "[" category "] " "(x|1) > x && (x-1) < x") + (test (format "[" category "] " "(x1) > x && (x-1) < x") (and (|> value inc (> value)) (|> value dec (< value)))) (test (format "[" category "] " "Every odd/even number is surrounded by two of the other kind.") @@ -54,7 +54,7 @@ (do-template [category rand-gen = < > <= >= min max] [(context: (format "[" category "] " "(More) simple operations.") - (<| (times |100) + (<| (times 100) (do @ [x rand-gen y rand-gen] @@ -77,7 +77,7 @@ (do-template [category rand-gen = + - * / <%> > <0> <1> <factor> <cap> <prep>] [(context: (format "[" category "] " "Additive identity") - (<| (times |100) + (<| (times 100) (do @ [x rand-gen] (test "" @@ -85,7 +85,7 @@ (|> x (- <0>) (= x))))))) (context: (format "[" category "] " "Addition & Substraction") - (<| (times |100) + (<| (times 100) (do @ [x (:: @ map <prep> rand-gen) y (:: @ map <prep> rand-gen) @@ -96,7 +96,7 @@ (|> x (+ y) (- y) (= x))))))) (context: (format "[" category "] " "Multiplicative identity") - (<| (times |100) + (<| (times 100) (do @ [x rand-gen] (test "" @@ -108,7 +108,7 @@ (|> x (/ <1>) (= x)))))))) (context: (format "[" category "] " "Multiplication & Division") - (<| (times |100) + (<| (times 100) (do @ [x (:: @ map <cap> rand-gen) y (|> rand-gen @@ -125,7 +125,7 @@ (|> x' (/ y) (* y) (= x')))) ))))] - ["Nat" r.nat n/= n/+ n/- n/* n// n/% n/> |0 |1 |1_000_000 (n/% |1_000) id] + ["Nat" r.nat n/= n/+ n/- n/* n// n/% n/> 0 1 1_000_000 (n/% 1_000) id] ["Int" r.int i/= i/+ i/- i/* i// i/% i/> +0 +1 +1_000_000 (i/% +1_000) id] ["Frac" r.frac f/= f/+ f/- f/* f// f/% f/> +0.0 +1.0 +1_000_000.0 id math.floor] ["Rev" r.rev r/= r/+ r/- r/* r// r/% r/> .0 (.rev -1) (.rev -1) id id] @@ -134,11 +134,11 @@ (def: frac-rev (r.Random Rev) (|> r.rev - (:: r.Functor<Random> map (|>> (i64.left-shift |11) (i64.logical-right-shift |11))))) + (:: r.Functor<Random> map (|>> (i64.left-shift 11) (i64.logical-right-shift 11))))) (do-template [category rand-gen -> <- = <cap>] [(context: (format "[" category "] " "Numeric conversions") - (<| (times |100) + (<| (times 100) (do @ [value rand-gen #let [value (<cap> value)]] @@ -146,7 +146,7 @@ (|> value -> <- (= value))))))] ["Int->Nat" r.int .nat .int i/= (i/% +1_000_000)] - ["Nat->Int" r.nat .int .nat n/= (n/% |1_000_000)] + ["Nat->Int" r.nat .int .nat n/= (n/% 1_000_000)] ["Int->Frac" r.int int-to-frac frac-to-int i/= (i/% +1_000_000)] ["Frac->Int" r.frac frac-to-int int-to-frac f/= math.floor] ["Rev->Frac" frac-rev rev-to-frac frac-to-rev r/= id] @@ -189,7 +189,7 @@ (i/+ (i/* x x) (i/* y y))) (context: "Templates." - (<| (times |100) + (<| (times 100) (do @ [x r.int y r.int] diff --git a/stdlib/test/test/lux/cli.lux b/stdlib/test/test/lux/cli.lux index c5b3a485c..501c62df4 100644 --- a/stdlib/test/test/lux/cli.lux +++ b/stdlib/test/test/lux/cli.lux @@ -17,16 +17,16 @@ lux/test) (context: "CLI" - (<| (times |100) + (<| (times 100) (do @ - [num-args (|> r.nat (:: @ map (n/% |10))) + [num-args (|> r.nat (:: @ map (n/% 10))) #let [(^open "Nat/.") number.Codec<Text,Nat> gen-arg (:: @ map Nat/encode r.nat)] yes gen-arg - #let [gen-ignore (|> (r.unicode |5) (r.filter (|>> (text/= yes) not)))] + #let [gen-ignore (|> (r.unicode 5) (r.filter (|>> (text/= yes) not)))] no gen-ignore - pre-ignore (r.list |5 gen-ignore) - post-ignore (r.list |5 gen-ignore)] + pre-ignore (r.list 5 gen-ignore) + post-ignore (r.list 5 gen-ignore)] ($_ seq (test "Can read any argument." (|> (/.run (list yes) /.any) diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/case.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/case.lux index 4a1b1e28e..abe199241 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/case.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/case.lux @@ -67,7 +67,7 @@ [#.Int r.int code.int] [#.Rev r.rev code.rev] [#.Frac r.frac code.frac] - [#.Text (r.unicode |5) code.text]) + [#.Text (r.unicode 5) code.text]) (^ [_ (#.Tuple (list))]) (random/wrap (list (' []))) @@ -118,7 +118,7 @@ choiceC (maybe.assume (list.nth choice primitivesC))]] (wrap (` ((~ choiceT) (~ choiceC))))) (do r.Monad<Random> - [size (|> r.nat (:: @ map (n/% |3))) + [size (|> r.nat (:: @ map (n/% 3))) elems (r.list size input)] (wrap (code.tuple elems))) (random/wrap (code.record (list.zip2 record-tags primitivesC))) @@ -129,17 +129,17 @@ [pattern body]) (context: "Pattern-matching." - ## #seed |9253409297339902486 - ## #seed |3793366152923578600 - (<| (seed |5004137551292836565) - ## (times |100) + ## #seed 9253409297339902486 + ## #seed 3793366152923578600 + (<| (seed 5004137551292836565) + ## (times 100) (do @ - [module-name (r.unicode |5) - variant-name (r.unicode |5) - record-name (|> (r.unicode |5) (r.filter (|>> (text/= variant-name) not))) - size (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) - variant-tags (|> (r.set text.Hash<Text> size (r.unicode |5)) (:: @ map set.to-list)) - record-tags (|> (r.set text.Hash<Text> size (r.unicode |5)) (:: @ map set.to-list)) + [module-name (r.unicode 5) + variant-name (r.unicode 5) + record-name (|> (r.unicode 5) (r.filter (|>> (text/= variant-name) not))) + size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) + variant-tags (|> (r.set text.Hash<Text> size (r.unicode 5)) (:: @ map set.to-list)) + record-tags (|> (r.set text.Hash<Text> size (r.unicode 5)) (:: @ map set.to-list)) primitivesTC (r.list size _primitive.primitive) #let [primitivesT (list/map product.left primitivesTC) primitivesC (list/map product.right primitivesTC) @@ -178,7 +178,7 @@ _ (module.declare-tags record-tags #0 (#.Named [module-name record-name] (type.tuple primitivesT)))]) - (module.with-module |0 module-name))]] + (module.with-module 0 module-name))]] ($_ seq (test "Will reject empty pattern-matching (no branches)." (|> (analyse-pm (list)) diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/function.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/function.lux index 11220052f..ba84d926f 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/function.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/function.lux @@ -47,10 +47,10 @@ #0))) (context: "Function definition." - (<| (times |100) + (<| (times 100) (do @ - [func-name (r.unicode |5) - arg-name (|> (r.unicode |5) (r.filter (|>> (text/= func-name) not))) + [func-name (r.unicode 5) + arg-name (|> (r.unicode 5) (r.filter (|>> (text/= func-name) not))) [outputT outputC] _primitive.primitive [inputT _] _primitive.primitive #let [g!arg (code.local-identifier arg-name)]] @@ -76,19 +76,19 @@ )))) (context: "Function application." - (<| (times |100) + (<| (times 100) (do @ - [full-args (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) + [full-args (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) partial-args (|> r.nat (:: @ map (n/% full-args))) - var-idx (|> r.nat (:: @ map (|>> (n/% full-args) (n/max |1)))) + var-idx (|> r.nat (:: @ map (|>> (n/% full-args) (n/max 1)))) inputsTC (r.list full-args _primitive.primitive) #let [inputsT (list/map product.left inputsTC) inputsC (list/map product.right inputsTC)] [outputT outputC] _primitive.primitive #let [funcT (type.function inputsT outputT) partialT (type.function (list.drop partial-args inputsT) outputT) - varT (#.Parameter |1) - polyT (<| (type.univ-q |1) + varT (#.Parameter 1) + polyT (<| (type.univ-q 1) (type.function (list.concat (list (list.take var-idx inputsT) (list varT) (list.drop (inc var-idx) inputsT)))) @@ -97,10 +97,10 @@ partial-poly-inputsT (list.drop (inc var-idx) inputsT) partial-polyT1 (<| (type.function partial-poly-inputsT) poly-inputT) - partial-polyT2 (<| (type.univ-q |1) + partial-polyT2 (<| (type.univ-q 1) (type.function (#.Cons varT partial-poly-inputsT)) varT) - dummy-function (#analysis.Function (list) (#analysis.Reference (reference.local |1)))]] + dummy-function (#analysis.Function (list) (#analysis.Reference (reference.local 1)))]] ($_ seq (test "Can analyse monomorphic type application." (|> (/.apply ..analyse funcT dummy-function inputsC) diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/primitive.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/primitive.lux index b6bec104f..1d807e519 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/primitive.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/primitive.lux @@ -36,13 +36,13 @@ (~~ (do-template [<type> <code-wrapper> <value-gen>] [(r.and (random/wrap <type>) (random/map <code-wrapper> <value-gen>))] - [Any code.tuple (r.list |0 ..unit)] + [Any code.tuple (r.list 0 ..unit)] [Bit code.bit r.bit] [Nat code.nat r.nat] [Int code.int r.int] [Rev code.rev r.rev] [Frac code.frac r.frac] - [Text code.text (r.unicode |5)] + [Text code.text (r.unicode 5)] ))))) (exception: (wrong-inference {expected Type} {inferred Type}) @@ -71,7 +71,7 @@ _ #0))) - (<| (times |100) + (<| (times 100) (`` ($_ seq (~~ (do-template [<desc> <type> <tag> <random> <constructor>] [(do @ @@ -89,5 +89,5 @@ ["int" Int #analysis.Int r.int code.int] ["rev" Rev #analysis.Rev r.rev code.rev] ["frac" Frac #analysis.Frac r.frac code.frac] - ["text" Text #analysis.Text (r.unicode |5) code.text] + ["text" Text #analysis.Text (r.unicode 5) code.text] ))))))) diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux index f13db8218..5fc04278b 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux @@ -47,7 +47,7 @@ ) (context: "Lux procedures" - (<| (times |100) + (<| (times 100) (do @ [[primT primC] _primitive.primitive [antiT antiC] (|> _primitive.primitive @@ -64,7 +64,7 @@ )))) (context: "Bit procedures" - (<| (times |100) + (<| (times 100) (do @ [subjectC (|> r.nat (:: @ map code.nat)) signedC (|> r.int (:: @ map code.int)) @@ -85,7 +85,7 @@ )))) (context: "Int procedures" - (<| (times |100) + (<| (times 100) (do @ [subjectC (|> r.int (:: @ map code.int)) paramC (|> r.int (:: @ map code.int))] @@ -111,11 +111,11 @@ )))) (context: "Frac procedures" - (<| (times |100) + (<| (times 100) (do @ [subjectC (|> r.frac (:: @ map code.frac)) paramC (|> r.frac (:: @ map code.frac)) - encodedC (|> (r.unicode |5) (:: @ map code.text))] + encodedC (|> (r.unicode 5) (:: @ map code.text))] ($_ seq (test "Can add frac numbers." (check-success+ "lux frac +" (list subjectC paramC) Frac)) @@ -146,11 +146,11 @@ )))) (context: "Text procedures" - (<| (times |100) + (<| (times 100) (do @ - [subjectC (|> (r.unicode |5) (:: @ map code.text)) - paramC (|> (r.unicode |5) (:: @ map code.text)) - replacementC (|> (r.unicode |5) (:: @ map code.text)) + [subjectC (|> (r.unicode 5) (:: @ map code.text)) + paramC (|> (r.unicode 5) (:: @ map code.text)) + replacementC (|> (r.unicode 5) (:: @ map code.text)) fromC (|> r.nat (:: @ map code.nat)) toC (|> r.nat (:: @ map code.nat))] ($_ seq @@ -171,12 +171,12 @@ )))) (context: "Array procedures" - (<| (times |100) + (<| (times 100) (do @ [[elemT elemC] _primitive.primitive sizeC (|> r.nat (:: @ map code.nat)) idxC (|> r.nat (:: @ map code.nat)) - var-name (r.unicode |5) + var-name (r.unicode 5) #let [arrayT (type (Array elemT)) g!array (code.local-identifier var-name) array-operation (function (_ output-type code) @@ -208,7 +208,7 @@ )))) (context: "Math procedures" - (<| (times |100) + (<| (times 100) (do @ [subjectC (|> r.frac (:: @ map code.frac)) paramC (|> r.frac (:: @ map code.frac))] @@ -239,12 +239,12 @@ ["lux math pow" "power"]))))))) (context: "Atom procedures" - (<| (times |100) + (<| (times 100) (do @ [[elemT elemC] _primitive.primitive sizeC (|> r.nat (:: @ map code.nat)) idxC (|> r.nat (:: @ map code.nat)) - var-name (r.unicode |5) + var-name (r.unicode 5) #let [atomT (type (atom.Atom elemT))]] ($_ seq (test "Can create atomic reference." @@ -277,7 +277,7 @@ )))) (context: "Process procedures" - (<| (times |100) + (<| (times 100) (do @ [[primT primC] _primitive.primitive timeC (|> r.nat (:: @ map code.nat))] @@ -292,9 +292,9 @@ )))) (context: "IO procedures" - (<| (times |100) + (<| (times 100) (do @ - [logC (|> (r.unicode |5) (:: @ map code.text)) + [logC (|> (r.unicode 5) (:: @ map code.text)) exitC (|> r.int (:: @ map code.int))] ($_ seq (test "Can log messages to standard output." diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/reference.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/reference.lux index 55a673935..dae6d916b 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/reference.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/reference.lux @@ -48,13 +48,13 @@ (def: (reach-test var-name [export? def-module] [import? dependent-module] check!) (-> Text [Bit Text] [Bit Text] Check Bit) (|> (do phase.Monad<Operation> - [_ (module.with-module |0 def-module + [_ (module.with-module 0 def-module (module.define var-name [Any (if export? (' {#.export? #1}) (' {})) []]))] - (module.with-module |0 dependent-module + (module.with-module 0 dependent-module (do @ [_ (if import? (module.import def-module) @@ -65,13 +65,13 @@ check!)) (context: "References" - (<| (times |100) + (<| (times 100) (do @ [[expectedT _] _primitive.primitive - def-module (r.unicode |5) - scope-name (r.unicode |5) - var-name (r.unicode |5) - dependent-module (|> (r.unicode |5) + def-module (r.unicode 5) + scope-name (r.unicode 5) + var-name (r.unicode 5) + dependent-module (|> (r.unicode 5) (r.filter (|>> (text/= def-module) not)))] ($_ seq (test "Can analyse variable." @@ -82,7 +82,7 @@ (phase.run [analysisE.bundle (init.compiler [])]) (case> (^ (#e.Success [inferredT (#analysis.Reference (reference.local var))])) (and (type/= expectedT inferredT) - (n/= |0 var)) + (n/= 0 var)) _ #0))) @@ -92,7 +92,7 @@ [_ (module.define var-name [expectedT (' {}) []])] (typeA.with-inference (..analyse (code.identifier def-name)))) - (module.with-module |0 def-module) + (module.with-module 0 def-module) (phase.run [analysisE.bundle (init.compiler [])]) (case> (^ (#e.Success [_ inferredT (#analysis.Reference (reference.constant constant-name))])) (and (type/= expectedT inferredT) diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux index 1b23587f7..d36bffe20 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux @@ -75,7 +75,7 @@ (All [a] (-> Text (List module.Tag) Type (Operation a) (Operation [Module a]))) (|>> (do phase.Monad<Operation> [_ (module.declare-tags tags #0 type)]) - (module.with-module |0 module))) + (module.with-module 0 module))) (def: (check-variant module tags type size tag analysis) (-> Text (List module.Tag) Type Nat Tag (Operation Analysis) Bit) @@ -108,9 +108,9 @@ #0))) (context: "Sums" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) + [size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) choice (|> r.nat (:: @ map (n/% size))) primitives (r.list size _primitive.primitive) +choice (|> r.nat (:: @ map (n/% (inc size)))) @@ -119,7 +119,7 @@ [valueT valueC] (maybe.assume (list.nth choice primitives)) +size (inc size) +primitives (list.concat (list (list.take choice primitives) - (list [(#.Parameter |1) +valueC]) + (list [(#.Parameter 1) +valueC]) (list.drop choice primitives))) [+valueT +valueC] (maybe.assume (list.nth +choice +primitives)) +variantT (type.variant (list/map product.left +primitives))]] @@ -149,29 +149,29 @@ (/.sum ..analyse choice valueC))) check-fails)) (test "Can analyse sum through existential quantification." - (|> (typeA.with-type (type.ex-q |1 +variantT) + (|> (typeA.with-type (type.ex-q 1 +variantT) (/.sum ..analyse +choice +valueC)) check-succeeds)) (test "Can analyse sum through universal quantification." (let [check-outcome (if (not (n/= choice +choice)) check-succeeds check-fails)] - (|> (typeA.with-type (type.univ-q |1 +variantT) + (|> (typeA.with-type (type.univ-q 1 +variantT) (/.sum ..analyse +choice +valueC)) check-outcome))) )))) (context: "Products" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) + [size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) primitives (r.list size _primitive.primitive) choice (|> r.nat (:: @ map (n/% size))) [_ +valueC] _primitive.primitive #let [tupleT (type.tuple (list/map product.left primitives)) [singletonT singletonC] (|> primitives (list.nth choice) maybe.assume) +primitives (list.concat (list (list.take choice primitives) - (list [(#.Parameter |1) +valueC]) + (list [(#.Parameter 1) +valueC]) (list.drop choice primitives))) +tupleT (type.tuple (list/map product.left +primitives))]] ($_ seq @@ -212,26 +212,26 @@ _ #0))) (test "Can analyse product through existential quantification." - (|> (typeA.with-type (type.ex-q |1 +tupleT) + (|> (typeA.with-type (type.ex-q 1 +tupleT) (/.product ..analyse (list/map product.right +primitives))) check-succeeds)) (test "Cannot analyse product through universal quantification." - (|> (typeA.with-type (type.univ-q |1 +tupleT) + (|> (typeA.with-type (type.univ-q 1 +tupleT) (/.product ..analyse (list/map product.right +primitives))) check-fails)) )))) (context: "Tagged Sums" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) - tags (|> (r.set text.Hash<Text> size (r.unicode |5)) (:: @ map set.to-list)) + [size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) + tags (|> (r.set text.Hash<Text> size (r.unicode 5)) (:: @ map set.to-list)) choice (|> r.nat (:: @ map (n/% size))) other-choice (|> r.nat (:: @ map (n/% size)) (r.filter (|>> (n/= choice) not))) primitives (r.list size _primitive.primitive) - module-name (r.unicode |5) - type-name (r.unicode |5) - #let [varT (#.Parameter |1) + module-name (r.unicode 5) + type-name (r.unicode 5) + #let [varT (#.Parameter 1) primitivesT (list/map product.left primitives) [choiceT choiceC] (maybe.assume (list.nth choice primitives)) [other-choiceT other-choiceC] (maybe.assume (list.nth other-choice primitives)) @@ -240,7 +240,7 @@ named-polyT (|> (type.variant (list.concat (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) - (type.univ-q |1) + (type.univ-q 1) (#.Named [module-name type-name])) choice-tag (maybe.assume (list.nth choice tags)) other-choice-tag (maybe.assume (list.nth other-choice tags))]] @@ -261,15 +261,15 @@ )))) (context: "Records" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) - tags (|> (r.set text.Hash<Text> size (r.unicode |5)) (:: @ map set.to-list)) + [size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) + tags (|> (r.set text.Hash<Text> size (r.unicode 5)) (:: @ map set.to-list)) primitives (r.list size _primitive.primitive) - module-name (r.unicode |5) - type-name (r.unicode |5) + module-name (r.unicode 5) + type-name (r.unicode 5) choice (|> r.nat (:: @ map (n/% size))) - #let [varT (#.Parameter |1) + #let [varT (#.Parameter 1) tagsC (list/map (|>> [module-name] code.tag) tags) primitivesT (list/map product.left primitives) primitivesC (list/map product.right primitives) @@ -279,7 +279,7 @@ named-polyT (|> (type.tuple (list.concat (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) - (type.univ-q |1) + (type.univ-q 1) (#.Named [module-name type-name]))]] ($_ seq (test "Can infer record." diff --git a/stdlib/test/test/lux/compiler/default/phase/synthesis/case.lux b/stdlib/test/test/lux/compiler/default/phase/synthesis/case.lux index 43c58f446..f3c3b9d2e 100644 --- a/stdlib/test/test/lux/compiler/default/phase/synthesis/case.lux +++ b/stdlib/test/test/lux/compiler/default/phase/synthesis/case.lux @@ -20,10 +20,10 @@ ["." //primitive]) (context: "Dummy variables." - (<| (times |100) + (<| (times 100) (do @ [maskedA //primitive.primitive - temp (|> r.nat (:: @ map (n/% |100))) + temp (|> r.nat (:: @ map (n/% 100))) #let [maskA (analysis.control/case [maskedA [[(#analysis.Bind temp) @@ -37,7 +37,7 @@ (error.default #0)))))) (context: "Let expressions." - (<| (times |100) + (<| (times 100) (do @ [registerA r.nat inputA //primitive.primitive @@ -60,7 +60,7 @@ #0)))))) (context: "If expressions." - (<| (times |100) + (<| (times 100) (do @ [then|else r.bit inputA //primitive.primitive diff --git a/stdlib/test/test/lux/compiler/default/phase/synthesis/function.lux b/stdlib/test/test/lux/compiler/default/phase/synthesis/function.lux index 046eef852..fae0e0fdf 100644 --- a/stdlib/test/test/lux/compiler/default/phase/synthesis/function.lux +++ b/stdlib/test/test/lux/compiler/default/phase/synthesis/function.lux @@ -42,7 +42,7 @@ predictionA])) (do @ [predictionA //primitive.primitive] - (wrap [|0 predictionA predictionA]))))))) + (wrap [0 predictionA predictionA]))))))) (def: (pick scope-size) (-> Nat (r.Random Nat)) @@ -51,12 +51,12 @@ (def: function-with-environment (r.Random [Arity Analysis Variable]) (do r.Monad<Random> - [num-locals (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) - #let [indices (list.n/range |0 (dec num-locals)) + [num-locals (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) + #let [indices (list.n/range 0 (dec num-locals)) local-env (list/map (|>> #reference.Local) indices) foreign-env (list/map (|>> #reference.Foreign) indices)] [arity bodyA predictionA] (: (r.Random [Arity Analysis Variable]) - (loop [arity |1 + (loop [arity 1 current-env foreign-env] (let [current-env/size (list.size current-env) resolver (list/fold (function (_ [idx var] resolver) @@ -68,7 +68,7 @@ [nest? r.bit] (if nest? (do @ - [num-picks (:: @ map (n/max |1) (pick (inc current-env/size))) + [num-picks (:: @ map (n/max 1) (pick (inc current-env/size))) picks (|> (r.set number.Hash<Nat> num-picks (pick current-env/size)) (:: @ map set.to-list)) [arity bodyA predictionA] (recur (inc arity) @@ -90,7 +90,7 @@ (def: local-function (r.Random [Arity Analysis Variable]) - (loop [arity |0 + (loop [arity 0 nest? #1] (if nest? (do r.Monad<Random> @@ -100,14 +100,14 @@ (#analysis.Function (list) bodyA) predictionA])) (do r.Monad<Random> - [chosen (|> r.nat (:: @ map (|>> (n/% |100) (n/max |2))))] + [chosen (|> r.nat (:: @ map (|>> (n/% 100) (n/max 2))))] (wrap [arity (#analysis.Reference (reference.local chosen)) (|> chosen (n/+ (dec arity)) #reference.Local)]))))) (context: "Function definition." - (<| (seed |13007429814532219492) - ## (times |100) + (<| (seed 13007429814532219492) + ## (times 100) (do @ [[arity//constant function//constant prediction//constant] constant-function [arity//environment function//environment prediction//environment] function-with-environment @@ -122,7 +122,7 @@ (//primitive.corresponds? prediction//constant output)) _ - (n/= |0 arity//constant)))) + (n/= 0 arity//constant)))) (test "Folded functions provide direct access to environment variables." (|> function//environment expression.synthesize @@ -146,9 +146,9 @@ )))) (context: "Function application." - (<| (times |100) + (<| (times 100) (do @ - [arity (|> r.nat (:: @ map (|>> (n/% |10) (n/max |1)))) + [arity (|> r.nat (:: @ map (|>> (n/% 10) (n/max 1)))) funcA //primitive.primitive argsA (r.list arity //primitive.primitive)] ($_ seq diff --git a/stdlib/test/test/lux/compiler/default/phase/synthesis/primitive.lux b/stdlib/test/test/lux/compiler/default/phase/synthesis/primitive.lux index e2fa45521..9587919a2 100644 --- a/stdlib/test/test/lux/compiler/default/phase/synthesis/primitive.lux +++ b/stdlib/test/test/lux/compiler/default/phase/synthesis/primitive.lux @@ -30,7 +30,7 @@ r.int r.rev r.frac - (r.unicode |5)))] + (r.unicode 5)))] (wrap (#analysis.Primitive primitive)))) (def: #export (corresponds? analysis synthesis) @@ -68,14 +68,14 @@ #0)) (context: "Primitives." - (<| (times |100) + (<| (times 100) (do @ [|bit| r.bit |nat| r.nat |int| r.int |rev| r.rev |frac| r.frac - |text| (r.unicode |5)] + |text| (r.unicode 5)] (`` ($_ seq (~~ (do-template [<desc> <analysis> <synthesis> <sample>] [(test (format "Can synthesize " <desc> ".") diff --git a/stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux b/stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux index b3363567a..90fd155b0 100644 --- a/stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux +++ b/stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux @@ -23,9 +23,9 @@ ["." //primitive]) (context: "Variants" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |10) (n/+ |2)))) + [size (|> r.nat (:: @ map (|>> (n/% 10) (n/+ 2)))) tagA (|> r.nat (:: @ map (n/% size))) memberA //primitive.primitive] ($_ seq @@ -44,9 +44,9 @@ )))) (context: "Tuples" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) + [size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) membersA (r.list size //primitive.primitive)] ($_ seq (test "Can synthesize tuple." diff --git a/stdlib/test/test/lux/compiler/default/syntax.lux b/stdlib/test/test/lux/compiler/default/syntax.lux index 5bd7c09d8..e52a6ea02 100644 --- a/stdlib/test/test/lux/compiler/default/syntax.lux +++ b/stdlib/test/test/lux/compiler/default/syntax.lux @@ -23,8 +23,8 @@ (def: default-cursor Cursor {#.module "" - #.line |0 - #.column |0}) + #.line 0 + #.column 0}) (def: name-part^ (r.Random Text) @@ -34,11 +34,11 @@ space "\t\v \n\r\f" invalid-range (format digits delimiters space) char-gen (|> r.nat - (:: @ map (|>> (n/% |256) (n/max |1))) + (:: @ map (|>> (n/% 256) (n/max 1))) (r.filter (function (_ sample) (not (text.contains? (text.from-code sample) invalid-range)))))] - size (|> r.nat (:: @ map (|>> (n/% |20) (n/max |1))))] + size (|> r.nat (:: @ map (|>> (n/% 20) (n/max 1))))] (r.text char-gen size))) (def: name^ @@ -57,7 +57,7 @@ textual^ (: (r.Random Code) ($_ r.either (do r.Monad<Random> - [size (|> r.nat (r/map (n/% |20)))] + [size (|> r.nat (r/map (n/% 20)))] (|> (r.unicode size) (r/map code.text))) (|> name^ (r/map code.identifier)) (|> name^ (r/map code.tag)))) @@ -68,28 +68,28 @@ (r.rec (function (_ code^) (let [multi^ (do r.Monad<Random> - [size (|> r.nat (r/map (n/% |3)))] + [size (|> r.nat (r/map (n/% 3)))] (r.list size code^)) composite^ (: (r.Random Code) ($_ r.either (|> multi^ (r/map code.form)) (|> multi^ (r/map code.tuple)) (do r.Monad<Random> - [size (|> r.nat (r/map (n/% |3)))] + [size (|> r.nat (r/map (n/% 3)))] (|> (r.list size (r.and code^ code^)) (r/map code.record)))))] (r.either simple^ composite^)))))) (context: "Lux code syntax." - (<| (times |100) + (<| (times 100) (do @ [sample code^ other code^] ($_ seq (test "Can parse Lux code." (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 (code.to-text sample)]) + [default-cursor 0 (code.to-text sample)]) (#e.Error error) #0 @@ -97,8 +97,8 @@ (:: code.Equivalence<Code> = parsed sample))) (test "Can parse Lux multiple code nodes." (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 (format (code.to-text sample) " " - (code.to-text other))]) + [default-cursor 0 (format (code.to-text sample) " " + (code.to-text other))]) (#e.Error error) #0 @@ -114,15 +114,15 @@ )))) (context: "Frac special syntax." - (<| (times |100) + (<| (times 100) (do @ - [numerator (|> r.nat (:: @ map (|>> (n/% |100) .int int-to-frac))) - denominator (|> r.nat (:: @ map (|>> (n/% |100) (n/max |1) .int int-to-frac))) + [numerator (|> r.nat (:: @ map (|>> (n/% 100) .int int-to-frac))) + denominator (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1) .int int-to-frac))) signed? r.bit #let [expected (|> numerator (f// denominator) (f/* (if signed? -1.0 +1.0)))]] (test "Can parse frac ratio syntax." (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 + [default-cursor 0 (format (if signed? "-" "") (%i (frac-to-int numerator)) "/" @@ -135,12 +135,12 @@ )))) (context: "Nat special syntax." - (<| (times |100) + (<| (times 100) (do @ - [expected (|> r.nat (:: @ map (n/% |1_000)))] + [expected (|> r.nat (:: @ map (n/% 1_000)))] (test "Can parse nat char syntax." (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 + [default-cursor 0 (format "#" (%t (text.from-code expected)) "")]) (#e.Success [_ [_ (#.Nat actual)]]) (n/= expected actual) @@ -157,7 +157,7 @@ (n/= (char "(") value) (n/= (char ")") value))))))] (do r.Monad<Random> - [size (|> r.nat (r/map (n/% |20)))] + [size (|> r.nat (r/map (n/% 20)))] (r.text char-gen size)))) (def: comment^ @@ -172,8 +172,8 @@ (wrap (format "#( " comment " )#"))))))) (context: "Multi-line text & comments." - (<| (seed |12137892244981970631) - ## (times |100) + (<| (seed 12137892244981970631) + ## (times 100) (do @ [#let [char-gen (|> r.nat (r.filter (function (_ value) (not (or (text.space? value) @@ -181,7 +181,7 @@ x char-gen y char-gen z char-gen - offset-size (|> r.nat (r/map (|>> (n/% |10) (n/max |1)))) + offset-size (|> r.nat (r/map (|>> (n/% 10) (n/max 1)))) #let [offset (text.join-with "" (list.repeat offset-size " "))] sample code^ comment comment^ @@ -192,7 +192,7 @@ (text.from-code y) "\n" (text.from-code z))] (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 + [default-cursor 0 (format "\"" bad-match "\"")]) (#e.Error error) #1 @@ -208,7 +208,7 @@ (text.from-code z))] (case (&.read "" (dict.new text.Hash<Text>) [(|> default-cursor (update@ #.column (n/+ (dec offset-size)))) - |0 + 0 (format "\"" good-input "\"")]) (#e.Error error) #0 @@ -219,7 +219,7 @@ (code.text good-output))))) (test "Can handle comments." (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 + [default-cursor 0 (format comment (code.to-text sample))]) (#e.Error error) #0 @@ -228,7 +228,7 @@ (:: code.Equivalence<Code> = parsed sample))) (test "Will reject unbalanced multi-line comments." (and (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 + [default-cursor 0 (format "#(" "#(" unbalanced-comment ")#" (code.to-text sample))]) (#e.Error error) @@ -237,7 +237,7 @@ (#e.Success [_ parsed]) #0) (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 + [default-cursor 0 (format "#(" unbalanced-comment ")#" ")#" (code.to-text sample))]) (#e.Error error) diff --git a/stdlib/test/test/lux/concurrency/actor.lux b/stdlib/test/test/lux/concurrency/actor.lux index 42b2f5412..a43845380 100644 --- a/stdlib/test/test/lux/concurrency/actor.lux +++ b/stdlib/test/test/lux/concurrency/actor.lux @@ -38,19 +38,19 @@ ($_ seq (test "Can check if an actor is alive." (io.run (do io.Monad<IO> - [counter (new@Counter |0)] + [counter (new@Counter 0)] (wrap (&.alive? counter))))) (test "Can poison actors." (io.run (do io.Monad<IO> - [counter (new@Counter |0) + [counter (new@Counter 0) poisoned? (&.poison counter)] (wrap (and poisoned? (not (&.alive? counter))))))) (test "Cannot poison an already dead actor." (io.run (do io.Monad<IO> - [counter (new@Counter |0) + [counter (new@Counter 0) first-time (&.poison counter) second-time (&.poison counter)] (wrap (and first-time @@ -58,13 +58,13 @@ (wrap (do P.Monad<Promise> [result (do T.Monad<Task> - [#let [counter (io.run (new@Counter |0))] - output-1 (count! |1 counter) - output-2 (count! |1 counter) - output-3 (count! |1 counter)] - (wrap (and (n/= |1 output-1) - (n/= |2 output-2) - (n/= |3 output-3))))] + [#let [counter (io.run (new@Counter 0))] + output-1 (count! 1 counter) + output-2 (count! 1 counter) + output-3 (count! 1 counter)] + (wrap (and (n/= 1 output-1) + (n/= 2 output-2) + (n/= 3 output-3))))] (assert "Can send messages to actors." (case result (#e.Success outcome) diff --git a/stdlib/test/test/lux/concurrency/atom.lux b/stdlib/test/test/lux/concurrency/atom.lux index db480b27e..a10edcae7 100644 --- a/stdlib/test/test/lux/concurrency/atom.lux +++ b/stdlib/test/test/lux/concurrency/atom.lux @@ -10,7 +10,7 @@ lux/test) (context: "Atoms" - (<| (times |100) + (<| (times 100) (do @ [value r.nat swap-value r.nat diff --git a/stdlib/test/test/lux/concurrency/frp.lux b/stdlib/test/test/lux/concurrency/frp.lux index 7ba1a80e9..46db40889 100644 --- a/stdlib/test/test/lux/concurrency/frp.lux +++ b/stdlib/test/test/lux/concurrency/frp.lux @@ -42,7 +42,7 @@ output (read! input) _ (write! values input)] (wrap output))) - _ (promise.wait |100) + _ (promise.wait 100) output (promise.future (atom.read output))] (assert "Can pipe one channel into another." (list/= values @@ -56,7 +56,7 @@ output (read! elems) _ (write! (list +0 +1 +2 +3 +4 +5) input)] (wrap output))) - _ (promise.wait |100) + _ (promise.wait 100) output (promise.future (atom.read output))] (assert "Can filter a channel's elements." (list/= (list +0 +2 +4) @@ -72,7 +72,7 @@ _ (write! (list +0 +1 +2 +3 +4 +5) left) _ (write! (list +0 -1 -2 -3 -4 -5) right)] (wrap output))) - _ (promise.wait |100) + _ (promise.wait 100) output (promise.future (atom.read output))] (assert "Can merge channels." (list/= (list +0 +1 +2 +3 +4 +5 +0 -1 -2 -3 -4 -5) @@ -86,7 +86,7 @@ output (read! mapped) _ (write! (list +0 +1 +2 +3 +4 +5) inputs)] (wrap output))) - _ (promise.wait |100) + _ (promise.wait 100) output (promise.future (atom.read output))] (assert "Functor goes over every element in a channel." (list/= (list +1 +2 +3 +4 +5 +6) @@ -102,7 +102,7 @@ _ (write! (list inc) >f<) _ (write! (list +12345) >a<)] (wrap output))) - _ (promise.wait |100) + _ (promise.wait 100) output (promise.future (atom.read output))] (assert "Apply works over all channel values." (list/= (list +12346) @@ -111,10 +111,10 @@ (wrap (do promise.Monad<Promise> [output (promise.future (read! (do frp.Monad<Channel> - [f (frp.from-promise (promise.delay |100 inc)) - a (frp.from-promise (promise.delay |200 +12345))] - (frp.from-promise (promise.delay |300 (f a)))))) - _ (promise.wait |700) + [f (frp.from-promise (promise.delay 100 inc)) + a (frp.from-promise (promise.delay 200 +12345))] + (frp.from-promise (promise.delay 300 (f a)))))) + _ (promise.wait 700) output (promise.future (atom.read output))] (assert "Valid monad." (list/= (list +12346) diff --git a/stdlib/test/test/lux/concurrency/promise.lux b/stdlib/test/test/lux/concurrency/promise.lux index 749adf802..e857d0708 100644 --- a/stdlib/test/test/lux/concurrency/promise.lux +++ b/stdlib/test/test/lux/concurrency/promise.lux @@ -18,7 +18,7 @@ running?))) (wrap (do &.Monad<Promise> - [_ (&.wait |500)] + [_ (&.wait 500)] (assert "Can wait for a specified amount of time." #1))) @@ -29,10 +29,10 @@ (and left (not right))))) (wrap (do &.Monad<Promise> - [?left (&.or (&.delay |100 #1) - (&.delay |200 #0)) - ?right (&.or (&.delay |200 #1) - (&.delay |100 #0))] + [?left (&.or (&.delay 100 #1) + (&.delay 200 #0)) + ?right (&.or (&.delay 200 #1) + (&.delay 100 #0))] (assert "Can combine promises alternatively." (case [?left ?right] [(#.Left #1) (#.Right #0)] @@ -42,17 +42,17 @@ #0)))) (wrap (do &.Monad<Promise> - [?left (&.either (&.delay |100 #1) - (&.delay |200 #0)) - ?right (&.either (&.delay |200 #1) - (&.delay |100 #0))] + [?left (&.either (&.delay 100 #1) + (&.delay 200 #0)) + ?right (&.either (&.delay 200 #1) + (&.delay 100 #0))] (assert "Can combine promises alternatively [Part 2]." (and ?left (not ?right))))) (test "Can poll a promise for its value." (and (|> (&.poll (&/wrap #1)) (case> (#.Some #1) #1 _ #0)) - (|> (&.poll (&.delay |200 #1)) + (|> (&.poll (&.delay 200 #1)) (case> #.None #1 _ #0)))) (test "Cannot re-resolve a resolved promise." @@ -60,8 +60,8 @@ (io.run (&.resolve #1 (: (&.Promise Bit) (&.promise #.None)))))) (wrap (do &.Monad<Promise> - [?none (&.time-out |100 (&.delay |200 #1)) - ?some (&.time-out |200 (&.delay |100 #1))] + [?none (&.time-out 100 (&.delay 200 #1)) + ?some (&.time-out 200 (&.delay 100 #1))] (assert "Can establish maximum waiting times for promises to be fulfilled." (case [?none ?some] [#.None (#.Some #1)] diff --git a/stdlib/test/test/lux/concurrency/semaphore.lux b/stdlib/test/test/lux/concurrency/semaphore.lux index 73ee3f8af..f309fcd0c 100644 --- a/stdlib/test/test/lux/concurrency/semaphore.lux +++ b/stdlib/test/test/lux/concurrency/semaphore.lux @@ -20,16 +20,16 @@ (def: (wait-many-times times semaphore) (-> Nat /.Semaphore (Promise Any)) (loop [steps times] - (if (n/> |0 steps) + (if (n/> 0 steps) (do promise.Monad<Promise> [_ (/.wait semaphore)] (recur (dec steps))) (:: promise.Monad<Promise> wrap [])))) (context: "Semaphore." - (<| (times |100) + (<| (times 100) (do @ - [open-positions (|> r.nat (:: @ map (|>> (n/% |10) (n/max |1))))] + [open-positions (|> r.nat (:: @ map (|>> (n/% 10) (n/max 1))))] ($_ seq (let [semaphore (/.semaphore open-positions)] (wrap (do promise.Monad<Promise> @@ -38,7 +38,7 @@ #1)))) (let [semaphore (/.semaphore open-positions)] (wrap (do promise.Monad<Promise> - [result (<| (promise.time-out |100) + [result (<| (promise.time-out 100) (wait-many-times (inc open-positions) semaphore))] (assert "Waiting on a semaphore more than the number of open positions blocks the process." (case result @@ -50,8 +50,8 @@ (let [semaphore (/.semaphore open-positions)] (wrap (do promise.Monad<Promise> [_ (: (Promise Any) - (loop [steps (n/* |2 open-positions)] - (if (n/> |0 steps) + (loop [steps (n/* 2 open-positions)] + (if (n/> 0 steps) (do @ [_ (/.wait semaphore) _ (/.signal semaphore)] @@ -68,7 +68,7 @@ #let [_ (io.run (atom.update (|>> (format "B")) resource))]] (wrap []))] - _ (promise.wait |100) + _ (promise.wait 100) _ (exec (io.run (atom.update (|>> (format "A")) resource)) (/.signal semaphore)) @@ -79,9 +79,9 @@ )))) (context: "Mutex." - (<| (times |100) + (<| (times 100) (do @ - [repetitions (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10))))] + [repetitions (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10))))] ($_ seq (let [mutex (/.mutex [])] (wrap (do promise.Monad<Promise> @@ -122,12 +122,12 @@ (wrap []))) (context: "Barrier." - (let [limit |10 + (let [limit 10 barrier (/.barrier (maybe.assume (/.limit limit))) resource (atom.atom "")] ($_ seq (wrap (do promise.Monad<Promise> - [#let [ids (list.n/range |0 (dec limit)) + [#let [ids (list.n/range 0 (dec limit)) waiters (list/map (function (_ id) (let [process (waiter resource barrier id)] (exec (io.run (atom.update (|>> (format "_")) resource)) diff --git a/stdlib/test/test/lux/concurrency/stm.lux b/stdlib/test/test/lux/concurrency/stm.lux index 4105551bb..3506146f4 100644 --- a/stdlib/test/test/lux/concurrency/stm.lux +++ b/stdlib/test/test/lux/concurrency/stm.lux @@ -28,45 +28,45 @@ channel)] (wrap output))) -(def: iterations-per-process Nat |100) +(def: iterations-per-process Nat 100) (context: "STM" ($_ seq (wrap (do promise.Monad<Promise> - [output (&.commit (&.read (&.var |0)))] + [output (&.commit (&.read (&.var 0)))] (assert "Can read STM vars." - (n/= |0 output)))) + (n/= 0 output)))) (wrap (do promise.Monad<Promise> - [#let [_var (&.var |0)] + [#let [_var (&.var 0)] output (&.commit (do &.Monad<STM> - [_ (&.write |5 _var)] + [_ (&.write 5 _var)] (&.read _var)))] (assert "Can write STM vars." - (n/= |5 output)))) + (n/= 5 output)))) (wrap (do promise.Monad<Promise> - [#let [_var (&.var |5)] + [#let [_var (&.var 5)] output (&.commit (do &.Monad<STM> - [_ (&.update (n/* |3) _var)] + [_ (&.update (n/* 3) _var)] (&.read _var)))] (assert "Can update STM vars." - (n/= |15 output)))) + (n/= 15 output)))) (wrap (do promise.Monad<Promise> - [#let [_var (&.var |0) + [#let [_var (&.var 0) changes (io.run (read! (io.run (&.follow _var))))] - _ (&.commit (&.write |5 _var)) - _ (&.commit (&.update (n/* |3) _var)) + _ (&.commit (&.write 5 _var)) + _ (&.commit (&.update (n/* 3) _var)) changes (promise.future (atom.read changes))] (assert "Can follow all the changes to STM vars." (:: (list.Equivalence<List> number.Equivalence<Nat>) = - (list |5 |15) + (list 5 15) (list.reverse changes))))) - (wrap (let [_concurrency-var (&.var |0)] + (wrap (let [_concurrency-var (&.var 0)] (do promise.Monad<Promise> [_ (|> promise.parallelism - (list.n/range |1) + (list.n/range 1) (list/map (function (_ _) (|> iterations-per-process - (list.n/range |1) + (list.n/range 1) (M.map @ (function (_ _) (&.commit (&.update inc _concurrency-var))))))) (M.seq @)) last-val (&.commit (&.read _concurrency-var))] diff --git a/stdlib/test/test/lux/control/continuation.lux b/stdlib/test/test/lux/control/continuation.lux index 489742c04..dfe93023a 100644 --- a/stdlib/test/test/lux/control/continuation.lux +++ b/stdlib/test/test/lux/control/continuation.lux @@ -11,12 +11,12 @@ lux/test) (context: "Continuations" - (<| (times |100) + (<| (times 100) (do @ [sample r.nat #let [(^open "&/.") &.Apply<Cont> (^open "&/.") &.Monad<Cont>] - elems (r.list |3 r.nat)] + elems (r.list 3 r.nat)] ($_ seq (test "Can run continuations to compute their values." (n/= sample (&.run (&/wrap sample)))) @@ -34,7 +34,7 @@ (wrap (func arg)))))) (test "Can use the current-continuation as a escape hatch." - (n/= (n/* |2 sample) + (n/= (n/* 2 sample) (&.run (do &.Monad<Cont> [value (&.call/cc (function (_ k) @@ -42,16 +42,16 @@ [temp (k sample)] ## If this code where to run, ## the output would be - ## (n/* |4 sample) + ## (n/* 4 sample) (k temp))))] - (wrap (n/* |2 value)))))) + (wrap (n/* 2 value)))))) (test "Can use the current-continuation to build a time machine." - (n/= (n/+ |100 sample) + (n/= (n/+ 100 sample) (&.run (do &.Monad<Cont> - [[restart [output idx]] (&.portal [sample |0])] - (if (n/< |10 idx) - (restart [(n/+ |10 output) (inc idx)]) + [[restart [output idx]] (&.portal [sample 0])] + (if (n/< 10 idx) + (restart [(n/+ 10 output) (inc idx)]) (wrap output)))))) (test "Can use delimited continuations with shifting." diff --git a/stdlib/test/test/lux/control/exception.lux b/stdlib/test/test/lux/control/exception.lux index 3cffa26c3..36555f490 100644 --- a/stdlib/test/test/lux/control/exception.lux +++ b/stdlib/test/test/lux/control/exception.lux @@ -18,7 +18,7 @@ (exception: unknown-exception) (context: "Exceptions" - (<| (times |100) + (<| (times 100) (do @ [should-throw? r.bit which? r.bit diff --git a/stdlib/test/test/lux/control/interval.lux b/stdlib/test/test/lux/control/interval.lux index 2c7192b59..9fe01a0a1 100644 --- a/stdlib/test/test/lux/control/interval.lux +++ b/stdlib/test/test/lux/control/interval.lux @@ -14,7 +14,7 @@ ["L" list]]]]) (context: "Equivalence." - (<| (times |100) + (<| (times 100) (do @ [bottom r.int top r.int @@ -29,7 +29,7 @@ (&/= self self)))))))) (context: "Boundaries" - (<| (times |100) + (<| (times 100) (do @ [bottom r.int top r.int @@ -85,7 +85,7 @@ gen-singleton)) (context: "Unions" - (<| (times |100) + (<| (times 100) (do @ [some-interval gen-interval left-inner gen-inner @@ -107,7 +107,7 @@ )))) (context: "Intersections" - (<| (times |100) + (<| (times 100) (do @ [some-interval gen-interval left-inner gen-inner @@ -129,7 +129,7 @@ )))) (context: "Complement" - (<| (times |100) + (<| (times 100) (do @ [some-interval gen-interval #let [(^open "&/.") &.Equivalence<Interval>]] @@ -141,9 +141,9 @@ )))) (context: "Positioning/location" - (<| (times |100) + (<| (times 100) (do @ - [[l m r] (|> (r.set number.Hash<Int> |3 r.int) + [[l m r] (|> (r.set number.Hash<Int> 3 r.int) (:: @ map (|>> S.to-list (L.sort i/<) (case> (^ (list b t1 t2)) @@ -163,9 +163,9 @@ )))) (context: "Touching intervals" - (<| (times |100) + (<| (times 100) (do @ - [[b t1 t2] (|> (r.set number.Hash<Int> |3 r.int) + [[b t1 t2] (|> (r.set number.Hash<Int> 3 r.int) (:: @ map (|>> S.to-list (L.sort i/<) (case> (^ (list b t1 t2)) @@ -189,10 +189,10 @@ )))) (context: "Nesting & overlap" - (<| (times |100) + (<| (times 100) (do @ [some-interval gen-interval - [x0 x1 x2 x3] (|> (r.set number.Hash<Int> |4 r.int) + [x0 x1 x2 x3] (|> (r.set number.Hash<Int> 4 r.int) (:: @ map (|>> S.to-list (L.sort i/<) (case> (^ (list x0 x1 x2 x3)) diff --git a/stdlib/test/test/lux/control/parser.lux b/stdlib/test/test/lux/control/parser.lux index 19ed2000d..378cbccd4 100644 --- a/stdlib/test/test/lux/control/parser.lux +++ b/stdlib/test/test/lux/control/parser.lux @@ -67,27 +67,27 @@ (context: "Combinators [Part 1]" ($_ seq (test "Can optionally succeed with some parser." - (and (match (#.Some |123) - (&.run (list (code.nat |123)) + (and (match (#.Some 123) + (&.run (list (code.nat 123)) (&.maybe s.nat))) (match #.None (&.run (list (code.int -123)) (&.maybe s.nat))))) (test "Can apply a parser 0 or more times." - (and (match (list |123 |456 |789) - (&.run (list (code.nat |123) (code.nat |456) (code.nat |789)) + (and (match (list 123 456 789) + (&.run (list (code.nat 123) (code.nat 456) (code.nat 789)) (&.some s.nat))) (match (list) (&.run (list (code.int -123)) (&.some s.nat))))) (test "Can apply a parser 1 or more times." - (and (match (list |123 |456 |789) - (&.run (list (code.nat |123) (code.nat |456) (code.nat |789)) + (and (match (list 123 456 789) + (&.run (list (code.nat 123) (code.nat 456) (code.nat 789)) (&.many s.nat))) - (match (list |123) - (&.run (list (code.nat |123)) + (match (list 123) + (&.run (list (code.nat 123)) (&.many s.nat))) (fails? (&.run (list (code.int -123)) (&.many s.nat))))) @@ -124,40 +124,40 @@ (test "Can apply a parser N times." (and (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.exactly |3 s.int))) + (&.exactly 3 s.int))) (match (list +123 +456) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.exactly |2 s.int))) + (&.exactly 2 s.int))) (fails? (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.exactly |4 s.int))))) + (&.exactly 4 s.int))))) (test "Can apply a parser at-least N times." (and (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-least |3 s.int))) + (&.at-least 3 s.int))) (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-least |2 s.int))) + (&.at-least 2 s.int))) (fails? (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-least |4 s.int))))) + (&.at-least 4 s.int))))) (test "Can apply a parser at-most N times." (and (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-most |3 s.int))) + (&.at-most 3 s.int))) (match (list +123 +456) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-most |2 s.int))) + (&.at-most 2 s.int))) (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-most |4 s.int))))) + (&.at-most 4 s.int))))) (test "Can apply a parser between N and M times." (and (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.between |3 |10 s.int))) + (&.between 3 10 s.int))) (fails? (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.between |4 |10 s.int))))) + (&.between 4 10 s.int))))) (test "Can parse while taking separators into account." (and (match (list +123 +456 +789) diff --git a/stdlib/test/test/lux/control/region.lux b/stdlib/test/test/lux/control/region.lux index 59f523666..8a419bb0a 100644 --- a/stdlib/test/test/lux/control/region.lux +++ b/stdlib/test/test/lux/control/region.lux @@ -27,14 +27,14 @@ ) (context: "Regions." - (<| (times |100) + (<| (times 100) (do @ - [expected-clean-ups (|> r.nat (:: @ map (|>> (n/% |100) (n/max |1))))] + [expected-clean-ups (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1))))] ($_ seq (test "Clean-up functions are always run when region execution is done." (thread.run (do thread.Monad<Thread> - [clean-up-counter (thread.box |0) + [clean-up-counter (thread.box 0) #let [@@ @ count-clean-up (function (_ value) (do @ @@ -43,7 +43,7 @@ outcome (/.run @ (do (/.Monad<Region> @) [_ (monad.map @ (/.acquire @@ count-clean-up) - (list.n/range |1 expected-clean-ups))] + (list.n/range 1 expected-clean-ups))] (wrap []))) actual-clean-ups (thread.read clean-up-counter)] (wrap (and (success? outcome) @@ -52,7 +52,7 @@ (test "Can clean-up despite errors." (thread.run (do thread.Monad<Thread> - [clean-up-counter (thread.box |0) + [clean-up-counter (thread.box 0) #let [@@ @ count-clean-up (function (_ value) (do @ @@ -61,7 +61,7 @@ outcome (/.run @ (do (/.Monad<Region> @) [_ (monad.map @ (/.acquire @@ count-clean-up) - (list.n/range |1 expected-clean-ups)) + (list.n/range 1 expected-clean-ups)) _ (/.throw @@ oops [])] (wrap []))) actual-clean-ups (thread.read clean-up-counter)] @@ -71,7 +71,7 @@ (test "Errors can propagate from the cleaners." (thread.run (do thread.Monad<Thread> - [clean-up-counter (thread.box |0) + [clean-up-counter (thread.box 0) #let [@@ @ count-clean-up (function (_ value) (do @ @@ -80,17 +80,17 @@ outcome (/.run @ (do (/.Monad<Region> @) [_ (monad.map @ (/.acquire @@ count-clean-up) - (list.n/range |1 expected-clean-ups))] + (list.n/range 1 expected-clean-ups))] (wrap []))) actual-clean-ups (thread.read clean-up-counter)] - (wrap (and (or (n/= |0 expected-clean-ups) + (wrap (and (or (n/= 0 expected-clean-ups) (error? outcome)) (n/= expected-clean-ups actual-clean-ups)))))) (test "Can lift operations." (thread.run (do thread.Monad<Thread> - [clean-up-counter (thread.box |0) + [clean-up-counter (thread.box 0) #let [@@ @] outcome (/.run @ (do (/.Monad<Region> @) diff --git a/stdlib/test/test/lux/control/state.lux b/stdlib/test/test/lux/control/state.lux index ba5fefb6d..45f8675d8 100644 --- a/stdlib/test/test/lux/control/state.lux +++ b/stdlib/test/test/lux/control/state.lux @@ -19,7 +19,7 @@ (n/= output))) (context: "Basics" - (<| (times |100) + (<| (times 100) (do @ [state r.nat value r.nat] @@ -47,7 +47,7 @@ )))) (context: "Structures" - (<| (times |100) + (<| (times 100) (do @ [state r.nat value r.nat @@ -75,7 +75,7 @@ )))) (context: "Monad transformer" - (<| (times |100) + (<| (times 100) (do @ [state r.nat left r.nat @@ -95,23 +95,23 @@ )))) (context: "Loops" - (<| (times |100) + (<| (times 100) (do @ - [limit (|> r.nat (:: @ map (n/% |10))) + [limit (|> r.nat (:: @ map (n/% 10))) #let [condition (do &.Monad<State> [state &.get] (wrap (n/< limit state)))]] ($_ seq (test "'while' will only execute if the condition is #1." (|> (&.while condition (&.update inc)) - (&.run |0) + (&.run 0) (case> [state' output'] (n/= limit state')))) (test "'do-while' will execute at least once." (|> (&.do-while condition (&.update inc)) - (&.run |0) + (&.run 0) (case> [state' output'] (or (n/= limit state') - (and (n/= |0 limit) - (n/= |1 state')))))) + (and (n/= 0 limit) + (n/= 1 state')))))) )))) diff --git a/stdlib/test/test/lux/control/thread.lux b/stdlib/test/test/lux/control/thread.lux index 5ac666c64..d9867f4bc 100644 --- a/stdlib/test/test/lux/control/thread.lux +++ b/stdlib/test/test/lux/control/thread.lux @@ -7,15 +7,15 @@ (def: _test0_ Nat (/.run (do /.Monad<Thread> - [box (/.box |123) - old (/.update (n/* |2) box) + [box (/.box 123) + old (/.update (n/* 2) box) new (/.read box)] (wrap (n/+ old new))))) (def: _test1_ (All [!] (/.Thread ! Nat)) (do /.Monad<Thread> - [box (/.box |123) - old (/.update (n/* |2) box) + [box (/.box 123) + old (/.update (n/* 2) box) new (/.read box)] (wrap (n/+ old new)))) diff --git a/stdlib/test/test/lux/data/bit.lux b/stdlib/test/test/lux/data/bit.lux index deabfe265..ecb0c90ad 100644 --- a/stdlib/test/test/lux/data/bit.lux +++ b/stdlib/test/test/lux/data/bit.lux @@ -9,7 +9,7 @@ lux/test) (context: "Bit operations." - (<| (times |100) + (<| (times 100) (do @ [value r.bit] (test "" (and (not (and value (not value))) diff --git a/stdlib/test/test/lux/data/collection/array.lux b/stdlib/test/test/lux/data/collection/array.lux index df43a3ef1..ac3061464 100644 --- a/stdlib/test/test/lux/data/collection/array.lux +++ b/stdlib/test/test/lux/data/collection/array.lux @@ -16,10 +16,10 @@ (def: bounded-size (r.Random Nat) (|> r.nat - (:: r.Monad<Random> map (|>> (n/% |100) (n/+ |1))))) + (:: r.Monad<Random> map (|>> (n/% 100) (n/+ 1))))) (context: "Arrays and their copies" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size original (r.array size r.nat) @@ -35,7 +35,7 @@ (and (:: (@.Equivalence<Array> number.Equivalence<Nat>) = original clone) (not (is? original clone)))) (test "Full-range manual copies should give the same result as cloning." - (exec (@.copy size |0 original |0 copy) + (exec (@.copy size 0 original 0 copy) (and (:: (@.Equivalence<Array> number.Equivalence<Nat>) = original copy) (not (is? original copy))))) (test "Array folding should go over all values." @@ -43,7 +43,7 @@ (function (_ x idx) (exec (@.write idx x manual-copy) (inc idx))) - |0 + 0 original) (:: (@.Equivalence<Array> number.Equivalence<Nat>) = original manual-copy))) (test "Transformations between (full) arrays and lists shouldn't cause lose or change any values." @@ -53,7 +53,7 @@ )))) (context: "Array mutation" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size idx (:: @ map (n/% size) r.nat) @@ -71,17 +71,17 @@ #.None #0)) (test "All cells should be occupied on a full array." (and (n/= size (@.occupied array)) - (n/= |0 (@.vacant array)))) + (n/= 0 (@.vacant array)))) (test "Filtering mutates the array to remove invalid values." (exec (@.filter n/even? array) (and (n/< size (@.occupied array)) - (n/> |0 (@.vacant array)) + (n/> 0 (@.vacant array)) (n/= size (n/+ (@.occupied array) (@.vacant array)))))) )))) (context: "Finding values." - (<| (times |100) + (<| (times 100) (do @ [size bounded-size array (|> (r.array size r.nat) @@ -100,7 +100,7 @@ #.None #0))))))) (context: "Functor" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size array (r.array size r.nat)] @@ -118,7 +118,7 @@ (= array back-again))))))))) (context: "Monoid" - (<| (times |100) + (<| (times 100) (do @ [sizeL bounded-size sizeR bounded-size @@ -133,11 +133,11 @@ (test "First elements of fused array should equal the first array." (|> (: (Array Nat) (@.new sizeL)) - (@.copy sizeL |0 fusion |0) + (@.copy sizeL 0 fusion 0) (= left))) (test "Last elements of fused array should equal the second array." (|> (: (Array Nat) (@.new sizeR)) - (@.copy sizeR sizeL fusion |0) + (@.copy sizeR sizeL fusion 0) (= right))) )))) diff --git a/stdlib/test/test/lux/data/collection/bits.lux b/stdlib/test/test/lux/data/collection/bits.lux index bf6823386..91ab7b828 100644 --- a/stdlib/test/test/lux/data/collection/bits.lux +++ b/stdlib/test/test/lux/data/collection/bits.lux @@ -22,14 +22,14 @@ (def: bits (r.Random /.Bits) (do r.Monad<Random> - [size (size |1 |1_000) + [size (size 1 1_000) idx (|> r.nat (:: @ map (n/% size)))] (wrap (|> /.empty (/.set idx))))) (context: "Bits." - (<| (times |100) + (<| (times 100) (do @ - [size (size |1 |1_000) + [size (size 1 1_000) idx (|> r.nat (:: @ map (n/% size))) sample bits] ($_ seq @@ -43,14 +43,14 @@ (|> /.empty (/.flip idx) (/.flip idx) (/.get idx) not))) (test "Bits (only) grow when (and as much as) necessary." - (and (n/= |0 (/.capacity /.empty)) + (and (n/= 0 (/.capacity /.empty)) (|> /.empty (/.set idx) /.capacity (n/- idx) - (predicate.union (n/>= |0) + (predicate.union (n/>= 0) (n/< /.chunk-size))))) (test "Bits (must) shrink when (and as much as) possible." (let [grown (/.flip idx /.empty)] - (and (n/> |0 (/.capacity grown)) + (and (n/> 0 (/.capacity grown)) (is? /.empty (/.flip idx grown))))) (test "Intersection can be detected when there are set bits in common." diff --git a/stdlib/test/test/lux/data/collection/dictionary.lux b/stdlib/test/test/lux/data/collection/dictionary.lux index a30cdaef0..466cb2872 100644 --- a/stdlib/test/test/lux/data/collection/dictionary.lux +++ b/stdlib/test/test/lux/data/collection/dictionary.lux @@ -14,9 +14,9 @@ lux/test) (context: "Dictionaries." - (<| (times |100) + (<| (times 100) (do @ - [#let [capped-nat (:: r.Monad<Random> map (n/% |100) r.nat)] + [#let [capped-nat (:: r.Monad<Random> map (n/% 100) r.nat)] size capped-nat dict (r.dictionary number.Hash<Nat> size r.nat capped-nat) non-key (|> r.nat (r.filter (function (_ key) (not (&.contains? key dict))))) @@ -26,7 +26,7 @@ (n/= size (&.size dict))) (test "Dictionaries of size 0 should be considered empty." - (if (n/= |0 size) + (if (n/= 0 size) (&.empty? dict) (not (&.empty? dict)))) @@ -62,7 +62,7 @@ _ #1)) (test "Shouldn't be able to put~ an existing key." - (or (n/= |0 size) + (or (n/= 0 size) (let [first-key (|> dict &.keys list.head maybe.assume)] (case (&.get first-key (&.put~ first-key test-val dict)) (#.Some v) (not (n/= test-val v)) @@ -106,7 +106,7 @@ (= dict' (&.merge dict' dict)))) (test "Can merge values in such a way that they become combined." - (list.every? (function (_ [x x*2]) (n/= (n/* |2 x) x*2)) + (list.every? (function (_ [x x*2]) (n/= (n/* 2 x) x*2)) (list.zip2 (&.values dict) (&.values (&.merge-with n/+ dict dict))))) @@ -115,10 +115,10 @@ (&.put non-key test-val) (&.select (list non-key)) &.size - (n/= |1))) + (n/= 1))) (test "Should be able to re-bind existing values to different keys." - (or (n/= |0 size) + (or (n/= 0 size) (let [first-key (|> dict &.keys list.head maybe.assume) rebound (&.re-bind first-key non-key dict)] (and (n/= (&.size dict) (&.size rebound)) diff --git a/stdlib/test/test/lux/data/collection/dictionary/ordered.lux b/stdlib/test/test/lux/data/collection/dictionary/ordered.lux index d6ec22ec1..a8246887e 100644 --- a/stdlib/test/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/test/test/lux/data/collection/dictionary/ordered.lux @@ -16,9 +16,9 @@ lux/test) (context: "Dictionary" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (n/% |100))) + [size (|> r.nat (:: @ map (n/% 100))) keys (r.set number.Hash<Nat> size r.nat) values (r.set number.Hash<Nat> size r.nat) extra-key (|> r.nat (r.filter (|>> (s.member? keys) not))) diff --git a/stdlib/test/test/lux/data/collection/list.lux b/stdlib/test/test/lux/data/collection/list.lux index dbe92f70a..31d5d6155 100644 --- a/stdlib/test/test/lux/data/collection/list.lux +++ b/stdlib/test/test/lux/data/collection/list.lux @@ -18,10 +18,10 @@ (def: bounded-size (r.Random Nat) (|> r.nat - (:: r.Monad<Random> map (|>> (n/% |100) (n/+ |10))))) + (:: r.Monad<Random> map (|>> (n/% 100) (n/+ 10))))) (context: "Lists: Part 1" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size idx (:: @ map (n/% size) r.nat) @@ -67,7 +67,7 @@ )))) (context: "Lists: Part 2" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size idx (:: @ map (n/% size) r.nat) @@ -115,7 +115,7 @@ ))) (test "Segmenting the list in pairs should yield as many elements as N/2." - (n/= (n// |2 size) + (n/= (n// 2 size) (&.size (&.as-pairs sample)))) (test "Sorting a list shouldn't change it's size." @@ -128,7 +128,7 @@ )))) (context: "Lists: Part 3" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size idx (:: @ map (n/% size) r.nat) @@ -136,8 +136,8 @@ other-size bounded-size other-sample (r.list other-size r.nat) separator r.nat - from (|> r.nat (:: @ map (n/% |10))) - to (|> r.nat (:: @ map (n/% |10))) + from (|> r.nat (:: @ map (n/% 10))) + to (|> r.nat (:: @ map (n/% 10))) #let [(^open ".") (&.Equivalence<List> number.Equivalence<Nat>) (^open "&/.") &.Functor<List>]] ($_ seq @@ -167,7 +167,7 @@ (test "The 'interpose' function places a value between every member of a list." (let [(^open ".") &.Functor<List> sample+ (&.interpose separator sample)] - (and (n/= (|> size (n/* |2) dec) + (and (n/= (|> size (n/* 2) dec) (&.size sample+)) (|> sample+ &.as-pairs (map product.right) (&.every? (n/= separator)))))) @@ -204,9 +204,9 @@ (&.every? (bit.complement n/even?) sample)))) (test "You can iteratively construct a list, generating values until you're done." - (= (&.n/range |0 (dec size)) + (= (&.n/range 0 (dec size)) (&.iterate (function (_ n) (if (n/< size n) (#.Some (inc n)) #.None)) - |0))) + 0))) (test "Can enumerate all elements in a list." (let [enum-sample (&.enumerate sample)] diff --git a/stdlib/test/test/lux/data/collection/queue.lux b/stdlib/test/test/lux/data/collection/queue.lux index 79c254341..9b21411fa 100644 --- a/stdlib/test/test/lux/data/collection/queue.lux +++ b/stdlib/test/test/lux/data/collection/queue.lux @@ -11,15 +11,15 @@ lux/test) (context: "Queues" - (<| (times |100) + (<| (times 100) (do @ - [size (:: @ map (n/% |100) r.nat) + [size (:: @ map (n/% 100) r.nat) sample (r.queue size r.nat) non-member (|> r.nat (r.filter (|>> (&.member? number.Equivalence<Nat> sample) not)))] ($_ seq (test "I can query the size of a queue (and empty queues have size 0)." - (if (n/= |0 size) + (if (n/= 0 size) (&.empty? sample) (n/= size (&.size sample)))) diff --git a/stdlib/test/test/lux/data/collection/queue/priority.lux b/stdlib/test/test/lux/data/collection/queue/priority.lux index b0adafd5e..5450b8ad9 100644 --- a/stdlib/test/test/lux/data/collection/queue/priority.lux +++ b/stdlib/test/test/lux/data/collection/queue/priority.lux @@ -24,9 +24,9 @@ inputs))) (context: "Queues" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (n/% |100))) + [size (|> r.nat (:: @ map (n/% 100))) sample (gen-queue size) non-member-priority r.nat non-member (|> r.nat (r.filter (|>> (&.member? number.Equivalence<Nat> sample) not)))] @@ -37,7 +37,7 @@ (test "Enqueueing and dequeing affects the size of queues." (and (n/= (inc size) (&.size (&.push non-member-priority non-member sample))) - (or (n/= |0 (&.size sample)) + (or (n/= 0 (&.size sample)) (n/= (dec size) (&.size (&.pop sample)))))) @@ -46,7 +46,7 @@ (&.member? number.Equivalence<Nat> (&.push non-member-priority non-member sample) non-member)) - (or (n/= |0 (&.size sample)) + (or (n/= 0 (&.size sample)) (and (&.member? number.Equivalence<Nat> sample (maybe.assume (&.peek sample))) diff --git a/stdlib/test/test/lux/data/collection/row.lux b/stdlib/test/test/lux/data/collection/row.lux index f33a369b7..09b443219 100644 --- a/stdlib/test/test/lux/data/collection/row.lux +++ b/stdlib/test/test/lux/data/collection/row.lux @@ -12,9 +12,9 @@ lux/test) (context: "Rows" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |1)))) + [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1)))) idx (|> r.nat (:: @ map (n/% size))) sample (r.row size r.nat) other-sample (r.row size r.nat) @@ -27,8 +27,8 @@ ($_ seq (test "Can query size of row." (if (&.empty? sample) - (and (n/= |0 size) - (n/= |0 (&.size sample))) + (and (n/= 0 size) + (n/= 0 (&.size sample))) (n/= size (&.size sample)))) (test "Can add and remove elements to rows." @@ -56,8 +56,8 @@ (&.member? number.Equivalence<Nat> (&.add non-member sample) non-member))) (test "Can fold over elements of row." - (n/= (list/fold n/+ |0 (&.to-list sample)) - (&/fold n/+ |0 sample))) + (n/= (list/fold n/+ 0 (&.to-list sample)) + (&/fold n/+ 0 sample))) (test "Functor goes over every element." (let [there (&/map inc sample) diff --git a/stdlib/test/test/lux/data/collection/sequence.lux b/stdlib/test/test/lux/data/collection/sequence.lux index 1f0298afd..ce8ef1b4f 100644 --- a/stdlib/test/test/lux/data/collection/sequence.lux +++ b/stdlib/test/test/lux/data/collection/sequence.lux @@ -15,38 +15,38 @@ lux/test) (context: "Sequences" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |2)))) - offset (|> r.nat (:: @ map (n/% |100))) - factor (|> r.nat (:: @ map (|>> (n/% |100) (n/max |2)))) + [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 2)))) + offset (|> r.nat (:: @ map (n/% 100))) + factor (|> r.nat (:: @ map (|>> (n/% 100) (n/max 2)))) elem r.nat cycle-seed (r.list size r.nat) - cycle-sample-idx (|> r.nat (:: @ map (n/% |1000))) + cycle-sample-idx (|> r.nat (:: @ map (n/% 1000))) #let [(^open "List/.") (list.Equivalence<List> number.Equivalence<Nat>) - sample0 (&.iterate inc |0) + sample0 (&.iterate inc 0) sample1 (&.iterate inc offset)]] ($_ seq (test "Can move along a sequence and take slices off it." - (and (and (List/= (list.n/range |0 (dec size)) + (and (and (List/= (list.n/range 0 (dec size)) (&.take size sample0)) (List/= (list.n/range offset (dec (n/+ offset size))) (&.take size (&.drop offset sample0))) (let [[drops takes] (&.split size sample0)] - (and (List/= (list.n/range |0 (dec size)) + (and (List/= (list.n/range 0 (dec size)) drops) - (List/= (list.n/range size (dec (n/* |2 size))) + (List/= (list.n/range size (dec (n/* 2 size))) (&.take size takes))))) - (and (List/= (list.n/range |0 (dec size)) + (and (List/= (list.n/range 0 (dec size)) (&.take-while (n/< size) sample0)) (List/= (list.n/range offset (dec (n/+ offset size))) (&.take-while (n/< (n/+ offset size)) (&.drop-while (n/< offset) sample0))) (let [[drops takes] (&.split-while (n/< size) sample0)] - (and (List/= (list.n/range |0 (dec size)) + (and (List/= (list.n/range 0 (dec size)) drops) - (List/= (list.n/range size (dec (n/* |2 size))) - (&.take-while (n/< (n/* |2 size)) takes))))) + (List/= (list.n/range size (dec (n/* 2 size))) + (&.take-while (n/< (n/* 2 size)) takes))))) )) (test "Can repeat any element and infinite number of times." @@ -58,13 +58,13 @@ (&.take size (&.tail sample1))))) (test "Can filter sequences." - (and (n/= (n/* |2 offset) + (and (n/= (n/* 2 offset) (&.nth offset (&.filter n/even? sample0))) - (let [[evens odds] (&.partition n/even? (&.iterate inc |0))] - (and (n/= (n/* |2 offset) + (let [[evens odds] (&.partition n/even? (&.iterate inc 0))] + (and (n/= (n/* 2 offset) (&.nth offset evens)) - (n/= (inc (n/* |2 offset)) + (n/= (inc (n/* 2 offset)) (&.nth offset odds)))))) (test "Functor goes over 'all' elements in a sequence." diff --git a/stdlib/test/test/lux/data/collection/set.lux b/stdlib/test/test/lux/data/collection/set.lux index d67503b53..1b94aed8c 100644 --- a/stdlib/test/test/lux/data/collection/set.lux +++ b/stdlib/test/test/lux/data/collection/set.lux @@ -14,10 +14,10 @@ (def: gen-nat (r.Random Nat) (|> r.nat - (:: r.Monad<Random> map (n/% |100)))) + (:: r.Monad<Random> map (n/% 100)))) (context: "Sets" - (<| (times |100) + (<| (times 100) (do @ [sizeL gen-nat sizeR gen-nat diff --git a/stdlib/test/test/lux/data/collection/set/ordered.lux b/stdlib/test/test/lux/data/collection/set/ordered.lux index 16eca4081..7eb313c0f 100644 --- a/stdlib/test/test/lux/data/collection/set/ordered.lux +++ b/stdlib/test/test/lux/data/collection/set/ordered.lux @@ -17,10 +17,10 @@ (def: gen-nat (r.Random Nat) (|> r.nat - (:: r.Monad<Random> map (n/% |100)))) + (:: r.Monad<Random> map (n/% 100)))) (context: "Sets" - (<| (times |100) + (<| (times 100) (do @ [sizeL gen-nat sizeR gen-nat diff --git a/stdlib/test/test/lux/data/collection/stack.lux b/stdlib/test/test/lux/data/collection/stack.lux index b786193b0..954e72e78 100644 --- a/stdlib/test/test/lux/data/collection/stack.lux +++ b/stdlib/test/test/lux/data/collection/stack.lux @@ -13,10 +13,10 @@ (def: gen-nat (r.Random Nat) (|> r.nat - (:: r.Monad<Random> map (n/% |100)))) + (:: r.Monad<Random> map (n/% 100)))) (context: "Stacks" - (<| (times |100) + (<| (times 100) (do @ [size gen-nat sample (r.stack size gen-nat) diff --git a/stdlib/test/test/lux/data/collection/tree/rose.lux b/stdlib/test/test/lux/data/collection/tree/rose.lux index 207c6aab9..674ac1d47 100644 --- a/stdlib/test/test/lux/data/collection/tree/rose.lux +++ b/stdlib/test/test/lux/data/collection/tree/rose.lux @@ -19,19 +19,19 @@ (r.Random [Nat (&.Tree Nat)]) (r.rec (function (_ gen-tree) - (r.either (:: r.Monad<Random> map (|>> &.leaf [|1]) r.nat) + (r.either (:: r.Monad<Random> map (|>> &.leaf [1]) r.nat) (do r.Monad<Random> [value r.nat - num-children (|> r.nat (:: @ map (n/% |3))) + num-children (|> r.nat (:: @ map (n/% 3))) children' (r.list num-children gen-tree) - #let [size' (list/fold n/+ |0 (list/map product.left children')) + #let [size' (list/fold n/+ 0 (list/map product.left children')) children (list/map product.right children')]] (wrap [(inc size') (&.branch value children)])) )))) (context: "Trees" - (<| (times |100) + (<| (times 100) (do @ [[size sample] gen-tree #let [(^open "&/.") (&.Equivalence<Tree> number.Equivalence<Nat>) diff --git a/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux b/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux index d91b0065d..b1481518b 100644 --- a/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux +++ b/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux @@ -22,7 +22,7 @@ (r.rec (function (_ gen-tree) (do r.Monad<Random> ## Each branch can have, at most, 1 child. - [size (|> r.nat (:: @ map (n/% |2)))] + [size (|> r.nat (:: @ map (n/% 2)))] (r.and r.nat (r.list size gen-tree)))))) @@ -34,7 +34,7 @@ (recur (&.next zipper))))) (context: "Zippers." - (<| (times |100) + (<| (times 100) (do @ [sample gen-tree new-val r.nat diff --git a/stdlib/test/test/lux/data/color.lux b/stdlib/test/test/lux/data/color.lux index 7d584ab4b..8932fad79 100644 --- a/stdlib/test/test/lux/data/color.lux +++ b/stdlib/test/test/lux/data/color.lux @@ -31,8 +31,8 @@ (def: error-margin Frac +1.8) -(def: black @.Color (@.color [|0 |0 |0])) -(def: white @.Color (@.color [|255 |255 |255])) +(def: black @.Color (@.color [0 0 0])) +(def: white @.Color (@.color [255 255 255])) (do-template [<field>] [(def: (<field> color) @@ -45,7 +45,7 @@ ) (context: "Color." - (<| (times |100) + (<| (times 100) (do @ [any color colorful (|> color diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index a898a2c97..dc30d54d7 100644 --- a/stdlib/test/test/lux/data/format/json.lux +++ b/stdlib/test/test/lux/data/format/json.lux @@ -44,7 +44,7 @@ (r.Random @.JSON) (r.rec (function (_ gen-json) (do r.Monad<Random> - [size (:: @ map (n/% |2) r.nat)] + [size (:: @ map (n/% 2) r.nat)] ($_ r.or (:: @ wrap []) r.bit @@ -55,7 +55,7 @@ ))))) (context: "JSON" - (<| (times |100) + (<| (times 100) (do @ [sample gen-json #let [(^open "@/.") @.Equivalence<JSON> @@ -113,7 +113,7 @@ (def: gen-record (r.Random Record) (do r.Monad<Random> - [size (:: @ map (n/% |2) r.nat)] + [size (:: @ map (n/% 2) r.nat)] ($_ r.and r.bit r.frac @@ -167,8 +167,8 @@ )))) (context: "Polytypism" - (<| (seed |14562075782602945288) - ## (times |100) + (<| (seed 14562075782602945288) + ## (times 100) (do @ [sample gen-record #let [(^open "@/.") Equivalence<Record> diff --git a/stdlib/test/test/lux/data/format/xml.lux b/stdlib/test/test/lux/data/format/xml.lux index 6e6894f8b..b61ad1a5d 100644 --- a/stdlib/test/test/lux/data/format/xml.lux +++ b/stdlib/test/test/lux/data/format/xml.lux @@ -44,22 +44,22 @@ (def: xml-identifier^ (r.Random Name) - (r.and (xml-text^ |0 |10) - (xml-text^ |1 |10))) + (r.and (xml-text^ 0 10) + (xml-text^ 1 10))) (def: gen-xml (r.Random &.XML) (r.rec (function (_ gen-xml) - (r.or (xml-text^ |1 |10) + (r.or (xml-text^ 1 10) (do r.Monad<Random> - [size (size^ |0 |2)] + [size (size^ 0 2)] ($_ r.and xml-identifier^ - (r.dictionary name.Hash<Name> size xml-identifier^ (xml-text^ |0 |10)) + (r.dictionary name.Hash<Name> size xml-identifier^ (xml-text^ 0 10)) (r.list size gen-xml))))))) (context: "XML." - (<| (times |100) + (<| (times 100) (do @ [sample gen-xml #let [(^open "&/.") &.Equivalence<XML> @@ -78,14 +78,14 @@ )))) (context: "Parsing." - (<| (times |100) + (<| (times 100) (do @ - [text (xml-text^ |1 |10) - num-children (|> r.nat (:: @ map (n/% |5))) - children (r.list num-children (xml-text^ |1 |10)) + [text (xml-text^ 1 10) + num-children (|> r.nat (:: @ map (n/% 5))) + children (r.list num-children (xml-text^ 1 10)) tag xml-identifier^ attr xml-identifier^ - value (xml-text^ |1 |10) + value (xml-text^ 1 10) #let [node (#&.Node tag (dict.put attr value &.attrs) (list/map (|>> #&.Text) children))]] diff --git a/stdlib/test/test/lux/data/lazy.lux b/stdlib/test/test/lux/data/lazy.lux index 416f3dd56..b5918c281 100644 --- a/stdlib/test/test/lux/data/lazy.lux +++ b/stdlib/test/test/lux/data/lazy.lux @@ -9,7 +9,7 @@ lux/test) (context: "Lazy." - (<| (times |100) + (<| (times 100) (do @ [left r.nat right r.nat @@ -27,7 +27,7 @@ )))) (context: "Functor, Apply, Monad." - (<| (times |100) + (<| (times 100) (do @ [sample r.nat] ($_ seq diff --git a/stdlib/test/test/lux/data/name.lux b/stdlib/test/test/lux/data/name.lux index 16ab67f59..53751066d 100644 --- a/stdlib/test/test/lux/data/name.lux +++ b/stdlib/test/test/lux/data/name.lux @@ -16,17 +16,17 @@ (|> (r.unicode size) (r.filter (|>> (text.contains? ".") not)))) (context: "Names" - (<| (times |100) + (<| (times 100) (do @ [## First Name - sizeM1 (|> r.nat (:: @ map (n/% |100))) - sizeN1 (|> r.nat (:: @ map (|>> (n/% |100) (n/max |1)))) + sizeM1 (|> r.nat (:: @ map (n/% 100))) + sizeN1 (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1)))) module1 (gen-part sizeM1) short1 (gen-part sizeN1) #let [name1 [module1 short1]] ## Second Name - sizeM2 (|> r.nat (:: @ map (n/% |100))) - sizeN2 (|> r.nat (:: @ map (|>> (n/% |100) (n/max |1)))) + sizeM2 (|> r.nat (:: @ map (n/% 100))) + sizeN2 (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1)))) module2 (gen-part sizeM2) short2 (gen-part sizeN2) #let [name2 [module2 short2]] diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux index c8e436d1d..36bc9a3f9 100644 --- a/stdlib/test/test/lux/data/number.lux +++ b/stdlib/test/test/lux/data/number.lux @@ -13,7 +13,7 @@ (do-template [category rand-gen <Equivalence> <Order>] [(context: (format "[" category "] " "Equivalence & Order") - (<| (times |100) + (<| (times 100) (do @ [x rand-gen y rand-gen] @@ -30,7 +30,7 @@ (do-template [category rand-gen <Number> <Order>] [(context: (format "[" category "] " "Number") - (<| (times |100) + (<| (times 100) (do @ [x rand-gen #let [(^open ".") <Number> @@ -53,7 +53,7 @@ (do-template [category rand-gen <Enum> <Number> <Order>] [(context: (format "[" category "] " "Enum") - (<| (times |100) + (<| (times 100) (do @ [x rand-gen] (test "" (let [(^open ".") <Number> @@ -75,7 +75,7 @@ (do-template [category rand-gen <Number> <Order> <Interval> <test>] [(context: (format "[" category "] " "Interval") - (<| (times |100) + (<| (times 100) (do @ [x (|> rand-gen (r.filter <test>)) #let [(^open ".") <Number> @@ -92,7 +92,7 @@ (do-template [category rand-gen <Number> <Order> <Monoid> <cap> <test>] [(context: (format "[" category "] " "Monoid") - (<| (times |100) + (<| (times 100) (do @ [x (|> rand-gen (:: @ map (|>> (:: <Number> abs) <cap>)) (r.filter <test>)) #let [(^open ".") <Number> @@ -103,10 +103,10 @@ (= x (compose x identity)) (= identity (compose identity identity)))))))] - ["Nat/Add" r.nat Number<Nat> Order<Nat> Add@Monoid<Nat> (n/% |1000) (function (_ _) #1)] - ["Nat/Mul" r.nat Number<Nat> Order<Nat> Mul@Monoid<Nat> (n/% |1000) (function (_ _) #1)] - ["Nat/Min" r.nat Number<Nat> Order<Nat> Min@Monoid<Nat> (n/% |1000) (function (_ _) #1)] - ["Nat/Max" r.nat Number<Nat> Order<Nat> Max@Monoid<Nat> (n/% |1000) (function (_ _) #1)] + ["Nat/Add" r.nat Number<Nat> Order<Nat> Add@Monoid<Nat> (n/% 1000) (function (_ _) #1)] + ["Nat/Mul" r.nat Number<Nat> Order<Nat> Mul@Monoid<Nat> (n/% 1000) (function (_ _) #1)] + ["Nat/Min" r.nat Number<Nat> Order<Nat> Min@Monoid<Nat> (n/% 1000) (function (_ _) #1)] + ["Nat/Max" r.nat Number<Nat> Order<Nat> Max@Monoid<Nat> (n/% 1000) (function (_ _) #1)] ["Int/Add" r.int Number<Int> Order<Int> Add@Monoid<Int> (i/% +1000) (function (_ _) #1)] ["Int/Mul" r.int Number<Int> Order<Int> Mul@Monoid<Int> (i/% +1000) (function (_ _) #1)] ["Int/Min" r.int Number<Int> Order<Int> Min@Monoid<Int> (i/% +1000) (function (_ _) #1)] @@ -123,7 +123,7 @@ (do-template [<category> <rand-gen> <Equivalence> <Codec>] [(context: (format "[" <category> "] " "Alternative formats") - (<| (times |100) + (<| (times 100) (do @ [x <rand-gen>] (test "Can encode/decode values." @@ -158,10 +158,10 @@ ) (context: "Can convert frac values to/from their bit patterns." - (<| (times |100) + (<| (times 100) (do @ [raw r.frac - factor (|> r.nat (:: @ map (|>> (n/% |1000) (n/max |1)))) + factor (|> r.nat (:: @ map (|>> (n/% 1000) (n/max 1)))) #let [sample (|> factor .int int-to-frac (f/* raw))]] (test "Can convert frac values to/from their bit patterns." (|> sample frac-to-bits bits-to-frac (f/= sample)))))) @@ -169,12 +169,12 @@ (context: "Macros for alternative numeric encodings." ($_ seq (test "Binary." - (and (n/= (bin "|11001001") (bin "|11_00_10_01")) + (and (n/= (bin "11001001") (bin "11_00_10_01")) (i/= (bin "+11001001") (bin "+11_00_10_01")) (r/= (bin ".11001001") (bin ".11_00_10_01")) (f/= (bin "+1100.1001") (bin "+11_00.10_01")))) (test "Octal." - (and (n/= (oct "|615243") (oct "|615_243")) + (and (n/= (oct "615243") (oct "615_243")) (i/= (oct "+615243") (oct "+615_243")) (r/= (oct ".615243") (oct ".615_243")) (f/= (oct "+6152.43") (oct "+615_2.43")))) diff --git a/stdlib/test/test/lux/data/number/complex.lux b/stdlib/test/test/lux/data/number/complex.lux index 994e1cafb..537027710 100644 --- a/stdlib/test/test/lux/data/number/complex.lux +++ b/stdlib/test/test/lux/data/number/complex.lux @@ -26,7 +26,7 @@ (def: gen-dim (r.Random Frac) (do r.Monad<Random> - [factor (|> r.nat (:: @ map (|>> (n/% |1000) (n/max |1)))) + [factor (|> r.nat (:: @ map (|>> (n/% 1000) (n/max 1)))) measure (|> r.frac (r.filter (f/> +0.0)))] (wrap (f/* (|> factor .int int-to-frac) measure)))) @@ -39,7 +39,7 @@ (wrap (&.complex real imaginary)))) (context: "Construction" - (<| (times |100) + (<| (times 100) (do @ [real gen-dim imaginary gen-dim] @@ -55,7 +55,7 @@ )))) (context: "Absolute value" - (<| (times |100) + (<| (times 100) (do @ [real gen-dim imaginary gen-dim] @@ -78,7 +78,7 @@ )))) (context: "Addidion, substraction, multiplication and division" - (<| (times |100) + (<| (times 100) (do @ [x gen-complex y gen-complex @@ -122,7 +122,7 @@ )))) (context: "Conjugate, reciprocal, signum, negation" - (<| (times |100) + (<| (times 100) (do @ [x gen-complex] ($_ seq @@ -162,8 +162,8 @@ (|> normal forward backward (within? margin-of-error normal)))) (context: "Trigonometry" - (<| (seed |17274883666004960943) - ## (times |100) + (<| (seed 17274883666004960943) + ## (times 100) (do @ [angle (|> gen-complex (:: @ map (|>> (update@ #&.real (f/% +1.0)) (update@ #&.imaginary (f/% +1.0)))))] @@ -178,7 +178,7 @@ (trigonometric-symmetry &.tan &.atan angle)))))) (context: "Power 2 and exponential/logarithm" - (<| (times |100) + (<| (times 100) (do @ [x gen-complex] ($_ seq @@ -190,10 +190,10 @@ )))) (context: "Complex roots" - (<| (times |100) + (<| (times 100) (do @ [sample gen-complex - degree (|> r.nat (:: @ map (|>> (n/max |1) (n/% |5))))] + degree (|> r.nat (:: @ map (|>> (n/max 1) (n/% 5))))] (test "Can calculate the N roots for any complex number." (|> sample (&.roots degree) diff --git a/stdlib/test/test/lux/data/number/i64.lux b/stdlib/test/test/lux/data/number/i64.lux index 96a174eaa..62de5e56e 100644 --- a/stdlib/test/test/lux/data/number/i64.lux +++ b/stdlib/test/test/lux/data/number/i64.lux @@ -10,7 +10,7 @@ lux/test) (context: "Bitwise operations." - (<| (times |100) + (<| (times 100) (do @ [pattern r.nat idx (:: @ map (n/% &.width) r.nat)] @@ -20,10 +20,10 @@ (&.count (&.clear idx pattern))) (|> (&.count pattern) (n/- (&.count (&.clear idx pattern))) - (n/<= |1)) + (n/<= 1)) (|> (&.count (&.set idx pattern)) (n/- (&.count pattern)) - (n/<= |1)))) + (n/<= 1)))) (test "Can query whether a bit is set." (and (or (and (&.set? idx pattern) (not (&.set? idx (&.clear idx pattern)))) @@ -39,16 +39,16 @@ (n/+ (&.count pattern) (&.count (&.not pattern))))) (test "Can do simple binary logic." - (and (n/= |0 + (and (n/= 0 (&.and pattern (&.not pattern))) - (n/= (&.not |0) + (n/= (&.not 0) (&.or pattern (&.not pattern))) - (n/= (&.not |0) + (n/= (&.not 0) (&.xor pattern (&.not pattern))) - (n/= |0 + (n/= 0 (&.xor pattern pattern)))) (test "rotate-left and rotate-right are inverses of one another." diff --git a/stdlib/test/test/lux/data/number/ratio.lux b/stdlib/test/test/lux/data/number/ratio.lux index d30278cf5..aa931d688 100644 --- a/stdlib/test/test/lux/data/number/ratio.lux +++ b/stdlib/test/test/lux/data/number/ratio.lux @@ -12,27 +12,27 @@ (def: gen-part (r.Random Nat) - (|> r.nat (:: r.Monad<Random> map (|>> (n/% |1000) (n/max |1))))) + (|> r.nat (:: r.Monad<Random> map (|>> (n/% 1000) (n/max 1))))) (def: gen-ratio (r.Random &.Ratio) (do r.Monad<Random> [numerator gen-part denominator (|> gen-part - (r.filter (|>> (n/= |0) not)) + (r.filter (|>> (n/= 0) not)) (r.filter (|>> (n/= numerator) not)))] (wrap (&.ratio numerator denominator)))) (context: "Normalization" - (<| (times |100) + (<| (times 100) (do @ [denom1 gen-part denom2 gen-part sample gen-ratio] ($_ seq (test "All zeroes are the same." - (&.= (&.ratio |0 denom1) - (&.ratio |0 denom2))) + (&.= (&.ratio 0 denom1) + (&.ratio 0 denom2))) (test "All ratios are built normalized." (|> sample @@ -42,7 +42,7 @@ )))) (context: "Arithmetic" - (<| (times |100) + (<| (times 100) (do @ [x gen-ratio y gen-ratio @@ -67,12 +67,12 @@ (let [remainder (&.% min max) multiple (&.- remainder max) factor (&./ min multiple)] - (and (|> factor (get@ #&.denominator) (n/= |1)) + (and (|> factor (get@ #&.denominator) (n/= 1)) (|> factor (&.* min) (&.+ remainder) (&.= max))))) )))) (context: "Negation, absolute value and signum" - (<| (times |100) + (<| (times 100) (do @ [sample gen-ratio] ($_ seq @@ -90,7 +90,7 @@ )))) (context: "Order" - (<| (times |100) + (<| (times 100) (do @ [x gen-ratio y gen-ratio] @@ -103,7 +103,7 @@ )))) (context: "Codec" - (<| (times |100) + (<| (times 100) (do @ [sample gen-ratio #let [(^open "&/.") &.Codec<Text,Ratio>]] diff --git a/stdlib/test/test/lux/data/sum.lux b/stdlib/test/test/lux/data/sum.lux index 4023c1cc3..96c0518c0 100644 --- a/stdlib/test/test/lux/data/sum.lux +++ b/stdlib/test/test/lux/data/sum.lux @@ -13,25 +13,25 @@ (let [(^open "List/.") (list.Equivalence<List> text.Equivalence<Text>)] ($_ seq (test "Can inject values into Either." - (and (|> (left "Hello") (case> (|0 "Hello") #1 _ #0)) - (|> (right "World") (case> (|1 "World") #1 _ #0)))) + (and (|> (left "Hello") (case> (0 "Hello") #1 _ #0)) + (|> (right "World") (case> (1 "World") #1 _ #0)))) (test "Can discriminate eithers based on their cases." (let [[_lefts _rights] (partition (: (List (| Text Text)) - (list (|0 "+0") (|1 "+1") (|0 "+2"))))] + (list (0 "+0") (1 "+1") (0 "+2"))))] (and (List/= _lefts (lefts (: (List (| Text Text)) - (list (|0 "+0") (|1 "+1") (|0 "+2"))))) + (list (0 "+0") (1 "+1") (0 "+2"))))) (List/= _rights (rights (: (List (| Text Text)) - (list (|0 "+0") (|1 "+1") (|0 "+2")))))))) + (list (0 "+0") (1 "+1") (0 "+2")))))))) (test "Can apply a function to an Either value depending on the case." (and (i/= +10 (either (function (_ _) +10) (function (_ _) +20) - (: (| Text Text) (|0 "")))) + (: (| Text Text) (0 "")))) (i/= +20 (either (function (_ _) +10) (function (_ _) +20) - (: (| Text Text) (|1 "")))))) + (: (| Text Text) (1 "")))))) ))) diff --git a/stdlib/test/test/lux/data/text.lux b/stdlib/test/test/lux/data/text.lux index 3d257cd75..a98eb92e6 100644 --- a/stdlib/test/test/lux/data/text.lux +++ b/stdlib/test/test/lux/data/text.lux @@ -13,21 +13,21 @@ lux/test) (context: "Size" - (<| (times |100) + (<| (times 100) (do @ - [size (:: @ map (n/% |100) r.nat) + [size (:: @ map (n/% 100) r.nat) sample (r.unicode size)] - (test "" (or (and (n/= |0 size) + (test "" (or (and (n/= 0 size) (&.empty? sample)) (n/= size (&.size sample))))))) (def: bounded-size (r.Random Nat) (|> r.nat - (:: r.Monad<Random> map (|>> (n/% |20) (n/+ |1))))) + (:: r.Monad<Random> map (|>> (n/% 20) (n/+ 1))))) (context: "Locations" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size idx (:: @ map (n/% size) r.nat) @@ -56,7 +56,7 @@ )))) (context: "Text functions" - (<| (times |100) + (<| (times 100) (do @ [sizeL bounded-size sizeR bounded-size @@ -83,10 +83,10 @@ _ #0)) - (|> [(&.clip |0 sizeL sample) + (|> [(&.clip 0 sizeL sample) (&.clip sizeL (&.size sample) sample) (&.clip' sizeL sample) - (&.clip' |0 sample)] + (&.clip' 0 sample)] (case> [(#.Right _l) (#.Right _r) (#.Right _r') (#.Right _f)] (and (= sampleL _l) (= sampleR _r) @@ -99,16 +99,16 @@ )))) (context: "More text functions" - (<| (times |100) + (<| (times 100) (do @ [sizeP bounded-size sizeL bounded-size #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 (|> r.nat (:: @ map (|>> (n/% |128) (n/max |1))))] - sep1 (r.text normal-char-gen |1) - sep2 (r.text normal-char-gen |1) + normal-char-gen (|> r.nat (:: @ map (|>> (n/% 128) (n/max 1))))] + sep1 (r.text normal-char-gen 1) + sep2 (r.text normal-char-gen 1) #let [part-gen (|> (r.text normal-char-gen sizeP) (r.filter (|>> (&.contains? sep1) not)))] parts (r.list sizeL part-gen) diff --git a/stdlib/test/test/lux/data/text/format.lux b/stdlib/test/test/lux/data/text/format.lux index adf4cdf7b..bd66712a8 100644 --- a/stdlib/test/test/lux/data/text/format.lux +++ b/stdlib/test/test/lux/data/text/format.lux @@ -12,7 +12,7 @@ ($_ seq (test "Can format common values simply." (and (&/= "#1" (%b #1)) - (&/= "|123" (%n |123)) + (&/= "123" (%n 123)) (&/= "+123" (%i +123)) (&/= "+123.456" (%f +123.456)) (&/= ".5" (%r .5)) diff --git a/stdlib/test/test/lux/data/text/lexer.lux b/stdlib/test/test/lux/data/text/lexer.lux index d413504e0..d87f91eb4 100644 --- a/stdlib/test/test/lux/data/text/lexer.lux +++ b/stdlib/test/test/lux/data/text/lexer.lux @@ -73,9 +73,9 @@ )) (context: "Literals" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) + [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) sample (r.unicode size) non-sample (|> (r.unicode size) (r.filter (|>> (text/= sample) not)))] diff --git a/stdlib/test/test/lux/data/text/regex.lux b/stdlib/test/test/lux/data/text/regex.lux index 1135dbb0c..96f56c3d9 100644 --- a/stdlib/test/test/lux/data/text/regex.lux +++ b/stdlib/test/test/lux/data/text/regex.lux @@ -252,26 +252,26 @@ (context: "Regular Expressions [Alternation]" ($_ seq (test "Can specify alternative patterns." - (and (should-check ["a" (|0 [])] (&.regex "a|b") "a") - (should-check ["b" (|1 [])] (&.regex "a|b") "b") + (and (should-check ["a" (0 [])] (&.regex "a|b") "a") + (should-check ["b" (1 [])] (&.regex "a|b") "b") (should-fail (&.regex "a|b") "c"))) (test "Can have groups within alternations." - (and (should-check ["abc" (|0 ["b" "c"])] (&.regex "a(.)(.)|b(.)(.)") "abc") - (should-check ["bcd" (|1 ["c" "d"])] (&.regex "a(.)(.)|b(.)(.)") "bcd") + (and (should-check ["abc" (0 ["b" "c"])] (&.regex "a(.)(.)|b(.)(.)") "abc") + (should-check ["bcd" (1 ["c" "d"])] (&.regex "a(.)(.)|b(.)(.)") "bcd") (should-fail (&.regex "a(.)(.)|b(.)(.)") "cde") - (should-check ["809-345-6789" (|0 ["809" "345-6789" "345" "6789"])] + (should-check ["809-345-6789" (0 ["809" "345-6789" "345" "6789"])] (&.regex "(\\d{3})-((\\d{3})-(\\d{4}))|b(.)d") "809-345-6789"))) )) (context: "Pattern-matching" - (<| (times |100) + (<| (times 100) (do @ - [sample1 (r.unicode |3) - sample2 (r.unicode |3) - sample3 (r.unicode |4)] + [sample1 (r.unicode 3) + sample2 (r.unicode 3) + sample3 (r.unicode 4)] (case (format sample1 "-" sample2 "-" sample3) (&.^regex "(.{3})-(.{3})-(.{4})" [_ match1 match2 match3]) diff --git a/stdlib/test/test/lux/host.jvm.lux b/stdlib/test/test/lux/host.jvm.lux index d6b125657..49a229d11 100644 --- a/stdlib/test/test/lux/host.jvm.lux +++ b/stdlib/test/test/lux/host.jvm.lux @@ -59,7 +59,7 @@ ([] foo [boolean String] void #throws [Exception])) (context: "Conversions" - (<| (times |100) + (<| (times 100) (do @ [sample r.int] (with-expansions @@ -108,9 +108,9 @@ )) (context: "Arrays" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |1)))) + [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1)))) idx (|> r.nat (:: @ map (n/% size))) value r.int] ($_ seq diff --git a/stdlib/test/test/lux/macro/poly/equivalence.lux b/stdlib/test/test/lux/macro/poly/equivalence.lux index 5d7cfee64..8b10dc738 100644 --- a/stdlib/test/test/lux/macro/poly/equivalence.lux +++ b/stdlib/test/test/lux/macro/poly/equivalence.lux @@ -48,7 +48,7 @@ (def: gen-record (r.Random Record) (do r.Monad<Random> - [size (:: @ map (n/% |2) r.nat) + [size (:: @ map (n/% 2) r.nat) #let [gen-int (|> r.int (:: @ map (|>> int/abs (i/% +1_000_000))))]] ($_ r.and r.bit @@ -65,7 +65,7 @@ ## [Tests] (context: "Equivalence polytypism" - (<| (times |100) + (<| (times 100) (do @ [sample gen-record #let [(^open "&/.") Equivalence<Record>]] diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index 63d592251..b1e2f445b 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -73,7 +73,7 @@ (enforced? (s.this (<ctor> <value>)) (list (<ctor> <value>)))))] ["Can parse Bit syntax." #1 code.bit bit.Equivalence<Bit> s.bit] - ["Can parse Nat syntax." |123 code.nat number.Equivalence<Nat> s.nat] + ["Can parse Nat syntax." 123 code.nat number.Equivalence<Nat> s.nat] ["Can parse Int syntax." +123 code.int number.Equivalence<Int> s.int] ["Can parse Rev syntax." .123 code.rev number.Equivalence<Rev> s.rev] ["Can parse Frac syntax." +123.0 code.frac number.Equivalence<Frac> s.frac] diff --git a/stdlib/test/test/lux/math.lux b/stdlib/test/test/lux/math.lux index 83ed1f8b0..4cdb8eed5 100644 --- a/stdlib/test/test/lux/math.lux +++ b/stdlib/test/test/lux/math.lux @@ -22,7 +22,7 @@ (|> normal forward backward (within? margin normal)))) (context: "Trigonometry" - (<| (times |100) + (<| (times 100) (do @ [angle (|> r.frac (:: @ map (f/* &.tau)))] ($_ seq @@ -37,7 +37,7 @@ )))) (context: "Rounding" - (<| (times |100) + (<| (times 100) (do @ [sample (|> r.frac (:: @ map (f/* +1000.0)))] ($_ seq @@ -60,34 +60,34 @@ )))) (context: "Exponentials and logarithms" - (<| (times |100) + (<| (times 100) (do @ [sample (|> r.frac (:: @ map (f/* +10.0)))] (test "Logarithm is the inverse of exponential." (|> sample &.exp &.log (within? +1.0e-15 sample)))))) (context: "Greatest-Common-Divisor and Least-Common-Multiple" - (<| (times |100) + (<| (times 100) (do @ - [#let [gen-nat (|> r.nat (:: @ map (|>> (n/% |1000) (n/max |1))))] + [#let [gen-nat (|> r.nat (:: @ map (|>> (n/% 1000) (n/max 1))))] x gen-nat y gen-nat] ($_ seq (test "GCD" (let [gcd (&.n/gcd x y)] - (and (n/= |0 (n/% gcd x)) - (n/= |0 (n/% gcd y)) - (n/>= |1 gcd)))) + (and (n/= 0 (n/% gcd x)) + (n/= 0 (n/% gcd y)) + (n/>= 1 gcd)))) (test "LCM" (let [lcm (&.n/lcm x y)] - (and (n/= |0 (n/% x lcm)) - (n/= |0 (n/% y lcm)) + (and (n/= 0 (n/% x lcm)) + (n/= 0 (n/% y lcm)) (n/<= (n/* x y) lcm)))) )))) (context: "Infix syntax" - (<| (times |100) + (<| (times 100) (do @ [x r.nat y r.nat @@ -109,8 +109,8 @@ (&.infix [&.sin theta]))) (test "Can use regular syntax in the middle of infix code." - (n/= (&.n/gcd |450 (n/* |3 |9)) - (&.infix [(n/* |3 |9) &.n/gcd |450]))) + (n/= (&.n/gcd 450 (n/* 3 9)) + (&.infix [(n/* 3 9) &.n/gcd 450]))) (test "Can use non-numerical functions/macros as operators." (bit/= (and (n/< y x) (n/< z y)) diff --git a/stdlib/test/test/lux/math/logic/continuous.lux b/stdlib/test/test/lux/math/logic/continuous.lux index 02329d05d..b9db253f6 100644 --- a/stdlib/test/test/lux/math/logic/continuous.lux +++ b/stdlib/test/test/lux/math/logic/continuous.lux @@ -9,7 +9,7 @@ lux/test) (context: "Operations" - (<| (times |100) + (<| (times 100) (do @ [left r.rev right r.rev] diff --git a/stdlib/test/test/lux/math/logic/fuzzy.lux b/stdlib/test/test/lux/math/logic/fuzzy.lux index ad23d2eb9..fe36a58c5 100644 --- a/stdlib/test/test/lux/math/logic/fuzzy.lux +++ b/stdlib/test/test/lux/math/logic/fuzzy.lux @@ -19,9 +19,9 @@ (do-template [<desc> <hash> <gen> <triangle> <lt> <lte> <gt> <gte>] [(context: (format "[" <desc> "] " "Triangles") - (<| (times |100) + (<| (times 100) (do @ - [values (r.set <hash> |3 <gen>) + [values (r.set <hash> 3 <gen>) #let [[x y z] (case (set.to-list values) (^ (list x y z)) [x y z] @@ -60,9 +60,9 @@ (do-template [<desc> <hash> <gen> <trapezoid> <lt> <lte> <gt> <gte>] [(context: (format "[" <desc> "] " "Trapezoids") - (<| (times |100) + (<| (times 100) (do @ - [values (r.set <hash> |4 <gen>) + [values (r.set <hash> 4 <gen>) #let [[w x y z] (case (set.to-list values) (^ (list w x y z)) [w x y z] @@ -114,7 +114,7 @@ (wrap (&.triangle x y z)))) (context: "Combinators" - (<| (times |100) + (<| (times 100) (do @ [left gen-triangle right gen-triangle @@ -148,10 +148,10 @@ )))) (context: "From predicates and sets" - (<| (times |100) + (<| (times 100) (do @ - [#let [set-10 (set.from-list number.Hash<Nat> (list.n/range |0 |10))] - sample (|> r.nat (:: @ map (n/% |20)))] + [#let [set-10 (set.from-list number.Hash<Nat> (list.n/range 0 10))] + sample (|> r.nat (:: @ map (n/% 20)))] ($_ seq (test "Values that satisfy a predicate have membership = 1. Values that don't have membership = 0." @@ -165,7 +165,7 @@ )))) (context: "Thresholds" - (<| (times |100) + (<| (times 100) (do @ [fuzzy gen-triangle sample r.rev diff --git a/stdlib/test/test/lux/math/modular.lux b/stdlib/test/test/lux/math/modular.lux index 43f7d178e..559928304 100644 --- a/stdlib/test/test/lux/math/modular.lux +++ b/stdlib/test/test/lux/math/modular.lux @@ -60,7 +60,7 @@ (/.m/= (m/! param subject))))) (context: "Modular arithmetic." - (<| (times |100) + (<| (times 100) (do @ [_normalM modulusR _alternativeM (|> modulusR (r.filter (|>> (i/= _normalM) not))) diff --git a/stdlib/test/test/lux/math/random.lux b/stdlib/test/test/lux/math/random.lux index 5085855e6..f3f118c90 100644 --- a/stdlib/test/test/lux/math/random.lux +++ b/stdlib/test/test/lux/math/random.lux @@ -17,9 +17,9 @@ lux/test) (context: "Random." - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) + [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) _list (r.list size r.nat) _row (r.row size r.nat) _array (r.array size r.nat) diff --git a/stdlib/test/test/lux/time/date.lux b/stdlib/test/test/lux/time/date.lux index 600f67b87..602ecc78f 100644 --- a/stdlib/test/test/lux/time/date.lux +++ b/stdlib/test/test/lux/time/date.lux @@ -30,7 +30,7 @@ (random/wrap #@.December)))))) (context: "(Month) Equivalence." - (<| (times |100) + (<| (times 100) (do @ [sample month #let [(^open "@/.") @.Equivalence<Month>]] @@ -38,7 +38,7 @@ (@/= sample sample))))) (context: "(Month) Order." - (<| (times |100) + (<| (times 100) (do @ [reference month sample month @@ -50,7 +50,7 @@ (@/<= reference sample))))))) (context: "(Month) Enum." - (<| (times |100) + (<| (times 100) (do @ [sample month #let [(^open "@/.") @.Enum<Month>]] @@ -73,7 +73,7 @@ (random/wrap #@.Saturday)))) (context: "(Day) Equivalence." - (<| (times |100) + (<| (times 100) (do @ [sample day #let [(^open "@/.") @.Equivalence<Day>]] @@ -81,7 +81,7 @@ (@/= sample sample))))) (context: "(Day) Order." - (<| (times |100) + (<| (times 100) (do @ [reference day sample day @@ -93,7 +93,7 @@ (@/<= reference sample))))))) (context: "(Day) Enum." - (<| (times |100) + (<| (times 100) (do @ [sample day #let [(^open "@/.") @.Enum<Day>]] @@ -110,7 +110,7 @@ (|> _instant.instant (:: r.Monad<Random> map @instant.date))) (context: "(Date) Equivalence." - (<| (times |100) + (<| (times 100) (do @ [sample date #let [(^open "@/.") @.Equivalence<Date>]] @@ -118,7 +118,7 @@ (@/= sample sample))))) (context: "(Date) Order." - (<| (times |100) + (<| (times 100) (do @ [reference date sample date @@ -130,8 +130,8 @@ (@/<= reference sample))))))) (context: "(Date) Codec" - (<| (seed |6623983470548808292) - ## (times |100) + (<| (seed 6623983470548808292) + ## (times 100) (do @ [sample date #let [(^open "@/.") @.Equivalence<Date> diff --git a/stdlib/test/test/lux/time/duration.lux b/stdlib/test/test/lux/time/duration.lux index 0f8c9f553..1231fb563 100644 --- a/stdlib/test/test/lux/time/duration.lux +++ b/stdlib/test/test/lux/time/duration.lux @@ -16,14 +16,14 @@ (|> r.int (:: r.Monad<Random> map @.from-millis))) (context: "Conversion." - (<| (times |100) + (<| (times 100) (do @ [millis r.int] (test "Can convert from/to milliseconds." (|> millis @.from-millis @.to-millis (i/= millis)))))) (context: "Equivalence." - (<| (times |100) + (<| (times 100) (do @ [sample duration #let [(^open "@/.") @.Equivalence<Duration>]] @@ -31,7 +31,7 @@ (@/= sample sample))))) (context: "Order." - (<| (times |100) + (<| (times 100) (do @ [reference duration sample duration @@ -43,7 +43,7 @@ (@/<= reference sample))))))) (context: "Arithmetic." - (<| (times |100) + (<| (times 100) (do @ [sample (|> duration (:: @ map (@.frame @.day))) frame duration @@ -74,7 +74,7 @@ frame)))))))))) (context: "Codec" - (<| (times |100) + (<| (times 100) (do @ [sample duration #let [(^open "@/.") @.Equivalence<Duration> diff --git a/stdlib/test/test/lux/time/instant.lux b/stdlib/test/test/lux/time/instant.lux index db4898e20..734456765 100644 --- a/stdlib/test/test/lux/time/instant.lux +++ b/stdlib/test/test/lux/time/instant.lux @@ -25,14 +25,14 @@ (|> r.int (:: r.Monad<Random> map (|>> (i/% boundary) @.from-millis)))) (context: "Conversion." - (<| (times |100) + (<| (times 100) (do @ [millis r.int] (test "Can convert from/to milliseconds." (|> millis @.from-millis @.to-millis (i/= millis)))))) (context: "Equivalence." - (<| (times |100) + (<| (times 100) (do @ [sample instant #let [(^open "@/.") @.Equivalence<Instant>]] @@ -40,7 +40,7 @@ (@/= sample sample))))) (context: "Order" - (<| (times |100) + (<| (times 100) (do @ [reference instant sample instant @@ -52,7 +52,7 @@ (@/<= reference sample))))))) (context: "Enum" - (<| (times |100) + (<| (times 100) (do @ [sample instant #let [(^open "@/.") @.Enum<Instant>]] @@ -65,7 +65,7 @@ (|> sample @/pred @/succ (@/= sample))))))) (context: "Arithmetic" - (<| (times |100) + (<| (times 100) (do @ [sample instant span _duration.duration @@ -82,8 +82,8 @@ (|> @.epoch (@.shift (@.relative sample)) (@/= sample))))))) ## (context: "Codec" -## (<| (seed |9863552679229274604) -## ## (times |100) +## (<| (seed 9863552679229274604) +## ## (times 100) ## (do @ ## [sample instant ## #let [(^open "@/.") @.Equivalence<Instant> diff --git a/stdlib/test/test/lux/type.lux b/stdlib/test/test/lux/type.lux index cd335e420..e8de83c56 100644 --- a/stdlib/test/test/lux/type.lux +++ b/stdlib/test/test/lux/type.lux @@ -18,7 +18,7 @@ (def: #export gen-short (r.Random Text) (do r.Monad<Random> - [size (|> r.nat (:: @ map (n/% |10)))] + [size (|> r.nat (:: @ map (n/% 10)))] (r.unicode size))) (def: #export gen-name @@ -48,7 +48,7 @@ ## [Tests] (context: "Types" - (<| (times |100) + (<| (times 100) (do @ [sample gen-type] (test "Every type is equal to itself." @@ -84,9 +84,9 @@ (&.un-name aliased))))))) (context: "Type construction [structs]" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (n/% |3))) + [size (|> r.nat (:: @ map (n/% 3))) members (|> gen-type (r.filter (function (_ type) (case type @@ -115,9 +115,9 @@ ))))) (context: "Type construction [parameterized]" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (n/% |3))) + [size (|> r.nat (:: @ map (n/% 3))) members (M.seq @ (list.repeat size gen-type)) extra (|> gen-type (r.filter (function (_ type) @@ -141,9 +141,9 @@ )))) (context: "Type construction [higher order]" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (n/% |3))) + [size (|> r.nat (:: @ map (n/% 3))) extra (|> gen-type (r.filter (function (_ type) (case type diff --git a/stdlib/test/test/lux/type/check.lux b/stdlib/test/test/lux/type/check.lux index 1ea83a10e..c5700f8cb 100644 --- a/stdlib/test/test/lux/type/check.lux +++ b/stdlib/test/test/lux/type/check.lux @@ -50,7 +50,7 @@ ## [Tests] (context: "Any and Nothing." - (<| (times |100) + (<| (times 100) (do @ [sample (|> //.gen-type (r.filter valid-type?))] ($_ seq @@ -98,7 +98,7 @@ )) (context: "Type application." - (<| (times |100) + (<| (times 100) (do @ [meta //.gen-type data //.gen-type] @@ -109,7 +109,7 @@ (|> Ann (#.Apply meta) (#.Apply data)))))))) (context: "Primitive types." - (<| (times |100) + (<| (times 100) (do @ [nameL //.gen-short nameR (|> //.gen-short (r.filter (|>> (text/= nameL) not))) @@ -177,9 +177,9 @@ (wrap [[head-id head-type] ids+types [tail-id tail-type]]))) (context: "Rings of type variables." - (<| (times |100) + (<| (times 100) (do @ - [num-connections (|> r.nat (:: @ map (n/% |100))) + [num-connections (|> r.nat (:: @ map (n/% 100))) boundT (|> //.gen-type (r.filter (|>> (case> (#.Var _) #0 _ #1)))) pick-pcg (r.and r.nat r.nat)] ($_ seq @@ -227,7 +227,7 @@ headRR-post (@.ring head-idR)] (@.assert "" (let [same-rings? (:: set.Equivalence<Set> = headRL-post headRR-post) - expected-size? (n/= (n/* |2 (inc num-connections)) + expected-size? (n/= (n/* 2 (inc num-connections)) (set.size headRL-post)) union? (:: set.Equivalence<Set> = headRL-post (set.union headRL-pre headRR-pre))] (and same-rings? diff --git a/stdlib/test/test/lux/type/implicit.lux b/stdlib/test/test/lux/type/implicit.lux index daf259609..669d720c2 100644 --- a/stdlib/test/test/lux/type/implicit.lux +++ b/stdlib/test/test/lux/type/implicit.lux @@ -15,7 +15,7 @@ lux/test) (context: "Automatic structure selection" - (<| (times |100) + (<| (times 100) (do @ [x r.nat y r.nat] @@ -24,17 +24,17 @@ (let [(^open "list/.") (list.Equivalence<List> number.Equivalence<Nat>)] (and (bit/= (:: number.Equivalence<Nat> = x y) (::: = x y)) - (list/= (list.n/range |1 |10) - (::: map inc (list.n/range |0 |9))) + (list/= (list.n/range 1 10) + (::: map inc (list.n/range 0 9))) ))) (test "Can automatically select second-order structures." (::: = - (list.n/range |1 |10) - (list.n/range |1 |10))) + (list.n/range 1 10) + (list.n/range 1 10))) (test "Can automatically select third-order structures." - (let [lln (::: map (list.n/range |1) - (list.n/range |1 |10))] + (let [lln (::: map (list.n/range 1) + (list.n/range 1 10))] (::: = lln lln))) )))) diff --git a/stdlib/test/test/lux/type/resource.lux b/stdlib/test/test/lux/type/resource.lux index b3eabd995..cf6d49b17 100644 --- a/stdlib/test/test/lux/type/resource.lux +++ b/stdlib/test/test/lux/type/resource.lux @@ -11,37 +11,37 @@ (context: "Sub-structural typing." ($_ seq (test "Can produce and consume keys in an ordered manner." - (<| (n/= (n/+ |123 |456)) + (<| (n/= (n/+ 123 456)) io.run resource.run-sync (do resource.IxMonad<Sync> - [res|left (resource.ordered-sync |123) - res|right (resource.ordered-sync |456) + [res|left (resource.ordered-sync 123) + res|right (resource.ordered-sync 456) right (resource.read-sync res|right) left (resource.read-sync res|left)] (wrap (n/+ left right))))) (test "Can exchange commutative keys." - (<| (n/= (n/+ |123 |456)) + (<| (n/= (n/+ 123 456)) io.run resource.run-sync (do resource.IxMonad<Sync> - [res|left (resource.commutative-sync |123) - res|right (resource.commutative-sync |456) - _ (resource.exchange-sync [|1 |0]) + [res|left (resource.commutative-sync 123) + res|right (resource.commutative-sync 456) + _ (resource.exchange-sync [1 0]) left (resource.read-sync res|left) right (resource.read-sync res|right)] (wrap (n/+ left right))))) (test "Can group and un-group keys." - (<| (n/= (n/+ |123 |456)) + (<| (n/= (n/+ 123 456)) io.run resource.run-sync (do resource.IxMonad<Sync> - [res|left (resource.commutative-sync |123) - res|right (resource.commutative-sync |456) - _ (resource.group-sync |2) - _ (resource.un-group-sync |2) + [res|left (resource.commutative-sync 123) + res|right (resource.commutative-sync 456) + _ (resource.group-sync 2) + _ (resource.un-group-sync 2) right (resource.read-sync res|right) left (resource.read-sync res|left)] (wrap (n/+ left right))))) diff --git a/stdlib/test/test/lux/world/binary.lux b/stdlib/test/test/lux/world/binary.lux index b5b625f50..a6a6df9d6 100644 --- a/stdlib/test/test/lux/world/binary.lux +++ b/stdlib/test/test/lux/world/binary.lux @@ -30,7 +30,7 @@ (def: #export (binary size) (-> Nat (r.Random /.Binary)) (let [output (/.create size)] - (loop [idx |0] + (loop [idx 0] (if (n/< size idx) (do r.Monad<Random> [byte r.nat] @@ -40,19 +40,19 @@ (def: (bits-io bytes read write value) (-> Nat (-> Nat /.Binary (e.Error Nat)) (-> Nat Nat /.Binary (e.Error Any)) Nat Bit) - (let [binary (/.create |8) - bits (n/* |8 bytes) - capped-value (|> |1 (i64.left-shift bits) dec (i64.and value))] + (let [binary (/.create 8) + bits (n/* 8 bytes) + capped-value (|> 1 (i64.left-shift bits) dec (i64.and value))] (succeed (do e.Monad<Error> - [_ (write |0 value binary) - output (read |0 binary)] + [_ (write 0 value binary) + output (read 0 binary)] (wrap (n/= capped-value output)))))) (context: "Binary." - (<| (times |100) + (<| (times 100) (do @ - [#let [gen-size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |8))))] + [#let [gen-size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 8))))] binary-size gen-size random-binary (binary binary-size) value r.nat @@ -65,17 +65,17 @@ (test "Can get size of binary." (|> random-binary /.size (n/= binary-size))) (test "Can read/write 8-bit values." - (bits-io |1 /.read/8 /.write/8 value)) + (bits-io 1 /.read/8 /.write/8 value)) (test "Can read/write 16-bit values." - (bits-io |2 /.read/16 /.write/16 value)) + (bits-io 2 /.read/16 /.write/16 value)) (test "Can read/write 32-bit values." - (bits-io |4 /.read/32 /.write/32 value)) + (bits-io 4 /.read/32 /.write/32 value)) (test "Can read/write 64-bit values." - (bits-io |8 /.read/64 /.write/64 value)) + (bits-io 8 /.read/64 /.write/64 value)) (test "Can slice binaries." (let [slice-size (|> to (n/- from) inc) random-slice (e.assume (/.slice from to random-binary)) - idxs (list.n/range |0 (dec slice-size)) + idxs (list.n/range 0 (dec slice-size)) reader (function (_ binary idx) (/.read/8 idx binary))] (and (n/= slice-size (/.size random-slice)) (case [(monad.map e.Monad<Error> (reader random-slice) idxs) diff --git a/stdlib/test/test/lux/world/file.lux b/stdlib/test/test/lux/world/file.lux index 857b6afb5..b9bd2457a 100644 --- a/stdlib/test/test/lux/world/file.lux +++ b/stdlib/test/test/lux/world/file.lux @@ -27,7 +27,7 @@ (context: "File system." (do @ - [file-size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) + [file-size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) dataL (_binary.binary file-size) dataR (_binary.binary file-size) code r.nat @@ -37,7 +37,7 @@ instant.absolute)))] ($_ seq (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |0 code)))] + [#let [file (format "temp_file_" (%n (n/+ 0 code)))] result (promise.future (do (:: @.JVM@System &monad) [pre! (@.exists? @.JVM@System file) @@ -50,7 +50,7 @@ (assert "Can create/delete files." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |1 code)))] + [#let [file (format "temp_file_" (%n (n/+ 1 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System write dataL file) @@ -60,7 +60,7 @@ (assert "Can write/read files." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |2 code)))] + [#let [file (format "temp_file_" (%n (n/+ 2 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System write dataL file) @@ -70,7 +70,7 @@ (assert "Can read file size." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |3 code)))] + [#let [file (format "temp_file_" (%n (n/+ 3 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System write dataL file) @@ -78,13 +78,13 @@ output (:: @.JVM@System read file) read-size (:: @.JVM@System size file) _ (:: @.JVM@System delete file)] - (wrap (and (n/= (n/* |2 file-size) read-size) - (:: binary.Equivalence<Binary> = dataL (error.assume (binary.slice |0 (dec file-size) output))) + (wrap (and (n/= (n/* 2 file-size) read-size) + (:: binary.Equivalence<Binary> = dataL (error.assume (binary.slice 0 (dec file-size) output))) (:: binary.Equivalence<Binary> = dataR (error.assume (binary.slice file-size (dec read-size) output)))))))] (assert "Can append to files." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [dir (format "temp_dir_" (%n (n/+ |4 code)))] + [#let [dir (format "temp_dir_" (%n (n/+ 4 code)))] result (promise.future (do (:: @.JVM@System &monad) [pre! (@.exists? @.JVM@System dir) @@ -97,8 +97,8 @@ (assert "Can create/delete directories." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |5 code))) - dir (format "temp_dir_" (%n (n/+ |5 code)))] + [#let [file (format "temp_file_" (%n (n/+ 5 code))) + dir (format "temp_dir_" (%n (n/+ 5 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System write dataL file) @@ -114,8 +114,8 @@ (assert "Can differentiate files from directories." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |6 code))) - dir (format "temp_dir_" (%n (n/+ |6 code)))] + [#let [file (format "temp_file_" (%n (n/+ 6 code))) + dir (format "temp_dir_" (%n (n/+ 6 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System make-directory dir) @@ -128,8 +128,8 @@ (assert "Can create files inside of directories." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |7 code))) - dir (format "temp_dir_" (%n (n/+ |7 code)))] + [#let [file (format "temp_file_" (%n (n/+ 7 code))) + dir (format "temp_dir_" (%n (n/+ 7 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System make-directory dir) @@ -147,7 +147,7 @@ (assert "Can list files inside a directory." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |8 code)))] + [#let [file (format "temp_file_" (%n (n/+ 8 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System write dataL file) @@ -158,8 +158,8 @@ (assert "Can change the time of last modification." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [file0 (format "temp_file_" (%n (n/+ |9 code)) "+0") - file1 (format "temp_file_" (%n (n/+ |9 code)) "+1")] + [#let [file0 (format "temp_file_" (%n (n/+ 9 code)) "+0") + file1 (format "temp_file_" (%n (n/+ 9 code)) "+1")] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System write dataL file0) diff --git a/stdlib/test/test/lux/world/net/tcp.lux b/stdlib/test/test/lux/world/net/tcp.lux index fb2ea3649..7520a2fbc 100644 --- a/stdlib/test/test/lux/world/net/tcp.lux +++ b/stdlib/test/test/lux/world/net/tcp.lux @@ -27,13 +27,13 @@ (r.Random net.Port) (|> r.nat (:: r.Monad<Random> map - (|>> (n/% |1000) - (n/+ |8000))))) + (|>> (n/% 1000) + (n/+ 8000))))) (context: "TCP networking." (do @ [port ..port - size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) + size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) from (_binary.binary size) to (_binary.binary size) #let [temp-from (binary.create size) @@ -46,18 +46,18 @@ (P.promise #.Nil)) _ (frp/map (function (_ socket) (do @ - [bytes-from (@.read temp-from |0 size socket) + [bytes-from (@.read temp-from 0 size socket) #let [_ (io.run (P.resolve (#E.Success (and (n/= size bytes-from) (:: binary.Equivalence<Binary> = from temp-from))) from-worked?))]] - (@.write to |0 size socket))) + (@.write to 0 size socket))) server)] client (@.client localhost port) - _ (@.write from |0 size client) + _ (@.write from 0 size client) from-worked? from-worked? #################### - bytes-to (@.read temp-to |0 size client) + bytes-to (@.read temp-to 0 size client) #let [to-worked? (and (n/= size bytes-to) (:: binary.Equivalence<Binary> = to temp-to))] #################### diff --git a/stdlib/test/test/lux/world/net/udp.lux b/stdlib/test/test/lux/world/net/udp.lux index 8365452a1..497cef8f3 100644 --- a/stdlib/test/test/lux/world/net/udp.lux +++ b/stdlib/test/test/lux/world/net/udp.lux @@ -24,13 +24,13 @@ (r.Random net.Port) (|> r.nat (:: r.Monad<Random> map - (|>> (n/% |1000) - (n/+ |8000))))) + (|>> (n/% 1000) + (n/+ 8000))))) (context: "UDP networking." (do @ [port ..port - size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) + size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) from (_binary.binary size) to (_binary.binary size) #let [temp (binary.create size)]] @@ -40,13 +40,13 @@ [server (@.server port) client (@.client []) #################### - _ (@.write localhost port from |0 size client) - [bytes-from from-address from-port] (@.read temp |0 size server) + _ (@.write localhost port from 0 size client) + [bytes-from from-address from-port] (@.read temp 0 size server) #let [from-worked? (and (n/= size bytes-from) (:: binary.Equivalence<Binary> = from temp))] #################### - _ (@.write from-address from-port to |0 size server) - [bytes-to to-address to-port] (@.read temp |0 size client) + _ (@.write from-address from-port to 0 size server) + [bytes-to to-address to-port] (@.read temp 0 size client) #let [to-worked? (and (n/= size bytes-to) (:: binary.Equivalence<Binary> = to temp) (n/= port to-port))] |