From a0889b2ee76c1ae7a9a5bbe2eec9f051b4f341e4 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 26 Jul 2019 21:23:27 -0400 Subject: No more "n/"-prefixed functions. --- stdlib/source/spec/compositor/generation/function.lux | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'stdlib/source/spec/compositor/generation/function.lux') diff --git a/stdlib/source/spec/compositor/generation/function.lux b/stdlib/source/spec/compositor/generation/function.lux index 0b8810620..9af307287 100644 --- a/stdlib/source/spec/compositor/generation/function.lux +++ b/stdlib/source/spec/compositor/generation/function.lux @@ -7,6 +7,8 @@ [pipe (#+ case>)]] [data ["." maybe] + [number + ["n" nat]] [collection ["." list ("#@." functor)]]] [math @@ -25,11 +27,11 @@ (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)) - (|> r.nat (r@map (|>> (n/% arity) inc)))) + (|> r.nat (r@map (|>> (n.% arity) inc)))) (def: function (Random [Arity Register Synthesis]) @@ -46,7 +48,7 @@ (-> Runner Test) (do r.monad [[arity local functionS] ..function - partial-arity (|> r.nat (:: @ map (|>> (n/% arity) (n/max 1)))) + 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)]] @@ -57,7 +59,7 @@ (run "with-local") (//case.verify expectation))) (_.test "Can partially apply functions." - (or (n/= 1 arity) + (or (n.= 1 arity) (let [preS (list.take partial-arity inputsS) postS (list.drop partial-arity inputsS) partialS (synthesis.function/apply {#synthesis.function functionS @@ -67,14 +69,14 @@ (run "partial-application") (//case.verify expectation))))) (_.test "Can read environment." - (or (n/= 1 arity) + (or (n.= 1 arity) (let [environment (|> partial-arity (list.n/range 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 -- cgit v1.2.3