aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/spec/compositor/generation/function.lux
diff options
context:
space:
mode:
authorEduardo Julian2019-07-26 21:23:27 -0400
committerEduardo Julian2019-07-26 21:23:27 -0400
commita0889b2ee76c1ae7a9a5bbe2eec9f051b4f341e4 (patch)
tree08df3db7f8fffad6360a476d20db1d40b36c85cb /stdlib/source/spec/compositor/generation/function.lux
parent78fd01f7e6688448bbd710336d4d7b1c35ae058a (diff)
No more "n/"-prefixed functions.
Diffstat (limited to '')
-rw-r--r--stdlib/source/spec/compositor/generation/function.lux18
1 files changed, 10 insertions, 8 deletions
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