diff options
Diffstat (limited to 'stdlib/source/specification/compositor/generation/function.lux')
-rw-r--r-- | stdlib/source/specification/compositor/generation/function.lux | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/stdlib/source/specification/compositor/generation/function.lux b/stdlib/source/specification/compositor/generation/function.lux index 61f6d6656..5a5891088 100644 --- a/stdlib/source/specification/compositor/generation/function.lux +++ b/stdlib/source/specification/compositor/generation/function.lux @@ -24,13 +24,13 @@ [// [common (#+ Runner)]]]) -(def: max-arity +(def: max_arity Arity 10) (def: arity (Random Arity) - (|> r.nat (r\map (|>> (n.% max-arity) (n.max 1))))) + (|> r.nat (r\map (|>> (n.% max_arity) (n.max 1))))) (def: (local arity) (-> Arity (Random Register)) @@ -51,45 +51,45 @@ (-> Runner Test) (do {! r.monad} [[arity local functionS] ..function - partial-arity (|> r.nat (\ ! map (|>> (n.% arity) (n.max 1)))) - inputs (r.list arity r.safe-frac) + partial_arity (|> r.nat (\ ! map (|>> (n.% arity) (n.max 1)))) + inputs (r.list arity r.safe_frac) #let [expectation (maybe.assume (list.nth (dec local) inputs)) inputsS (list\map (|>> synthesis.f64) inputs)]] ($_ _.and (_.test "Can read arguments." (|> (synthesis.function/apply {#synthesis.function functionS #synthesis.arguments inputsS}) - (run "with-local") + (run "with_local") (//case.verify expectation))) (_.test "Can partially apply functions." (or (n.= 1 arity) - (let [preS (list.take partial-arity inputsS) - postS (list.drop partial-arity inputsS) + (let [preS (list.take partial_arity inputsS) + postS (list.drop 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") + (run "partial_application") (//case.verify expectation))))) (_.test "Can read environment." (or (n.= 1 arity) - (let [environment (|> partial-arity + (let [environment (|> partial_arity (enum.range n.enum 1) (list\map (|>> #reference.Local))) - variableS (if (n.<= partial-arity local) + variableS (if (n.<= partial_arity local) (synthesis.variable/foreign (dec local)) - (synthesis.variable/local (|> local (n.- partial-arity)))) - inner-arity (n.- partial-arity arity) + (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.arity inner_arity #synthesis.body variableS}) outerS (synthesis.function/abstraction {#synthesis.environment (list) - #synthesis.arity partial-arity + #synthesis.arity partial_arity #synthesis.body innerS})] (|> (synthesis.function/apply {#synthesis.function outerS #synthesis.arguments inputsS}) - (run "with-foreign") + (run "with_foreign") (//case.verify expectation))))) ))) |