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/case.lux | 122 ++++++++++----------- .../specification/compositor/generation/common.lux | 114 +++++++++---------- .../compositor/generation/function.lux | 30 ++--- .../compositor/generation/primitive.lux | 10 +- .../compositor/generation/reference.lux | 8 +- .../compositor/generation/structure.lux | 58 +++++----- 6 files changed, 171 insertions(+), 171 deletions(-) (limited to 'stdlib/source/specification/compositor/generation') diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index d18d6b461..3ca5440bf 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -96,48 +96,48 @@ (in [caseS caseP])) )))) -(def: (let-spec run) +(def: (let_spec run) (-> Runner Test) (do r.monad - [value r.safe-frac] - (_.test (%.name (name-of synthesis.branch/let)) + [value r.safe_frac] + (_.test (%.name (name_of synthesis.branch/let)) (|> (synthesis.branch/let [(synthesis.f64 value) 0 (synthesis.variable/local 0)]) - (run "let-spec") + (run "let_spec") (verify value))))) -(def: (if-spec run) +(def: (if_spec run) (-> Runner Test) (do r.monad - [on-true r.safe-frac - on-false (|> r.safe-frac (r.only (|>> (f.= on-true) not))) + [on_true r.safe_frac + on_false (|> r.safe_frac (r.only (|>> (f.= on_true) not))) verdict r.bit] - (_.test (%.name (name-of synthesis.branch/if)) + (_.test (%.name (name_of synthesis.branch/if)) (|> (synthesis.branch/if [(synthesis.bit verdict) - (synthesis.f64 on-true) - (synthesis.f64 on-false)]) - (run "if-spec") - (verify (if verdict on-true on-false)))))) + (synthesis.f64 on_true) + (synthesis.f64 on_false)]) + (run "if_spec") + (verify (if verdict on_true on_false)))))) -(def: (case-spec run) +(def: (case_spec run) (-> Runner Test) (do r.monad [[inputS pathS] ..case - on-success r.safe-frac - on-failure (|> r.safe-frac (r.only (|>> (f.= on-success) not)))] - (_.test (%.name (name-of synthesis.branch/case)) + on_success r.safe_frac + on_failure (|> r.safe_frac (r.only (|>> (f.= on_success) not)))] + (_.test (%.name (name_of synthesis.branch/case)) (|> (synthesis.branch/case [inputS ($_ synthesis.path/alt ($_ synthesis.path/seq pathS - (synthesis.path/then (synthesis.f64 on-success))) - (synthesis.path/then (synthesis.f64 on-failure)))]) - (run "case-spec") - (verify on-success))))) + (synthesis.path/then (synthesis.f64 on_success))) + (synthesis.path/then (synthesis.f64 on_failure)))]) + (run "case_spec") + (verify on_success))))) -(def: special-input +(def: special_input Synthesis (let [_cursor_ (: Synthesis (synthesis.tuple (list (synthesis.text .prelude_module) @@ -146,13 +146,13 @@ _code_ (: (-> Synthesis Synthesis) (function (_ content) (synthesis.tuple (list _cursor_ content)))) - _nil_ (: Synthesis + _end_ (: Synthesis (synthesis.variant [0 #0 (synthesis.text "")])) - _cons_ (: (-> Synthesis Synthesis Synthesis) + _item_ (: (-> Synthesis Synthesis Synthesis) (function (_ head tail) (synthesis.variant [0 #1 (synthesis.tuple (list head tail))]))) _list_ (: (-> (List Synthesis) Synthesis) - (list\fold _cons_ _nil_))] + (list\fold _item_ _end_))] (let [__tuple__ (: (-> (List Synthesis) Synthesis) (|>> list.reverse _list_ [9 #0] synthesis.variant _code_)) __form__ (: (-> (List Synthesis) Synthesis) @@ -170,40 +170,40 @@ (synthesis.text short)))])))) __list__ (: (-> (List Synthesis) Synthesis) (list\fold (function (_ head tail) - (__form__ (list (__tag__ ["" "Cons"]) head tail))) - (__tag__ ["" "Nil"]))) + (__form__ (list (__tag__ ["" "Item"]) head tail))) + (__tag__ ["" "End"]))) __apply__ (: (-> Synthesis Synthesis Synthesis) (function (_ func arg) (__form__ (list func arg))))] - (|> _nil_ - (_cons_ (__apply__ (__identifier__ ["" "form$"]) + (|> _end_ + (_item_ (__apply__ (__identifier__ ["" "form$"]) (__list__ (list (__apply__ (__identifier__ ["" "tag$"]) (__tuple__ (list (__text__ .prelude_module) - (__text__ "Cons")))) + (__text__ "Item")))) (__identifier__ ["" "export?-meta"]) (__identifier__ ["" "tail"]))))) - (_cons_ (__tuple__ (list (__identifier__ ["" "tail"])))) + (_item_ (__tuple__ (list (__identifier__ ["" "tail"])))) )))) -(def: special-path +(def: special_path Path - (let [_nil_ (synthesis.path/side (#.Left 0)) - _cons_ (synthesis.path/side (#.Right 0)) + (let [_end_ (synthesis.path/side (#.Left 0)) + _item_ (synthesis.path/side (#.Right 0)) _head_ (synthesis.path/member (#.Left 0)) _tail_ (synthesis.path/member (#.Right 0)) _tuple_ (synthesis.path/side (#.Left 9))] ($_ synthesis.path/alt ($_ synthesis.path/seq - _cons_ + _item_ _head_ _head_ (synthesis.path/bind 2) synthesis.path/pop - _tail_ _tuple_ _cons_ + _tail_ _tuple_ _item_ _head_ (synthesis.path/bind 3) synthesis.path/pop _tail_ (synthesis.path/bind 4) synthesis.path/pop synthesis.path/pop synthesis.path/pop synthesis.path/pop synthesis.path/pop - _tail_ _cons_ + _tail_ _item_ _head_ (synthesis.path/bind 5) synthesis.path/pop - _tail_ _nil_ + _tail_ _end_ ## THEN (synthesis.path/then (synthesis.bit #1))) ($_ synthesis.path/seq @@ -211,31 +211,31 @@ ## THEN (synthesis.path/then (synthesis.bit #0)))))) -(def: special-pattern +(def: special_pattern analysis.Pattern - (let [## [_ (#Tuple (#Cons arg args'))] + (let [## [_ (#Tuple (#Item arg args'))] head (<| analysis.pattern/tuple (list (analysis.pattern/bind 2)) analysis.pattern/variant [9 #0] analysis.pattern/variant [0 #1] analysis.pattern/tuple (list (analysis.pattern/bind 3) (analysis.pattern/bind 4))) - ## (#Cons body #Nil) + ## (#Item body #End) tail (<| analysis.pattern/variant [0 #1] analysis.pattern/tuple (list (analysis.pattern/bind 5)) analysis.pattern/variant [0 #0] (analysis.pattern/unit))] - ## (#Cons ) + ## (#Item ) (<| analysis.pattern/variant [0 #1] (analysis.pattern/tuple (list head tail))))) -(def: special-pattern-path +(def: special_pattern_path Path ($_ synthesis.path/alt (<| try.assumed (phase.run [extension/synthesis.bundle synthesis.init]) (case.path phase/synthesis.phase - special-pattern) + special_pattern) (analysis.bit #1)) ($_ synthesis.path/seq (synthesis.path/bind 2) @@ -243,34 +243,34 @@ (synthesis.path/then (synthesis.bit #0))))) ## TODO: Get rid of this ASAP -(def: (special-spec run) +(def: (special_spec run) (-> Runner Test) ($_ _.and (_.test "===" - (and (text\= (synthesis.%path special-path) - (synthesis.%path special-pattern-path)) - (\ synthesis.path-equivalence = special-path special-pattern-path))) + (and (text\= (synthesis.%path special_path) + (synthesis.%path special_pattern_path)) + (\ synthesis.path_equivalence = special_path special_pattern_path))) (_.test "CODE" - (|> special-input - (run "special-input") + (|> special_input + (run "special_input") (case> (#try.Success output) true (#try.Failure _) false))) - (_.test "PATTERN-MATCHING 0" - (|> (synthesis.branch/case [special-input - special-path]) - (run "special-path") + (_.test "PATTERN_MATCHING 0" + (|> (synthesis.branch/case [special_input + special_path]) + (run "special_path") (case> (#try.Success output) true (#try.Failure _) false))) - (_.test "PATTERN-MATCHING 1" - (|> (synthesis.branch/case [special-input - special-pattern-path]) - (run "special-pattern-path") + (_.test "PATTERN_MATCHING 1" + (|> (synthesis.branch/case [special_input + special_pattern_path]) + (run "special_pattern_path") (case> (#try.Success output) true @@ -281,8 +281,8 @@ (def: #export (spec run) (-> Runner Test) ($_ _.and - (..special-spec run) - (..let-spec run) - (..if-spec run) - (..case-spec run) + (..special_spec run) + (..let_spec run) + (..if_spec run) + (..case_spec run) )) 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))) diff --git a/stdlib/source/specification/compositor/generation/function.lux b/stdlib/source/specification/compositor/generation/function.lux index 61f6d6656..5a5891088 100644 --- a/stdlib/source/specification/compositor/generation/function.lux +++ b/stdlib/source/specification/compositor/generation/function.lux @@ -24,13 +24,13 @@ [// [common (#+ Runner)]]]) -(def: max-arity +(def: max_arity Arity 10) (def: arity (Random Arity) - (|> r.nat (r\map (|>> (n.% max-arity) (n.max 1))))) + (|> r.nat (r\map (|>> (n.% max_arity) (n.max 1))))) (def: (local arity) (-> Arity (Random Register)) @@ -51,45 +51,45 @@ (-> Runner Test) (do {! r.monad} [[arity local functionS] ..function - partial-arity (|> r.nat (\ ! map (|>> (n.% arity) (n.max 1)))) - inputs (r.list arity r.safe-frac) + partial_arity (|> r.nat (\ ! map (|>> (n.% arity) (n.max 1)))) + inputs (r.list arity r.safe_frac) #let [expectation (maybe.assume (list.nth (dec local) inputs)) inputsS (list\map (|>> synthesis.f64) inputs)]] ($_ _.and (_.test "Can read arguments." (|> (synthesis.function/apply {#synthesis.function functionS #synthesis.arguments inputsS}) - (run "with-local") + (run "with_local") (//case.verify expectation))) (_.test "Can partially apply functions." (or (n.= 1 arity) - (let [preS (list.take partial-arity inputsS) - postS (list.drop partial-arity inputsS) + (let [preS (list.take partial_arity inputsS) + postS (list.drop partial_arity inputsS) partialS (synthesis.function/apply {#synthesis.function functionS #synthesis.arguments preS})] (|> (synthesis.function/apply {#synthesis.function partialS #synthesis.arguments postS}) - (run "partial-application") + (run "partial_application") (//case.verify expectation))))) (_.test "Can read environment." (or (n.= 1 arity) - (let [environment (|> partial-arity + (let [environment (|> partial_arity (enum.range n.enum 1) (list\map (|>> #reference.Local))) - variableS (if (n.<= partial-arity local) + variableS (if (n.<= partial_arity local) (synthesis.variable/foreign (dec local)) - (synthesis.variable/local (|> local (n.- partial-arity)))) - inner-arity (n.- partial-arity arity) + (synthesis.variable/local (|> local (n.- partial_arity)))) + inner_arity (n.- partial_arity arity) innerS (synthesis.function/abstraction {#synthesis.environment environment - #synthesis.arity inner-arity + #synthesis.arity inner_arity #synthesis.body variableS}) outerS (synthesis.function/abstraction {#synthesis.environment (list) - #synthesis.arity partial-arity + #synthesis.arity partial_arity #synthesis.body innerS})] (|> (synthesis.function/apply {#synthesis.function outerS #synthesis.arguments inputsS}) - (run "with-foreign") + (run "with_foreign") (//case.verify expectation))))) ))) diff --git a/stdlib/source/specification/compositor/generation/primitive.lux b/stdlib/source/specification/compositor/generation/primitive.lux index 3b6dd657b..2ddb9a02e 100644 --- a/stdlib/source/specification/compositor/generation/primitive.lux +++ b/stdlib/source/specification/compositor/generation/primitive.lux @@ -23,17 +23,17 @@ (def: (f/=' reference subject) (-> Frac Frac Bit) (or (f.= reference subject) - (and (f.not-a-number? reference) - (f.not-a-number? subject)))) + (and (f.not_a_number? reference) + (f.not_a_number? subject)))) (def: #export (spec run) (-> Runner Test) (`` ($_ _.and - (~~ (template [ ] + (~~ (template [ ] [(do r.monad [expected ] - (_.test (%.name (name-of )) - (|> (run ( expected)) + (_.test (%.name (name_of )) + (|> (run ( expected)) (case> (#try.Success actual) ( expected (:assume actual)) diff --git a/stdlib/source/specification/compositor/generation/reference.lux b/stdlib/source/specification/compositor/generation/reference.lux index 665175ab4..d5c3cfd34 100644 --- a/stdlib/source/specification/compositor/generation/reference.lux +++ b/stdlib/source/specification/compositor/generation/reference.lux @@ -21,14 +21,14 @@ (def: name (Random Name) - (let [name-part (r.ascii/upper-alpha 5)] - [(r.and name-part name-part)])) + (let [name_part (r.ascii/upper_alpha 5)] + [(r.and name_part name_part)])) (def: (definition define) (-> Definer Test) (do r.monad [name ..name - expected r.safe-frac] + expected r.safe_frac] (_.test "Definitions." (|> (define name (synthesis.f64 expected)) (case> (#try.Success actual) @@ -41,7 +41,7 @@ (-> Runner Test) (do {! r.monad} [register (|> r.nat (\ ! map (n.% 100))) - expected r.safe-frac] + expected r.safe_frac] (_.test "Local variables." (|> (synthesis.branch/let [(synthesis.f64 expected) register diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux index 355b98409..4cc4f0676 100644 --- a/stdlib/source/specification/compositor/generation/structure.lux +++ b/stdlib/source/specification/compositor/generation/structure.lux @@ -31,34 +31,34 @@ (def: (variant run) (-> Runner Test) (do {! r.monad} - [num-tags (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) - tag-in (|> r.nat (\ ! map (n.% num-tags))) - #let [last?-in (|> num-tags dec (n.= tag-in))] - value-in r.i64] - (_.test (%.name (name-of synthesis.variant)) - (|> (synthesis.variant {#analysis.lefts (if last?-in - (dec tag-in) - tag-in) - #analysis.right? last?-in - #analysis.value (synthesis.i64 value-in)}) + [num_tags (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) + tag_in (|> r.nat (\ ! map (n.% num_tags))) + #let [last?_in (|> num_tags dec (n.= tag_in))] + value_in r.i64] + (_.test (%.name (name_of synthesis.variant)) + (|> (synthesis.variant {#analysis.lefts (if last?_in + (dec tag_in) + tag_in) + #analysis.right? last?_in + #analysis.value (synthesis.i64 value_in)}) (run "variant") (case> (#try.Success valueT) (let [valueT (:as (Array Any) valueT)] (and (n.= 3 (array.size valueT)) - (let [tag-out (:as java/lang/Integer (maybe.assume (array.read 0 valueT))) - last?-out (array.read 1 valueT) - value-out (:as Any (maybe.assume (array.read 2 valueT))) - same-tag? (|> tag-out ffi.int-to-long (:as Nat) (n.= tag-in)) - same-flag? (case last?-out - (#.Some last?-out') - (and last?-in (text\= "" (:as Text last?-out'))) + (let [tag_out (:as java/lang/Integer (maybe.assume (array.read 0 valueT))) + last?_out (array.read 1 valueT) + value_out (:as Any (maybe.assume (array.read 2 valueT))) + same_tag? (|> tag_out ffi.int_to_long (:as Nat) (n.= tag_in)) + same_flag? (case last?_out + (#.Some last?_out') + (and last?_in (text\= "" (:as Text last?_out'))) #.None - (not last?-in)) - same-value? (|> value-out (:as Int) (i.= value-in))] - (and same-tag? - same-flag? - same-value?)))) + (not last?_in)) + same_value? (|> value_out (:as Int) (i.= value_in))] + (and same_tag? + same_flag? + same_value?)))) (#try.Failure _) false))))) @@ -67,16 +67,16 @@ (-> Runner Test) (do {! r.monad} [size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) - tuple-in (r.list size r.i64)] - (_.test (%.name (name-of synthesis.tuple)) - (|> (synthesis.tuple (list\map (|>> synthesis.i64) tuple-in)) + tuple_in (r.list size r.i64)] + (_.test (%.name (name_of synthesis.tuple)) + (|> (synthesis.tuple (list\map (|>> synthesis.i64) tuple_in)) (run "tuple") - (case> (#try.Success tuple-out) - (let [tuple-out (:as (Array Any) tuple-out)] - (and (n.= size (array.size tuple-out)) + (case> (#try.Success tuple_out) + (let [tuple_out (:as (Array Any) tuple_out)] + (and (n.= size (array.size tuple_out)) (list.every? (function (_ [left right]) (i.= left (:as Int right))) - (list.zipped/2 tuple-in (array.to_list tuple-out))))) + (list.zipped/2 tuple_in (array.to_list tuple_out))))) (#try.Failure _) false))))) -- cgit v1.2.3