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 ++++++++++----------- 1 file changed, 61 insertions(+), 61 deletions(-) (limited to 'stdlib/source/specification/compositor/generation/case.lux') 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) )) -- cgit v1.2.3