aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/specification/compositor/generation/case.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-08-11 04:15:07 -0400
committerEduardo Julian2022-08-11 04:15:07 -0400
commit065e8a4d8122d4616b570496915d2c0e2c78cd6b (patch)
treef2bbdc3e40b796b34026ab04c9a478d8a3f082d5 /stdlib/source/specification/compositor/generation/case.lux
parent68d78235694c633c956bb9e8a007cad7d65370bc (diff)
Re-named the "case" macro to "when".
Diffstat (limited to 'stdlib/source/specification/compositor/generation/case.lux')
-rw-r--r--stdlib/source/specification/compositor/generation/case.lux50
1 files changed, 25 insertions, 25 deletions
diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux
index ba1168ad0..8043bd2e0 100644
--- a/stdlib/source/specification/compositor/generation/case.lux
+++ b/stdlib/source/specification/compositor/generation/case.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except case)
+ [lux (.except when)
[abstract
[monad (.only do)]]
[control
@@ -23,7 +23,7 @@
["[0]" synthesis (.only Path Synthesis)]
["[0]" phase
["[1]/[0]" synthesis
- ["[0]" case]]
+ ["[0]" when]]
["[0]" extension/synthesis]]]]
[test
["_" property (.only Test)]]]]
@@ -42,16 +42,16 @@
(def .public (verify expected)
(-> Frac (Try Any) Bit)
- (|>> (pipe.case
+ (|>> (pipe.when
{try.#Success actual}
(f.= expected (as Frac actual))
{try.#Failure _}
false)))
-(def case
+(def when
(Random [Synthesis Path])
- (<| r.rec (function (_ case))
+ (<| r.rec (function (_ when))
(`` (all r.either
(do r.monad
[value r.i64]
@@ -70,33 +70,33 @@
(do [! r.monad]
[size ..size
idx (|> r.nat (at ! each (n.% size)))
- [subS subP] case
+ [subS subP] when
.let [unitS (synthesis.text synthesis.unit)
- caseS (synthesis.tuple
+ whenS (synthesis.tuple
(list.together (list (list.repeated idx unitS)
(list subS)
(list.repeated (|> size -- (n.- idx)) unitS))))
- caseP (all synthesis.path/seq
+ whenP (all synthesis.path/seq
(if (tail? size idx)
(synthesis.member/right idx)
(synthesis.member/left idx))
subP)]]
- (in [caseS caseP]))
+ (in [whenS whenP]))
(do [! r.monad]
[size ..size
idx (|> r.nat (at ! each (n.% size)))
- [subS subP] case
+ [subS subP] when
.let [right? (tail? size idx)
- caseS (synthesis.variant
+ whenS (synthesis.variant
[analysis.#lefts idx
analysis.#right? right?
analysis.#value subS])
- caseP (all synthesis.path/seq
+ whenP (all synthesis.path/seq
(if right?
(synthesis.side/right idx)
(synthesis.side/left idx))
subP)]]
- (in [caseS caseP]))
+ (in [whenS whenP]))
))))
(def (let_spec run)
@@ -123,21 +123,21 @@
(run "if_spec")
(verify (if verdict on_true on_false))))))
-(def (case_spec run)
+(def (when_spec run)
(-> Runner Test)
(do r.monad
- [[inputS pathS] ..case
+ [[inputS pathS] ..when
on_success r.safe_frac
on_failure (|> r.safe_frac (r.only (|>> (f.= on_success) not)))]
- (_.test (%.symbol (symbol synthesis.branch/case))
- (|> (synthesis.branch/case
+ (_.test (%.symbol (symbol synthesis.branch/when))
+ (|> (synthesis.branch/when
[inputS
(all synthesis.path/alt
(all synthesis.path/seq
pathS
(synthesis.path/then (synthesis.f64 on_success)))
(synthesis.path/then (synthesis.f64 on_failure)))])
- (run "case_spec")
+ (run "when_spec")
(verify on_success)))))
(def special_input
@@ -233,7 +233,7 @@
(<| try.trusted
(phase.result [extension/synthesis.bundle
synthesis.init])
- (case.path phase/synthesis.phase
+ (when.path phase/synthesis.phase
special_pattern)
(analysis.bit #1))
(all synthesis.path/seq
@@ -252,27 +252,27 @@
(_.test "CODE"
(|> special_input
(run "special_input")
- (pipe.case
+ (pipe.when
{try.#Success output}
true
{try.#Failure _}
false)))
(_.test "PATTERN_MATCHING 0"
- (|> (synthesis.branch/case [special_input
+ (|> (synthesis.branch/when [special_input
special_path])
(run "special_path")
- (pipe.case
+ (pipe.when
{try.#Success output}
true
{try.#Failure _}
false)))
(_.test "PATTERN_MATCHING 1"
- (|> (synthesis.branch/case [special_input
+ (|> (synthesis.branch/when [special_input
special_pattern_path])
(run "special_pattern_path")
- (pipe.case
+ (pipe.when
{try.#Success output}
true
@@ -286,5 +286,5 @@
(..special_spec run)
(..let_spec run)
(..if_spec run)
- (..case_spec run)
+ (..when_spec run)
))