aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/specification/compositor/generation/function.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-04-09 03:03:46 -0400
committerEduardo Julian2022-04-09 03:03:46 -0400
commit04c7f49a732380a2b9f72b1b937171b341c24323 (patch)
treed54c92bf10665bba0ec4643746becce569604fb2 /stdlib/source/specification/compositor/generation/function.lux
parentf11afb9d2dfe2d59b41e8056eb8c4ae65268415f (diff)
Better names for testing macros (plus better indentation).
Diffstat (limited to 'stdlib/source/specification/compositor/generation/function.lux')
-rw-r--r--stdlib/source/specification/compositor/generation/function.lux70
1 files changed, 35 insertions, 35 deletions
diff --git a/stdlib/source/specification/compositor/generation/function.lux b/stdlib/source/specification/compositor/generation/function.lux
index 6cc0d14b5..33db49436 100644
--- a/stdlib/source/specification/compositor/generation/function.lux
+++ b/stdlib/source/specification/compositor/generation/function.lux
@@ -55,40 +55,40 @@
.let [expectation (maybe.trusted (list.item (-- local) inputs))
inputsS (list#each (|>> synthesis.f64) inputs)]]
(all _.and
- (_.test "Can read arguments."
- (|> (synthesis.function/apply [synthesis.#function functionS
+ (_.property "Can read arguments."
+ (|> (synthesis.function/apply [synthesis.#function functionS
+ synthesis.#arguments inputsS])
+ (run "with_local")
+ (//case.verify expectation)))
+ (_.property "Can partially apply functions."
+ (or (n.= 1 arity)
+ (let [preS (list.first partial_arity inputsS)
+ postS (list.after 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")
+ (//case.verify expectation)))))
+ (_.property "Can read environment."
+ (or (n.= 1 arity)
+ (let [environment (|> partial_arity
+ (enum.range n.enum 1)
+ (list#each (|>> {reference.#Local})))
+ variableS (if (n.<= partial_arity local)
+ (synthesis.variable/foreign (-- local))
+ (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.#body variableS])
+ outerS (synthesis.function/abstraction
+ [synthesis.#environment (list)
+ synthesis.#arity partial_arity
+ synthesis.#body innerS])]
+ (|> (synthesis.function/apply [synthesis.#function outerS
synthesis.#arguments inputsS])
- (run "with_local")
- (//case.verify expectation)))
- (_.test "Can partially apply functions."
- (or (n.= 1 arity)
- (let [preS (list.first partial_arity inputsS)
- postS (list.after 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")
- (//case.verify expectation)))))
- (_.test "Can read environment."
- (or (n.= 1 arity)
- (let [environment (|> partial_arity
- (enum.range n.enum 1)
- (list#each (|>> {reference.#Local})))
- variableS (if (n.<= partial_arity local)
- (synthesis.variable/foreign (-- local))
- (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.#body variableS])
- outerS (synthesis.function/abstraction
- [synthesis.#environment (list)
- synthesis.#arity partial_arity
- synthesis.#body innerS])]
- (|> (synthesis.function/apply [synthesis.#function outerS
- synthesis.#arguments inputsS])
- (run "with_foreign")
- (//case.verify expectation)))))
+ (run "with_foreign")
+ (//case.verify expectation)))))
)))