aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/specification/compositor/generation/structure.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-03-14 18:27:37 -0400
committerEduardo Julian2022-03-14 18:27:37 -0400
commit41495e32d3f5f88b5f189f48dd4fdbfa883c6ac0 (patch)
tree7a561e83768d5ac4eb08855858dde38d2987fc46 /stdlib/source/specification/compositor/generation/structure.lux
parent62299ecdc93b39f6a22b1f89779f55dfa735fb3c (diff)
De-sigil-ification: >
Diffstat (limited to 'stdlib/source/specification/compositor/generation/structure.lux')
-rw-r--r--stdlib/source/specification/compositor/generation/structure.lux106
1 files changed, 54 insertions, 52 deletions
diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux
index bf852085d..5fe2a809f 100644
--- a/stdlib/source/specification/compositor/generation/structure.lux
+++ b/stdlib/source/specification/compositor/generation/structure.lux
@@ -1,30 +1,30 @@
(.using
- [lux "*"
- ["_" test {"+" Test}]
- [abstract
- [monad {"+" do}]]
- [control
- [pipe {"+" case>}]
- ["[0]" maybe]
- ["[0]" try]]
- [data
- [number
- ["n" nat]
- ["i" int]]
- ["[0]" text ("[1]#[0]" equivalence)
- ["%" format {"+" format}]]
- [collection
- ["[0]" array {"+" Array}]
- ["[0]" list ("[1]#[0]" functor)]]]
- [math
- ["r" random]]
- ["[0]" ffi {"+" import:}]
- [tool
- [compiler
- ["[0]" analysis]
- ["[0]" synthesis]]]]
- [///
- [common {"+" Runner}]])
+ [lux "*"
+ ["_" test {"+" Test}]
+ [abstract
+ [monad {"+" do}]]
+ [control
+ ["[0]" pipe]
+ ["[0]" maybe]
+ ["[0]" try]]
+ [data
+ [number
+ ["n" nat]
+ ["i" int]]
+ ["[0]" text ("[1]#[0]" equivalence)
+ ["%" format {"+" format}]]
+ [collection
+ ["[0]" array {"+" Array}]
+ ["[0]" list ("[1]#[0]" functor)]]]
+ [math
+ ["r" random]]
+ ["[0]" ffi {"+" import:}]
+ [tool
+ [compiler
+ ["[0]" analysis]
+ ["[0]" synthesis]]]]
+ [///
+ [common {"+" Runner}]])
(import: java/lang/Integer)
@@ -42,26 +42,27 @@
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.trusted (array.read! 0 valueT)))
- last?_out (array.read! 1 valueT)
- value_out (:as Any (maybe.trusted (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')))
+ (pipe.case
+ {try.#Success valueT}
+ (let [valueT (:as (Array Any) valueT)]
+ (and (n.= 3 (array.size valueT))
+ (let [tag_out (:as java/lang/Integer (maybe.trusted (array.read! 0 valueT)))
+ last?_out (array.read! 1 valueT)
+ value_out (:as Any (maybe.trusted (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?))))
+ {.#None}
+ (not last?_in))
+ same_value? (|> value_out (:as Int) (i.= value_in))]
+ (and same_tag?
+ same_flag?
+ same_value?))))
- {try.#Failure _}
- false)))))
+ {try.#Failure _}
+ false)))))
(def: (tuple run)
(-> Runner Test)
@@ -71,15 +72,16 @@
(_.test (%.symbol (symbol synthesis.tuple))
(|> (synthesis.tuple (list#each (|>> 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))
- (list.every? (function (_ [left right])
- (i.= left (:as Int right)))
- (list.zipped/2 tuple_in (array.list tuple_out)))))
+ (pipe.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.list tuple_out)))))
- {try.#Failure _}
- false)))))
+ {try.#Failure _}
+ false)))))
(def: .public (spec runner)
(-> Runner Test)