From 5d4583aebd00adced10275b32ff1a93ab418be50 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 28 Jul 2021 04:48:42 -0400 Subject: Re-named List's tags: Nil => End && Cons => Item --- .../specification/compositor/generation/common.lux | 114 ++++++++++----------- 1 file changed, 57 insertions(+), 57 deletions(-) (limited to 'stdlib/source/specification/compositor/generation/common.lux') diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index bea185b99..1ef9f780b 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -30,14 +30,14 @@ (def: safe (-> Text Text) - (text.replace-all " " "_")) + (text.replace_all " " "_")) (def: (bit run) (-> Runner Test) (do r.monad [param r.i64 subject r.i64] - (with-expansions [ (template [ ] + (with_expansions [ (template [ ] [(_.test (|> (#synthesis.Extension (list (synthesis.i64 param) (synthesis.i64 subject))) @@ -47,30 +47,30 @@ (#try.Failure _) false) - (let [param ])))] + (let [param ])))] ["lux i64 and" i64.and param] ["lux i64 or" i64.or param] ["lux i64 xor" i64.xor param] - ["lux i64 left-shift" i64.left-shift (n.% 64 param)] - ["lux i64 logical-right-shift" i64.logic-right-shift (n.% 64 param)] + ["lux i64 left-shift" i64.left_shift (n.% 64 param)] + ["lux i64 logical-right-shift" i64.logic_right_shift (n.% 64 param)] )] - ($_ _.and - - (_.test "lux i64 arithmetic-right-shift" - (|> (#synthesis.Extension "lux i64 arithmetic-right-shift" - (list (synthesis.i64 subject) - (synthesis.i64 param))) - (run (..safe "lux i64 arithmetic-right-shift")) - (case> (#try.Success valueT) - ("lux i64 =" - (i64.arithmetic-right-shift param subject) - (:as I64 valueT)) - - (#try.Failure _) - false) - (let [param (n.% 64 param)]))) - )))) + ($_ _.and + + (_.test "lux i64 arithmetic-right-shift" + (|> (#synthesis.Extension "lux i64 arithmetic-right-shift" + (list (synthesis.i64 subject) + (synthesis.i64 param))) + (run (..safe "lux i64 arithmetic-right-shift")) + (case> (#try.Success valueT) + ("lux i64 =" + (i64.arithmetic_right_shift param subject) + (:as I64 valueT)) + + (#try.Failure _) + false) + (let [param (n.% 64 param)]))) + )))) (def: (i64 run) (-> Runner Test) @@ -78,7 +78,7 @@ [param (|> r.i64 (r.only (|>> ("lux i64 =" 0) not))) subject r.i64] (`` ($_ _.and - (~~ (template [ ] + (~~ (template [ ] [(_.test (|> (#synthesis.Extension (list (synthesis.i64 subject))) (run (..safe )) @@ -87,12 +87,12 @@ (#try.Failure _) false) - (let [subject ])))] + (let [subject ])))] ["lux i64 f64" Frac i.frac f.= subject] - ["lux i64 char" Text (|>> (:as Nat) text.from-code) text\= (|> subject + ["lux i64 char" Text (|>> (:as Nat) text.from_code) text\= (|> subject (:as Nat) - (n.% (i64.left-shift 8 1)) + (n.% (i64.left_shift 8 1)) (:as Int))] )) (~~ (template [ ] @@ -116,15 +116,15 @@ )) )))) -(def: simple-frac +(def: simple_frac (Random Frac) (|> r.nat (\ r.monad map (|>> (n.% 1000) .int i.frac)))) (def: (f64 run) (-> Runner Test) (do r.monad - [param (|> ..simple-frac (r.only (|>> (f.= +0.0) not))) - subject ..simple-frac] + [param (|> ..simple_frac (r.only (|>> (f.= +0.0) not))) + subject ..simple_frac] (`` ($_ _.and (~~ (template [ ] [(_.test @@ -175,30 +175,30 @@ (def: (text run) (-> Runner Test) (do {! r.monad} - [sample-size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 1)))) - sample-lower (r.ascii/lower-alpha sample-size) - sample-upper (r.ascii/upper-alpha sample-size) - sample-alpha (|> (r.ascii/alpha sample-size) - (r.only (|>> (text\= sample-upper) not))) - char-idx (|> r.nat (\ ! map (n.% sample-size))) - #let [sample-lowerS (synthesis.text sample-lower) - sample-upperS (synthesis.text sample-upper) - sample-alphaS (synthesis.text sample-alpha) - concatenatedS (#synthesis.Extension "lux text concat" (list sample-lowerS sample-upperS)) - pre-rep-once (format sample-lower sample-upper) - post-rep-once (format sample-lower sample-alpha) - pre-rep-all (|> (list.repeat sample-size sample-lower) (text.join-with sample-upper)) - post-rep-all (|> (list.repeat sample-size sample-lower) (text.join-with sample-alpha))]] + [sample_size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 1)))) + sample_lower (r.ascii/lower_alpha sample_size) + sample_upper (r.ascii/upper_alpha sample_size) + sample_alpha (|> (r.ascii/alpha sample_size) + (r.only (|>> (text\= sample_upper) not))) + char_idx (|> r.nat (\ ! map (n.% sample_size))) + #let [sample_lowerS (synthesis.text sample_lower) + sample_upperS (synthesis.text sample_upper) + sample_alphaS (synthesis.text sample_alpha) + concatenatedS (#synthesis.Extension "lux text concat" (list sample_lowerS sample_upperS)) + pre_rep_once (format sample_lower sample_upper) + post_rep_once (format sample_lower sample_alpha) + pre_rep_all (|> (list.repeat sample_size sample_lower) (text.join_with sample_upper)) + post_rep_all (|> (list.repeat sample_size sample_lower) (text.join_with sample_alpha))]] ($_ _.and (_.test "Can compare texts for equality." - (and (|> (#synthesis.Extension "lux text =" (list sample-lowerS sample-lowerS)) + (and (|> (#synthesis.Extension "lux text =" (list sample_lowerS sample_lowerS)) (run (..safe "lux text =")) (case> (#try.Success valueV) (:as Bit valueV) _ false)) - (|> (#synthesis.Extension "lux text =" (list sample-upperS sample-lowerS)) + (|> (#synthesis.Extension "lux text =" (list sample_upperS sample_lowerS)) (run (..safe "lux text =")) (case> (#try.Success valueV) (not (:as Bit valueV)) @@ -206,7 +206,7 @@ _ false)))) (_.test "Can compare texts for order." - (|> (#synthesis.Extension "lux text <" (list sample-lowerS sample-upperS)) + (|> (#synthesis.Extension "lux text <" (list sample_lowerS sample_upperS)) (run (..safe "lux text <")) (case> (#try.Success valueV) (:as Bit valueV) @@ -214,10 +214,10 @@ (#try.Failure _) false))) (_.test "Can get length of text." - (|> (#synthesis.Extension "lux text size" (list sample-lowerS)) + (|> (#synthesis.Extension "lux text size" (list sample_lowerS)) (run (..safe "lux text size")) (case> (#try.Success valueV) - (n.= sample-size (:as Nat valueV)) + (n.= sample_size (:as Nat valueV)) _ false))) @@ -225,13 +225,13 @@ (|> (#synthesis.Extension "lux text size" (list concatenatedS)) (run (..safe "lux text size")) (case> (#try.Success valueV) - (n.= (n.* 2 sample-size) (:as Nat valueV)) + (n.= (n.* 2 sample_size) (:as Nat valueV)) _ false))) (_.test "Can find index of sub-text." (and (|> (#synthesis.Extension "lux text index" - (list concatenatedS sample-lowerS + (list concatenatedS sample_lowerS (synthesis.i64 +0))) (run (..safe "lux text index")) (case> (^multi (#try.Success valueV) @@ -241,16 +241,16 @@ _ false)) (|> (#synthesis.Extension "lux text index" - (list concatenatedS sample-upperS + (list concatenatedS sample_upperS (synthesis.i64 +0))) (run (..safe "lux text index")) (case> (^multi (#try.Success valueV) {(:as (Maybe Nat) valueV) (#.Some valueV)}) - (n.= sample-size valueV) + (n.= sample_size valueV) _ false)))) - (let [test-clip (: (-> (I64 Any) (I64 Any) Text Bit) + (let [test_clip (: (-> (I64 Any) (I64 Any) Text Bit) (function (_ offset length expected) (|> (#synthesis.Extension "lux text clip" (list concatenatedS @@ -264,17 +264,17 @@ _ false))))] (_.test "Can clip text to extract sub-text." - (and (test-clip 0 sample-size sample-lower) - (test-clip sample-size sample-size sample-upper)))) + (and (test_clip 0 sample_size sample_lower) + (test_clip sample_size sample_size sample_upper)))) (_.test "Can extract individual characters from text." (|> (#synthesis.Extension "lux text char" - (list sample-lowerS - (synthesis.i64 char-idx))) + (list sample_lowerS + (synthesis.i64 char_idx))) (run (..safe "lux text char")) (case> (^multi (#try.Success valueV) {(:as (Maybe Int) valueV) (#.Some valueV)}) (text.contains? ("lux i64 char" valueV) - sample-lower) + sample_lower) _ false))) -- cgit v1.2.3