aboutsummaryrefslogtreecommitdiff
path: root/stdlib/test
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/test')
-rw-r--r--stdlib/test/test/lux.lux42
-rw-r--r--stdlib/test/test/lux/cli.lux24
-rw-r--r--stdlib/test/test/lux/codata/env.lux8
-rw-r--r--stdlib/test/test/lux/codata/io.lux6
-rw-r--r--stdlib/test/test/lux/codata/state.lux12
-rw-r--r--stdlib/test/test/lux/codata/struct/stream.lux32
-rw-r--r--stdlib/test/test/lux/concurrency/actor.lux4
-rw-r--r--stdlib/test/test/lux/concurrency/frp.lux8
-rw-r--r--stdlib/test/test/lux/concurrency/stm.lux4
-rw-r--r--stdlib/test/test/lux/data/bit.lux56
-rw-r--r--stdlib/test/test/lux/data/error.lux12
-rw-r--r--stdlib/test/test/lux/data/error/exception.lux12
-rw-r--r--stdlib/test/test/lux/data/format/json.lux12
-rw-r--r--stdlib/test/test/lux/data/ident.lux8
-rw-r--r--stdlib/test/test/lux/data/log.lux16
-rw-r--r--stdlib/test/test/lux/data/number.lux24
-rw-r--r--stdlib/test/test/lux/data/product.lux8
-rw-r--r--stdlib/test/test/lux/data/struct/array.lux40
-rw-r--r--stdlib/test/test/lux/data/struct/dict.lux36
-rw-r--r--stdlib/test/test/lux/data/struct/list.lux100
-rw-r--r--stdlib/test/test/lux/data/struct/queue.lux12
-rw-r--r--stdlib/test/test/lux/data/struct/set.lux6
-rw-r--r--stdlib/test/test/lux/data/struct/stack.lux8
-rw-r--r--stdlib/test/test/lux/data/struct/tree.lux2
-rw-r--r--stdlib/test/test/lux/data/struct/vector.lux28
-rw-r--r--stdlib/test/test/lux/data/struct/zipper.lux4
-rw-r--r--stdlib/test/test/lux/data/sum.lux4
-rw-r--r--stdlib/test/test/lux/data/text.lux22
-rw-r--r--stdlib/test/test/lux/math.lux24
-rw-r--r--stdlib/test/test/lux/pipe.lux26
30 files changed, 300 insertions, 300 deletions
diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux
index f507e1e9a..a9f638c73 100644
--- a/stdlib/test/test/lux.lux
+++ b/stdlib/test/test/lux.lux
@@ -15,7 +15,7 @@
(macro ["s" syntax #+ syntax:])))
(test: "Value identity."
- [size (|> R;nat (:: @ map (|>. (%+ +100) (max+ +10))))
+ [size (|> R;nat (:: @ map (|>. (n.% +100) (n.max +10))))
x (R;text size)
y (R;text size)]
($_ seq
@@ -47,8 +47,8 @@
(and (|> value inc even?)
(|> value dec even?)))))]
- ["Nat" R;nat inc+ dec+ even?+ odd?+ =+ <+ >+]
- ["Int" R;int inc dec even? odd? = < >]
+ ["Nat" R;nat n.inc n.dec n.even? n.odd? n.= n.< n.>]
+ ["Int" R;int i.inc i.dec i.even? i.odd? i.= i.< i.>]
)
(do-template [category rand-gen = < > <= >= min max]
@@ -71,10 +71,10 @@
(>= y (max x y)))
)))]
- ["Int" R;int = < > <= >= min max]
- ["Nat" R;nat =+ <+ >+ <=+ >=+ min+ max+]
- ["Real" R;real =. <. >. <=. >=. min. max.]
- ["Frac" R;frac =.. <.. >.. <=.. >=.. min.. max..]
+ ["Int" R;int i.= i.< i.> i.<= i.>= i.min i.max]
+ ["Nat" R;nat n.= n.< n.> n.<= n.>= n.min n.max]
+ ["Real" R;real r.= r.< r.> r.<= r.>= r.min r.max]
+ ["Frac" R;frac f.= f.< f.> f.<= f.>= f.min f.max]
)
(do-template [category rand-gen = + - * / <%> > <0> <1> <10> %x <cap> <prep>]
@@ -120,9 +120,9 @@
(|> x' (/ y) (* y) (= x')))
))]
- ["Nat" R;nat =+ ++ -+ *+ /+ ;%+ >+ +0 +1 +1000000 %n (;%+ +1000) id]
- ["Int" R;int = + - * / ;% > 0 1 1000000 %i (;% 1000) id]
- ["Real" R;real =. +. -. *. /. ;%. >. 0.0 1.0 1000000.0 %r id math;floor]
+ ["Nat" R;nat n.= n.+ n.- n.* n./ n.% n.> +0 +1 +1000000 %n (n.% +1000) id]
+ ["Int" R;int i.= i.+ i.- i.* i./ i.% i.> 0 1 1000000 %i (i.% 1000) id]
+ ["Real" R;real r.= r.+ r.- r.* r./ r.% r.> 0.0 1.0 1000000.0 %r id math;floor]
)
(do-template [category rand-gen -> <- = <cap> %a %z]
@@ -132,22 +132,22 @@
(assert ""
(|> value -> <- (= value))))]
- ["Int->Nat" R;int int-to-nat nat-to-int = (;% 1000000) %i %n]
- ["Nat->Int" R;nat nat-to-int int-to-nat =+ (;%+ +1000000) %n %i]
- ["Int->Real" R;int int-to-real real-to-int = (;% 1000000) %i %r]
- ["Real->Int" R;real real-to-int int-to-real =. math;floor %r %i]
- ## [R;real real-to-frac frac-to-real =. (;%. 1.0) %r %f]
+ ["Int->Nat" R;int int-to-nat nat-to-int i.= (i.% 1000000) %i %n]
+ ["Nat->Int" R;nat nat-to-int int-to-nat n.= (n.% +1000000) %n %i]
+ ["Int->Real" R;int int-to-real real-to-int i.= (i.% 1000000) %i %r]
+ ["Real->Int" R;real real-to-int int-to-real r.= math;floor %r %i]
+ ## [R;real real-to-frac frac-to-real r.= (r.% 1.0) %r %f]
)
(test: "Simple macros and constructs"
($_ seq
(assert "Can write easy loops for iterative programming."
- (= 1000
- (loop [counter 0
- value 1]
- (if (< 3 counter)
- (recur (inc counter) (* 10 value))
- value))))
+ (i.= 1000
+ (loop [counter 0
+ value 1]
+ (if (i.< 3 counter)
+ (recur (i.inc counter) (i.* 10 value))
+ value))))
(assert "Can create lists easily through macros."
(and (case (list 1 2 3)
diff --git a/stdlib/test/test/lux/cli.lux b/stdlib/test/test/lux/cli.lux
index 20a3cb5b6..cecc2306f 100644
--- a/stdlib/test/test/lux/cli.lux
+++ b/stdlib/test/test/lux/cli.lux
@@ -20,7 +20,7 @@
lux/test)
(test: "CLI"
- [num-args (:: @ map (%+ +10) R;nat)
+ [num-args (:: @ map (n.% +10) R;nat)
#let [(^open "Nat/") number;Codec<Text,Nat>
gen-arg (:: @ map Nat/encode R;nat)]
option-name (R;text +5)
@@ -29,22 +29,22 @@
(assert "Can read any argument."
(|> (&;run &;any args)
(case> (#;Left _)
- (=+ +0 num-args)
+ (n.= +0 num-args)
(#;Right arg)
- (and (not (=+ +0 num-args))
+ (and (not (n.= +0 num-args))
(Text/= arg (default (undefined)
(list;head args)))))))
(assert "Can safely fail parsing an argument."
(|> (&;run (&;opt &;any) args)
(case> (#;Right (#;Some arg))
- (and (not (=+ +0 num-args))
+ (and (not (n.= +0 num-args))
(Text/= arg (default (undefined)
(list;head args))))
(#;Right #;None)
- (=+ +0 num-args)
+ (n.= +0 num-args)
_
false)))
@@ -55,18 +55,18 @@
false
(#;Right args')
- (=+ num-args (list;size args'))))
+ (n.= num-args (list;size args'))))
(|> (&;run (&;many &;any) args)
(case> (#;Left _)
- (=+ +0 num-args)
+ (n.= +0 num-args)
(#;Right args')
- (=+ num-args (list;size args'))))))
+ (n.= num-args (list;size args'))))))
(assert "Can use custom token parsers."
(|> (&;run (&;parse Nat/decode) args)
(case> (#;Left _)
- (=+ +0 num-args)
+ (n.= +0 num-args)
(#;Right parsed)
(Text/= (Nat/encode parsed)
@@ -76,7 +76,7 @@
(assert "Can obtain option values."
(and (|> (&;run (&;option (list option-name)) (list& option-name args))
(case> (#;Left _)
- (=+ +0 num-args)
+ (n.= +0 num-args)
(#;Right value)
(Text/= value (default (undefined)
@@ -92,7 +92,7 @@
(assert "Can query if there are any more inputs."
(and (|> (&;run &;end args)
- (case> (#;Right []) (=+ +0 num-args) _ false))
+ (case> (#;Right []) (n.= +0 num-args) _ false))
(|> (&;run (&;not &;end) args)
- (case> (#;Right []) (not (=+ +0 num-args)) _ false))))
+ (case> (#;Right []) (not (n.= +0 num-args)) _ false))))
))
diff --git a/stdlib/test/test/lux/codata/env.lux b/stdlib/test/test/lux/codata/env.lux
index 7a374cd4d..0e24ddf75 100644
--- a/stdlib/test/test/lux/codata/env.lux
+++ b/stdlib/test/test/lux/codata/env.lux
@@ -11,13 +11,13 @@
(test: "lux/codata/env exports"
(test-all (match 123 (run 123 ask))
- (match 246 (run 123 (local (* 2) ask)))
- (match 134 (run 123 (:: Functor<Env> map inc (+ 10))))
+ (match 246 (run 123 (local (i.* 2) ask)))
+ (match 134 (run 123 (:: Functor<Env> map i.inc (i.+ 10))))
(match 10 (run 123 (:: Applicative<Env> wrap 10)))
(match 30 (run 123 (let [(^open) Applicative<Env>]
- (apply (wrap (+ 10)) (wrap 20)))))
+ (apply (wrap (i.+ 10)) (wrap 20)))))
(match 30 (run 123 (do Monad<Env>
- [f (wrap +)
+ [f (wrap i.+)
x (wrap 10)
y (wrap 20)]
(wrap (f x y)))))))
diff --git a/stdlib/test/test/lux/codata/io.lux b/stdlib/test/test/lux/codata/io.lux
index 5d521faff..916609226 100644
--- a/stdlib/test/test/lux/codata/io.lux
+++ b/stdlib/test/test/lux/codata/io.lux
@@ -10,12 +10,12 @@
(test: "lux/codata/io exports"
(test-all (match "YOLO" (run (io "YOLO")))
- (match 11 (run (:: Functor<IO> map inc (io 10))))
+ (match 11 (run (:: Functor<IO> map i.inc (io 10))))
(match 10 (run (:: Applicative<IO> wrap 10)))
(match 30 (run (let [(^open) Applicative<IO>]
- (apply (wrap (+ 10)) (wrap 20)))))
+ (apply (wrap (i.+ 10)) (wrap 20)))))
(match 30 (run (do Monad<IO>
- [f (wrap +)
+ [f (wrap i.+)
x (wrap 10)
y (wrap 20)]
(wrap (f x y)))))))
diff --git a/stdlib/test/test/lux/codata/state.lux b/stdlib/test/test/lux/codata/state.lux
index 054b59d45..84c90b5b1 100644
--- a/stdlib/test/test/lux/codata/state.lux
+++ b/stdlib/test/test/lux/codata/state.lux
@@ -16,17 +16,17 @@
[_ (put 321)]
get))))
(match 369 (product;right (run 123 (do Monad<State>
- [_ (update (* 3))]
+ [_ (update (i.* 3))]
get))))
- (match 124 (product;right (run 123 (use inc))))
- (match 246 (product;right (run 123 (local (* 2) get))))
- (match 124 (product;right (run 123 (:: Functor<State> map inc get))))
+ (match 124 (product;right (run 123 (use i.inc))))
+ (match 246 (product;right (run 123 (local (i.* 2) get))))
+ (match 124 (product;right (run 123 (:: Functor<State> map i.inc get))))
(match 10 (product;right (run 123 (:: Applicative<State> wrap 10))))
(match 30 (product;right (run 123 (let [(^open) Applicative<State>]
- (apply (wrap (+ 10)) (wrap 20))))))
+ (apply (wrap (i.+ 10)) (wrap 20))))))
(match 30 (product;right (run 123 (: (State Int Int)
(do Monad<State>
- [f (wrap +)
+ [f (wrap i.+)
x (wrap 10)
y (wrap 20)]
diff --git a/stdlib/test/test/lux/codata/struct/stream.lux b/stdlib/test/test/lux/codata/struct/stream.lux
index 28292a405..1da81aa02 100644
--- a/stdlib/test/test/lux/codata/struct/stream.lux
+++ b/stdlib/test/test/lux/codata/struct/stream.lux
@@ -14,21 +14,21 @@
(test: "lux/codata/stream exports"
(let% [<take+drop+split> (do-template [<take> <drop> <split> <arg>]
[(match (^ (list 0 1 2))
- (<take> <arg> (iterate inc 0)))
+ (<take> <arg> (iterate i.inc 0)))
(match (^=> (^stream& w x y z ...)
{[w x y z] [3 4 5 6]})
- (<drop> <arg> (iterate inc 0)))
+ (<drop> <arg> (iterate i.inc 0)))
(match (^=> (^ [(list 0 1 2) _stream_])
{_stream_ (^stream& w x y z ...)}
{[w x y z] [3 4 5 6]})
- (<split> <arg> (iterate inc 0)))]
+ (<split> <arg> (iterate i.inc 0)))]
[take drop split +3]
- [take-while drop-while split-with (< 3)])
+ [take-while drop-while split-with (i.< 3)])
]
(test-all (match (^=> (^stream& w x y z ...)
{[w x y z] [0 1 2 3]})
- (iterate inc 0))
+ (iterate i.inc 0))
(match (^=> (^stream& w x y z ...)
{[w x y z] [0 0 0 0]})
(repeat 0))
@@ -36,33 +36,33 @@
{the-stream (^stream& w x y z ...)}
{[w x y z] [0 1 0 1]})
(cycle (list 0 1)))
- (match 0 (head (iterate inc 0)))
+ (match 0 (head (iterate i.inc 0)))
(match (^=> (^stream& w x y z ...)
{[w x y z] [1 2 3 4]})
- (tail (iterate inc 0)))
- (match 9 (at +9 (iterate inc 0)))
- (match 0 (at +0 (iterate inc 0)))
+ (tail (iterate i.inc 0)))
+ (match 9 (at +9 (iterate i.inc 0)))
+ (match 0 (at +0 (iterate i.inc 0)))
<take+drop+split>
(match (^=> (^stream& w x y z ...)
{[w x y z] ["0" "1" "2" "3"]})
- (unfold (lambda [n] [(inc n) (Int/encode n)])
+ (unfold (lambda [n] [(i.inc n) (Int/encode n)])
0))
(match (^=> (^stream& w x y z ...)
{[w x y z] [0 2 4 6]})
- (filter even? (iterate inc 0)))
+ (filter even? (iterate i.inc 0)))
(match (^=> [e_stream o_stream]
{e_stream (^stream& w x y z ...)}
{o_stream (^stream& a b c d ...)}
{[w x y z a b c d] [0 2 4 6 1 3 5 7]})
- (partition even? (iterate inc 0)))
+ (partition even? (iterate i.inc 0)))
(match (^=> (^stream& w x y z ...)
{[w x y z] [0 1 4 9]})
- (let [square (lambda [n] (* n n))]
- (:: Functor<Stream> map square (iterate inc 0))))
+ (let [square (lambda [n] (i.* n n))]
+ (:: Functor<Stream> map square (iterate i.inc 0))))
(match (^=> (^stream& w x y z ...)
{[w x y z] [4 9 16 25]})
- (let [square (lambda [n] (* n n))]
+ (let [square (lambda [n] (i.* n n))]
(be CoMonad<Stream>
- [inputs (iterate inc 2)]
+ [inputs (iterate i.inc 2)]
(square (head inputs)))))
)))
diff --git a/stdlib/test/test/lux/concurrency/actor.lux b/stdlib/test/test/lux/concurrency/actor.lux
index e9a19e8ea..718ce080a 100644
--- a/stdlib/test/test/lux/concurrency/actor.lux
+++ b/stdlib/test/test/lux/concurrency/actor.lux
@@ -15,7 +15,7 @@
(method: (add! {offset Int})
[Int Int]
- (let [*state*' (+ offset *state*)]
+ (let [*state*' (i.+ offset *state*)]
(wrap (#;Right [*state*' [*state* *state*']]))))
(stop:
@@ -26,7 +26,7 @@
(test: "lux/concurrency/actor exports"
(let [counter-proc (: (Proc Int (Promise Int))
[(lambda [self output state]
- (let [state' (inc state)]
+ (let [state' (i.inc state)]
(exec (io;run (promise;resolve state' output))
(Promise/wrap (#;Right state')))))
(lambda [?error state] (Promise/wrap []))])]
diff --git a/stdlib/test/test/lux/concurrency/frp.lux b/stdlib/test/test/lux/concurrency/frp.lux
index 62ca0b57d..b163aaa3f 100644
--- a/stdlib/test/test/lux/concurrency/frp.lux
+++ b/stdlib/test/test/lux/concurrency/frp.lux
@@ -34,21 +34,21 @@
(match+ (^ (list 0 1 2 3 4 5 0 -1 -2 -3 -4 -5))
(from-promise (consume (merge (list (List->Chan (list 0 1 2 3 4 5))
(List->Chan (list 0 -1 -2 -3 -4 -5)))))))
- (match+ 15 (from-promise (fold (lambda [base input] (Promise/wrap (+ input base))) 0 (List->Chan (list 0 1 2 3 4 5)))))
+ (match+ 15 (from-promise (fold (lambda [base input] (Promise/wrap (i.+ input base))) 0 (List->Chan (list 0 1 2 3 4 5)))))
(match+ (^ (list 0 1 2 3 4 5))
(from-promise (consume (no-dups number;Eq<Int> (List->Chan (list 0 0 0 1 2 2 3 3 3 3 4 4 4 5 5))))))
(match+ (^ (list 12345))
(from-promise (consume (as-chan (:: promise;Monad<Promise> wrap 12345)))))
(match+ (^ (list 1 2 3 4 5 6))
- (from-promise (consume (:: Functor<Chan> map inc (List->Chan (list 0 1 2 3 4 5))))))
+ (from-promise (consume (:: Functor<Chan> map i.inc (List->Chan (list 0 1 2 3 4 5))))))
(match+ (^ (list 12345))
(from-promise (consume (:: Applicative<Chan> wrap 12345))))
(match+ (^ (list 12346))
(from-promise (consume (let [(^open) Applicative<Chan>]
- (apply (wrap inc) (wrap 12345))))))
+ (apply (wrap i.inc) (wrap 12345))))))
(match+ (^ (list 12346))
(from-promise (consume (do Monad<Chan>
- [f (wrap inc)
+ [f (wrap i.inc)
a (wrap 12345)]
(wrap (f a))))))
))
diff --git a/stdlib/test/test/lux/concurrency/stm.lux b/stdlib/test/test/lux/concurrency/stm.lux
index e29a5294b..da3c10dca 100644
--- a/stdlib/test/test/lux/concurrency/stm.lux
+++ b/stdlib/test/test/lux/concurrency/stm.lux
@@ -23,7 +23,7 @@
(from-promise (do promise;Monad<Promise>
[_ (seqM @
(map (lambda [_]
- (mapM @ (lambda [_] (commit (update inc _concurrency-var)))
+ (mapM @ (lambda [_] (commit (update i.inc _concurrency-var)))
(list;range 1 iterations/processes)))
(list;range 1 processes/vars)))]
(commit (read _concurrency-var))))))
@@ -39,7 +39,7 @@
[value (read _var)]
(wrap (#;Right value)))))
(match+ 15 (commit (do Monad<STM>
- [_ (update (* 3) _var)
+ [_ (update (i.* 3) _var)
value (read _var)]
(wrap (#;Right value)))))
(match+ 15 (commit (do Monad<STM>
diff --git a/stdlib/test/test/lux/data/bit.lux b/stdlib/test/test/lux/data/bit.lux
index a6d897519..5aca04332 100644
--- a/stdlib/test/test/lux/data/bit.lux
+++ b/stdlib/test/test/lux/data/bit.lux
@@ -16,14 +16,14 @@
(test: "Bitwise operations."
[pattern R;nat
- idx (:: @ map (%+ width) R;nat)]
+ idx (:: @ map (n.% width) R;nat)]
($_ seq
- (assert "" (and (<+ (&;count (&;set idx pattern))
- (&;count (&;clear idx pattern)))
- (<=+ (&;count pattern)
+ (assert "" (and (n.< (&;count (&;set idx pattern))
(&;count (&;clear idx pattern)))
- (>=+ (&;count pattern)
- (&;count (&;set idx pattern)))
+ (n.<= (&;count pattern)
+ (&;count (&;clear idx pattern)))
+ (n.>= (&;count pattern)
+ (&;count (&;set idx pattern)))
(or (and (&;set? idx pattern)
(not (&;set? idx (&;clear idx pattern))))
@@ -35,32 +35,32 @@
(and (not (&;set? idx pattern))
(&;set? idx (&;flip idx pattern))))
- (=+ width
- (++ (&;count pattern)
- (&;count (&;~ pattern))))
+ (n.= width
+ (n.+ (&;count pattern)
+ (&;count (&;~ pattern))))
- (=+ +0
- (&;& pattern
- (&;~ pattern)))
- (=+ (&;~ +0)
- (&;| pattern
- (&;~ pattern)))
- (=+ (&;~ +0)
- (&;^ pattern
- (&;~ pattern)))
- (=+ +0
- (&;^ pattern
- pattern))
+ (n.= +0
+ (&;& pattern
+ (&;~ pattern)))
+ (n.= (&;~ +0)
+ (&;| pattern
+ (&;~ pattern)))
+ (n.= (&;~ +0)
+ (&;^ pattern
+ (&;~ pattern)))
+ (n.= +0
+ (&;^ pattern
+ pattern))
- (|> pattern (&;rotate-left idx) (&;rotate-right idx) (=+ pattern))
- (|> pattern (&;rotate-right idx) (&;rotate-left idx) (=+ pattern))
- (|> pattern (&;rotate-left idx) (&;rotate-left (-+ idx width)) (=+ pattern))
- (|> pattern (&;rotate-right idx) (&;rotate-right (-+ idx width)) (=+ pattern))
+ (|> pattern (&;rotate-left idx) (&;rotate-right idx) (n.= pattern))
+ (|> pattern (&;rotate-right idx) (&;rotate-left idx) (n.= pattern))
+ (|> pattern (&;rotate-left idx) (&;rotate-left (n.- idx width)) (n.= pattern))
+ (|> pattern (&;rotate-right idx) (&;rotate-right (n.- idx width)) (n.= pattern))
))
(assert "Shift right respect the sign of ints."
(let [value (nat-to-int pattern)]
- (if (< 0 value)
- (< 0 (&;>> idx value))
- (>= 0 (&;>> idx value)))))
+ (if (i.< 0 value)
+ (i.< 0 (&;>> idx value))
+ (i.>= 0 (&;>> idx value)))))
))
diff --git a/stdlib/test/test/lux/data/error.lux b/stdlib/test/test/lux/data/error.lux
index cc92a1276..7cc7c2f4c 100644
--- a/stdlib/test/test/lux/data/error.lux
+++ b/stdlib/test/test/lux/data/error.lux
@@ -16,31 +16,31 @@
($_ seq
(assert "Functor correctly handles both cases."
(and (|> (: (&;Error Int) (#;Right 10))
- (&/map inc)
+ (&/map i.inc)
(case> (#;Right 11) true _ false))
(|> (: (&;Error Int) (#;Left "YOLO"))
- (&/map inc)
+ (&/map i.inc)
(case> (#;Left "YOLO") true _ false))
))
(assert "Applicative correctly handles both cases."
(and (|> (&/wrap 20)
(case> (#;Right 20) true _ false))
- (|> (&/apply (&/wrap inc) (&/wrap 10))
+ (|> (&/apply (&/wrap i.inc) (&/wrap 10))
(case> (#;Right 11) true _ false))
- (|> (&/apply (&/wrap inc) (#;Left "YOLO"))
+ (|> (&/apply (&/wrap i.inc) (#;Left "YOLO"))
(case> (#;Left "YOLO") true _ false))))
(assert "Monad correctly handles both cases."
(and (|> (do &;Monad<Error>
- [f (wrap +)
+ [f (wrap i.+)
a (wrap 10)
b (wrap 20)]
(wrap (f a b)))
(case> (#;Right 30) true _ false))
(|> (do &;Monad<Error>
- [f (wrap +)
+ [f (wrap i.+)
a (#;Left "YOLO")
b (wrap 20)]
(wrap (f a b)))
diff --git a/stdlib/test/test/lux/data/error/exception.lux b/stdlib/test/test/lux/data/error/exception.lux
index 16d09a626..92d73ae80 100644
--- a/stdlib/test/test/lux/data/error/exception.lux
+++ b/stdlib/test/test/lux/data/error/exception.lux
@@ -42,9 +42,9 @@
otherwise-val)
default-val)]]
(assert "Catch and otherwhise handlers can properly handle the flow of exception-handling."
- (=+ this-val (|> (if should-throw?
- (&;return default-val)
- (&;throw this-ex "Uh-oh..."))
- (&;catch Some-Exception (lambda [ex] some-val))
- (&;catch Another-Exception (lambda [ex] another-val))
- (&;otherwise (lambda [ex] otherwise-val))))))
+ (n.= this-val (|> (if should-throw?
+ (&;return default-val)
+ (&;throw this-ex "Uh-oh..."))
+ (&;catch Some-Exception (lambda [ex] some-val))
+ (&;catch Another-Exception (lambda [ex] another-val))
+ (&;otherwise (lambda [ex] otherwise-val))))))
diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux
index d7c622bd5..270a42358 100644
--- a/stdlib/test/test/lux/data/format/json.lux
+++ b/stdlib/test/test/lux/data/format/json.lux
@@ -34,7 +34,7 @@
(R;Random &;JSON)
(R;rec (lambda [gen-json]
(do R;Monad<Random>
- [size (:: @ map (%+ +2) R;nat)]
+ [size (:: @ map (n.% +2) R;nat)]
($_ R;alt
(:: @ wrap [])
R;bool
@@ -81,7 +81,7 @@
(def: gen-record
(R;Random Record)
(do R;Monad<Random>
- [size (:: @ map (%+ +2) R;nat)]
+ [size (:: @ map (n.% +2) R;nat)]
($_ R;seq
(:: @ wrap [])
R;bool
@@ -100,16 +100,16 @@
(struct: _ (Eq Record)
(def: (= recL recR)
(and (:: bool;Eq<Bool> = (get@ #bool recL) (get@ #bool recR))
- (;= (get@ #int recL) (get@ #int recR))
- (=. (get@ #real recL) (get@ #real recR))
+ (i.= (get@ #int recL) (get@ #int recR))
+ (r.= (get@ #real recL) (get@ #real recR))
(:: char;Eq<Char> = (get@ #char recL) (get@ #char recR))
(:: text;Eq<Text> = (get@ #text recL) (get@ #text recR))
(:: (maybe;Eq<Maybe> number;Eq<Int>) = (get@ #maybe recL) (get@ #maybe recR))
(:: (list;Eq<List> number;Eq<Int>) = (get@ #list recL) (get@ #list recR))
(let [[tL0 tL1 tL2] (get@ #tuple recL)
[tR0 tR1 tR2] (get@ #tuple recR)]
- (and (;= tL0 tR0)
- (=. tL1 tR1)
+ (and (i.= tL0 tR0)
+ (r.= tL1 tR1)
(:: char;Eq<Char> = tL2 tR2)))
)))
diff --git a/stdlib/test/test/lux/data/ident.lux b/stdlib/test/test/lux/data/ident.lux
index 53ce4968e..e3e313f1a 100644
--- a/stdlib/test/test/lux/data/ident.lux
+++ b/stdlib/test/test/lux/data/ident.lux
@@ -15,14 +15,14 @@
(test: "Idents"
[## First Ident
- sizeM1 (|> R;nat (:: @ map (%+ +100)))
- sizeN1 (|> R;nat (:: @ map (%+ +100)))
+ sizeM1 (|> R;nat (:: @ map (n.% +100)))
+ sizeN1 (|> R;nat (:: @ map (n.% +100)))
module1 (R;text sizeM1)
name1 (R;text sizeN1)
#let [ident1 [module1 name1]]
## Second Ident
- sizeM2 (|> R;nat (:: @ map (%+ +100)))
- sizeN2 (|> R;nat (:: @ map (%+ +100)))
+ sizeM2 (|> R;nat (:: @ map (n.% +100)))
+ sizeN2 (|> R;nat (:: @ map (n.% +100)))
module2 (R;text sizeM2)
name2 (R;text sizeN2)
#let [ident2 [module2 name2]]
diff --git a/stdlib/test/test/lux/data/log.lux b/stdlib/test/test/lux/data/log.lux
index 3a02638c7..2075e0232 100644
--- a/stdlib/test/test/lux/data/log.lux
+++ b/stdlib/test/test/lux/data/log.lux
@@ -18,18 +18,18 @@
(let [(^open "&/") (&;Monad<Log> text;Monoid<Text>)]
($_ seq
(assert "Functor respects Log."
- (= 11 (product;right (&/map inc ["" 10]))))
+ (i.= 11 (product;right (&/map i.inc ["" 10]))))
(assert "Applicative respects Log."
- (and (= 20 (product;right (&/wrap 20)))
- (= 30 (product;right (&/apply (&/wrap (+ 10)) (&/wrap 20))))))
+ (and (i.= 20 (product;right (&/wrap 20)))
+ (i.= 30 (product;right (&/apply (&/wrap (i.+ 10)) (&/wrap 20))))))
(assert "Monad respects Log."
- (= 30 (product;right (do (&;Monad<Log> text;Monoid<Text>)
- [f (wrap +)
- a (wrap 10)
- b (wrap 20)]
- (wrap (f a b))))))
+ (i.= 30 (product;right (do (&;Monad<Log> text;Monoid<Text>)
+ [f (wrap i.+)
+ a (wrap 10)
+ b (wrap 20)]
+ (wrap (f a b))))))
(assert "Can log any value."
(Text/= "YOLO" (product;left (&;log "YOLO"))))
diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux
index adefb480a..513af2ddf 100644
--- a/stdlib/test/test/lux/data/number.lux
+++ b/stdlib/test/test/lux/data/number.lux
@@ -85,18 +85,18 @@
(= unit (append unit unit))
(>= x (append x x))))))]
- ["Nat/Add" R;nat Number<Nat> Add@Monoid<Nat> (;%+ +1000)]
- ["Nat/Mul" R;nat Number<Nat> Mul@Monoid<Nat> (;%+ +1000)]
- ["Nat/Min" R;nat Number<Nat> Min@Monoid<Nat> (;%+ +1000)]
- ["Nat/Max" R;nat Number<Nat> Max@Monoid<Nat> (;%+ +1000)]
- ["Int/Add" R;int Number<Int> Add@Monoid<Int> (;% 1000)]
- ["Int/Mul" R;int Number<Int> Mul@Monoid<Int> (;% 1000)]
- ["Int/Min" R;int Number<Int> Min@Monoid<Int> (;% 1000)]
- ["Int/Max" R;int Number<Int> Max@Monoid<Int> (;% 1000)]
- ["Real/Add" R;real Number<Real> Add@Monoid<Real> (;%. 1000.0)]
- ["Real/Mul" R;real Number<Real> Mul@Monoid<Real> (;%. 1000.0)]
- ["Real/Min" R;real Number<Real> Min@Monoid<Real> (;%. 1000.0)]
- ["Real/Max" R;real Number<Real> Max@Monoid<Real> (;%. 1000.0)]
+ ["Nat/Add" R;nat Number<Nat> Add@Monoid<Nat> (n.% +1000)]
+ ["Nat/Mul" R;nat Number<Nat> Mul@Monoid<Nat> (n.% +1000)]
+ ["Nat/Min" R;nat Number<Nat> Min@Monoid<Nat> (n.% +1000)]
+ ["Nat/Max" R;nat Number<Nat> Max@Monoid<Nat> (n.% +1000)]
+ ["Int/Add" R;int Number<Int> Add@Monoid<Int> (i.% 1000)]
+ ["Int/Mul" R;int Number<Int> Mul@Monoid<Int> (i.% 1000)]
+ ["Int/Min" R;int Number<Int> Min@Monoid<Int> (i.% 1000)]
+ ["Int/Max" R;int Number<Int> Max@Monoid<Int> (i.% 1000)]
+ ["Real/Add" R;real Number<Real> Add@Monoid<Real> (r.% 1000.0)]
+ ["Real/Mul" R;real Number<Real> Mul@Monoid<Real> (r.% 1000.0)]
+ ["Real/Min" R;real Number<Real> Min@Monoid<Real> (r.% 1000.0)]
+ ["Real/Max" R;real Number<Real> Max@Monoid<Real> (r.% 1000.0)]
)
(do-template [category rand-gen <Number> <Codec>]
diff --git a/stdlib/test/test/lux/data/product.lux b/stdlib/test/test/lux/data/product.lux
index f74c9a4d8..3d064f96e 100644
--- a/stdlib/test/test/lux/data/product.lux
+++ b/stdlib/test/test/lux/data/product.lux
@@ -16,11 +16,11 @@
(test: "Products"
($_ seq
(assert "Can access the sides of a pair."
- (and (= 1 (left [1 2]))
- (= 2 (right [1 2]))))
+ (and (i.= 1 (left [1 2]))
+ (i.= 2 (right [1 2]))))
(assert "Can swap the sides of a pair."
(let [[_left _right] (swap [1 2])]
- (and (= 2 _left)
- (= 1 _right))))
+ (and (i.= 2 _left)
+ (i.= 1 _right))))
))
diff --git a/stdlib/test/test/lux/data/struct/array.lux b/stdlib/test/test/lux/data/struct/array.lux
index ba4b5a3ae..6decd910f 100644
--- a/stdlib/test/test/lux/data/struct/array.lux
+++ b/stdlib/test/test/lux/data/struct/array.lux
@@ -17,7 +17,7 @@
(def: bounded-size
(R;Random Nat)
(|> R;nat
- (:: R;Monad<Random> map (|>. (%+ +100) (++ +1)))))
+ (:: R;Monad<Random> map (|>. (n.% +100) (n.+ +1)))))
(test: "Arrays and their copies"
[size bounded-size
@@ -29,7 +29,7 @@
(&;new size))]]
($_ seq
(assert "Size function must correctly return size of array."
- (=+ size (&;size original)))
+ (n.= size (&;size original)))
(assert "Cloning an array should yield and identical array, but not the same one."
(and (:: (&;Eq<Array> number;Eq<Nat>) = original clone)
(not (== original clone))))
@@ -41,7 +41,7 @@
(exec (:: &;Fold<Array> fold
(lambda [x idx]
(exec (&;put idx x manual-copy)
- (inc+ idx)))
+ (n.inc idx)))
+0
original)
(:: (&;Eq<Array> number;Eq<Nat>) = original manual-copy)))
@@ -53,9 +53,9 @@
(test: "Array mutation"
[size bounded-size
- idx (:: @ map (%+ size) R;nat)
+ idx (:: @ map (n.% size) R;nat)
array (|> (R;array size R;nat)
- (R;filter (|>. &;to-list (list;any? odd?+))))
+ (R;filter (|>. &;to-list (list;any? n.odd?))))
#let [value (default (undefined)
(&;get idx array))]]
($_ seq
@@ -65,32 +65,32 @@
#;None true))
(assert "You should be able to access values put into the array."
(case (&;get idx (&;put idx value array))
- (#;Some value') (=+ value' value)
+ (#;Some value') (n.= value' value)
#;None false))
(assert "All cells should be occupied on a full array."
- (and (=+ size (&;occupied array))
- (=+ +0 (&;vacant array))))
+ (and (n.= size (&;occupied array))
+ (n.= +0 (&;vacant array))))
(assert "Filtering mutates the array to remove invalid values."
- (exec (&;filter even?+ array)
- (and (<+ size (&;occupied array))
- (>+ +0 (&;vacant array))
- (=+ size (++ (&;occupied array)
- (&;vacant array))))))
+ (exec (&;filter n.even? array)
+ (and (n.< size (&;occupied array))
+ (n.> +0 (&;vacant array))
+ (n.= size (n.+ (&;occupied array)
+ (&;vacant array))))))
))
(test: "Finding values."
[size bounded-size
array (|> (R;array size R;nat)
- (R;filter (|>. &;to-list (list;any? even?+))))]
+ (R;filter (|>. &;to-list (list;any? n.even?))))]
($_ seq
(assert "Can find values inside arrays."
- (|> (&;find even?+ array)
+ (|> (&;find n.even? array)
(case> (#;Some _) true
#;None false)))
(assert "Can find values inside arrays (with access to indices)."
(|> (&;find+ (lambda [idx n]
- (and (even?+ n)
- (<+ size idx)))
+ (and (n.even? n)
+ (n.< size idx)))
array)
(case> (#;Some _) true
#;None false)))))
@@ -106,8 +106,8 @@
(and (= array copy)
(not (== array copy)))))
(assert "Functor should go over all available array elements."
- (let [there (map inc+ array)
- back-again (map dec+ there)]
+ (let [there (map n.inc array)
+ back-again (map n.dec there)]
(and (not (= array there))
(= array back-again)))))))
@@ -121,7 +121,7 @@
fusion (append left right)]]
($_ seq
(assert "Appending two arrays should produce a new one twice as large."
- (=+ (++ sizeL sizeR) (&;size fusion)))
+ (n.= (n.+ sizeL sizeR) (&;size fusion)))
(assert "First elements of fused array should equal the first array."
(|> (: (&;Array Nat)
(&;new sizeL))
diff --git a/stdlib/test/test/lux/data/struct/dict.lux b/stdlib/test/test/lux/data/struct/dict.lux
index 2e14ddfff..acd878e8d 100644
--- a/stdlib/test/test/lux/data/struct/dict.lux
+++ b/stdlib/test/test/lux/data/struct/dict.lux
@@ -20,7 +20,7 @@
lux/test)
(test: "Dictionaries."
- [#let [capped-nat (:: R;Monad<Random> map (%+ +100) R;nat)]
+ [#let [capped-nat (:: R;Monad<Random> map (n.% +100) R;nat)]
size capped-nat
dict (R;dict char;Hash<Char> size R;char capped-nat)
non-key (|> R;char
@@ -29,10 +29,10 @@
(R;filter (lambda [val] (not (list;member? number;Eq<Nat> (&;values dict) val)))))]
($_ seq
(assert "Size function should correctly represent Dict size."
- (=+ size (&;size dict)))
+ (n.= size (&;size dict)))
(assert "Dicts of size 0 should be considered empty."
- (if (=+ +0 size)
+ (if (n.= +0 size)
(&;empty? dict)
(not (&;empty? dict))))
@@ -59,19 +59,19 @@
(assert "Should be able to put and then get a value."
(case (&;get non-key (&;put non-key test-val dict))
- (#;Some v) (=+ test-val v)
+ (#;Some v) (n.= test-val v)
_ true))
(assert "Should be able to put~ and then get a value."
(case (&;get non-key (&;put~ non-key test-val dict))
- (#;Some v) (=+ test-val v)
+ (#;Some v) (n.= test-val v)
_ true))
(assert "Shouldn't be able to put~ an existing key."
- (or (=+ +0 size)
+ (or (n.= +0 size)
(let [first-key (|> dict &;keys list;head (default (undefined)))]
(case (&;get first-key (&;put~ first-key test-val dict))
- (#;Some v) (not (=+ test-val v))
+ (#;Some v) (not (n.= test-val v))
_ true))))
(assert "Removing a key should make it's value inaccessible."
@@ -81,10 +81,10 @@
(assert "Should be possible to update values via their keys."
(let [base (&;put non-key test-val dict)
- updt (&;update non-key inc+ base)]
+ updt (&;update non-key n.inc base)]
(case [(&;get non-key base) (&;get non-key updt)]
[(#;Some x) (#;Some y)]
- (=+ (inc+ x) y)
+ (n.= (n.inc x) y)
_
false)))
@@ -92,8 +92,8 @@
(assert "Additions and removals to a Dict should affect its size."
(let [plus (&;put non-key test-val dict)
base (&;remove non-key plus)]
- (and (=+ (inc+ (&;size dict)) (&;size plus))
- (=+ (dec+ (&;size plus)) (&;size base)))))
+ (and (n.= (n.inc (&;size dict)) (&;size plus))
+ (n.= (n.dec (&;size plus)) (&;size base)))))
(assert "A Dict should equal itself & going to<->from lists shouldn't change that."
(let [(^open) (&;Eq<Dict> number;Eq<Nat>)]
@@ -106,31 +106,31 @@
(assert "If you merge, and the second dict has overlapping keys, it should overwrite yours."
(let [dict' (|> dict &;entries
- (List/map (lambda [[k v]] [k (inc+ v)]))
+ (List/map (lambda [[k v]] [k (n.inc v)]))
(&;from-list char;Hash<Char>))
(^open) (&;Eq<Dict> number;Eq<Nat>)]
(= dict' (&;merge dict' dict))))
(assert "Can merge values in such a way that they become combined."
- (list;every? (lambda [[x x*2]] (=+ (*+ +2 x) x*2))
+ (list;every? (lambda [[x x*2]] (n.= (n.* +2 x) x*2))
(list;zip2 (&;values dict)
- (&;values (&;merge-with ++ dict dict)))))
+ (&;values (&;merge-with n.+ dict dict)))))
(assert "Should be able to select subset of keys from dict."
(|> dict
(&;put non-key test-val)
(&;select (list non-key))
&;size
- (=+ +1)))
+ (n.= +1)))
(assert "Should be able to re-bind existing values to different keys."
- (or (=+ +0 size)
+ (or (n.= +0 size)
(let [first-key (|> dict &;keys list;head (default (undefined)))
rebound (&;re-bind first-key non-key dict)]
- (and (=+ (&;size dict) (&;size rebound))
+ (and (n.= (&;size dict) (&;size rebound))
(&;contains? non-key rebound)
(not (&;contains? first-key rebound))
- (=+ (default (undefined)
+ (n.= (default (undefined)
(&;get first-key dict))
(default (undefined)
(&;get non-key rebound)))))))
diff --git a/stdlib/test/test/lux/data/struct/list.lux b/stdlib/test/test/lux/data/struct/list.lux
index 5803e8615..aa269988b 100644
--- a/stdlib/test/test/lux/data/struct/list.lux
+++ b/stdlib/test/test/lux/data/struct/list.lux
@@ -19,11 +19,11 @@
(def: bounded-size
(R;Random Nat)
(|> R;nat
- (:: R;Monad<Random> map (|>. (%+ +100) (++ +10)))))
+ (:: R;Monad<Random> map (|>. (n.% +100) (n.+ +10)))))
(test: "Lists: Part 1"
[size bounded-size
- idx (:: @ map (%+ size) R;nat)
+ idx (:: @ map (n.% size) R;nat)
sample (R;list size R;nat)
other-size bounded-size
other-sample (R;list other-size R;nat)
@@ -32,33 +32,33 @@
(^open "&/") &;Functor<List>]]
($_ seq
(assert "The size function should correctly portray the size of the list."
- (=+ size (&;size sample)))
+ (n.= size (&;size sample)))
(assert "The repeat function should produce as many elements as asked of it."
- (=+ size (&;size (&;repeat size []))))
+ (n.= size (&;size (&;repeat size []))))
(assert "Reversing a list does not change it's size."
- (=+ (&;size sample)
- (&;size (&;reverse sample))))
+ (n.= (&;size sample)
+ (&;size (&;reverse sample))))
(assert "Reversing a list twice results in the original list."
(= sample
(&;reverse (&;reverse sample))))
(assert "Filtering by a predicate and its complement should result in a number of elements equal to the original list."
- (and (=+ (&;size sample)
- (++ (&;size (&;filter even?+ sample))
- (&;size (&;filter (bool;complement even?+) sample))))
- (let [[plus minus] (&;partition even?+ sample)]
- (=+ (&;size sample)
- (++ (&;size plus)
- (&;size minus))))))
+ (and (n.= (&;size sample)
+ (n.+ (&;size (&;filter n.even? sample))
+ (&;size (&;filter (bool;complement n.even?) sample))))
+ (let [[plus minus] (&;partition n.even? sample)]
+ (n.= (&;size sample)
+ (n.+ (&;size plus)
+ (&;size minus))))))
(assert "If every element in a list satisfies a predicate, there can't be any that satisfy its complement."
- (if (&;every? even?+ sample)
- (and (not (&;any? (bool;complement even?+) sample))
- (&;empty? (&;filter (bool;complement even?+) sample)))
- (&;any? (bool;complement even?+) sample)))
+ (if (&;every? n.even? sample)
+ (and (not (&;any? (bool;complement n.even?) sample))
+ (&;empty? (&;filter (bool;complement n.even?) sample)))
+ (&;any? (bool;complement n.even?) sample)))
(assert "Any element of the list can be considered it's member."
(let [elem (default (undefined)
@@ -68,7 +68,7 @@
(test: "Lists: Part 2"
[size bounded-size
- idx (:: @ map (%+ size) R;nat)
+ idx (:: @ map (n.% size) R;nat)
sample (R;list size R;nat)
other-size bounded-size
other-sample (R;list other-size R;nat)
@@ -95,15 +95,15 @@
(assert "Functor should go over every element of the list."
(let [(^open) &;Functor<List>
- there (map inc+ sample)
- back-again (map dec+ there)]
+ there (map n.inc sample)
+ back-again (map n.dec there)]
(and (not (= sample there))
(= sample back-again))))
(assert "Splitting a list into chunks and re-appending them should yield the original list."
(let [(^open) &;Monoid<List>
[left right] (&;split idx sample)
- [left' right'] (&;split-with even?+ sample)]
+ [left' right'] (&;split-with n.even? sample)]
(and (= sample
(append left right))
(= sample
@@ -112,26 +112,26 @@
(append (&;take idx sample)
(&;drop idx sample)))
(= sample
- (append (&;take-while even?+ sample)
- (&;drop-while even?+ sample)))
+ (append (&;take-while n.even? sample)
+ (&;drop-while n.even? sample)))
)))
(assert "Segmenting the list in pairs should yield as many elements as N/2."
- (=+ (/+ +2 size)
- (&;size (&;as-pairs sample))))
+ (n.= (n./ +2 size)
+ (&;size (&;as-pairs sample))))
(assert "Sorting a list shouldn't change it's size."
- (=+ (&;size sample)
- (&;size (&;sort <+ sample))))
+ (n.= (&;size sample)
+ (&;size (&;sort n.< sample))))
(assert "Sorting a list with one order should yield the reverse of sorting it with the opposite order."
- (= (&;sort <+ sample)
- (&;reverse (&;sort >+ sample))))
+ (= (&;sort n.< sample)
+ (&;reverse (&;sort n.> sample))))
))
(test: "Lists: Part 3"
[size bounded-size
- idx (:: @ map (%+ size) R;nat)
+ idx (:: @ map (n.% size) R;nat)
sample (R;list size R;nat)
other-size bounded-size
other-sample (R;list other-size R;nat)
@@ -140,8 +140,8 @@
(^open "&/") &;Functor<List>]]
($_ seq
(assert "If you zip 2 lists, the result's size will be that of the smaller list."
- (=+ (&;size (&;zip2 sample other-sample))
- (min+ (&;size sample) (&;size other-sample))))
+ (n.= (&;size (&;zip2 sample other-sample))
+ (n.min (&;size sample) (&;size other-sample))))
(assert "I can pair-up elements of a list in order."
(let [(^open) &;Functor<List>
@@ -153,21 +153,21 @@
(assert "You can generate indices for any size, and they will be in ascending order."
(let [(^open) &;Functor<List>
indices (&;indices size)]
- (and (=+ size (&;size indices))
+ (and (n.= size (&;size indices))
(= indices
- (&;sort <+ indices))
- (&;every? (=+ (dec+ size))
- (&;zip2-with ++
+ (&;sort n.< indices))
+ (&;every? (n.= (n.dec size))
+ (&;zip2-with n.+
indices
- (&;sort >+ indices)))
+ (&;sort n.> indices)))
)))
(assert "The 'interpose' function places a value between every member of a list."
(let [(^open) &;Functor<List>
sample+ (&;interpose separator sample)]
- (and (=+ (|> size (*+ +2) dec+)
- (&;size sample+))
- (|> sample+ &;as-pairs (map product;right) (&;every? (=+ separator))))))
+ (and (n.= (|> size (n.* +2) n.dec)
+ (&;size sample+))
+ (|> sample+ &;as-pairs (map product;right) (&;every? (n.= separator))))))
(assert "List append is a monoid."
(let [(^open) &;Monoid<List>]
@@ -180,8 +180,8 @@
(assert "Applicative allows you to create singleton lists, and apply lists of functions to lists of values."
(let [(^open) &;Applicative<List>]
(and (= (list separator) (wrap separator))
- (= (map inc+ sample)
- (apply (wrap inc+) sample)))))
+ (= (map n.inc sample)
+ (apply (wrap n.inc) sample)))))
(assert "List concatenation is a monad."
(let [(^open) &;Monad<List>
@@ -190,19 +190,19 @@
(join (list sample other-sample)))))
(assert "You can find any value that satisfies some criterium, if such values exist in the list."
- (case (&;find even?+ sample)
+ (case (&;find n.even? sample)
(#;Some found)
- (and (even?+ found)
- (&;any? even?+ sample)
- (not (&;every? (bool;complement even?+) sample)))
+ (and (n.even? found)
+ (&;any? n.even? sample)
+ (not (&;every? (bool;complement n.even?) sample)))
#;None
- (and (not (&;any? even?+ sample))
- (&;every? (bool;complement even?+) sample))))
+ (and (not (&;any? n.even? sample))
+ (&;every? (bool;complement n.even?) sample))))
(assert "You can iteratively construct a list, generating values until you're done."
- (= (&;range+ +0 (dec+ size))
- (&;iterate (lambda [n] (if (<+ size n) (#;Some (inc+ n)) #;None))
+ (= (&;n.range +0 (n.dec size))
+ (&;iterate (lambda [n] (if (n.< size n) (#;Some (n.inc n)) #;None))
+0)))
(assert "Can enumerate all elements in a list."
diff --git a/stdlib/test/test/lux/data/struct/queue.lux b/stdlib/test/test/lux/data/struct/queue.lux
index 5473532bc..98379e30a 100644
--- a/stdlib/test/test/lux/data/struct/queue.lux
+++ b/stdlib/test/test/lux/data/struct/queue.lux
@@ -14,21 +14,21 @@
lux/test)
(test: "Queues"
- [size (:: @ map (%+ +100) R;nat)
+ [size (:: @ map (n.% +100) R;nat)
sample (R;queue size R;nat)
non-member (|> R;nat
(R;filter (. not (&;enqueued? number;Eq<Nat> sample))))]
($_ seq
(assert "I can query the size of a queue (and empty queues have size 0)."
- (if (=+ +0 size)
+ (if (n.= +0 size)
(&;empty? sample)
- (=+ size (&;size sample))))
+ (n.= size (&;size sample))))
(assert "Enqueueing and dequeing affects the size of queues."
- (and (=+ (inc+ size) (&;size (&;enqueue non-member sample)))
+ (and (n.= (n.inc size) (&;size (&;enqueue non-member sample)))
(or (&;empty? sample)
- (=+ (dec+ size) (&;size (&;dequeue sample))))
- (=+ size (&;size (&;dequeue (&;enqueue non-member sample))))))
+ (n.= (n.dec size) (&;size (&;dequeue sample))))
+ (n.= size (&;size (&;dequeue (&;enqueue non-member sample))))))
(assert "Transforming to/from list can't change the queue."
(let [(^open "&/") (&;Eq<Queue> number;Eq<Nat>)]
diff --git a/stdlib/test/test/lux/data/struct/set.lux b/stdlib/test/test/lux/data/struct/set.lux
index 7a4663509..bc284dd4a 100644
--- a/stdlib/test/test/lux/data/struct/set.lux
+++ b/stdlib/test/test/lux/data/struct/set.lux
@@ -17,7 +17,7 @@
(def: gen-nat
(R;Random Nat)
(|> R;nat
- (:: R;Monad<Random> map (%+ +100))))
+ (:: R;Monad<Random> map (n.% +100))))
(test: "Sets"
[sizeL gen-nat
@@ -29,8 +29,8 @@
#let [(^open "&/") &;Eq<Set>]]
($_ seq
(assert "I can query the size of a set."
- (and (=+ sizeL (&;size setL))
- (=+ sizeR (&;size setR))))
+ (and (n.= sizeL (&;size setL))
+ (n.= sizeR (&;size setR))))
(assert "Converting sets to/from lists can't change their values."
(|> setL
diff --git a/stdlib/test/test/lux/data/struct/stack.lux b/stdlib/test/test/lux/data/struct/stack.lux
index c33bc4012..427c5c04d 100644
--- a/stdlib/test/test/lux/data/struct/stack.lux
+++ b/stdlib/test/test/lux/data/struct/stack.lux
@@ -17,7 +17,7 @@
(def: gen-nat
(R;Random Nat)
(|> R;nat
- (:: R;Monad<Random> map (%+ +100))))
+ (:: R;Monad<Random> map (n.% +100))))
(test: "Stacks"
[size gen-nat
@@ -25,7 +25,7 @@
new-top gen-nat]
($_ seq
(assert "Can query the size of a stack."
- (=+ size (&;size sample)))
+ (n.= size (&;size sample)))
(assert "Can peek inside non-empty stacks."
(case (&;peek sample)
@@ -35,14 +35,14 @@
(assert "Popping empty stacks doesn't change anything.
But, if they're non-empty, the top of the stack is removed."
(let [sample' (&;pop sample)]
- (or (=+ (&;size sample) (inc+ (&;size sample')))
+ (or (n.= (&;size sample) (n.inc (&;size sample')))
(and (&;empty? sample) (&;empty? sample')))
))
(assert "Pushing onto a stack always increases it by 1, adding a new value at the top."
(and (== sample
(&;pop (&;push new-top sample)))
- (=+ (inc+ (&;size sample)) (&;size (&;push new-top sample)))
+ (n.= (n.inc (&;size sample)) (&;size (&;push new-top sample)))
(|> (&;push new-top sample) &;peek (default (undefined))
(== new-top))))
))
diff --git a/stdlib/test/test/lux/data/struct/tree.lux b/stdlib/test/test/lux/data/struct/tree.lux
index 90b80943a..3c60628e5 100644
--- a/stdlib/test/test/lux/data/struct/tree.lux
+++ b/stdlib/test/test/lux/data/struct/tree.lux
@@ -17,7 +17,7 @@
(def: gen-nat
(R;Random Nat)
(|> R;nat
- (:: R;Monad<Random> map (%+ +100))))
+ (:: R;Monad<Random> map (n.% +100))))
(test: "Trees"
[leaf (:: @ map &;leaf R;nat)
diff --git a/stdlib/test/test/lux/data/struct/vector.lux b/stdlib/test/test/lux/data/struct/vector.lux
index c3f3a706e..fe1350ce0 100644
--- a/stdlib/test/test/lux/data/struct/vector.lux
+++ b/stdlib/test/test/lux/data/struct/vector.lux
@@ -18,8 +18,8 @@
lux/test)
(test: "Vectors"
- [size (|> R;nat (:: @ map (%+ +100)))
- idx (|> R;nat (:: @ map (%+ size)))
+ [size (|> R;nat (:: @ map (n.% +100)))
+ idx (|> R;nat (:: @ map (n.% size)))
sample (R;vector size R;nat)
other-sample (R;vector size R;nat)
non-member (|> R;nat (R;filter (. not (&;member? number;Eq<Nat> sample))))
@@ -30,13 +30,13 @@
($_ seq
(assert "Can query size of vector."
(if (&;empty? sample)
- (and (=+ +0 size)
- (=+ +0 (&;size sample)))
- (=+ size (&;size sample))))
+ (and (n.= +0 size)
+ (n.= +0 (&;size sample)))
+ (n.= size (&;size sample))))
(assert "Can add and remove elements to vectors."
- (and (=+ (inc+ size) (&;size (&;add non-member sample)))
- (=+ (dec+ size) (&;size (&;pop sample)))))
+ (and (n.= (n.inc size) (&;size (&;add non-member sample)))
+ (n.= (n.dec size) (&;size (&;pop sample)))))
(assert "Can put and get elements into vectors."
(|> sample
@@ -47,9 +47,9 @@
(assert "Can update elements of vectors."
(|> sample
- (&;put idx non-member) (&;update idx inc+)
+ (&;put idx non-member) (&;update idx n.inc)
(&;at idx) (default (undefined))
- (=+ (inc+ non-member))))
+ (n.= (n.inc non-member))))
(assert "Can safely transform to/from lists."
(|> sample &;to-list &;from-list (&/= sample)))
@@ -59,18 +59,18 @@
(&;member? number;Eq<Nat> (&;add non-member sample) non-member)))
(assert "Can fold over elements of vector."
- (=+ (List/fold ++ +0 (&;to-list sample))
- (&/fold ++ +0 sample)))
+ (n.= (List/fold n.+ +0 (&;to-list sample))
+ (&/fold n.+ +0 sample)))
(assert "Functor goes over every element."
- (let [there (&/map inc+ sample)
- back-again (&/map dec+ there)]
+ (let [there (&/map n.inc sample)
+ back-again (&/map n.dec there)]
(and (not (&/= sample there))
(&/= sample back-again))))
(assert "Applicative allows you to create singleton vectors, and apply vectors of functions to vectors of values."
(and (&/= (&;vector non-member) (&/wrap non-member))
- (&/= (&/map inc+ sample) (&/apply (&/wrap inc+) sample))))
+ (&/= (&/map n.inc sample) (&/apply (&/wrap n.inc) sample))))
(assert "Vector concatenation is a monad."
(&/= (&/append sample other-sample)
diff --git a/stdlib/test/test/lux/data/struct/zipper.lux b/stdlib/test/test/lux/data/struct/zipper.lux
index 62f167ffd..6e1a168c2 100644
--- a/stdlib/test/test/lux/data/struct/zipper.lux
+++ b/stdlib/test/test/lux/data/struct/zipper.lux
@@ -23,7 +23,7 @@
(R;rec (lambda [gen-tree]
(do R;Monad<Random>
## Each branch can have, at most, 1 child.
- [size (|> R;nat (:: @ map (%+ +2)))]
+ [size (|> R;nat (:: @ map (n.% +2)))]
(R;seq R;nat
(R;list size gen-tree))))))
@@ -99,7 +99,7 @@
#;None true))))))
(assert "Can set and update the value of a node."
- (|> sample &;from-tree (&;set new-val) &;value (=+ new-val)))
+ (|> sample &;from-tree (&;set new-val) &;value (n.= new-val)))
(assert "Zipper traversal follows the outline of the tree depth-first."
(List/= (tree;flatten sample)
diff --git a/stdlib/test/test/lux/data/sum.lux b/stdlib/test/test/lux/data/sum.lux
index 049dff77c..2ff10dbf5 100644
--- a/stdlib/test/test/lux/data/sum.lux
+++ b/stdlib/test/test/lux/data/sum.lux
@@ -34,6 +34,6 @@
(list (+0 "0") (+1 "1") (+0 "2"))))))))
(assert "Can apply a function to an Either value depending on the case."
- (and (= 10 (either (lambda [_] 10) (lambda [_] 20) (: (| Text Text) (+0 ""))))
- (= 20 (either (lambda [_] 10) (lambda [_] 20) (: (| Text Text) (+1 ""))))))
+ (and (i.= 10 (either (lambda [_] 10) (lambda [_] 20) (: (| Text Text) (+0 ""))))
+ (i.= 20 (either (lambda [_] 10) (lambda [_] 20) (: (| Text Text) (+1 ""))))))
)))
diff --git a/stdlib/test/test/lux/data/text.lux b/stdlib/test/test/lux/data/text.lux
index 8b315c8b0..46f9192dd 100644
--- a/stdlib/test/test/lux/data/text.lux
+++ b/stdlib/test/test/lux/data/text.lux
@@ -18,20 +18,20 @@
lux/test)
(test: "Size"
- [size (:: @ map (%+ +100) R;nat)
+ [size (:: @ map (n.% +100) R;nat)
sample (R;text size)]
- (assert "" (or (and (=+ +0 size)
+ (assert "" (or (and (n.= +0 size)
(&;empty? sample))
- (=+ size (&;size sample)))))
+ (n.= size (&;size sample)))))
(def: bounded-size
(R;Random Nat)
(|> R;nat
- (:: R;Monad<Random> map (|>. (%+ +100) (++ +1)))))
+ (:: R;Monad<Random> map (|>. (n.% +100) (n.+ +1)))))
(test: "Locations"
[size bounded-size
- idx (:: @ map (%+ size) R;nat)
+ idx (:: @ map (n.% size) R;nat)
sample (R;text size)]
(assert "" (|> sample
(&;at idx)
@@ -43,11 +43,11 @@
(&;last-index-of' char' idx sample)]
[(#;Some io) (#;Some lio)
(#;Some io') (#;Some lio')]})
- (and (<=+ idx io)
- (>=+ idx lio)
+ (and (n.<= idx io)
+ (n.>= idx lio)
- (=+ idx io')
- (>=+ idx lio')
+ (n.= idx io')
+ (n.>= idx lio')
(&;contains? char' sample))
@@ -109,8 +109,8 @@
#let [sample1 (&;concat (list;interpose sep1 parts))
sample2 (&;concat (list;interpose sep2 parts))
(^open) &;Eq<Text>]]
- (assert "" (and (=+ (list;size parts)
- (list;size (&;split-all-with sep1 sample1)))
+ (assert "" (and (n.= (list;size parts)
+ (list;size (&;split-all-with sep1 sample1)))
(= sample2
(&;replace sep1 sep2 sample1))
)))
diff --git a/stdlib/test/test/lux/math.lux b/stdlib/test/test/lux/math.lux
index 3d5e053f7..8d96fcc41 100644
--- a/stdlib/test/test/lux/math.lux
+++ b/stdlib/test/test/lux/math.lux
@@ -13,14 +13,14 @@
(test: "lux/math exports"
(test-all (match 1.0 (cos 0.0))
- (match -1.0 (cos (/. 2.0 tau)))
- ## (match 0.0 (cos (/. 4.0 tau)))
- ## (match 0.0 (cos (*. (/. 4.0 3.0) tau)))
+ (match -1.0 (cos (r./ 2.0 tau)))
+ ## (match 0.0 (cos (r./ 4.0 tau)))
+ ## (match 0.0 (cos (r.* (r./ 4.0 3.0) tau)))
- (match 1.0 (sin (/. 4.0 tau)))
- (match -1.0 (sin (*. (/. 4.0 3.0) tau)))
+ (match 1.0 (sin (r./ 4.0 tau)))
+ (match -1.0 (sin (r.* (r./ 4.0 3.0) tau)))
## (match 0.0 (sin 0.0))
- ## (match 0.0 (sin (/. 2.0 tau)))
+ ## (match 0.0 (sin (r./ 2.0 tau)))
(match 4 (ceil 3.75))
(match 3 (floor 3.75))
@@ -30,16 +30,16 @@
(match 3.0 (cbrt 27.0))
(match 4.0 (sqrt 16.0))
- (match 90.0 (degrees (/. 4.0 tau)))
- (match true (=. tau (radians (degrees tau))))
+ (match 90.0 (degrees (r./ 4.0 tau)))
+ (match true (r.= tau (radians (degrees tau))))
(match 9 (gcd 450 27))
(match 40 (lcm 10 8))
(match 27 (infix 27))
(match 9 (infix [27 gcd 450]))
- (match 9 (infix [(* 3 9) gcd 450]))
- (match true (infix [#and 27 < 450 < 2000]))
- (match true (infix [#and 27 < 450 > 200]))
- (match true (infix [[27 < 450] and [200 < 2000]]))
+ (match 9 (infix [(i.* 3 9) gcd 450]))
+ (match true (infix [#and 27 i.< 450 i.< 2000]))
+ (match true (infix [#and 27 i.< 450 i.> 200]))
+ (match true (infix [[27 i.< 450] and [200 i.< 2000]]))
))
diff --git a/stdlib/test/test/lux/pipe.lux b/stdlib/test/test/lux/pipe.lux
index a601bbf98..681c4bf71 100644
--- a/stdlib/test/test/lux/pipe.lux
+++ b/stdlib/test/test/lux/pipe.lux
@@ -12,26 +12,26 @@
(test: "lux/pipe exports"
(test-all (match 1 (|> 20
- (* 3)
- (+ 4)
- (_> 0 inc)))
+ (i.* 3)
+ (i.+ 4)
+ (_> 0 i.inc)))
(match 10 (|> 5
- (@> [(+ @ @)])))
+ (@> [(i.+ @ @)])))
(match 15 (|> 5
- (?> [even?] [(* 2)]
- [odd?] [(* 3)]
+ (?> [i.even?] [(i.* 2)]
+ [i.odd?] [(i.* 3)]
[(_> -1)])))
(match 15 (|> 5
- (?> [even?] [(* 2)]
- [odd?] [(* 3)])))
+ (?> [i.even?] [(i.* 2)]
+ [i.odd?] [(i.* 3)])))
(match 10 (|> 1
- (!> [(< 10)]
- [inc])))
+ (!> [(i.< 10)]
+ [i.inc])))
(match 20 (|> 5
(%> Monad<Identity>
- [(* 3)]
- [(+ 4)]
- [inc])))
+ [(i.* 3)]
+ [(i.+ 4)]
+ [i.inc])))
(match "five" (|> 5
(case> 0 "zero"
1 "one"