aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/specification/compositor/generation/function.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/specification/compositor/generation/function.lux')
-rw-r--r--stdlib/source/specification/compositor/generation/function.lux122
1 files changed, 61 insertions, 61 deletions
diff --git a/stdlib/source/specification/compositor/generation/function.lux b/stdlib/source/specification/compositor/generation/function.lux
index e6bdf79c0..6cc0d14b5 100644
--- a/stdlib/source/specification/compositor/generation/function.lux
+++ b/stdlib/source/specification/compositor/generation/function.lux
@@ -1,27 +1,27 @@
(.using
- [lux {"-" function}
- ["_" test {"+" Test}]
- [abstract
- [monad {"+" do}]
- ["[0]" enum]]
- [control
- ["[0]" maybe]]
- [data
- [number
- ["n" nat]]
- [collection
- ["[0]" list ("[1]#[0]" functor)]]]
- [math
- ["r" random {"+" Random} ("[1]#[0]" monad)]]
- [tool
- [compiler
- [analysis {"+" Arity}]
- ["[0]" reference {"+" Register}]
- ["[0]" synthesis {"+" Synthesis}]]]]
- ["[0]" // "_"
- ["[1][0]" case]
- [//
- [common {"+" Runner}]]])
+ [lux {"-" function}
+ ["_" test {"+" Test}]
+ [abstract
+ [monad {"+" do}]
+ ["[0]" enum]]
+ [control
+ ["[0]" maybe]]
+ [data
+ [number
+ ["n" nat]]
+ [collection
+ ["[0]" list ("[1]#[0]" functor)]]]
+ [math
+ ["r" random {"+" Random} ("[1]#[0]" monad)]]
+ [tool
+ [compiler
+ [analysis {"+" Arity}]
+ ["[0]" reference {"+" Register}]
+ ["[0]" synthesis {"+" Synthesis}]]]]
+ ["[0]" // "_"
+ ["[1][0]" case]
+ [//
+ [common {"+" Runner}]]])
(def: max_arity
Arity
@@ -54,41 +54,41 @@
inputs (r.list arity r.safe_frac)
.let [expectation (maybe.trusted (list.item (-- local) inputs))
inputsS (list#each (|>> synthesis.f64) inputs)]]
- ($_ _.and
- (_.test "Can read arguments."
- (|> (synthesis.function/apply [synthesis.#function functionS
- 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)))))
- )))
+ (all _.and
+ (_.test "Can read arguments."
+ (|> (synthesis.function/apply [synthesis.#function functionS
+ 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)))))
+ )))