aboutsummaryrefslogtreecommitdiff
path: root/stdlib/test
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/test')
-rw-r--r--stdlib/test/test/lux.lux56
-rw-r--r--stdlib/test/test/lux/cli.lux50
-rw-r--r--stdlib/test/test/lux/concurrency/actor.lux46
-rw-r--r--stdlib/test/test/lux/concurrency/atom.lux24
-rw-r--r--stdlib/test/test/lux/concurrency/frp.lux56
-rw-r--r--stdlib/test/test/lux/concurrency/promise.lux58
-rw-r--r--stdlib/test/test/lux/concurrency/space.lux6
-rw-r--r--stdlib/test/test/lux/concurrency/stm.lux44
-rw-r--r--stdlib/test/test/lux/control/cont.lux44
-rw-r--r--stdlib/test/test/lux/control/exception.lux28
-rw-r--r--stdlib/test/test/lux/control/interval.lux180
-rw-r--r--stdlib/test/test/lux/control/parser.lux160
-rw-r--r--stdlib/test/test/lux/control/pipe.lux2
-rw-r--r--stdlib/test/test/lux/control/reader.lux24
-rw-r--r--stdlib/test/test/lux/control/state.lux76
-rw-r--r--stdlib/test/test/lux/control/writer.lux20
-rw-r--r--stdlib/test/test/lux/data/bit.lux74
-rw-r--r--stdlib/test/test/lux/data/bool.lux8
-rw-r--r--stdlib/test/test/lux/data/coll/array.lux108
-rw-r--r--stdlib/test/test/lux/data/coll/dict.lux116
-rw-r--r--stdlib/test/test/lux/data/coll/list.lux196
-rw-r--r--stdlib/test/test/lux/data/coll/ordered/dict.lux64
-rw-r--r--stdlib/test/test/lux/data/coll/ordered/set.lux70
-rw-r--r--stdlib/test/test/lux/data/coll/priority-queue.lux48
-rw-r--r--stdlib/test/test/lux/data/coll/queue.lux48
-rw-r--r--stdlib/test/test/lux/data/coll/sequence.lux52
-rw-r--r--stdlib/test/test/lux/data/coll/set.lux50
-rw-r--r--stdlib/test/test/lux/data/coll/stack.lux30
-rw-r--r--stdlib/test/test/lux/data/coll/stream.lux114
-rw-r--r--stdlib/test/test/lux/data/coll/tree/rose.lux30
-rw-r--r--stdlib/test/test/lux/data/coll/tree/zipper.lux150
-rw-r--r--stdlib/test/test/lux/data/color.lux58
-rw-r--r--stdlib/test/test/lux/data/error.lux38
-rw-r--r--stdlib/test/test/lux/data/format/json.lux126
-rw-r--r--stdlib/test/test/lux/data/format/xml.lux94
-rw-r--r--stdlib/test/test/lux/data/ident.lux40
-rw-r--r--stdlib/test/test/lux/data/identity.lux10
-rw-r--r--stdlib/test/test/lux/data/lazy.lux36
-rw-r--r--stdlib/test/test/lux/data/maybe.lux46
-rw-r--r--stdlib/test/test/lux/data/number.lux112
-rw-r--r--stdlib/test/test/lux/data/number/complex.lux142
-rw-r--r--stdlib/test/test/lux/data/number/ratio.lux70
-rw-r--r--stdlib/test/test/lux/data/product.lux2
-rw-r--r--stdlib/test/test/lux/data/sum.lux4
-rw-r--r--stdlib/test/test/lux/data/text.lux108
-rw-r--r--stdlib/test/test/lux/data/text/format.lux4
-rw-r--r--stdlib/test/test/lux/data/text/lexer.lux216
-rw-r--r--stdlib/test/test/lux/data/text/regex.lux232
-rw-r--r--stdlib/test/test/lux/host.jvm.lux64
-rw-r--r--stdlib/test/test/lux/io.lux12
-rw-r--r--stdlib/test/test/lux/lang/syntax.lux228
-rw-r--r--stdlib/test/test/lux/lang/type.lux128
-rw-r--r--stdlib/test/test/lux/lang/type/check.lux266
-rw-r--r--stdlib/test/test/lux/macro/code.lux30
-rw-r--r--stdlib/test/test/lux/macro/poly/eq.lux36
-rw-r--r--stdlib/test/test/lux/macro/poly/functor.lux10
-rw-r--r--stdlib/test/test/lux/macro/syntax.lux118
-rw-r--r--stdlib/test/test/lux/math.lux64
-rw-r--r--stdlib/test/test/lux/math/logic/continuous.lux16
-rw-r--r--stdlib/test/test/lux/math/logic/fuzzy.lux120
-rw-r--r--stdlib/test/test/lux/math/random.lux50
-rw-r--r--stdlib/test/test/lux/time/date.lux76
-rw-r--r--stdlib/test/test/lux/time/duration.lux54
-rw-r--r--stdlib/test/test/lux/time/instant.lux40
-rw-r--r--stdlib/test/test/lux/type/implicit.lux22
-rw-r--r--stdlib/test/test/lux/type/object.lux6
-rw-r--r--stdlib/test/test/lux/world/blob.lux86
-rw-r--r--stdlib/test/test/lux/world/file.lux186
-rw-r--r--stdlib/test/test/lux/world/net/tcp.lux60
-rw-r--r--stdlib/test/test/lux/world/net/udp.lux60
-rw-r--r--stdlib/test/tests.lux147
71 files changed, 2624 insertions, 2625 deletions
diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux
index cfc562686..8bd3a1ee5 100644
--- a/stdlib/test/test/lux.lux
+++ b/stdlib/test/test/lux.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
lux/test
(lux (control ["M" monad #+ do Monad])
@@ -14,9 +14,9 @@
(context: "Value identity."
(<| (times +100)
(do @
- [size (|> r;nat (:: @ map (|>> (n/% +100) (n/max +10))))
- x (r;text size)
- y (r;text size)]
+ [size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +10))))
+ x (r.text size)
+ y (r.text size)]
($_ seq
(test "Every value is identical to itself, and the 'id' function doesn't change values in any way."
(and (is x x)
@@ -52,8 +52,8 @@
(and (|> value inc even?)
(|> value dec even?)))))))]
- ["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/>]
+ ["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]
@@ -80,10 +80,10 @@
(>= y (max x y)))
)))))]
- ["Int" r;int i/= i/< i/> i/<= i/>= i/min i/max]
- ["Nat" r;nat n/= n/< n/> n/<= n/>= n/min n/max]
- ["Frac" r;frac f/= f/< f/> f/<= f/>= f/min f/max]
- ["Deg" r;deg d/= d/< d/> d/<= d/>= d/min d/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]
+ ["Frac" r.frac f/= f/< f/> f/<= f/>= f/min f/max]
+ ["Deg" r.deg d/= d/< d/> d/<= d/>= d/min d/max]
)
(do-template [category rand-gen = + - * / <%> > <0> <1> <factor> %x <cap> <prep>]
@@ -124,7 +124,7 @@
[x (:: @ map <cap> rand-gen)
y (|> rand-gen
(:: @ map <cap>)
- (r;filter (|>> (= <0>) not)))
+ (r.filter (|>> (= <0>) not)))
#let [r (<%> y x)
x' (- r x)]]
(test ""
@@ -136,10 +136,10 @@
(|> x' (/ y) (* y) (= x'))))
))))]
- ["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]
- ["Frac" r;frac f/= f/+ f/- f/* f// f/% f/> 0.0 1.0 1000000.0 %r id math;floor]
- ["Deg" r;deg d/= d/+ d/- d/* d// d/% d/> .0 ("lux deg max") ("lux deg max") %f id id]
+ ["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]
+ ["Frac" r.frac f/= f/+ f/- f/* f// f/% f/> 0.0 1.0 1000000.0 %r id math.floor]
+ ["Deg" r.deg d/= d/+ d/- d/* d// d/% d/> .0 ("lux deg max") ("lux deg max") %f id id]
)
(do-template [category rand-gen -> <- = <cap> %a %z]
@@ -151,11 +151,11 @@
(test ""
(|> value -> <- (= value))))))]
- ["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->Frac" r;int int-to-frac frac-to-int i/= (i/% 1000000) %i %r]
- ["Frac->Int" r;frac frac-to-int int-to-frac f/= math;floor %r %i]
- ## [r;frac frac-to-deg deg-to-frac f/= (f/% 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->Frac" r.int int-to-frac frac-to-int i/= (i/% 1000000) %i %r]
+ ["Frac->Int" r.frac frac-to-int int-to-frac f/= math.floor %r %i]
+ ## [r.frac frac-to-deg deg-to-frac f/= (f/% 1.0) %r %f]
)
(context: "Simple macros and constructs"
@@ -170,25 +170,25 @@
(test "Can create lists easily through macros."
(and (case (list 1 2 3)
- (#;Cons 1 (#;Cons 2 (#;Cons 3 #;Nil)))
+ (#.Cons 1 (#.Cons 2 (#.Cons 3 #.Nil)))
true
_
false)
(case (list& 1 2 3 (list 4 5 6))
- (#;Cons 1 (#;Cons 2 (#;Cons 3 (#;Cons 4 (#;Cons 5 (#;Cons 6 #;Nil))))))
+ (#.Cons 1 (#.Cons 2 (#.Cons 3 (#.Cons 4 (#.Cons 5 (#.Cons 6 #.Nil))))))
true
_
false)))
(test "Can have defaults for Maybe values."
- (and (is "yolo" (maybe;default "yolo"
- #;None))
+ (and (is "yolo" (maybe.default "yolo"
+ #.None))
- (is "lol" (maybe;default "yolo"
- (#;Some "lol")))))
+ (is "lol" (maybe.default "yolo"
+ (#.Some "lol")))))
))
(template: (hypotenuse x y)
@@ -197,8 +197,8 @@
(context: "Templates."
(<| (times +100)
(do @
- [x r;int
- y r;int]
+ [x r.int
+ y r.int]
(test "Template application is a stand-in for the templated code."
(i/= (i/+ (i/* x x) (i/* y y))
(hypotenuse x y))))))
diff --git a/stdlib/test/test/lux/cli.lux b/stdlib/test/test/lux/cli.lux
index 37e954e76..b5f251c57 100644
--- a/stdlib/test/test/lux/cli.lux
+++ b/stdlib/test/test/lux/cli.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad]
@@ -18,43 +18,43 @@
(context: "CLI"
(<| (times +100)
(do @
- [num-args (|> r;nat (:: @ map (n/% +10)))
- #let [(^open "Nat/") number;Codec<Text,Nat>
- gen-arg (:: @ map Nat/encode r;nat)]
+ [num-args (|> r.nat (:: @ map (n/% +10)))
+ #let [(^open "Nat/") number.Codec<Text,Nat>
+ gen-arg (:: @ map Nat/encode r.nat)]
yes gen-arg
- #let [gen-ignore (|> (r;text +5) (r;filter (|>> (text/= yes) not)))]
+ #let [gen-ignore (|> (r.text +5) (r.filter (|>> (text/= yes) not)))]
no gen-ignore
- pre-ignore (r;list +5 gen-ignore)
- post-ignore (r;list +5 gen-ignore)]
+ pre-ignore (r.list +5 gen-ignore)
+ post-ignore (r.list +5 gen-ignore)]
($_ seq
(test "Can read any argument."
- (|> (/;run (list yes) /;any)
- (case> (#E;Error _)
+ (|> (/.run (list yes) /.any)
+ (case> (#E.Error _)
false
- (#E;Success arg)
+ (#E.Success arg)
(text/= arg yes))))
(test "Can test tokens."
- (and (|> (/;run (list yes) (/;this yes))
- (case> (#E;Error _) false (#E;Success _) true))
- (|> (/;run (list no) (/;this yes))
- (case> (#E;Error _) true (#E;Success _) false))))
+ (and (|> (/.run (list yes) (/.this yes))
+ (case> (#E.Error _) false (#E.Success _) true))
+ (|> (/.run (list no) (/.this yes))
+ (case> (#E.Error _) true (#E.Success _) false))))
(test "Can use custom token parsers."
- (|> (/;run (list yes) (/;parse Nat/decode))
- (case> (#E;Error _)
+ (|> (/.run (list yes) (/.parse Nat/decode))
+ (case> (#E.Error _)
false
- (#E;Success parsed)
+ (#E.Success parsed)
(text/= (Nat/encode parsed)
yes))))
(test "Can query if there are any more inputs."
- (and (|> (/;run (list) /;end)
- (case> (#E;Success []) true _ false))
- (|> (/;run (list yes) (p;not /;end))
- (case> (#E;Success []) false _ true))))
+ (and (|> (/.run (list) /.end)
+ (case> (#E.Success []) true _ false))
+ (|> (/.run (list yes) (p.not /.end))
+ (case> (#E.Success []) false _ true))))
(test "Can parse CLI input anywhere."
- (|> (/;run (list;concat (list pre-ignore (list yes) post-ignore))
- (|> (/;somewhere (/;this yes))
- (p;before (p;some /;any))))
- (case> (#E;Error _) false (#E;Success _) true)))
+ (|> (/.run (list.concat (list pre-ignore (list yes) post-ignore))
+ (|> (/.somewhere (/.this yes))
+ (p.before (p.some /.any))))
+ (case> (#E.Error _) false (#E.Success _) true)))
))))
diff --git a/stdlib/test/test/lux/concurrency/actor.lux b/stdlib/test/test/lux/concurrency/actor.lux
index 450f3b399..f041ebe54 100644
--- a/stdlib/test/test/lux/concurrency/actor.lux
+++ b/stdlib/test/test/lux/concurrency/actor.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io #+ IO io]
(control ["M" monad #+ do Monad]
@@ -15,62 +15,62 @@
Nat
((handle message state self)
- (do T;Monad<Task>
+ (do T.Monad<Task>
[#let [_ (log! "BEFORE")]
output (message state self)
#let [_ (log! "AFTER")]]
(wrap output)))
((stop cause state)
- (P/wrap (log! (if (ex;match? &;Killed cause)
+ (P/wrap (log! (if (ex.match? &.Killed cause)
(format "Counter was killed: " (%n state))
cause)))))
(message: #export Counter
(count! [increment Nat] state self Nat)
(let [state' (n/+ increment state)]
- (T;return [state' state'])))
+ (T.return [state' state'])))
(context: "Actors"
($_ seq
(test "Can check if an actor is alive."
- (io;run (do io;Monad<IO>
+ (io.run (do io.Monad<IO>
[counter (new@Counter +0)]
- (wrap (&;alive? counter)))))
+ (wrap (&.alive? counter)))))
(test "Can kill actors."
- (io;run (do io;Monad<IO>
+ (io.run (do io.Monad<IO>
[counter (new@Counter +0)
- killed? (&;kill counter)]
+ killed? (&.kill counter)]
(wrap (and killed?
- (not (&;alive? counter)))))))
+ (not (&.alive? counter)))))))
(test "Can poison actors."
- (io;run (do io;Monad<IO>
+ (io.run (do io.Monad<IO>
[counter (new@Counter +0)
- poisoned? (&;poison counter)]
+ poisoned? (&.poison counter)]
(wrap (and poisoned?
- (not (&;alive? counter)))))))
+ (not (&.alive? counter)))))))
(test "Cannot kill an already dead actor."
- (io;run (do io;Monad<IO>
+ (io.run (do io.Monad<IO>
[counter (new@Counter +0)
- first-time (&;kill counter)
- second-time (&;kill counter)]
+ first-time (&.kill counter)
+ second-time (&.kill counter)]
(wrap (and first-time
(not second-time))))))
(test "Cannot poison an already dead actor."
- (io;run (do io;Monad<IO>
+ (io.run (do io.Monad<IO>
[counter (new@Counter +0)
- first-time (&;kill counter)
- second-time (&;poison counter)]
+ first-time (&.kill counter)
+ second-time (&.poison counter)]
(wrap (and first-time
(not second-time))))))
- (wrap (do P;Monad<Promise>
- [result (do T;Monad<Task>
- [#let [counter (io;run (new@Counter +0))]
+ (wrap (do P.Monad<Promise>
+ [result (do T.Monad<Task>
+ [#let [counter (io.run (new@Counter +0))]
output-1 (count! +1 counter)
output-2 (count! +1 counter)
output-3 (count! +1 counter)]
@@ -79,9 +79,9 @@
(n/= +3 output-3))))]
(assert "Can send messages to actors."
(case result
- (#E;Success outcome)
+ (#E.Success outcome)
outcome
- (#E;Error error)
+ (#E.Error error)
false))))
))
diff --git a/stdlib/test/test/lux/concurrency/atom.lux b/stdlib/test/test/lux/concurrency/atom.lux
index c7e2c42b3..9063af2e7 100644
--- a/stdlib/test/test/lux/concurrency/atom.lux
+++ b/stdlib/test/test/lux/concurrency/atom.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad])
@@ -12,23 +12,23 @@
(context: "Atoms"
(<| (times +100)
(do @
- [value r;nat
- swap-value r;nat
- set-value r;nat
- #let [box (&;atom value)]]
+ [value r.nat
+ swap-value r.nat
+ set-value r.nat
+ #let [box (&.atom value)]]
($_ seq
(test "Can obtain the value of an atom."
- (n/= value (io;run (&;read box))))
+ (n/= value (io.run (&.read box))))
(test "Can swap the value of an atom."
- (and (io;run (&;compare-and-swap value swap-value box))
- (n/= swap-value (io;run (&;read box)))))
+ (and (io.run (&.compare-and-swap value swap-value box))
+ (n/= swap-value (io.run (&.read box)))))
(test "Can update the value of an atom."
- (exec (io;run (&;update n/inc box))
- (n/= (n/inc swap-value) (io;run (&;read box)))))
+ (exec (io.run (&.update n/inc box))
+ (n/= (n/inc swap-value) (io.run (&.read box)))))
(test "Can immediately set the value of an atom."
- (exec (io;run (&;write set-value box))
- (n/= set-value (io;run (&;read box)))))
+ (exec (io.run (&.write set-value box))
+ (n/= set-value (io.run (&.read box)))))
))))
diff --git a/stdlib/test/test/lux/concurrency/frp.lux b/stdlib/test/test/lux/concurrency/frp.lux
index 5faa404e9..057f155d0 100644
--- a/stdlib/test/test/lux/concurrency/frp.lux
+++ b/stdlib/test/test/lux/concurrency/frp.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io #+ IO io]
(control ["M" monad #+ do Monad])
@@ -9,18 +9,18 @@
lux/test)
(def: (to-channel values)
- (-> (List Int) (&;Channel Int))
- (let [_channel (&;channel Int)]
- (io;run (do io;Monad<IO>
- [_ (M;map @ (function [value] (&;write value _channel))
+ (-> (List Int) (&.Channel Int))
+ (let [_channel (&.channel Int)]
+ (io.run (do io.Monad<IO>
+ [_ (M.map @ (function [value] (&.write value _channel))
values)
- _ (&;close _channel)]
+ _ (&.close _channel)]
(wrap _channel)))))
(context: "FRP"
($_ seq
- (wrap (do P;Monad<Promise>
- [elems (&;consume (to-channel (list 0 1 2 3 4 5)))]
+ (wrap (do P.Monad<Promise>
+ [elems (&.consume (to-channel (list 0 1 2 3 4 5)))]
(assert "Can consume a channel into a list."
(case elems
(^ (list 0 1 2 3 4 5))
@@ -29,10 +29,10 @@
_
false))))
- (wrap (do P;Monad<Promise>
- [elems (&;consume (let [input (to-channel (list 0 1 2 3 4 5))
- output (&;channel Int)]
- (exec (&;pipe input output)
+ (wrap (do P.Monad<Promise>
+ [elems (&.consume (let [input (to-channel (list 0 1 2 3 4 5))
+ output (&.channel Int)]
+ (exec (&.pipe input output)
output)))]
(assert "Can pipe one channel into another."
(case elems
@@ -42,8 +42,8 @@
_
false))))
- (wrap (do P;Monad<Promise>
- [elems (&;consume (&;filter i/even? (to-channel (list 0 1 2 3 4 5))))]
+ (wrap (do P.Monad<Promise>
+ [elems (&.consume (&.filter i/even? (to-channel (list 0 1 2 3 4 5))))]
(assert "Can filter a channel's elements."
(case elems
(^ (list 0 2 4))
@@ -52,8 +52,8 @@
_
false))))
- (wrap (do P;Monad<Promise>
- [elems (&;consume (&;merge (list (to-channel (list 0 1 2 3 4 5))
+ (wrap (do P.Monad<Promise>
+ [elems (&.consume (&.merge (list (to-channel (list 0 1 2 3 4 5))
(to-channel (list 0 -1 -2 -3 -4 -5)))))]
(assert "Can merge channels."
(case elems
@@ -63,13 +63,13 @@
_
false))))
- (wrap (do P;Monad<Promise>
- [output (&;fold (function [base input] (P/wrap (i/+ input base))) 0 (to-channel (list 0 1 2 3 4 5)))]
+ (wrap (do P.Monad<Promise>
+ [output (&.fold (function [base input] (P/wrap (i/+ input base))) 0 (to-channel (list 0 1 2 3 4 5)))]
(assert "Can fold over a channel."
(i/= 15 output))))
- (wrap (do P;Monad<Promise>
- [elems (&;consume (&;distinct number;Eq<Int> (to-channel (list 0 0 0 1 2 2 3 3 3 3 4 4 4 5 5))))]
+ (wrap (do P.Monad<Promise>
+ [elems (&.consume (&.distinct number.Eq<Int> (to-channel (list 0 0 0 1 2 2 3 3 3 3 4 4 4 5 5))))]
(assert "Can avoid immediate repetition in the channel."
(case elems
(^ (list 0 1 2 3 4 5))
@@ -78,8 +78,8 @@
_
false))))
- (wrap (do P;Monad<Promise>
- [elems (&;consume (&;once (:: @ wrap 12345)))]
+ (wrap (do P.Monad<Promise>
+ [elems (&.consume (&.once (:: @ wrap 12345)))]
(assert "Can convert a promise into a single-value channel."
(case elems
(^ (list 12345))
@@ -88,8 +88,8 @@
_
false))))
- (wrap (do P;Monad<Promise>
- [elems (&;consume (:: &;Functor<Channel> map i/inc (to-channel (list 0 1 2 3 4 5))))]
+ (wrap (do P.Monad<Promise>
+ [elems (&.consume (:: &.Functor<Channel> map i/inc (to-channel (list 0 1 2 3 4 5))))]
(assert "Functor goes over every element in a channel."
(case elems
(^ (list 1 2 3 4 5 6))
@@ -98,8 +98,8 @@
_
false))))
- (wrap (do P;Monad<Promise>
- [elems (&;consume (let [(^open) &;Applicative<Channel>]
+ (wrap (do P.Monad<Promise>
+ [elems (&.consume (let [(^open) &.Applicative<Channel>]
(apply (wrap i/inc) (wrap 12345))))]
(assert "Applicative works over all channel values."
(case elems
@@ -109,8 +109,8 @@
_
false))))
- (wrap (do P;Monad<Promise>
- [elems (&;consume (do &;Monad<Channel>
+ (wrap (do P.Monad<Promise>
+ [elems (&.consume (do &.Monad<Channel>
[f (wrap i/inc)
a (wrap 12345)]
(wrap (f a))))]
diff --git a/stdlib/test/test/lux/concurrency/promise.lux b/stdlib/test/test/lux/concurrency/promise.lux
index 26193851a..3be2f03b5 100644
--- a/stdlib/test/test/lux/concurrency/promise.lux
+++ b/stdlib/test/test/lux/concurrency/promise.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io #+ IO io]
(control ["M" monad #+ do Monad]
@@ -11,59 +11,59 @@
(context: "Promises"
($_ seq
- (wrap (do &;Monad<Promise>
- [running? (&;future (io true))]
+ (wrap (do &.Monad<Promise>
+ [running? (&.future (io true))]
(assert "Can run IO actions in separate threads."
running?)))
- (wrap (do &;Monad<Promise>
- [_ (&;wait +500)]
+ (wrap (do &.Monad<Promise>
+ [_ (&.wait +500)]
(assert "Can wait for a specified amount of time."
true)))
- (wrap (do &;Monad<Promise>
- [[left right] (&;seq (&;future (io true))
- (&;future (io false)))]
+ (wrap (do &.Monad<Promise>
+ [[left right] (&.seq (&.future (io true))
+ (&.future (io false)))]
(assert "Can combine promises sequentially."
(and left (not right)))))
- (wrap (do &;Monad<Promise>
- [?left (&;alt (&;delay +100 true)
- (&;delay +200 false))
- ?right (&;alt (&;delay +200 true)
- (&;delay +100 false))]
+ (wrap (do &.Monad<Promise>
+ [?left (&.alt (&.delay +100 true)
+ (&.delay +200 false))
+ ?right (&.alt (&.delay +200 true)
+ (&.delay +100 false))]
(assert "Can combine promises alternatively."
(case [?left ?right]
- [(#;Left true) (#;Right false)]
+ [(#.Left true) (#.Right false)]
true
_
false))))
- (wrap (do &;Monad<Promise>
- [?left (&;either (&;delay +100 true)
- (&;delay +200 false))
- ?right (&;either (&;delay +200 true)
- (&;delay +100 false))]
+ (wrap (do &.Monad<Promise>
+ [?left (&.either (&.delay +100 true)
+ (&.delay +200 false))
+ ?right (&.either (&.delay +200 true)
+ (&.delay +100 false))]
(assert "Can combine promises alternatively [Part 2]."
(and ?left (not ?right)))))
(test "Can poll a promise for its value."
- (and (|> (&;poll (&/wrap true))
- (case> (#;Some true) true _ false))
- (|> (&;poll (&;delay +200 true))
- (case> #;None true _ false))))
+ (and (|> (&.poll (&/wrap true))
+ (case> (#.Some true) true _ false))
+ (|> (&.poll (&.delay +200 true))
+ (case> #.None true _ false))))
(test "Cannot re-resolve a resolved promise."
- (and (not (io;run (&;resolve false (&/wrap true))))
- (io;run (&;resolve true (&;promise Bool)))))
+ (and (not (io.run (&.resolve false (&/wrap true))))
+ (io.run (&.resolve true (&.promise Bool)))))
- (wrap (do &;Monad<Promise>
- [?none (&;time-out +100 (&;delay +200 true))
- ?some (&;time-out +200 (&;delay +100 true))]
+ (wrap (do &.Monad<Promise>
+ [?none (&.time-out +100 (&.delay +200 true))
+ ?some (&.time-out +200 (&.delay +100 true))]
(assert "Can establish maximum waiting times for promises to be fulfilled."
(case [?none ?some]
- [#;None (#;Some true)]
+ [#.None (#.Some true)]
true
_
diff --git a/stdlib/test/test/lux/concurrency/space.lux b/stdlib/test/test/lux/concurrency/space.lux
index 1e71d03c1..dd295501e 100644
--- a/stdlib/test/test/lux/concurrency/space.lux
+++ b/stdlib/test/test/lux/concurrency/space.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux (control [monad #+ do])
(concurrency ["T" task]
@@ -10,12 +10,12 @@
#Ping
#Pong)
-(A;actor: #export Player {}
+(A.actor: #export Player {}
{#hits Nat})
(on: Player Move (reply! who where what state self)
(do @
- [_ (S;emit (case what
+ [_ (S.emit (case what
#Ping #Pong
#Pong #Ping)
where
diff --git a/stdlib/test/test/lux/concurrency/stm.lux b/stdlib/test/test/lux/concurrency/stm.lux
index 75354b374..d2e299c50 100644
--- a/stdlib/test/test/lux/concurrency/stm.lux
+++ b/stdlib/test/test/lux/concurrency/stm.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad])
@@ -15,21 +15,21 @@
(context: "STM"
($_ seq
- (wrap (do promise;Monad<Promise>
- [#let [_var (&;var 0)
- changes (io;run (&;follow _var))]
- output1 (&;commit (&;read _var))
- output2 (&;commit (do &;Monad<STM>
- [_ (&;write 5 _var)]
- (&;read _var)))
- output3 (&;commit (do &;Monad<STM>
- [temp (&;read _var)
- _ (&;update (i/* 3) _var)]
- (&;read _var)))
+ (wrap (do promise.Monad<Promise>
+ [#let [_var (&.var 0)
+ changes (io.run (&.follow _var))]
+ output1 (&.commit (&.read _var))
+ output2 (&.commit (do &.Monad<STM>
+ [_ (&.write 5 _var)]
+ (&.read _var)))
+ output3 (&.commit (do &.Monad<STM>
+ [temp (&.read _var)
+ _ (&.update (i/* 3) _var)]
+ (&.read _var)))
?c1+changes' changes
- #let [[c1 changes'] (maybe;default [-1 changes] ?c1+changes')]
+ #let [[c1 changes'] (maybe.default [-1 changes] ?c1+changes')]
?c2+changes' changes'
- #let [[c2 changes'] (maybe;default [-1 changes] ?c2+changes')]]
+ #let [[c2 changes'] (maybe.default [-1 changes] ?c2+changes')]]
(assert "Can read STM vars.
Can write STM vars.
Can update STM vars.
@@ -38,14 +38,14 @@
(i/= 5 output2)
(i/= 15 output3)
(and (i/= 5 c1) (i/= 15 c2))))))
- (wrap (let [_concurrency-var (&;var 0)]
- (do promise;Monad<Promise>
- [_ (M;seq @
+ (wrap (let [_concurrency-var (&.var 0)]
+ (do promise.Monad<Promise>
+ [_ (M.seq @
(map (function [_]
- (M;map @ (function [_] (&;commit (&;update i/inc _concurrency-var)))
- (list;i/range 1 iterations/processes)))
- (list;i/range 1 (nat-to-int promise;concurrency-level))))
- last-val (&;commit (&;read _concurrency-var))]
+ (M.map @ (function [_] (&.commit (&.update i/inc _concurrency-var)))
+ (list.i/range 1 iterations/processes)))
+ (list.i/range 1 (nat-to-int promise.concurrency-level))))
+ last-val (&.commit (&.read _concurrency-var))]
(assert "Can modify STM vars concurrently from multiple threads."
- (i/= (i/* iterations/processes (nat-to-int promise;concurrency-level))
+ (i/= (i/* iterations/processes (nat-to-int promise.concurrency-level))
last-val)))))))
diff --git a/stdlib/test/test/lux/control/cont.lux b/stdlib/test/test/lux/control/cont.lux
index c0fd26ccc..1b9a165ff 100644
--- a/stdlib/test/test/lux/control/cont.lux
+++ b/stdlib/test/test/lux/control/cont.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad]
@@ -14,29 +14,29 @@
(context: "Continuations"
(<| (times +100)
(do @
- [sample r;nat
- #let [(^open "&/") &;Monad<Cont>]
- elems (r;list +3 r;nat)]
+ [sample r.nat
+ #let [(^open "&/") &.Monad<Cont>]
+ elems (r.list +3 r.nat)]
($_ seq
(test "Can run continuations to compute their values."
- (n/= sample (&;run (&/wrap sample))))
+ (n/= sample (&.run (&/wrap sample))))
(test "Can use functor."
- (n/= (n/inc sample) (&;run (&/map n/inc (&/wrap sample)))))
+ (n/= (n/inc sample) (&.run (&/map n/inc (&/wrap sample)))))
(test "Can use applicative."
- (n/= (n/inc sample) (&;run (&/apply (&/wrap n/inc) (&/wrap sample)))))
+ (n/= (n/inc sample) (&.run (&/apply (&/wrap n/inc) (&/wrap sample)))))
(test "Can use monad."
- (n/= (n/inc sample) (&;run (do &;Monad<Cont>
+ (n/= (n/inc sample) (&.run (do &.Monad<Cont>
[func (wrap n/inc)
arg (wrap sample)]
(wrap (func arg))))))
(test "Can use the current-continuation as a escape hatch."
(n/= (n/* +2 sample)
- (&;run (do &;Monad<Cont>
- [value (&;call/cc
+ (&.run (do &.Monad<Cont>
+ [value (&.call/cc
(function [k]
(do @
[temp (k sample)]
@@ -48,30 +48,30 @@
(test "Can use the current-continuation to build a time machine."
(n/= (n/+ +100 sample)
- (&;run (do &;Monad<Cont>
- [[restart [output idx]] (&;portal [sample +0])]
+ (&.run (do &.Monad<Cont>
+ [[restart [output idx]] (&.portal [sample +0])]
(if (n/< +10 idx)
(restart [(n/+ +10 output) (n/inc idx)])
(wrap output))))))
(test "Can use delimited continuations with shifting."
- (let [(^open "&/") &;Monad<Cont>
- (^open "L/") (list;Eq<List> number;Eq<Nat>)
+ (let [(^open "&/") &.Monad<Cont>
+ (^open "L/") (list.Eq<List> number.Eq<Nat>)
visit (: (-> (List Nat)
- (&;Cont (List Nat) (List Nat)))
+ (&.Cont (List Nat) (List Nat)))
(function visit [xs]
(case xs
- #;Nil
- (&/wrap #;Nil)
+ #.Nil
+ (&/wrap #.Nil)
- (#;Cons x xs')
- (do &;Monad<Cont>
- [output (&;shift (function [k]
+ (#.Cons x xs')
+ (do &.Monad<Cont>
+ [output (&.shift (function [k]
(do @
[tail (k xs')]
- (wrap (#;Cons x tail)))))]
+ (wrap (#.Cons x tail)))))]
(visit output)))))]
(L/= elems
- (&;run (&;reset (visit elems))))
+ (&.run (&.reset (visit elems))))
))
))))
diff --git a/stdlib/test/test/lux/control/exception.lux b/stdlib/test/test/lux/control/exception.lux
index e7adbe93b..40838875e 100644
--- a/stdlib/test/test/lux/control/exception.lux
+++ b/stdlib/test/test/lux/control/exception.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad]
@@ -19,13 +19,13 @@
(context: "Exceptions"
(<| (times +100)
(do @
- [should-throw? r;bool
- which? r;bool
- should-catch? r;bool
- default-val r;nat
- some-val r;nat
- another-val r;nat
- otherwise-val r;nat
+ [should-throw? r.bool
+ which? r.bool
+ should-catch? r.bool
+ default-val r.nat
+ some-val r.nat
+ another-val r.nat
+ otherwise-val r.nat
#let [this-ex (if should-catch?
(if which?
Some-Exception
@@ -38,12 +38,12 @@
another-val)
otherwise-val)
default-val)
- actual (|> (: (E;Error Nat)
+ actual (|> (: (E.Error Nat)
(if should-throw?
- (&;throw this-ex "Uh-oh...")
- (&;return default-val)))
- (&;catch Some-Exception (function [ex] some-val))
- (&;catch Another-Exception (function [ex] another-val))
- (&;otherwise (function [ex] otherwise-val)))]]
+ (&.throw this-ex "Uh-oh...")
+ (&.return default-val)))
+ (&.catch Some-Exception (function [ex] some-val))
+ (&.catch Another-Exception (function [ex] another-val))
+ (&.otherwise (function [ex] otherwise-val)))]]
(test "Catch and otherwhise handlers can properly handle the flow of exception-handling."
(n/= expected actual)))))
diff --git a/stdlib/test/test/lux/control/interval.lux b/stdlib/test/test/lux/control/interval.lux
index 1dc6e0afa..05566f464 100644
--- a/stdlib/test/test/lux/control/interval.lux
+++ b/stdlib/test/test/lux/control/interval.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
lux/test
(lux (control ["M" monad #+ do Monad]
@@ -14,35 +14,35 @@
(context: "Equality."
(<| (times +100)
(do @
- [bottom r;int
- top r;int
- #let [(^open "&/") &;Eq<Interval>]]
+ [bottom r.int
+ top r.int
+ #let [(^open "&/") &.Eq<Interval>]]
($_ seq
(test "Every interval is equal to itself."
- (and (let [self (&;between number;Enum<Int> bottom top)]
+ (and (let [self (&.between number.Enum<Int> bottom top)]
(&/= self self))
- (let [self (&;between number;Enum<Int> top bottom)]
+ (let [self (&.between number.Enum<Int> top bottom)]
(&/= self self))
- (let [self (&;singleton number;Enum<Int> bottom)]
+ (let [self (&.singleton number.Enum<Int> bottom)]
(&/= self self))))))))
(context: "Boundaries"
(<| (times +100)
(do @
- [bottom r;int
- top r;int
- #let [interval (&;between number;Enum<Int> bottom top)]]
+ [bottom r.int
+ top r.int
+ #let [interval (&.between number.Enum<Int> bottom top)]]
($_ seq
(test "Every boundary value belongs to it's interval."
- (and (&;within? interval bottom)
- (&;within? interval top)))
+ (and (&.within? interval bottom)
+ (&.within? interval top)))
(test "Every interval starts with its bottom."
- (&;starts-with? bottom interval))
+ (&.starts-with? bottom interval))
(test "Every interval ends with its top."
- (&;ends-with? top interval))
+ (&.ends-with? top interval))
(test "The boundary values border the interval."
- (and (&;borders? interval bottom)
- (&;borders? interval top)))
+ (and (&.borders? interval bottom)
+ (&.borders? interval top)))
))))
(def: (list-to-4tuple list)
@@ -57,27 +57,27 @@
(do-template [<name> <cmp>]
[(def: <name>
- (r;Random (&;Interval Int))
- (do r;Monad<Random>
- [bottom r;int
- top (|> r;int (r;filter (|>> (i/= bottom) not)))]
+ (r.Random (&.Interval Int))
+ (do r.Monad<Random>
+ [bottom r.int
+ top (|> r.int (r.filter (|>> (i/= bottom) not)))]
(if (<cmp> top bottom)
- (wrap (&;between number;Enum<Int> bottom top))
- (wrap (&;between number;Enum<Int> top bottom)))))]
+ (wrap (&.between number.Enum<Int> bottom top))
+ (wrap (&.between number.Enum<Int> top bottom)))))]
[gen-inner i/<]
[gen-outer i/>]
)
(def: gen-singleton
- (r;Random (&;Interval Int))
- (do r;Monad<Random>
- [point r;int]
- (wrap (&;singleton number;Enum<Int> point))))
+ (r.Random (&.Interval Int))
+ (do r.Monad<Random>
+ [point r.int]
+ (wrap (&.singleton number.Enum<Int> point))))
(def: gen-interval
- (r;Random (&;Interval Int))
- ($_ r;either
+ (r.Random (&.Interval Int))
+ ($_ r.either
gen-inner
gen-outer
gen-singleton))
@@ -92,16 +92,16 @@
right-singleton gen-singleton
left-outer gen-outer
right-outer gen-outer
- #let [(^open "&/") &;Eq<Interval>]]
+ #let [(^open "&/") &.Eq<Interval>]]
($_ seq
(test "The union of an interval to itself yields the same interval."
- (&/= some-interval (&;union some-interval some-interval)))
+ (&/= some-interval (&.union some-interval some-interval)))
(test "The union of 2 inner intervals is another inner interval."
- (&;inner? (&;union left-inner right-inner)))
+ (&.inner? (&.union left-inner right-inner)))
(test "The union of 2 outer intervals yields an inner interval when their complements don't overlap, and an outer when they do."
- (if (&;overlaps? (&;complement left-outer) (&;complement right-outer))
- (&;outer? (&;union left-outer right-outer))
- (&;inner? (&;union left-outer right-outer))))
+ (if (&.overlaps? (&.complement left-outer) (&.complement right-outer))
+ (&.outer? (&.union left-outer right-outer))
+ (&.inner? (&.union left-outer right-outer))))
))))
(context: "Intersections"
@@ -114,85 +114,85 @@
right-singleton gen-singleton
left-outer gen-outer
right-outer gen-outer
- #let [(^open "&/") &;Eq<Interval>]]
+ #let [(^open "&/") &.Eq<Interval>]]
($_ seq
(test "The intersection of an interval to itself yields the same interval."
- (&/= some-interval (&;intersection some-interval some-interval)))
+ (&/= some-interval (&.intersection some-interval some-interval)))
(test "The intersection of 2 inner intervals yields an inner interval when they overlap, and an outer when they don't."
- (if (&;overlaps? left-inner right-inner)
- (&;inner? (&;intersection left-inner right-inner))
- (&;outer? (&;intersection left-inner right-inner))))
+ (if (&.overlaps? left-inner right-inner)
+ (&.inner? (&.intersection left-inner right-inner))
+ (&.outer? (&.intersection left-inner right-inner))))
(test "The intersection of 2 outer intervals is another outer interval."
- (&;outer? (&;intersection left-outer right-outer)))
+ (&.outer? (&.intersection left-outer right-outer)))
))))
(context: "Complement"
(<| (times +100)
(do @
[some-interval gen-interval
- #let [(^open "&/") &;Eq<Interval>]]
+ #let [(^open "&/") &.Eq<Interval>]]
($_ seq
(test "The complement of a complement is the same as the original."
- (&/= some-interval (|> some-interval &;complement &;complement)))
+ (&/= some-interval (|> some-interval &.complement &.complement)))
(test "The complement of an interval does not overlap it."
- (not (&;overlaps? some-interval (&;complement some-interval))))
+ (not (&.overlaps? some-interval (&.complement some-interval))))
))))
(context: "Positioning/location"
(<| (times +100)
(do @
- [[l m r] (|> (r;set number;Hash<Int> +3 r;int)
- (:: @ map (|>> S;to-list
- (L;sort i/<)
+ [[l m r] (|> (r.set number.Hash<Int> +3 r.int)
+ (:: @ map (|>> S.to-list
+ (L.sort i/<)
(case> (^ (list b t1 t2))
[b t1 t2]
_
(undefined)))))
- #let [left (&;singleton number;Enum<Int> l)
- right (&;singleton number;Enum<Int> r)]]
+ #let [left (&.singleton number.Enum<Int> l)
+ right (&.singleton number.Enum<Int> r)]]
($_ seq
(test "'precedes?' and 'succeeds?' are symetric."
- (and (&;precedes? right left)
- (&;succeeds? left right)))
+ (and (&.precedes? right left)
+ (&.succeeds? left right)))
(test "Can check if an interval is before or after some element."
- (and (&;before? m left)
- (&;after? m right)))
+ (and (&.before? m left)
+ (&.after? m right)))
))))
(context: "Touching intervals"
(<| (times +100)
(do @
- [[b t1 t2] (|> (r;set number;Hash<Int> +3 r;int)
- (:: @ map (|>> S;to-list
- (L;sort i/<)
+ [[b t1 t2] (|> (r.set number.Hash<Int> +3 r.int)
+ (:: @ map (|>> S.to-list
+ (L.sort i/<)
(case> (^ (list b t1 t2))
[b t1 t2]
_
(undefined)))))
- #let [int-left (&;between number;Enum<Int> t1 t2)
- int-right (&;between number;Enum<Int> b t1)]]
+ #let [int-left (&.between number.Enum<Int> t1 t2)
+ int-right (&.between number.Enum<Int> b t1)]]
($_ seq
(test "An interval meets another if it's top is the other's bottom."
- (&;meets? int-left int-right))
+ (&.meets? int-left int-right))
(test "Two intervals touch one another if any one meets the other."
- (&;touches? int-left int-right))
+ (&.touches? int-left int-right))
(test "Can check if 2 intervals start together."
- (&;starts? (&;between number;Enum<Int> b t2)
- (&;between number;Enum<Int> b t1)))
+ (&.starts? (&.between number.Enum<Int> b t2)
+ (&.between number.Enum<Int> b t1)))
(test "Can check if 2 intervals finish together."
- (&;finishes? (&;between number;Enum<Int> b t2)
- (&;between number;Enum<Int> t1 t2)))
+ (&.finishes? (&.between number.Enum<Int> b t2)
+ (&.between number.Enum<Int> t1 t2)))
))))
(context: "Nesting & overlap"
(<| (times +100)
(do @
[some-interval gen-interval
- [x0 x1 x2 x3] (|> (r;set number;Hash<Int> +4 r;int)
- (:: @ map (|>> S;to-list
- (L;sort i/<)
+ [x0 x1 x2 x3] (|> (r.set number.Hash<Int> +4 r.int)
+ (:: @ map (|>> S.to-list
+ (L.sort i/<)
(case> (^ (list x0 x1 x2 x3))
[x0 x1 x2 x3]
@@ -200,34 +200,34 @@
(undefined)))))]
($_ seq
(test "Every interval is nested into itself."
- (&;nested? some-interval some-interval))
+ (&.nested? some-interval some-interval))
(test "No interval overlaps with itself."
- (not (&;overlaps? some-interval some-interval)))
- (let [small-inner (&;between number;Enum<Int> x1 x2)
- large-inner (&;between number;Enum<Int> x0 x3)]
+ (not (&.overlaps? some-interval some-interval)))
+ (let [small-inner (&.between number.Enum<Int> x1 x2)
+ large-inner (&.between number.Enum<Int> x0 x3)]
(test "Inner intervals can be nested inside one another."
- (and (&;nested? large-inner small-inner)
- (not (&;nested? small-inner large-inner)))))
- (let [left-inner (&;between number;Enum<Int> x0 x2)
- right-inner (&;between number;Enum<Int> x1 x3)]
+ (and (&.nested? large-inner small-inner)
+ (not (&.nested? small-inner large-inner)))))
+ (let [left-inner (&.between number.Enum<Int> x0 x2)
+ right-inner (&.between number.Enum<Int> x1 x3)]
(test "Inner intervals can overlap one another."
- (and (&;overlaps? left-inner right-inner)
- (&;overlaps? right-inner left-inner))))
- (let [small-outer (&;between number;Enum<Int> x2 x1)
- large-outer (&;between number;Enum<Int> x3 x0)]
+ (and (&.overlaps? left-inner right-inner)
+ (&.overlaps? right-inner left-inner))))
+ (let [small-outer (&.between number.Enum<Int> x2 x1)
+ large-outer (&.between number.Enum<Int> x3 x0)]
(test "Outer intervals can be nested inside one another."
- (and (&;nested? small-outer large-outer)
- (not (&;nested? large-outer small-outer)))))
- (let [left-inner (&;between number;Enum<Int> x0 x1)
- right-inner (&;between number;Enum<Int> x2 x3)
- outer (&;between number;Enum<Int> x0 x3)]
+ (and (&.nested? small-outer large-outer)
+ (not (&.nested? large-outer small-outer)))))
+ (let [left-inner (&.between number.Enum<Int> x0 x1)
+ right-inner (&.between number.Enum<Int> x2 x3)
+ outer (&.between number.Enum<Int> x0 x3)]
(test "Inners can be nested inside outers."
- (and (&;nested? outer left-inner)
- (&;nested? outer right-inner))))
- (let [left-inner (&;between number;Enum<Int> x0 x2)
- right-inner (&;between number;Enum<Int> x1 x3)
- outer (&;between number;Enum<Int> x1 x2)]
+ (and (&.nested? outer left-inner)
+ (&.nested? outer right-inner))))
+ (let [left-inner (&.between number.Enum<Int> x0 x2)
+ right-inner (&.between number.Enum<Int> x1 x3)
+ outer (&.between number.Enum<Int> x1 x2)]
(test "Inners can overlap outers."
- (and (&;overlaps? outer left-inner)
- (&;overlaps? outer right-inner))))
+ (and (&.overlaps? outer left-inner)
+ (&.overlaps? outer right-inner))))
))))
diff --git a/stdlib/test/test/lux/control/parser.lux b/stdlib/test/test/lux/control/parser.lux
index b5ec72dc5..64e8fac32 100644
--- a/stdlib/test/test/lux/control/parser.lux
+++ b/stdlib/test/test/lux/control/parser.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad]
@@ -19,42 +19,42 @@
## [Utils]
(def: (should-fail input)
- (All [a] (-> (E;Error a) Bool))
+ (All [a] (-> (E.Error a) Bool))
(case input
- (#E;Error _) true
+ (#E.Error _) true
_ false))
(def: (enforced? parser input)
- (All [s] (-> (&;Parser s Unit) s Bool))
- (case (&;run input parser)
- (#E;Success [_ []])
+ (All [s] (-> (&.Parser s Unit) s Bool))
+ (case (&.run input parser)
+ (#E.Success [_ []])
true
_
false))
(def: (found? parser input)
- (All [s] (-> (&;Parser s Bool) s Bool))
- (case (&;run input parser)
- (#E;Success [_ true])
+ (All [s] (-> (&.Parser s Bool) s Bool))
+ (case (&.run input parser)
+ (#E.Success [_ true])
true
_
false))
(def: (is? Eq<a> test parser input)
- (All [s a] (-> (Eq a) a (&;Parser s a) s Bool))
- (case (&;run input parser)
- (#E;Success [_ output])
+ (All [s a] (-> (Eq a) a (&.Parser s a) s Bool))
+ (case (&.run input parser)
+ (#E.Success [_ output])
(:: Eq<a> = test output)
_
false))
(def: (fails? input)
- (All [a] (-> (E;Error a) Bool))
+ (All [a] (-> (E.Error a) Bool))
(case input
- (#E;Error _)
+ (#E.Error _)
true
_
@@ -62,7 +62,7 @@
(syntax: (match pattern input)
(wrap (list (` (case (~ input)
- (^ (#E;Success [(~' _) (~ pattern)]))
+ (^ (#E.Success [(~' _) (~ pattern)]))
true
(~' _)
@@ -72,116 +72,116 @@
(context: "Assertions"
(test "Can make assertions while parsing."
(and (match []
- (&;run (list (code;bool true) (code;int 123))
- (&;assert "yolo" true)))
- (fails? (&;run (list (code;bool true) (code;int 123))
- (&;assert "yolo" false))))))
+ (&.run (list (code.bool true) (code.int 123))
+ (&.assert "yolo" true)))
+ (fails? (&.run (list (code.bool true) (code.int 123))
+ (&.assert "yolo" false))))))
(context: "Combinators [Part 1]"
($_ seq
(test "Can optionally succeed with some parser."
- (and (match (#;Some +123)
- (&;run (list (code;nat +123))
- (&;maybe s;nat)))
- (match #;None
- (&;run (list (code;int -123))
- (&;maybe s;nat)))))
+ (and (match (#.Some +123)
+ (&.run (list (code.nat +123))
+ (&.maybe s.nat)))
+ (match #.None
+ (&.run (list (code.int -123))
+ (&.maybe s.nat)))))
(test "Can apply a parser 0 or more times."
(and (match (list +123 +456 +789)
- (&;run (list (code;nat +123) (code;nat +456) (code;nat +789))
- (&;some s;nat)))
+ (&.run (list (code.nat +123) (code.nat +456) (code.nat +789))
+ (&.some s.nat)))
(match (list)
- (&;run (list (code;int -123))
- (&;some s;nat)))))
+ (&.run (list (code.int -123))
+ (&.some s.nat)))))
(test "Can apply a parser 1 or more times."
(and (match (list +123 +456 +789)
- (&;run (list (code;nat +123) (code;nat +456) (code;nat +789))
- (&;many s;nat)))
+ (&.run (list (code.nat +123) (code.nat +456) (code.nat +789))
+ (&.many s.nat)))
(match (list +123)
- (&;run (list (code;nat +123))
- (&;many s;nat)))
- (fails? (&;run (list (code;int -123))
- (&;many s;nat)))))
+ (&.run (list (code.nat +123))
+ (&.many s.nat)))
+ (fails? (&.run (list (code.int -123))
+ (&.many s.nat)))))
(test "Can use either parser."
- (let [positive (: (s;Syntax Int)
- (do &;Monad<Parser>
- [value s;int
- _ (&;assert "" (i/> 0 value))]
+ (let [positive (: (s.Syntax Int)
+ (do &.Monad<Parser>
+ [value s.int
+ _ (&.assert "" (i/> 0 value))]
(wrap value)))]
(and (match 123
- (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;either positive s;int)))
+ (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.either positive s.int)))
(match -123
- (&;run (list (code;int -123) (code;int 456) (code;int 789))
- (&;either positive s;int)))
- (fails? (&;run (list (code;bool true) (code;int 456) (code;int 789))
- (&;either positive s;int))))))
+ (&.run (list (code.int -123) (code.int 456) (code.int 789))
+ (&.either positive s.int)))
+ (fails? (&.run (list (code.bool true) (code.int 456) (code.int 789))
+ (&.either positive s.int))))))
(test "Can create the opposite/negation of any parser."
- (and (fails? (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;not s;int)))
+ (and (fails? (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.not s.int)))
(match []
- (&;run (list (code;bool true) (code;int 456) (code;int 789))
- (&;not s;int)))))
+ (&.run (list (code.bool true) (code.int 456) (code.int 789))
+ (&.not s.int)))))
))
(context: "Combinators Part [2]"
($_ seq
(test "Can fail at will."
- (should-fail (&;run (list)
- (&;fail "Well, it really SHOULD fail..."))))
+ (should-fail (&.run (list)
+ (&.fail "Well, it really SHOULD fail..."))))
(test "Can apply a parser N times."
(and (match (list 123 456 789)
- (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;exactly +3 s;int)))
+ (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.exactly +3 s.int)))
(match (list 123 456)
- (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;exactly +2 s;int)))
- (fails? (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;exactly +4 s;int)))))
+ (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.exactly +2 s.int)))
+ (fails? (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.exactly +4 s.int)))))
(test "Can apply a parser at-least N times."
(and (match (list 123 456 789)
- (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;at-least +3 s;int)))
+ (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.at-least +3 s.int)))
(match (list 123 456 789)
- (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;at-least +2 s;int)))
- (fails? (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;at-least +4 s;int)))))
+ (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.at-least +2 s.int)))
+ (fails? (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.at-least +4 s.int)))))
(test "Can apply a parser at-most N times."
(and (match (list 123 456 789)
- (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;at-most +3 s;int)))
+ (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.at-most +3 s.int)))
(match (list 123 456)
- (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;at-most +2 s;int)))
+ (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.at-most +2 s.int)))
(match (list 123 456 789)
- (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;at-most +4 s;int)))))
+ (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.at-most +4 s.int)))))
(test "Can apply a parser between N and M times."
(and (match (list 123 456 789)
- (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;between +3 +10 s;int)))
- (fails? (&;run (list (code;int 123) (code;int 456) (code;int 789))
- (&;between +4 +10 s;int)))))
+ (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.between +3 +10 s.int)))
+ (fails? (&.run (list (code.int 123) (code.int 456) (code.int 789))
+ (&.between +4 +10 s.int)))))
(test "Can parse while taking separators into account."
(and (match (list 123 456 789)
- (&;run (list (code;int 123) (code;text "YOLO") (code;int 456) (code;text "YOLO") (code;int 789))
- (&;sep-by (s;this (' "YOLO")) s;int)))
+ (&.run (list (code.int 123) (code.text "YOLO") (code.int 456) (code.text "YOLO") (code.int 789))
+ (&.sep-by (s.this (' "YOLO")) s.int)))
(match (list 123 456)
- (&;run (list (code;int 123) (code;text "YOLO") (code;int 456) (code;int 789))
- (&;sep-by (s;this (' "YOLO")) s;int)))))
+ (&.run (list (code.int 123) (code.text "YOLO") (code.int 456) (code.int 789))
+ (&.sep-by (s.this (' "YOLO")) s.int)))))
(test "Can obtain the whole of the remaining input."
- (|> &;remaining
- (&;run (list (code;int 123) (code;int 456) (code;int 789)))
- (match (list [_ (#;Int 123)] [_ (#;Int 456)] [_ (#;Int 789)]))))
+ (|> &.remaining
+ (&.run (list (code.int 123) (code.int 456) (code.int 789)))
+ (match (list [_ (#.Int 123)] [_ (#.Int 456)] [_ (#.Int 789)]))))
))
diff --git a/stdlib/test/test/lux/control/pipe.lux b/stdlib/test/test/lux/control/pipe.lux
index 9147f501e..545640030 100644
--- a/stdlib/test/test/lux/control/pipe.lux
+++ b/stdlib/test/test/lux/control/pipe.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
diff --git a/stdlib/test/test/lux/control/reader.lux b/stdlib/test/test/lux/control/reader.lux
index 804660a2c..38b4f2893 100644
--- a/stdlib/test/test/lux/control/reader.lux
+++ b/stdlib/test/test/lux/control/reader.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -11,27 +11,27 @@
(context: "Readers"
($_ seq
- (test "" (i/= 123 (&;run 123 &;ask)))
- (test "" (i/= 246 (&;run 123 (&;local (i/* 2) &;ask))))
- (test "" (i/= 134 (&;run 123 (:: &;Functor<Reader> map i/inc (i/+ 10)))))
- (test "" (i/= 10 (&;run 123 (:: &;Applicative<Reader> wrap 10))))
- (test "" (i/= 30 (&;run 123 (let [(^open "&/") &;Applicative<Reader>]
+ (test "" (i/= 123 (&.run 123 &.ask)))
+ (test "" (i/= 246 (&.run 123 (&.local (i/* 2) &.ask))))
+ (test "" (i/= 134 (&.run 123 (:: &.Functor<Reader> map i/inc (i/+ 10)))))
+ (test "" (i/= 10 (&.run 123 (:: &.Applicative<Reader> wrap 10))))
+ (test "" (i/= 30 (&.run 123 (let [(^open "&/") &.Applicative<Reader>]
(&/apply (&/wrap (i/+ 10)) (&/wrap 20))))))
- (test "" (i/= 30 (&;run 123 (do &;Monad<Reader>
+ (test "" (i/= 30 (&.run 123 (do &.Monad<Reader>
[f (wrap i/+)
x (wrap 10)
y (wrap 20)]
(wrap (f x y))))))))
(context: "Monad transformer"
- (let [(^open "io/") io;Monad<IO>]
+ (let [(^open "io/") io.Monad<IO>]
(test "Can add reader functionality to any monad."
- (|> (do (&;ReaderT io;Monad<IO>)
- [a (&;lift (io/wrap 123))
+ (|> (do (&.ReaderT io.Monad<IO>)
+ [a (&.lift (io/wrap 123))
b (wrap 456)]
(wrap (i/+ a b)))
- (&;run "")
- io;run
+ (&.run "")
+ io.run
(case> 579 true
_ false)))
))
diff --git a/stdlib/test/test/lux/control/state.lux b/stdlib/test/test/lux/control/state.lux
index 070f3425c..4457952a1 100644
--- a/stdlib/test/test/lux/control/state.lux
+++ b/stdlib/test/test/lux/control/state.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad]
@@ -12,51 +12,51 @@
lux/test)
(def: (with-conditions [state output] computation)
- (-> [Nat Nat] (&;State Nat Nat) Bool)
+ (-> [Nat Nat] (&.State Nat Nat) Bool)
(|> computation
- (&;run state)
- product;right
+ (&.run state)
+ product.right
(n/= output)))
(context: "Basics"
(<| (times +100)
(do @
- [state r;nat
- value r;nat]
+ [state r.nat
+ value r.nat]
($_ seq
(test "Can get the state as a value."
(with-conditions [state state]
- &;get))
+ &.get))
(test "Can replace the state."
(with-conditions [state value]
- (do &;Monad<State>
- [_ (&;put value)]
- &;get)))
+ (do &.Monad<State>
+ [_ (&.put value)]
+ &.get)))
(test "Can update the state."
(with-conditions [state (n/* value state)]
- (do &;Monad<State>
- [_ (&;update (n/* value))]
- &;get)))
+ (do &.Monad<State>
+ [_ (&.update (n/* value))]
+ &.get)))
(test "Can use the state."
(with-conditions [state (n/inc state)]
- (&;use n/inc)))
+ (&.use n/inc)))
(test "Can use a temporary (local) state."
(with-conditions [state (n/* value state)]
- (&;local (n/* value)
- &;get)))
+ (&.local (n/* value)
+ &.get)))
))))
(context: "Structures"
(<| (times +100)
(do @
- [state r;nat
- value r;nat]
+ [state r.nat
+ value r.nat]
($_ seq
(test "Can use functor."
(with-conditions [state (n/inc state)]
- (:: &;Functor<State> map n/inc &;get)))
+ (:: &.Functor<State> map n/inc &.get)))
(test "Can use applicative."
- (let [(^open "&/") &;Applicative<State>]
+ (let [(^open "&/") &.Applicative<State>]
(and (with-conditions [state value]
(&/wrap value))
(with-conditions [state (n/+ value value)]
@@ -64,8 +64,8 @@
(&/wrap value))))))
(test "Can use monad."
(with-conditions [state (n/+ value value)]
- (: (&;State Nat Nat)
- (do &;Monad<State>
+ (: (&.State Nat Nat)
+ (do &.Monad<State>
[f (wrap n/+)
x (wrap value)
y (wrap value)]
@@ -75,18 +75,18 @@
(context: "Monad transformer"
(<| (times +100)
(do @
- [state r;nat
- left r;nat
- right r;nat]
- (let [(^open "io/") io;Monad<IO>]
+ [state r.nat
+ left r.nat
+ right r.nat]
+ (let [(^open "io/") io.Monad<IO>]
(test "Can add state functionality to any monad."
- (|> (: (&;State' io;IO Nat Nat)
- (do (&;StateT io;Monad<IO>)
- [a (&;lift io;Monad<IO> (io/wrap left))
+ (|> (: (&.State' io.IO Nat Nat)
+ (do (&.StateT io.Monad<IO>)
+ [a (&.lift io.Monad<IO> (io/wrap left))
b (wrap right)]
(wrap (n/+ a b))))
- (&;run' state)
- io;run
+ (&.run' state)
+ io.run
(case> [state' output']
(and (n/= state state')
(n/= (n/+ left right) output')))))
@@ -95,19 +95,19 @@
(context: "Loops"
(<| (times +100)
(do @
- [limit (|> r;nat (:: @ map (n/% +10)))
- #let [condition (do &;Monad<State>
- [state &;get]
+ [limit (|> r.nat (:: @ map (n/% +10)))
+ #let [condition (do &.Monad<State>
+ [state &.get]
(wrap (n/< limit state)))]]
($_ seq
(test "'while' will only execute if the condition is true."
- (|> (&;while condition (&;update n/inc))
- (&;run +0)
+ (|> (&.while condition (&.update n/inc))
+ (&.run +0)
(case> [state' output']
(n/= limit state'))))
(test "'do-while' will execute at least once."
- (|> (&;do-while condition (&;update n/inc))
- (&;run +0)
+ (|> (&.do-while condition (&.update n/inc))
+ (&.run +0)
(case> [state' output']
(or (n/= limit state')
(and (n/= +0 limit)
diff --git a/stdlib/test/test/lux/control/writer.lux b/stdlib/test/test/lux/control/writer.lux
index cbabbb6cd..42a5f9543 100644
--- a/stdlib/test/test/lux/control/writer.lux
+++ b/stdlib/test/test/lux/control/writer.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad]
@@ -10,31 +10,31 @@
lux/test)
(context: "Writer."
- (let [(^open "&/") (&;Monad<Writer> text;Monoid<Text>)]
+ (let [(^open "&/") (&.Monad<Writer> text.Monoid<Text>)]
($_ seq
(test "Functor respects Writer."
- (i/= 11 (product;right (&/map i/inc ["" 10]))))
+ (i/= 11 (product.right (&/map i/inc ["" 10]))))
(test "Applicative respects Writer."
- (and (i/= 20 (product;right (&/wrap 20)))
- (i/= 30 (product;right (&/apply (&/wrap (i/+ 10)) (&/wrap 20))))))
+ (and (i/= 20 (product.right (&/wrap 20)))
+ (i/= 30 (product.right (&/apply (&/wrap (i/+ 10)) (&/wrap 20))))))
(test "Monad respects Writer."
- (i/= 30 (product;right (do (&;Monad<Writer> text;Monoid<Text>)
+ (i/= 30 (product.right (do (&.Monad<Writer> text.Monoid<Text>)
[f (wrap i/+)
a (wrap 10)
b (wrap 20)]
(wrap (f a b))))))
(test "Can log any value."
- (Text/= "YOLO" (product;left (&;log "YOLO"))))
+ (Text/= "YOLO" (product.left (&.log "YOLO"))))
)))
(context: "Monad transformer"
- (let [lift (&;lift text;Monoid<Text> io;Monad<IO>)
- (^open "io/") io;Monad<IO>]
+ (let [lift (&.lift text.Monoid<Text> io.Monad<IO>)
+ (^open "io/") io.Monad<IO>]
(test "Can add writer functionality to any monad."
- (|> (io;run (do (&;WriterT text;Monoid<Text> io;Monad<IO>)
+ (|> (io.run (do (&.WriterT text.Monoid<Text> io.Monad<IO>)
[a (lift (io/wrap 123))
b (wrap 456)]
(wrap (i/+ a b))))
diff --git a/stdlib/test/test/lux/data/bit.lux b/stdlib/test/test/lux/data/bit.lux
index ac80f9b06..ca9e21d86 100644
--- a/stdlib/test/test/lux/data/bit.lux
+++ b/stdlib/test/test/lux/data/bit.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad])
@@ -10,62 +10,62 @@
(context: "Bitwise operations."
(<| (times +100)
(do @
- [pattern r;nat
- idx (:: @ map (n/% &;width) r;nat)]
+ [pattern r.nat
+ idx (:: @ map (n/% &.width) r.nat)]
($_ seq
(test "Clearing and settings bits should alter the count."
- (and (n/< (&;count (&;set idx pattern))
- (&;count (&;clear idx pattern)))
- (n/<= (&;count pattern)
- (&;count (&;clear idx pattern)))
- (n/>= (&;count pattern)
- (&;count (&;set idx pattern)))))
+ (and (n/< (&.count (&.set idx pattern))
+ (&.count (&.clear idx pattern)))
+ (n/<= (&.count pattern)
+ (&.count (&.clear idx pattern)))
+ (n/>= (&.count pattern)
+ (&.count (&.set idx pattern)))))
(test "Can query whether a bit is set."
- (and (or (and (&;set? idx pattern)
- (not (&;set? idx (&;clear idx pattern))))
- (and (not (&;set? idx pattern))
- (&;set? idx (&;set idx pattern))))
+ (and (or (and (&.set? idx pattern)
+ (not (&.set? idx (&.clear idx pattern))))
+ (and (not (&.set? idx pattern))
+ (&.set? idx (&.set idx pattern))))
- (or (and (&;set? idx pattern)
- (not (&;set? idx (&;flip idx pattern))))
- (and (not (&;set? idx pattern))
- (&;set? idx (&;flip idx pattern))))))
+ (or (and (&.set? idx pattern)
+ (not (&.set? idx (&.flip idx pattern))))
+ (and (not (&.set? idx pattern))
+ (&.set? idx (&.flip idx pattern))))))
(test "The negation of a bit pattern should have a complementary bit count."
- (n/= &;width
- (n/+ (&;count pattern)
- (&;count (&;not pattern)))))
+ (n/= &.width
+ (n/+ (&.count pattern)
+ (&.count (&.not pattern)))))
(test "Can do simple binary boolean logic."
(and (n/= +0
- (&;and pattern
- (&;not pattern)))
- (n/= (&;not +0)
- (&;or pattern
- (&;not pattern)))
- (n/= (&;not +0)
- (&;xor pattern
- (&;not pattern)))
+ (&.and pattern
+ (&.not pattern)))
+ (n/= (&.not +0)
+ (&.or pattern
+ (&.not pattern)))
+ (n/= (&.not +0)
+ (&.xor pattern
+ (&.not pattern)))
(n/= +0
- (&;xor pattern
+ (&.xor pattern
pattern))))
(test "rotate-left and rotate-right are inverses of one another."
(and (|> pattern
- (&;rotate-left idx)
- (&;rotate-right idx)
+ (&.rotate-left idx)
+ (&.rotate-right idx)
(n/= pattern))
(|> pattern
- (&;rotate-right idx)
- (&;rotate-left idx)
+ (&.rotate-right idx)
+ (&.rotate-left idx)
(n/= pattern))))
(test "Rotate as many spaces as the bit-pattern's width leaves the pattern unchanged."
(and (|> pattern
- (&;rotate-left &;width)
+ (&.rotate-left &.width)
(n/= pattern))
(|> pattern
- (&;rotate-right &;width)
+ (&.rotate-right &.width)
(n/= pattern))))
(test "Shift right respect the sign of ints."
(let [value (nat-to-int pattern)]
(if (i/< 0 value)
- (i/< 0 (&;signed-shift-right idx value))
- (i/>= 0 (&;signed-shift-right idx value)))))
+ (i/< 0 (&.signed-shift-right idx value))
+ (i/>= 0 (&.signed-shift-right idx value)))))
))))
diff --git a/stdlib/test/test/lux/data/bool.lux b/stdlib/test/test/lux/data/bool.lux
index 0336c15e7..d7bc88e87 100644
--- a/stdlib/test/test/lux/data/bool.lux
+++ b/stdlib/test/test/lux/data/bool.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux (control ["M" monad #+ do Monad])
[io]
@@ -9,7 +9,7 @@
(context: "Boolean operations."
(<| (times +100)
(do @
- [value r;bool]
+ [value r.bool]
(test "" (and (not (and value (not value)))
(or value (not value))
@@ -27,9 +27,9 @@
(case (|> value
(:: Codec<Text,Bool> encode)
(:: Codec<Text,Bool> decode))
- (#;Right dec-value)
+ (#.Right dec-value)
(:: Eq<Bool> = value dec-value)
- (#;Left _)
+ (#.Left _)
false)
)))))
diff --git a/stdlib/test/test/lux/data/coll/array.lux b/stdlib/test/test/lux/data/coll/array.lux
index 6d30f3e1e..cd834a41e 100644
--- a/stdlib/test/test/lux/data/coll/array.lux
+++ b/stdlib/test/test/lux/data/coll/array.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux (control [monad #+ do Monad]
pipe)
@@ -11,98 +11,98 @@
lux/test)
(def: bounded-size
- (r;Random Nat)
- (|> r;nat
- (:: r;Monad<Random> map (|>> (n/% +100) (n/+ +1)))))
+ (r.Random Nat)
+ (|> r.nat
+ (:: r.Monad<Random> map (|>> (n/% +100) (n/+ +1)))))
(context: "Arrays and their copies"
(<| (times +100)
(do @
[size bounded-size
- original (r;array size r;nat)
- #let [clone (@;clone original)
+ original (r.array size r.nat)
+ #let [clone (@.clone original)
copy (: (Array Nat)
- (@;new size))
+ (@.new size))
manual-copy (: (Array Nat)
- (@;new size))]]
+ (@.new size))]]
($_ seq
(test "Size function must correctly return size of array."
- (n/= size (@;size original)))
+ (n/= size (@.size original)))
(test "Cloning an array should yield and identical array, but not the same one."
- (and (:: (@;Eq<Array> number;Eq<Nat>) = original clone)
+ (and (:: (@.Eq<Array> number.Eq<Nat>) = original clone)
(not (is original clone))))
(test "Full-range manual copies should give the same result as cloning."
- (exec (@;copy size +0 original +0 copy)
- (and (:: (@;Eq<Array> number;Eq<Nat>) = original copy)
+ (exec (@.copy size +0 original +0 copy)
+ (and (:: (@.Eq<Array> number.Eq<Nat>) = original copy)
(not (is original copy)))))
(test "Array folding should go over all values."
- (exec (:: @;Fold<Array> fold
+ (exec (:: @.Fold<Array> fold
(function [x idx]
- (exec (@;write idx x manual-copy)
+ (exec (@.write idx x manual-copy)
(n/inc idx)))
+0
original)
- (:: (@;Eq<Array> number;Eq<Nat>) = original manual-copy)))
+ (:: (@.Eq<Array> number.Eq<Nat>) = original manual-copy)))
(test "Transformations between (full) arrays and lists shouldn't cause lose or change any values."
(|> original
- @;to-list @;from-list
- (:: (@;Eq<Array> number;Eq<Nat>) = original)))
+ @.to-list @.from-list
+ (:: (@.Eq<Array> number.Eq<Nat>) = original)))
))))
(context: "Array mutation"
(<| (times +100)
(do @
[size bounded-size
- idx (:: @ map (n/% size) r;nat)
- array (|> (r;array size r;nat)
- (r;filter (|>> @;to-list (list;any? n/odd?))))
- #let [value (maybe;assume (@;read idx array))]]
+ idx (:: @ map (n/% size) r.nat)
+ array (|> (r.array size r.nat)
+ (r.filter (|>> @.to-list (list.any? n/odd?))))
+ #let [value (maybe.assume (@.read idx array))]]
($_ seq
(test "Shouldn't be able to find a value in an unoccupied cell."
- (case (@;read idx (@;delete idx array))
- (#;Some _) false
- #;None true))
+ (case (@.read idx (@.delete idx array))
+ (#.Some _) false
+ #.None true))
(test "You should be able to access values put into the array."
- (case (@;read idx (@;write idx value array))
- (#;Some value') (n/= value' value)
- #;None false))
+ (case (@.read idx (@.write idx value array))
+ (#.Some value') (n/= value' value)
+ #.None false))
(test "All cells should be occupied on a full array."
- (and (n/= size (@;occupied array))
- (n/= +0 (@;vacant array))))
+ (and (n/= size (@.occupied array))
+ (n/= +0 (@.vacant array))))
(test "Filtering mutates the array to remove invalid values."
- (exec (@;filter n/even? array)
- (and (n/< size (@;occupied array))
- (n/> +0 (@;vacant array))
- (n/= size (n/+ (@;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))))))
))))
(context: "Finding values."
(<| (times +100)
(do @
[size bounded-size
- array (|> (r;array size r;nat)
- (r;filter (|>> @;to-list (list;any? n/even?))))]
+ array (|> (r.array size r.nat)
+ (r.filter (|>> @.to-list (list.any? n/even?))))]
($_ seq
(test "Can find values inside arrays."
- (|> (@;find n/even? array)
- (case> (#;Some _) true
- #;None false)))
+ (|> (@.find n/even? array)
+ (case> (#.Some _) true
+ #.None false)))
(test "Can find values inside arrays (with access to indices)."
- (|> (@;find+ (function [idx n]
+ (|> (@.find+ (function [idx n]
(and (n/even? n)
(n/< size idx)))
array)
- (case> (#;Some _) true
- #;None false)))))))
+ (case> (#.Some _) true
+ #.None false)))))))
(context: "Functor"
(<| (times +100)
(do @
[size bounded-size
- array (r;array size r;nat)]
- (let [(^open) @;Functor<Array>
- (^open) (@;Eq<Array> number;Eq<Nat>)]
+ array (r.array size r.nat)]
+ (let [(^open) @.Functor<Array>
+ (^open) (@.Eq<Array> number.Eq<Nat>)]
($_ seq
(test "Functor shouldn't alter original array."
(let [copy (map id array)]
@@ -119,22 +119,22 @@
(do @
[sizeL bounded-size
sizeR bounded-size
- left (r;array sizeL r;nat)
- right (r;array sizeR r;nat)
- #let [(^open) @;Monoid<Array>
- (^open) (@;Eq<Array> number;Eq<Nat>)
+ left (r.array sizeL r.nat)
+ right (r.array sizeR r.nat)
+ #let [(^open) @.Monoid<Array>
+ (^open) (@.Eq<Array> number.Eq<Nat>)
fusion (compose left right)]]
($_ seq
(test "Appending two arrays should produce a new one twice as large."
- (n/= (n/+ sizeL sizeR) (@;size fusion)))
+ (n/= (n/+ sizeL sizeR) (@.size fusion)))
(test "First elements of fused array should equal the first array."
(|> (: (Array Nat)
- (@;new sizeL))
- (@;copy sizeL +0 fusion +0)
+ (@.new sizeL))
+ (@.copy sizeL +0 fusion +0)
(= left)))
(test "Last elements of fused array should equal the second array."
(|> (: (Array Nat)
- (@;new sizeR))
- (@;copy sizeR sizeL fusion +0)
+ (@.new sizeR))
+ (@.copy sizeR sizeL fusion +0)
(= right)))
))))
diff --git a/stdlib/test/test/lux/data/coll/dict.lux b/stdlib/test/test/lux/data/coll/dict.lux
index 4f1b94478..d2dcd93a1 100644
--- a/stdlib/test/test/lux/data/coll/dict.lux
+++ b/stdlib/test/test/lux/data/coll/dict.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -15,114 +15,114 @@
(context: "Dictionaries."
(<| (times +100)
(do @
- [#let [capped-nat (:: r;Monad<Random> map (n/% +100) r;nat)]
+ [#let [capped-nat (:: r.Monad<Random> map (n/% +100) r.nat)]
size capped-nat
- dict (r;dict number;Hash<Nat> size r;nat capped-nat)
- non-key (|> r;nat (r;filter (function [key] (not (&;contains? key dict)))))
- test-val (|> r;nat (r;filter (function [val] (not (list;member? number;Eq<Nat> (&;values dict) val)))))]
+ dict (r.dict number.Hash<Nat> size r.nat capped-nat)
+ non-key (|> r.nat (r.filter (function [key] (not (&.contains? key dict)))))
+ test-val (|> r.nat (r.filter (function [val] (not (list.member? number.Eq<Nat> (&.values dict) val)))))]
($_ seq
(test "Size function should correctly represent Dict size."
- (n/= size (&;size dict)))
+ (n/= size (&.size dict)))
(test "Dicts of size 0 should be considered empty."
(if (n/= +0 size)
- (&;empty? dict)
- (not (&;empty? dict))))
+ (&.empty? dict)
+ (not (&.empty? dict))))
(test "The functions 'entries', 'keys' and 'values' should be synchronized."
- (:: (list;Eq<List> (eq;product number;Eq<Nat> number;Eq<Nat>)) =
- (&;entries dict)
- (list;zip2 (&;keys dict)
- (&;values dict))))
+ (:: (list.Eq<List> (eq.product number.Eq<Nat> number.Eq<Nat>)) =
+ (&.entries dict)
+ (list.zip2 (&.keys dict)
+ (&.values dict))))
(test "Dict should be able to recognize it's own keys."
- (list;every? (function [key] (&;contains? key dict))
- (&;keys dict)))
+ (list.every? (function [key] (&.contains? key dict))
+ (&.keys dict)))
(test "Should be able to get every key."
- (list;every? (function [key] (case (&;get key dict)
- (#;Some _) true
+ (list.every? (function [key] (case (&.get key dict)
+ (#.Some _) true
_ false))
- (&;keys dict)))
+ (&.keys dict)))
(test "Shouldn't be able to access non-existant keys."
- (case (&;get non-key dict)
- (#;Some _) false
+ (case (&.get non-key dict)
+ (#.Some _) false
_ true))
(test "Should be able to put and then get a value."
- (case (&;get non-key (&;put non-key test-val dict))
- (#;Some v) (n/= test-val v)
+ (case (&.get non-key (&.put non-key test-val dict))
+ (#.Some v) (n/= test-val v)
_ true))
(test "Should be able to put~ and then get a value."
- (case (&;get non-key (&;put~ non-key test-val dict))
- (#;Some v) (n/= test-val v)
+ (case (&.get non-key (&.put~ non-key test-val dict))
+ (#.Some v) (n/= test-val v)
_ true))
(test "Shouldn't be able to put~ an existing key."
(or (n/= +0 size)
- (let [first-key (|> dict &;keys list;head maybe;assume)]
- (case (&;get first-key (&;put~ first-key test-val dict))
- (#;Some v) (not (n/= test-val v))
+ (let [first-key (|> dict &.keys list.head maybe.assume)]
+ (case (&.get first-key (&.put~ first-key test-val dict))
+ (#.Some v) (not (n/= test-val v))
_ true))))
(test "Removing a key should make it's value inaccessible."
- (let [base (&;put non-key test-val dict)]
- (and (&;contains? non-key base)
- (not (&;contains? non-key (&;remove non-key base))))))
+ (let [base (&.put non-key test-val dict)]
+ (and (&.contains? non-key base)
+ (not (&.contains? non-key (&.remove non-key base))))))
(test "Should be possible to update values via their keys."
- (let [base (&;put non-key test-val dict)
- updt (&;update non-key n/inc base)]
- (case [(&;get non-key base) (&;get non-key updt)]
- [(#;Some x) (#;Some y)]
+ (let [base (&.put non-key test-val dict)
+ updt (&.update non-key n/inc base)]
+ (case [(&.get non-key base) (&.get non-key updt)]
+ [(#.Some x) (#.Some y)]
(n/= (n/inc x) y)
_
false)))
(test "Additions and removals to a Dict should affect its size."
- (let [plus (&;put non-key test-val dict)
- base (&;remove non-key plus)]
- (and (n/= (n/inc (&;size dict)) (&;size plus))
- (n/= (n/dec (&;size plus)) (&;size base)))))
+ (let [plus (&.put non-key test-val dict)
+ base (&.remove non-key plus)]
+ (and (n/= (n/inc (&.size dict)) (&.size plus))
+ (n/= (n/dec (&.size plus)) (&.size base)))))
(test "A Dict should equal itself & going to<->from lists shouldn't change that."
- (let [(^open) (&;Eq<Dict> number;Eq<Nat>)]
+ (let [(^open) (&.Eq<Dict> number.Eq<Nat>)]
(and (= dict dict)
- (|> dict &;entries (&;from-list number;Hash<Nat>) (= dict)))))
+ (|> dict &.entries (&.from-list number.Hash<Nat>) (= dict)))))
(test "Merging a Dict to itself changes nothing."
- (let [(^open) (&;Eq<Dict> number;Eq<Nat>)]
- (= dict (&;merge dict dict))))
+ (let [(^open) (&.Eq<Dict> number.Eq<Nat>)]
+ (= dict (&.merge dict dict))))
(test "If you merge, and the second dict has overlapping keys, it should overwrite yours."
- (let [dict' (|> dict &;entries
+ (let [dict' (|> dict &.entries
(list/map (function [[k v]] [k (n/inc v)]))
- (&;from-list number;Hash<Nat>))
- (^open) (&;Eq<Dict> number;Eq<Nat>)]
- (= dict' (&;merge dict' dict))))
+ (&.from-list number.Hash<Nat>))
+ (^open) (&.Eq<Dict> number.Eq<Nat>)]
+ (= dict' (&.merge dict' dict))))
(test "Can merge values in such a way that they become combined."
- (list;every? (function [[x x*2]] (n/= (n/* +2 x) x*2))
- (list;zip2 (&;values dict)
- (&;values (&;merge-with n/+ dict dict)))))
+ (list.every? (function [[x x*2]] (n/= (n/* +2 x) x*2))
+ (list.zip2 (&.values dict)
+ (&.values (&.merge-with n/+ dict dict)))))
(test "Should be able to select subset of keys from dict."
(|> dict
- (&;put non-key test-val)
- (&;select (list non-key))
- &;size
+ (&.put non-key test-val)
+ (&.select (list non-key))
+ &.size
(n/= +1)))
(test "Should be able to re-bind existing values to different keys."
(or (n/= +0 size)
- (let [first-key (|> dict &;keys list;head maybe;assume)
- rebound (&;re-bind first-key non-key dict)]
- (and (n/= (&;size dict) (&;size rebound))
- (&;contains? non-key rebound)
- (not (&;contains? first-key rebound))
- (n/= (maybe;assume (&;get first-key dict))
- (maybe;assume (&;get non-key rebound)))))))
+ (let [first-key (|> dict &.keys list.head maybe.assume)
+ rebound (&.re-bind first-key non-key dict)]
+ (and (n/= (&.size dict) (&.size rebound))
+ (&.contains? non-key rebound)
+ (not (&.contains? first-key rebound))
+ (n/= (maybe.assume (&.get first-key dict))
+ (maybe.assume (&.get non-key rebound)))))))
))))
diff --git a/stdlib/test/test/lux/data/coll/list.lux b/stdlib/test/test/lux/data/coll/list.lux
index 501c2cfc8..281f8b459 100644
--- a/stdlib/test/test/lux/data/coll/list.lux
+++ b/stdlib/test/test/lux/data/coll/list.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -13,208 +13,208 @@
lux/test)
(def: bounded-size
- (r;Random Nat)
- (|> r;nat
- (:: r;Monad<Random> map (|>> (n/% +100) (n/+ +10)))))
+ (r.Random Nat)
+ (|> r.nat
+ (:: r.Monad<Random> map (|>> (n/% +100) (n/+ +10)))))
(context: "Lists: Part 1"
(<| (times +100)
(do @
[size bounded-size
- idx (:: @ map (n/% size) r;nat)
- sample (r;list 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)
- separator r;nat
- #let [(^open) (&;Eq<List> number;Eq<Nat>)
- (^open "&/") &;Functor<List>]]
+ other-sample (r.list other-size r.nat)
+ separator r.nat
+ #let [(^open) (&.Eq<List> number.Eq<Nat>)
+ (^open "&/") &.Functor<List>]]
($_ seq
(test "The size function should correctly portray the size of the list."
- (n/= size (&;size sample)))
+ (n/= size (&.size sample)))
(test "The repeat function should produce as many elements as asked of it."
- (n/= size (&;size (&;repeat size []))))
+ (n/= size (&.size (&.repeat size []))))
(test "Reversing a list does not change it's size."
- (n/= (&;size sample)
- (&;size (&;reverse sample))))
+ (n/= (&.size sample)
+ (&.size (&.reverse sample))))
(test "Reversing a list twice results in the original list."
(= sample
- (&;reverse (&;reverse sample))))
+ (&.reverse (&.reverse sample))))
(test "Filtering by a predicate and its complement should result in a number of elements equal to the original list."
- (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))))))
+ (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))))))
(test "If every element in a list satisfies a predicate, there can't be any that satisfy its complement."
- (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)))
+ (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)))
(test "Any element of the list can be considered its member."
- (let [elem (maybe;assume (&;nth idx sample))]
- (&;member? number;Eq<Nat> sample elem)))
+ (let [elem (maybe.assume (&.nth idx sample))]
+ (&.member? number.Eq<Nat> sample elem)))
))))
(context: "Lists: Part 2"
(<| (times +100)
(do @
[size bounded-size
- idx (:: @ map (n/% size) r;nat)
- sample (r;list 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)
- separator r;nat
- #let [(^open) (&;Eq<List> number;Eq<Nat>)
- (^open "&/") &;Functor<List>]]
+ other-sample (r.list other-size r.nat)
+ separator r.nat
+ #let [(^open) (&.Eq<List> number.Eq<Nat>)
+ (^open "&/") &.Functor<List>]]
($_ seq
(test "Appending the head and the tail should yield the original list."
- (let [head (maybe;assume (&;head sample))
- tail (maybe;assume (&;tail sample))]
+ (let [head (maybe.assume (&.head sample))
+ tail (maybe.assume (&.tail sample))]
(= sample
- (#;Cons head tail))))
+ (#.Cons head tail))))
(test "Appending the inits and the last should yield the original list."
- (let [(^open) &;Monoid<List>
- inits (maybe;assume (&;inits sample))
- last (maybe;assume (&;last sample))]
+ (let [(^open) &.Monoid<List>
+ inits (maybe.assume (&.inits sample))
+ last (maybe.assume (&.last sample))]
(= sample
(compose inits (list last)))))
(test "Functor should go over every element of the list."
- (let [(^open) &;Functor<List>
+ (let [(^open) &.Functor<List>
there (map n/inc sample)
back-again (map n/dec there)]
(and (not (= sample there))
(= sample back-again))))
(test "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 n/even? sample)]
+ (let [(^open) &.Monoid<List>
+ [left right] (&.split idx sample)
+ [left' right'] (&.split-with n/even? sample)]
(and (= sample
(compose left right))
(= sample
(compose left' right'))
(= sample
- (compose (&;take idx sample)
- (&;drop idx sample)))
+ (compose (&.take idx sample)
+ (&.drop idx sample)))
(= sample
- (compose (&;take-while n/even? sample)
- (&;drop-while n/even? sample)))
+ (compose (&.take-while n/even? sample)
+ (&.drop-while n/even? sample)))
)))
(test "Segmenting the list in pairs should yield as many elements as N/2."
(n/= (n// +2 size)
- (&;size (&;as-pairs sample))))
+ (&.size (&.as-pairs sample))))
(test "Sorting a list shouldn't change it's size."
- (n/= (&;size sample)
- (&;size (&;sort n/< sample))))
+ (n/= (&.size sample)
+ (&.size (&.sort n/< sample))))
(test "Sorting a list with one order should yield the reverse of sorting it with the opposite order."
- (= (&;sort n/< sample)
- (&;reverse (&;sort n/> sample))))
+ (= (&.sort n/< sample)
+ (&.reverse (&.sort n/> sample))))
))))
(context: "Lists: Part 3"
(<| (times +100)
(do @
[size bounded-size
- idx (:: @ map (n/% size) r;nat)
- sample (r;list 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)
- separator r;nat
- #let [(^open) (&;Eq<List> number;Eq<Nat>)
- (^open "&/") &;Functor<List>]]
+ other-sample (r.list other-size r.nat)
+ separator r.nat
+ #let [(^open) (&.Eq<List> number.Eq<Nat>)
+ (^open "&/") &.Functor<List>]]
($_ seq
(test "If you zip 2 lists, the result's size will be that of the smaller list."
- (n/= (&;size (&;zip2 sample other-sample))
- (n/min (&;size sample) (&;size other-sample))))
+ (n/= (&.size (&.zip2 sample other-sample))
+ (n/min (&.size sample) (&.size other-sample))))
(test "I can pair-up elements of a list in order."
- (let [(^open) &;Functor<List>
- zipped (&;zip2 sample other-sample)
- num-zipper (&;size zipped)]
- (and (|> zipped (map product;left) (= (&;take num-zipper sample)))
- (|> zipped (map product;right) (= (&;take num-zipper other-sample))))))
+ (let [(^open) &.Functor<List>
+ zipped (&.zip2 sample other-sample)
+ num-zipper (&.size zipped)]
+ (and (|> zipped (map product.left) (= (&.take num-zipper sample)))
+ (|> zipped (map product.right) (= (&.take num-zipper other-sample))))))
(test "You can generate indices for any size, and they will be in ascending order."
- (let [(^open) &;Functor<List>
- indices (&;indices size)]
- (and (n/= size (&;size indices))
+ (let [(^open) &.Functor<List>
+ indices (&.indices size)]
+ (and (n/= size (&.size indices))
(= indices
- (&;sort n/< indices))
- (&;every? (n/= (n/dec size))
- (&;zip2-with n/+
+ (&.sort n/< indices))
+ (&.every? (n/= (n/dec size))
+ (&.zip2-with n/+
indices
- (&;sort n/> indices)))
+ (&.sort n/> indices)))
)))
(test "The 'interpose' function places a value between every member of a list."
- (let [(^open) &;Functor<List>
- sample+ (&;interpose separator sample)]
+ (let [(^open) &.Functor<List>
+ sample+ (&.interpose separator sample)]
(and (n/= (|> size (n/* +2) n/dec)
- (&;size sample+))
- (|> sample+ &;as-pairs (map product;right) (&;every? (n/= separator))))))
+ (&.size sample+))
+ (|> sample+ &.as-pairs (map product.right) (&.every? (n/= separator))))))
(test "List append is a monoid."
- (let [(^open) &;Monoid<List>]
+ (let [(^open) &.Monoid<List>]
(and (= sample (compose identity sample))
(= sample (compose sample identity))
- (let [[left right] (&;split size (compose sample other-sample))]
+ (let [[left right] (&.split size (compose sample other-sample))]
(and (= sample left)
(= other-sample right))))))
(test "Applicative allows you to create singleton lists, and apply lists of functions to lists of values."
- (let [(^open) &;Applicative<List>]
+ (let [(^open) &.Applicative<List>]
(and (= (list separator) (wrap separator))
(= (map n/inc sample)
(apply (wrap n/inc) sample)))))
(test "List concatenation is a monad."
- (let [(^open) &;Monad<List>
- (^open) &;Monoid<List>]
+ (let [(^open) &.Monad<List>
+ (^open) &.Monoid<List>]
(= (compose sample other-sample)
(join (list sample other-sample)))))
(test "You can find any value that satisfies some criterium, if such values exist in the list."
- (case (&;find n/even? sample)
- (#;Some found)
+ (case (&.find n/even? sample)
+ (#.Some found)
(and (n/even? found)
- (&;any? n/even? sample)
- (not (&;every? (bool;complement n/even?) sample)))
+ (&.any? n/even? sample)
+ (not (&.every? (bool.complement n/even?) sample)))
- #;None
- (and (not (&;any? n/even? sample))
- (&;every? (bool;complement n/even?) sample))))
+ #.None
+ (and (not (&.any? n/even? sample))
+ (&.every? (bool.complement n/even?) sample))))
(test "You can iteratively construct a list, generating values until you're done."
- (= (&;n/range +0 (n/dec size))
- (&;iterate (function [n] (if (n/< size n) (#;Some (n/inc n)) #;None))
+ (= (&.n/range +0 (n/dec size))
+ (&.iterate (function [n] (if (n/< size n) (#.Some (n/inc n)) #.None))
+0)))
(test "Can enumerate all elements in a list."
- (let [enum-sample (&;enumerate sample)]
- (and (= (&;indices (&;size enum-sample))
- (&/map product;left enum-sample))
+ (let [enum-sample (&.enumerate sample)]
+ (and (= (&.indices (&.size enum-sample))
+ (&/map product.left enum-sample))
(= sample
- (&/map product;right enum-sample)))))
+ (&/map product.right enum-sample)))))
))))
(context: "Monad transformer"
- (let [lift (&;lift io;Monad<IO>)
- (^open "io/") io;Monad<IO>]
+ (let [lift (&.lift io.Monad<IO>)
+ (^open "io/") io.Monad<IO>]
(test "Can add list functionality to any monad."
- (|> (io;run (do (&;ListT io;Monad<IO>)
+ (|> (io.run (do (&.ListT io.Monad<IO>)
[a (lift (io/wrap 123))
b (wrap 456)]
(wrap (i/+ a b))))
diff --git a/stdlib/test/test/lux/data/coll/ordered/dict.lux b/stdlib/test/test/lux/data/coll/ordered/dict.lux
index b3a6d6f58..dc4adca7c 100644
--- a/stdlib/test/test/lux/data/coll/ordered/dict.lux
+++ b/stdlib/test/test/lux/data/coll/ordered/dict.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -15,40 +15,40 @@
(context: "Dict"
(<| (times +100)
(do @
- [size (|> r;nat (:: @ map (n/% +100)))
- keys (r;set number;Hash<Nat> size r;nat)
- values (r;set number;Hash<Nat> size r;nat)
- extra-key (|> r;nat (r;filter (|>> (s;member? keys) not)))
- extra-value r;nat
- #let [pairs (list;zip2 (s;to-list keys)
- (s;to-list values))
- sample (&;from-list number;Order<Nat> pairs)
- sorted-pairs (list;sort (function [[left _] [right _]]
+ [size (|> r.nat (:: @ map (n/% +100)))
+ keys (r.set number.Hash<Nat> size r.nat)
+ values (r.set number.Hash<Nat> size r.nat)
+ extra-key (|> r.nat (r.filter (|>> (s.member? keys) not)))
+ extra-value r.nat
+ #let [pairs (list.zip2 (s.to-list keys)
+ (s.to-list values))
+ sample (&.from-list number.Order<Nat> pairs)
+ sorted-pairs (list.sort (function [[left _] [right _]]
(n/< left right))
pairs)
- sorted-values (L/map product;right sorted-pairs)
- (^open "&/") (&;Eq<Dict> number;Eq<Nat>)]]
+ sorted-values (L/map product.right sorted-pairs)
+ (^open "&/") (&.Eq<Dict> number.Eq<Nat>)]]
($_ seq
(test "Can query the size of a dictionary."
- (n/= size (&;size sample)))
+ (n/= size (&.size sample)))
(test "Can query value for minimum key."
- (case [(&;min sample) (list;head sorted-values)]
- [#;None #;None]
+ (case [(&.min sample) (list.head sorted-values)]
+ [#.None #.None]
true
- [(#;Some reference) (#;Some sample)]
+ [(#.Some reference) (#.Some sample)]
(n/= reference sample)
_
false))
(test "Can query value for maximum key."
- (case [(&;max sample) (list;last sorted-values)]
- [#;None #;None]
+ (case [(&.max sample) (list.last sorted-values)]
+ [#.None #.None]
true
- [(#;Some reference) (#;Some sample)]
+ [(#.Some reference) (#.Some sample)]
(n/= reference sample)
_
@@ -56,30 +56,30 @@
(test "Converting dictionaries to/from lists cannot change their values."
(|> sample
- &;entries (&;from-list number;Order<Nat>)
+ &.entries (&.from-list number.Order<Nat>)
(&/= sample)))
(test "Order is preserved."
- (let [(^open "L/") (list;Eq<List> (: (Eq [Nat Nat])
+ (let [(^open "L/") (list.Eq<List> (: (Eq [Nat Nat])
(function [[kr vr] [ks vs]]
(and (n/= kr ks)
(n/= vr vs)))))]
- (L/= (&;entries sample)
+ (L/= (&.entries sample)
sorted-pairs)))
(test "Every key in a dictionary must be identifiable."
- (list;every? (function [key] (&;contains? key sample))
- (&;keys sample)))
+ (list.every? (function [key] (&.contains? key sample))
+ (&.keys sample)))
(test "Can add and remove elements in a dictionary."
- (and (not (&;contains? extra-key sample))
- (let [sample' (&;put extra-key extra-value sample)
- sample'' (&;remove extra-key sample')]
- (and (&;contains? extra-key sample')
- (not (&;contains? extra-key sample''))
- (case [(&;get extra-key sample')
- (&;get extra-key sample'')]
- [(#;Some found) #;None]
+ (and (not (&.contains? extra-key sample))
+ (let [sample' (&.put extra-key extra-value sample)
+ sample'' (&.remove extra-key sample')]
+ (and (&.contains? extra-key sample')
+ (not (&.contains? extra-key sample''))
+ (case [(&.get extra-key sample')
+ (&.get extra-key sample'')]
+ [(#.Some found) #.None]
(n/= extra-value found)
_
diff --git a/stdlib/test/test/lux/data/coll/ordered/set.lux b/stdlib/test/test/lux/data/coll/ordered/set.lux
index 87c720597..123613972 100644
--- a/stdlib/test/test/lux/data/coll/ordered/set.lux
+++ b/stdlib/test/test/lux/data/coll/ordered/set.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -11,44 +11,44 @@
lux/test)
(def: gen-nat
- (r;Random Nat)
- (|> r;nat
- (:: r;Monad<Random> map (n/% +100))))
+ (r.Random Nat)
+ (|> r.nat
+ (:: r.Monad<Random> map (n/% +100))))
(context: "Sets"
(<| (times +100)
(do @
[sizeL gen-nat
sizeR gen-nat
- listL (|> (r;set number;Hash<Nat> sizeL gen-nat) (:: @ map s;to-list))
- listR (|> (r;set number;Hash<Nat> sizeR gen-nat) (:: @ map s;to-list))
- #let [(^open "&/") &;Eq<Set>
- setL (&;from-list number;Order<Nat> listL)
- setR (&;from-list number;Order<Nat> listR)
- sortedL (list;sort n/< listL)
- minL (list;head sortedL)
- maxL (list;last sortedL)]]
+ listL (|> (r.set number.Hash<Nat> sizeL gen-nat) (:: @ map s.to-list))
+ listR (|> (r.set number.Hash<Nat> sizeR gen-nat) (:: @ map s.to-list))
+ #let [(^open "&/") &.Eq<Set>
+ setL (&.from-list number.Order<Nat> listL)
+ setR (&.from-list number.Order<Nat> listR)
+ sortedL (list.sort n/< listL)
+ minL (list.head sortedL)
+ maxL (list.last sortedL)]]
($_ seq
(test "I can query the size of a set."
- (n/= sizeL (&;size setL)))
+ (n/= sizeL (&.size setL)))
(test "Can query minimum value."
- (case [(&;min setL) minL]
- [#;None #;None]
+ (case [(&.min setL) minL]
+ [#.None #.None]
true
- [(#;Some reference) (#;Some sample)]
+ [(#.Some reference) (#.Some sample)]
(n/= reference sample)
_
false))
(test "Can query maximum value."
- (case [(&;max setL) maxL]
- [#;None #;None]
+ (case [(&.max setL) maxL]
+ [#.None #.None]
true
- [(#;Some reference) (#;Some sample)]
+ [(#.Some reference) (#.Some sample)]
(n/= reference sample)
_
@@ -56,39 +56,39 @@
(test "Converting sets to/from lists can't change their values."
(|> setL
- &;to-list (&;from-list number;Order<Nat>)
+ &.to-list (&.from-list number.Order<Nat>)
(&/= setL)))
(test "Order is preserved."
- (let [listL (&;to-list setL)
- (^open "L/") (list;Eq<List> number;Eq<Nat>)]
+ (let [listL (&.to-list setL)
+ (^open "L/") (list.Eq<List> number.Eq<Nat>)]
(L/= listL
- (list;sort n/< listL))))
+ (list.sort n/< listL))))
(test "Every set is a sub-set of the union of itself with another."
- (let [setLR (&;union setL setR)]
- (and (&;sub? setLR setL)
- (&;sub? setLR setR))))
+ (let [setLR (&.union setL setR)]
+ (and (&.sub? setLR setL)
+ (&.sub? setLR setR))))
(test "Every set is a super-set of the intersection of itself with another."
- (let [setLR (&;intersection setL setR)]
- (and (&;super? setLR setL)
- (&;super? setLR setR))))
+ (let [setLR (&.intersection setL setR)]
+ (and (&.super? setLR setL)
+ (&.super? setLR setR))))
(test "Union with the empty set leaves a set unchanged."
(&/= setL
- (&;union (&;new number;Order<Nat>)
+ (&.union (&.new number.Order<Nat>)
setL)))
(test "Intersection with the empty set results in the empty set."
- (let [empty-set (&;new number;Order<Nat>)]
+ (let [empty-set (&.new number.Order<Nat>)]
(&/= empty-set
- (&;intersection empty-set setL))))
+ (&.intersection empty-set setL))))
(test "After substracting a set A from another B, no member of A can be a member of B."
- (let [sub (&;difference setR setL)]
- (not (list;any? (&;member? sub) (&;to-list setR)))))
+ (let [sub (&.difference setR setL)]
+ (not (list.any? (&.member? sub) (&.to-list setR)))))
(test "Every member of a set must be identifiable."
- (list;every? (&;member? setL) (&;to-list setL)))
+ (list.every? (&.member? setL) (&.to-list setL)))
))))
diff --git a/stdlib/test/test/lux/data/coll/priority-queue.lux b/stdlib/test/test/lux/data/coll/priority-queue.lux
index 8b94d0612..6c7fac180 100644
--- a/stdlib/test/test/lux/data/coll/priority-queue.lux
+++ b/stdlib/test/test/lux/data/coll/priority-queue.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -9,44 +9,44 @@
lux/test)
(def: (gen-queue size)
- (-> Nat (r;Random (&;Queue Nat)))
- (do r;Monad<Random>
- [inputs (r;list size r;nat)]
- (monad;fold @ (function [head tail]
+ (-> Nat (r.Random (&.Queue Nat)))
+ (do r.Monad<Random>
+ [inputs (r.list size r.nat)]
+ (monad.fold @ (function [head tail]
(do @
- [priority r;nat]
- (wrap (&;push priority head tail))))
- &;empty
+ [priority r.nat]
+ (wrap (&.push priority head tail))))
+ &.empty
inputs)))
(context: "Queues"
(<| (times +100)
(do @
- [size (|> r;nat (:: @ map (n/% +100)))
+ [size (|> r.nat (:: @ map (n/% +100)))
sample (gen-queue size)
- non-member-priority r;nat
- non-member (|> r;nat (r;filter (|>> (&;member? number;Eq<Nat> sample) not)))]
+ non-member-priority r.nat
+ non-member (|> r.nat (r.filter (|>> (&.member? number.Eq<Nat> sample) not)))]
($_ seq
(test "I can query the size of a queue (and empty queues have size 0)."
- (n/= size (&;size sample)))
+ (n/= size (&.size sample)))
(test "Enqueueing and dequeing affects the size of queues."
(and (n/= (n/inc size)
- (&;size (&;push non-member-priority non-member sample)))
- (or (n/= +0 (&;size sample))
+ (&.size (&.push non-member-priority non-member sample)))
+ (or (n/= +0 (&.size sample))
(n/= (n/dec size)
- (&;size (&;pop sample))))))
+ (&.size (&.pop sample))))))
(test "I can query whether an element belongs to a queue."
- (and (and (not (&;member? number;Eq<Nat> sample non-member))
- (&;member? number;Eq<Nat>
- (&;push non-member-priority non-member sample)
+ (and (and (not (&.member? number.Eq<Nat> sample non-member))
+ (&.member? number.Eq<Nat>
+ (&.push non-member-priority non-member sample)
non-member))
- (or (n/= +0 (&;size sample))
- (and (&;member? number;Eq<Nat>
+ (or (n/= +0 (&.size sample))
+ (and (&.member? number.Eq<Nat>
sample
- (maybe;assume (&;peek sample)))
- (not (&;member? number;Eq<Nat>
- (&;pop sample)
- (maybe;assume (&;peek sample))))))))
+ (maybe.assume (&.peek sample)))
+ (not (&.member? number.Eq<Nat>
+ (&.pop sample)
+ (maybe.assume (&.peek sample))))))))
))))
diff --git a/stdlib/test/test/lux/data/coll/queue.lux b/stdlib/test/test/lux/data/coll/queue.lux
index 4e9d00093..34330838b 100644
--- a/stdlib/test/test/lux/data/coll/queue.lux
+++ b/stdlib/test/test/lux/data/coll/queue.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -10,42 +10,42 @@
(context: "Queues"
(<| (times +100)
(do @
- [size (:: @ map (n/% +100) r;nat)
- sample (r;queue size r;nat)
- non-member (|> r;nat
- (r;filter (|>> (&;member? number;Eq<Nat> sample) not)))]
+ [size (:: @ map (n/% +100) r.nat)
+ sample (r.queue size r.nat)
+ non-member (|> r.nat
+ (r.filter (|>> (&.member? number.Eq<Nat> sample) not)))]
($_ seq
(test "I can query the size of a queue (and empty queues have size 0)."
(if (n/= +0 size)
- (&;empty? sample)
- (n/= size (&;size sample))))
+ (&.empty? sample)
+ (n/= size (&.size sample))))
(test "Enqueueing and dequeing affects the size of queues."
- (and (n/= (n/inc size) (&;size (&;push non-member sample)))
- (or (&;empty? sample)
- (n/= (n/dec size) (&;size (&;pop sample))))
- (n/= size (&;size (&;pop (&;push non-member sample))))))
+ (and (n/= (n/inc size) (&.size (&.push non-member sample)))
+ (or (&.empty? sample)
+ (n/= (n/dec size) (&.size (&.pop sample))))
+ (n/= size (&.size (&.pop (&.push non-member sample))))))
(test "Transforming to/from list can't change the queue."
- (let [(^open "&/") (&;Eq<Queue> number;Eq<Nat>)]
+ (let [(^open "&/") (&.Eq<Queue> number.Eq<Nat>)]
(|> sample
- &;to-list &;from-list
+ &.to-list &.from-list
(&/= sample))))
(test "I can always peek at a non-empty queue."
- (case (&;peek sample)
- #;None (&;empty? sample)
- (#;Some _) true))
+ (case (&.peek sample)
+ #.None (&.empty? sample)
+ (#.Some _) true))
(test "I can query whether an element belongs to a queue."
- (and (not (&;member? number;Eq<Nat> sample non-member))
- (&;member? number;Eq<Nat> (&;push non-member sample)
+ (and (not (&.member? number.Eq<Nat> sample non-member))
+ (&.member? number.Eq<Nat> (&.push non-member sample)
non-member)
- (case (&;peek sample)
- #;None
- (&;empty? sample)
+ (case (&.peek sample)
+ #.None
+ (&.empty? sample)
- (#;Some first)
- (and (&;member? number;Eq<Nat> sample first)
- (not (&;member? number;Eq<Nat> (&;pop sample) first))))))
+ (#.Some first)
+ (and (&.member? number.Eq<Nat> sample first)
+ (not (&.member? number.Eq<Nat> (&.pop sample) first))))))
))))
diff --git a/stdlib/test/test/lux/data/coll/sequence.lux b/stdlib/test/test/lux/data/coll/sequence.lux
index 28660cc6f..145493c3e 100644
--- a/stdlib/test/test/lux/data/coll/sequence.lux
+++ b/stdlib/test/test/lux/data/coll/sequence.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -12,48 +12,48 @@
(context: "Sequences"
(<| (times +100)
(do @
- [size (|> r;nat (:: @ map (|>> (n/% +100) (n/max +1))))
- idx (|> r;nat (:: @ map (n/% size)))
- sample (r;sequence size r;nat)
- other-sample (r;sequence size r;nat)
- non-member (|> r;nat (r;filter (|>> (&;member? number;Eq<Nat> sample) not)))
- #let [(^open "&/") (&;Eq<Sequence> number;Eq<Nat>)
- (^open "&/") &;Monad<Sequence>
- (^open "&/") &;Fold<Sequence>
- (^open "&/") &;Monoid<Sequence>]]
+ [size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +1))))
+ idx (|> r.nat (:: @ map (n/% size)))
+ sample (r.sequence size r.nat)
+ other-sample (r.sequence size r.nat)
+ non-member (|> r.nat (r.filter (|>> (&.member? number.Eq<Nat> sample) not)))
+ #let [(^open "&/") (&.Eq<Sequence> number.Eq<Nat>)
+ (^open "&/") &.Monad<Sequence>
+ (^open "&/") &.Fold<Sequence>
+ (^open "&/") &.Monoid<Sequence>]]
($_ seq
(test "Can query size of sequence."
- (if (&;empty? sample)
+ (if (&.empty? sample)
(and (n/= +0 size)
- (n/= +0 (&;size sample)))
- (n/= size (&;size sample))))
+ (n/= +0 (&.size sample)))
+ (n/= size (&.size sample))))
(test "Can add and remove elements to sequences."
- (and (n/= (n/inc size) (&;size (&;add non-member sample)))
- (n/= (n/dec size) (&;size (&;pop sample)))))
+ (and (n/= (n/inc size) (&.size (&.add non-member sample)))
+ (n/= (n/dec size) (&.size (&.pop sample)))))
(test "Can put and get elements into sequences."
(|> sample
- (&;put idx non-member)
- (&;nth idx)
- maybe;assume
+ (&.put idx non-member)
+ (&.nth idx)
+ maybe.assume
(is non-member)))
(test "Can update elements of sequences."
(|> sample
- (&;put idx non-member) (&;update idx n/inc)
- (&;nth idx) maybe;assume
+ (&.put idx non-member) (&.update idx n/inc)
+ (&.nth idx) maybe.assume
(n/= (n/inc non-member))))
(test "Can safely transform to/from lists."
- (|> sample &;to-list &;from-list (&/= sample)))
+ (|> sample &.to-list &.from-list (&/= sample)))
(test "Can identify members of a sequence."
- (and (not (&;member? number;Eq<Nat> sample non-member))
- (&;member? number;Eq<Nat> (&;add non-member sample) non-member)))
+ (and (not (&.member? number.Eq<Nat> sample non-member))
+ (&.member? number.Eq<Nat> (&.add non-member sample) non-member)))
(test "Can fold over elements of sequence."
- (n/= (list/fold n/+ +0 (&;to-list sample))
+ (n/= (list/fold n/+ +0 (&.to-list sample))
(&/fold n/+ +0 sample)))
(test "Functor goes over every element."
@@ -63,10 +63,10 @@
(&/= sample back-again))))
(test "Applicative allows you to create singleton sequences, and apply sequences of functions to sequences of values."
- (and (&/= (&;sequence non-member) (&/wrap non-member))
+ (and (&/= (&.sequence non-member) (&/wrap non-member))
(&/= (&/map n/inc sample) (&/apply (&/wrap n/inc) sample))))
(test "Sequence concatenation is a monad."
(&/= (&/compose sample other-sample)
- (&/join (&;sequence sample other-sample))))
+ (&/join (&.sequence sample other-sample))))
))))
diff --git a/stdlib/test/test/lux/data/coll/set.lux b/stdlib/test/test/lux/data/coll/set.lux
index e4a0b2ad1..eb43bd0d2 100644
--- a/stdlib/test/test/lux/data/coll/set.lux
+++ b/stdlib/test/test/lux/data/coll/set.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -9,56 +9,56 @@
lux/test)
(def: gen-nat
- (r;Random Nat)
- (|> r;nat
- (:: r;Monad<Random> map (n/% +100))))
+ (r.Random Nat)
+ (|> r.nat
+ (:: r.Monad<Random> map (n/% +100))))
(context: "Sets"
(<| (times +100)
(do @
[sizeL gen-nat
sizeR gen-nat
- setL (r;set number;Hash<Nat> sizeL gen-nat)
- setR (r;set number;Hash<Nat> sizeR gen-nat)
+ setL (r.set number.Hash<Nat> sizeL gen-nat)
+ setR (r.set number.Hash<Nat> sizeR gen-nat)
non-member (|> gen-nat
- (r;filter (|>> (&;member? setL) not)))
- #let [(^open "&/") &;Eq<Set>]]
+ (r.filter (|>> (&.member? setL) not)))
+ #let [(^open "&/") &.Eq<Set>]]
($_ seq
(test "I can query the size of a set."
- (and (n/= sizeL (&;size setL))
- (n/= sizeR (&;size setR))))
+ (and (n/= sizeL (&.size setL))
+ (n/= sizeR (&.size setR))))
(test "Converting sets to/from lists can't change their values."
(|> setL
- &;to-list (&;from-list number;Hash<Nat>)
+ &.to-list (&.from-list number.Hash<Nat>)
(&/= setL)))
(test "Every set is a sub-set of the union of itself with another."
- (let [setLR (&;union setL setR)]
- (and (&;sub? setLR setL)
- (&;sub? setLR setR))))
+ (let [setLR (&.union setL setR)]
+ (and (&.sub? setLR setL)
+ (&.sub? setLR setR))))
(test "Every set is a super-set of the intersection of itself with another."
- (let [setLR (&;intersection setL setR)]
- (and (&;super? setLR setL)
- (&;super? setLR setR))))
+ (let [setLR (&.intersection setL setR)]
+ (and (&.super? setLR setL)
+ (&.super? setLR setR))))
(test "Union with the empty set leaves a set unchanged."
(&/= setL
- (&;union (&;new number;Hash<Nat>)
+ (&.union (&.new number.Hash<Nat>)
setL)))
(test "Intersection with the empty set results in the empty set."
- (let [empty-set (&;new number;Hash<Nat>)]
+ (let [empty-set (&.new number.Hash<Nat>)]
(&/= empty-set
- (&;intersection empty-set setL))))
+ (&.intersection empty-set setL))))
(test "After substracting a set A from another B, no member of A can be a member of B."
- (let [sub (&;difference setR setL)]
- (not (list;any? (&;member? sub) (&;to-list setR)))))
+ (let [sub (&.difference setR setL)]
+ (not (list.any? (&.member? sub) (&.to-list setR)))))
(test "Every member of a set must be identifiable."
- (and (not (&;member? setL non-member))
- (&;member? (&;add non-member setL) non-member)
- (not (&;member? (&;remove non-member (&;add non-member setL)) non-member))))
+ (and (not (&.member? setL non-member))
+ (&.member? (&.add non-member setL) non-member)
+ (not (&.member? (&.remove non-member (&.add non-member setL)) non-member))))
))))
diff --git a/stdlib/test/test/lux/data/coll/stack.lux b/stdlib/test/test/lux/data/coll/stack.lux
index d9e365d61..2cbd2a1ab 100644
--- a/stdlib/test/test/lux/data/coll/stack.lux
+++ b/stdlib/test/test/lux/data/coll/stack.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -10,36 +10,36 @@
lux/test)
(def: gen-nat
- (r;Random Nat)
- (|> r;nat
- (:: r;Monad<Random> map (n/% +100))))
+ (r.Random Nat)
+ (|> r.nat
+ (:: r.Monad<Random> map (n/% +100))))
(context: "Stacks"
(<| (times +100)
(do @
[size gen-nat
- sample (r;stack size gen-nat)
+ sample (r.stack size gen-nat)
new-top gen-nat]
($_ seq
(test "Can query the size of a stack."
- (n/= size (&;size sample)))
+ (n/= size (&.size sample)))
(test "Can peek inside non-empty stacks."
- (case (&;peek sample)
- #;None (&;empty? sample)
- (#;Some _) (not (&;empty? sample))))
+ (case (&.peek sample)
+ #.None (&.empty? sample)
+ (#.Some _) (not (&.empty? sample))))
(test "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 (n/= (&;size sample) (n/inc (&;size sample')))
- (and (&;empty? sample) (&;empty? sample')))
+ (let [sample' (&.pop sample)]
+ (or (n/= (&.size sample) (n/inc (&.size sample')))
+ (and (&.empty? sample) (&.empty? sample')))
))
(test "Pushing onto a stack always increases it by 1, adding a new value at the top."
(and (is sample
- (&;pop (&;push new-top sample)))
- (n/= (n/inc (&;size sample)) (&;size (&;push new-top sample)))
- (|> (&;push new-top sample) &;peek maybe;assume
+ (&.pop (&.push new-top sample)))
+ (n/= (n/inc (&.size sample)) (&.size (&.push new-top sample)))
+ (|> (&.push new-top sample) &.peek maybe.assume
(is new-top))))
))))
diff --git a/stdlib/test/test/lux/data/coll/stream.lux b/stdlib/test/test/lux/data/coll/stream.lux
index 725426f1b..f7beb55bf 100644
--- a/stdlib/test/test/lux/data/coll/stream.lux
+++ b/stdlib/test/test/lux/data/coll/stream.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -16,87 +16,87 @@
(context: "Streams"
(<| (times +100)
(do @
- [size (|> r;nat (:: @ map (|>> (n/% +100) (n/max +2))))
- offset (|> r;nat (:: @ map (n/% +100)))
- factor (|> r;nat (:: @ map (|>> (n/% +100) (n/max +2))))
- elem r;nat
- cycle-seed (r;list size r;nat)
- cycle-sample-idx (|> r;nat (:: @ map (n/% +1000)))
- #let [(^open "List/") (list;Eq<List> number;Eq<Nat>)
- sample0 (&;iterate n/inc +0)
- sample1 (&;iterate n/inc offset)]]
+ [size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +2))))
+ offset (|> r.nat (:: @ map (n/% +100)))
+ factor (|> r.nat (:: @ map (|>> (n/% +100) (n/max +2))))
+ elem r.nat
+ cycle-seed (r.list size r.nat)
+ cycle-sample-idx (|> r.nat (:: @ map (n/% +1000)))
+ #let [(^open "List/") (list.Eq<List> number.Eq<Nat>)
+ sample0 (&.iterate n/inc +0)
+ sample1 (&.iterate n/inc offset)]]
($_ seq
(test "Can move along a stream and take slices off it."
- (and (and (List/= (list;n/range +0 (n/dec size))
- (&;take size sample0))
- (List/= (list;n/range offset (n/dec (n/+ offset size)))
- (&;take size (&;drop offset sample0)))
- (let [[drops takes...] (&;split size sample0)]
- (and (List/= (list;n/range +0 (n/dec size))
+ (and (and (List/= (list.n/range +0 (n/dec size))
+ (&.take size sample0))
+ (List/= (list.n/range offset (n/dec (n/+ offset size)))
+ (&.take size (&.drop offset sample0)))
+ (let [[drops takes] (&.split size sample0)]
+ (and (List/= (list.n/range +0 (n/dec size))
drops)
- (List/= (list;n/range size (n/dec (n/* +2 size)))
- (&;take size takes...)))))
- (and (List/= (list;n/range +0 (n/dec size))
- (&;take-while (n/< size) sample0))
- (List/= (list;n/range offset (n/dec (n/+ offset size)))
- (&;take-while (n/< (n/+ offset size))
- (&;drop-while (n/< offset) sample0)))
- (let [[drops takes...] (&;split-while (n/< size) sample0)]
- (and (List/= (list;n/range +0 (n/dec size))
+ (List/= (list.n/range size (n/dec (n/* +2 size)))
+ (&.take size takes)))))
+ (and (List/= (list.n/range +0 (n/dec size))
+ (&.take-while (n/< size) sample0))
+ (List/= (list.n/range offset (n/dec (n/+ offset size)))
+ (&.take-while (n/< (n/+ offset size))
+ (&.drop-while (n/< offset) sample0)))
+ (let [[drops takes] (&.split-while (n/< size) sample0)]
+ (and (List/= (list.n/range +0 (n/dec size))
drops)
- (List/= (list;n/range size (n/dec (n/* +2 size)))
- (&;take-while (n/< (n/* +2 size)) takes...)))))
+ (List/= (list.n/range size (n/dec (n/* +2 size)))
+ (&.take-while (n/< (n/* +2 size)) takes)))))
))
(test "Can repeat any element and infinite number of times."
- (n/= elem (&;nth offset (&;repeat elem))))
+ (n/= elem (&.nth offset (&.repeat elem))))
(test "Can obtain the head & tail of a stream."
- (and (n/= offset (&;head sample1))
- (List/= (list;n/range (n/inc offset) (n/+ offset size))
- (&;take size (&;tail sample1)))))
+ (and (n/= offset (&.head sample1))
+ (List/= (list.n/range (n/inc offset) (n/+ offset size))
+ (&.take size (&.tail sample1)))))
(test "Can filter streams."
(and (n/= (n/* +2 offset)
- (&;nth offset
- (&;filter n/even? sample0)))
- (let [[evens odds] (&;partition n/even? (&;iterate n/inc +0))]
+ (&.nth offset
+ (&.filter n/even? sample0)))
+ (let [[evens odds] (&.partition n/even? (&.iterate n/inc +0))]
(and (n/= (n/* +2 offset)
- (&;nth offset evens))
+ (&.nth offset evens))
(n/= (n/inc (n/* +2 offset))
- (&;nth offset odds))))))
+ (&.nth offset odds))))))
(test "Functor goes over 'all' elements in a stream."
- (let [(^open "&/") &;Functor<Stream>
+ (let [(^open "&/") &.Functor<Stream>
there (&/map (n/* factor) sample0)
back-again (&/map (n// factor) there)]
- (and (not (List/= (&;take size sample0)
- (&;take size there)))
- (List/= (&;take size sample0)
- (&;take size back-again)))))
+ (and (not (List/= (&.take size sample0)
+ (&.take size there)))
+ (List/= (&.take size sample0)
+ (&.take size back-again)))))
(test "CoMonad produces a value for every element in a stream."
- (let [(^open "&/") &;Functor<Stream>]
- (List/= (&;take size (&/map (n/* factor) sample1))
- (&;take size
- (be &;CoMonad<Stream>
+ (let [(^open "&/") &.Functor<Stream>]
+ (List/= (&.take size (&/map (n/* factor) sample1))
+ (&.take size
+ (be &.CoMonad<Stream>
[inputs sample1]
- (n/* factor (&;head inputs)))))))
+ (n/* factor (&.head inputs)))))))
(test "'unfold' generalizes 'iterate'."
- (let [(^open "&/") &;Functor<Stream>
- (^open "List/") (list;Eq<List> text;Eq<Text>)]
- (List/= (&;take size
- (&/map Nat/encode (&;iterate n/inc offset)))
- (&;take size
- (&;unfold (function [n] [(n/inc n) (Nat/encode n)])
+ (let [(^open "&/") &.Functor<Stream>
+ (^open "List/") (list.Eq<List> text.Eq<Text>)]
+ (List/= (&.take size
+ (&/map Nat/encode (&.iterate n/inc offset)))
+ (&.take size
+ (&.unfold (function [n] [(n/inc n) (Nat/encode n)])
offset)))))
(test "Can cycle over the same elements as an infinite stream."
- (|> (&;cycle cycle-seed)
- maybe;assume
- (&;nth cycle-sample-idx)
+ (|> (&.cycle cycle-seed)
+ maybe.assume
+ (&.nth cycle-sample-idx)
(n/= (|> cycle-seed
- (list;nth (n/% size cycle-sample-idx))
- maybe;assume))))
+ (list.nth (n/% size cycle-sample-idx))
+ maybe.assume))))
))))
diff --git a/stdlib/test/test/lux/data/coll/tree/rose.lux b/stdlib/test/test/lux/data/coll/tree/rose.lux
index 9fe725f9b..4ff1c9ea3 100644
--- a/stdlib/test/test/lux/data/coll/tree/rose.lux
+++ b/stdlib/test/test/lux/data/coll/tree/rose.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -12,26 +12,26 @@
lux/test)
(def: gen-tree
- (r;Random [Nat (&;Tree Nat)])
- (r;rec
+ (r.Random [Nat (&.Tree Nat)])
+ (r.rec
(function [gen-tree]
- (r;either (:: r;Monad<Random> map (|>> &;leaf [+1]) r;nat)
- (do r;Monad<Random>
- [value r;nat
- num-children (|> r;nat (:: @ map (n/% +3)))
- children' (r;list num-children gen-tree)
- #let [size' (L/fold n/+ +0 (L/map product;left children'))
- children (L/map product;right children')]]
+ (r.either (:: r.Monad<Random> map (|>> &.leaf [+1]) r.nat)
+ (do r.Monad<Random>
+ [value r.nat
+ num-children (|> r.nat (:: @ map (n/% +3)))
+ children' (r.list num-children gen-tree)
+ #let [size' (L/fold n/+ +0 (L/map product.left children'))
+ children (L/map product.right children')]]
(wrap [(n/inc size')
- (&;branch value children)]))
+ (&.branch value children)]))
))))
(context: "Trees"
(<| (times +100)
(do @
[[size sample] gen-tree
- #let [(^open "&/") (&;Eq<Tree> number;Eq<Nat>)
- (^open "&/") &;Fold<Tree>
+ #let [(^open "&/") (&.Eq<Tree> number.Eq<Nat>)
+ (^open "&/") &.Fold<Tree>
concat (function [addition partial] (format partial (%n addition)))]]
($_ seq
(test "Can compare trees for equality."
@@ -39,9 +39,9 @@
(test "Can flatten a tree to get all the nodes as a flat tree."
(n/= size
- (list;size (&;flatten sample))))
+ (list.size (&.flatten sample))))
(test "Can fold trees."
(T/= (&/fold concat "" sample)
- (L/fold concat "" (&;flatten sample))))
+ (L/fold concat "" (&.flatten sample))))
))))
diff --git a/stdlib/test/test/lux/data/coll/tree/zipper.lux b/stdlib/test/test/lux/data/coll/tree/zipper.lux
index f184090db..1347ee7bd 100644
--- a/stdlib/test/test/lux/data/coll/tree/zipper.lux
+++ b/stdlib/test/test/lux/data/coll/tree/zipper.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -14,111 +14,111 @@
lux/test)
(def: gen-tree
- (r;Random (rose;Tree Nat))
- (r;rec (function [gen-tree]
- (do r;Monad<Random>
+ (r.Random (rose.Tree Nat))
+ (r.rec (function [gen-tree]
+ (do r.Monad<Random>
## Each branch can have, at most, 1 child.
- [size (|> r;nat (:: @ map (n/% +2)))]
- (r;seq r;nat
- (r;list size gen-tree))))))
+ [size (|> r.nat (:: @ map (n/% +2)))]
+ (r.seq r.nat
+ (r.list size gen-tree))))))
(def: (to-end zipper)
- (All [a] (-> (&;Zipper a) (&;Zipper a)))
+ (All [a] (-> (&.Zipper a) (&.Zipper a)))
(loop [zipper zipper]
- (if (&;end? zipper)
+ (if (&.end? zipper)
zipper
- (recur (&;next zipper)))))
+ (recur (&.next zipper)))))
(context: "Zippers."
(<| (times +100)
(do @
[sample gen-tree
- new-val r;nat
- pre-val r;nat
- post-val r;nat
- #let [(^open "tree/") (rose;Eq<Tree> number;Eq<Nat>)
- (^open "L/") (list;Eq<List> number;Eq<Nat>)]]
+ new-val r.nat
+ pre-val r.nat
+ post-val r.nat
+ #let [(^open "tree/") (rose.Eq<Tree> number.Eq<Nat>)
+ (^open "L/") (list.Eq<List> number.Eq<Nat>)]]
($_ seq
(test "Trees can be converted to/from zippers."
(|> sample
- &;zip &;unzip
+ &.zip &.unzip
(tree/= sample)))
(test "Creating a zipper gives you a root node."
- (|> sample &;zip &;root?))
+ (|> sample &.zip &.root?))
(test "Can move down inside branches. Can move up from lower nodes."
- (let [zipper (&;zip sample)]
- (if (&;branch? zipper)
- (let [child (|> zipper &;down)]
- (and (not (tree/= sample (&;unzip child)))
- (|> child &;up (is zipper) not)
- (|> child &;root (is zipper) not)))
- (and (&;leaf? zipper)
- (|> zipper (&;prepend-child new-val) &;branch?)))))
+ (let [zipper (&.zip sample)]
+ (if (&.branch? zipper)
+ (let [child (|> zipper &.down)]
+ (and (not (tree/= sample (&.unzip child)))
+ (|> child &.up (is zipper) not)
+ (|> child &.root (is zipper) not)))
+ (and (&.leaf? zipper)
+ (|> zipper (&.prepend-child new-val) &.branch?)))))
(test "Can prepend and append children."
- (let [zipper (&;zip sample)]
- (if (&;branch? zipper)
- (let [mid-val (|> zipper &;down &;value)
+ (let [zipper (&.zip sample)]
+ (if (&.branch? zipper)
+ (let [mid-val (|> zipper &.down &.value)
zipper (|> zipper
- (&;prepend-child pre-val)
- (&;append-child post-val))]
- (and (|> zipper &;down &;value (is pre-val))
- (|> zipper &;down &;right &;value (is mid-val))
- (|> zipper &;down &;right &;right &;value (is post-val))
- (|> zipper &;down &;rightmost &;leftmost &;value (is pre-val))
- (|> zipper &;down &;right &;left &;value (is pre-val))
- (|> zipper &;down &;rightmost &;value (is post-val))))
+ (&.prepend-child pre-val)
+ (&.append-child post-val))]
+ (and (|> zipper &.down &.value (is pre-val))
+ (|> zipper &.down &.right &.value (is mid-val))
+ (|> zipper &.down &.right &.right &.value (is post-val))
+ (|> zipper &.down &.rightmost &.leftmost &.value (is pre-val))
+ (|> zipper &.down &.right &.left &.value (is pre-val))
+ (|> zipper &.down &.rightmost &.value (is post-val))))
true)))
(test "Can insert children around a node (unless it's root)."
- (let [zipper (&;zip sample)]
- (if (&;branch? zipper)
- (let [mid-val (|> zipper &;down &;value)
+ (let [zipper (&.zip sample)]
+ (if (&.branch? zipper)
+ (let [mid-val (|> zipper &.down &.value)
zipper (|> zipper
- &;down
- (&;insert-left pre-val)
- maybe;assume
- (&;insert-right post-val)
- maybe;assume
- &;up)]
- (and (|> zipper &;down &;value (is pre-val))
- (|> zipper &;down &;right &;value (is mid-val))
- (|> zipper &;down &;right &;right &;value (is post-val))
- (|> zipper &;down &;rightmost &;leftmost &;value (is pre-val))
- (|> zipper &;down &;right &;left &;value (is pre-val))
- (|> zipper &;down &;rightmost &;value (is post-val))))
- (and (|> zipper (&;insert-left pre-val) (case> (#;Some _) false
- #;None true))
- (|> zipper (&;insert-right post-val) (case> (#;Some _) false
- #;None true))))))
+ &.down
+ (&.insert-left pre-val)
+ maybe.assume
+ (&.insert-right post-val)
+ maybe.assume
+ &.up)]
+ (and (|> zipper &.down &.value (is pre-val))
+ (|> zipper &.down &.right &.value (is mid-val))
+ (|> zipper &.down &.right &.right &.value (is post-val))
+ (|> zipper &.down &.rightmost &.leftmost &.value (is pre-val))
+ (|> zipper &.down &.right &.left &.value (is pre-val))
+ (|> zipper &.down &.rightmost &.value (is post-val))))
+ (and (|> zipper (&.insert-left pre-val) (case> (#.Some _) false
+ #.None true))
+ (|> zipper (&.insert-right post-val) (case> (#.Some _) false
+ #.None true))))))
(test "Can set and update the value of a node."
- (|> sample &;zip (&;set new-val) &;value (n/= new-val)))
+ (|> sample &.zip (&.set new-val) &.value (n/= new-val)))
(test "Zipper traversal follows the outline of the tree depth-first."
- (L/= (rose;flatten sample)
- (loop [zipper (&;zip sample)]
- (if (&;end? zipper)
- (list (&;value zipper))
- (#;Cons (&;value zipper)
- (recur (&;next zipper)))))))
+ (L/= (rose.flatten sample)
+ (loop [zipper (&.zip sample)]
+ (if (&.end? zipper)
+ (list (&.value zipper))
+ (#.Cons (&.value zipper)
+ (recur (&.next zipper)))))))
(test "Backwards zipper traversal yield reverse tree flatten."
- (L/= (list;reverse (rose;flatten sample))
- (loop [zipper (to-end (&;zip sample))]
- (if (&;root? zipper)
- (list (&;value zipper))
- (#;Cons (&;value zipper)
- (recur (&;prev zipper)))))))
+ (L/= (list.reverse (rose.flatten sample))
+ (loop [zipper (to-end (&.zip sample))]
+ (if (&.root? zipper)
+ (list (&.value zipper))
+ (#.Cons (&.value zipper)
+ (recur (&.prev zipper)))))))
(test "Can remove nodes (except root nodes)."
- (let [zipper (&;zip sample)]
- (if (&;branch? zipper)
- (and (|> zipper &;down &;root? not)
- (|> zipper &;down &;remove (case> #;None false
- (#;Some node) (&;root? node))))
- (|> zipper &;remove (case> #;None true
- (#;Some _) false)))))
+ (let [zipper (&.zip sample)]
+ (if (&.branch? zipper)
+ (and (|> zipper &.down &.root? not)
+ (|> zipper &.down &.remove (case> #.None false
+ (#.Some node) (&.root? node))))
+ (|> zipper &.remove (case> #.None true
+ (#.Some _) false)))))
))))
diff --git a/stdlib/test/test/lux/data/color.lux b/stdlib/test/test/lux/data/color.lux
index b4597b22a..ed62a221f 100644
--- a/stdlib/test/test/lux/data/color.lux
+++ b/stdlib/test/test/lux/data/color.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do])
@@ -9,34 +9,34 @@
lux/test)
(def: color
- (r;Random @;Color)
- (|> ($_ r;seq r;nat r;nat r;nat)
- (:: r;Monad<Random> map @;color)))
+ (r.Random @.Color)
+ (|> ($_ r.seq r.nat r.nat r.nat)
+ (:: r.Monad<Random> map @.color)))
(def: scale
(-> Nat Frac)
(|>> nat-to-int int-to-frac))
-(def: square (-> Frac Frac) (math;pow 2.0))
+(def: square (-> Frac Frac) (math.pow 2.0))
(def: (distance from to)
- (-> @;Color @;Color Frac)
- (let [[fr fg fb] (@;unpack from)
- [tr tg tb] (@;unpack to)]
- (math;root2 ($_ f/+
+ (-> @.Color @.Color Frac)
+ (let [[fr fg fb] (@.unpack from)
+ [tr tg tb] (@.unpack to)]
+ (math.root2 ($_ f/+
(|> (scale tr) (f/- (scale fr)) square)
(|> (scale tg) (f/- (scale fg)) square)
(|> (scale tb) (f/- (scale fb)) square)))))
(def: error-margin Frac 1.8)
-(def: black @;Color (@;color [+0 +0 +0]))
-(def: white @;Color (@;color [+255 +255 +255]))
+(def: black @.Color (@.color [+0 +0 +0]))
+(def: white @.Color (@.color [+255 +255 +255]))
(do-template [<field>]
[(def: (<field> color)
- (-> @;Color Frac)
- (let [[hue saturation luminance] (@;to-hsl color)]
+ (-> @.Color Frac)
+ (let [[hue saturation luminance] (@.to-hsl color)]
<field>))]
[saturation]
@@ -48,47 +48,47 @@
(do @
[any color
colorful (|> color
- (r;filter (function [color] (|> (distance color black) (f/>= 100.0))))
- (r;filter (function [color] (|> (distance color white) (f/>= 100.0)))))
+ (r.filter (function [color] (|> (distance color black) (f/>= 100.0))))
+ (r.filter (function [color] (|> (distance color white) (f/>= 100.0)))))
mediocre (|> color
- (r;filter (|>> saturation
+ (r.filter (|>> saturation
((function [saturation]
(and (f/>= 0.25 saturation)
(f/<= 0.75 saturation)))))))
- ratio (|> r;frac (r;filter (f/>= 0.5)))]
+ ratio (|> r.frac (r.filter (f/>= 0.5)))]
($_ seq
(test "Has equality."
- (:: @;Eq<Color> = any any))
+ (:: @.Eq<Color> = any any))
(test "Can convert to/from HSL."
- (|> any @;to-hsl @;from-hsl
+ (|> any @.to-hsl @.from-hsl
(distance any)
(f/<= error-margin)))
(test "Can convert to/from HSB."
- (|> any @;to-hsb @;from-hsb
+ (|> any @.to-hsb @.from-hsb
(distance any)
(f/<= error-margin)))
(test "Can convert to/from CMYK."
- (|> any @;to-cmyk @;from-cmyk
+ (|> any @.to-cmyk @.from-cmyk
(distance any)
(f/<= error-margin)))
(test "Can interpolate between 2 colors."
(and (f/<= (distance colorful black)
- (distance (@;darker ratio colorful) black))
+ (distance (@.darker ratio colorful) black))
(f/<= (distance colorful white)
- (distance (@;brighter ratio colorful) white))))
+ (distance (@.brighter ratio colorful) white))))
(test "Can calculate complement."
- (let [~any (@;complement any)
- (^open "@/") @;Eq<Color>]
+ (let [~any (@.complement any)
+ (^open "@/") @.Eq<Color>]
(and (not (@/= any ~any))
- (@/= any (@;complement ~any)))))
+ (@/= any (@.complement ~any)))))
(test "Can saturate color."
(f/> (saturation mediocre)
- (saturation (@;saturate ratio mediocre))))
+ (saturation (@.saturate ratio mediocre))))
(test "Can de-saturate color."
(f/< (saturation mediocre)
- (saturation (@;de-saturate ratio mediocre))))
+ (saturation (@.de-saturate ratio mediocre))))
(test "Can gray-scale color."
- (let [gray'ed (@;gray-scale mediocre)]
+ (let [gray'ed (@.gray-scale mediocre)]
(and (f/= 0.0
(saturation gray'ed))
(|> (luminance gray'ed)
diff --git a/stdlib/test/test/lux/data/error.lux b/stdlib/test/test/lux/data/error.lux
index 9eeec4fbc..f6c7d7a70 100644
--- a/stdlib/test/test/lux/data/error.lux
+++ b/stdlib/test/test/lux/data/error.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad]
@@ -8,49 +8,49 @@
lux/test)
(context: "Errors"
- (let [(^open "&/") &;Monad<Error>]
+ (let [(^open "&/") &.Monad<Error>]
($_ seq
(test "Functor correctly handles both cases."
- (and (|> (: (&;Error Int) (#&;Success 10))
+ (and (|> (: (&.Error Int) (#&.Success 10))
(&/map i/inc)
- (case> (#&;Success 11) true _ false))
+ (case> (#&.Success 11) true _ false))
- (|> (: (&;Error Int) (#&;Error "YOLO"))
+ (|> (: (&.Error Int) (#&.Error "YOLO"))
(&/map i/inc)
- (case> (#&;Error "YOLO") true _ false))
+ (case> (#&.Error "YOLO") true _ false))
))
(test "Applicative correctly handles both cases."
(and (|> (&/wrap 20)
- (case> (#&;Success 20) true _ false))
+ (case> (#&.Success 20) true _ false))
(|> (&/apply (&/wrap i/inc) (&/wrap 10))
- (case> (#&;Success 11) true _ false))
- (|> (&/apply (&/wrap i/inc) (#&;Error "YOLO"))
- (case> (#&;Error "YOLO") true _ false))))
+ (case> (#&.Success 11) true _ false))
+ (|> (&/apply (&/wrap i/inc) (#&.Error "YOLO"))
+ (case> (#&.Error "YOLO") true _ false))))
(test "Monad correctly handles both cases."
- (and (|> (do &;Monad<Error>
+ (and (|> (do &.Monad<Error>
[f (wrap i/+)
a (wrap 10)
b (wrap 20)]
(wrap (f a b)))
- (case> (#&;Success 30) true _ false))
- (|> (do &;Monad<Error>
+ (case> (#&.Success 30) true _ false))
+ (|> (do &.Monad<Error>
[f (wrap i/+)
- a (#&;Error "YOLO")
+ a (#&.Error "YOLO")
b (wrap 20)]
(wrap (f a b)))
- (case> (#&;Error "YOLO") true _ false))
+ (case> (#&.Error "YOLO") true _ false))
))
)))
(context: "Monad transformer"
- (let [lift (&;lift io;Monad<IO>)
- (^open "io/") io;Monad<IO>]
+ (let [lift (&.lift io.Monad<IO>)
+ (^open "io/") io.Monad<IO>]
(test "Can add error functionality to any monad."
- (|> (io;run (do (&;ErrorT io;Monad<IO>)
+ (|> (io.run (do (&.ErrorT io.Monad<IO>)
[a (lift (io/wrap 123))
b (wrap 456)]
(wrap (i/+ a b))))
- (case> (#&;Success 579) true
+ (case> (#&.Success 579) true
_ false)))))
diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux
index c8ba05f1d..5cbef91b0 100644
--- a/stdlib/test/test/lux/data/format/json.lux
+++ b/stdlib/test/test/lux/data/format/json.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -28,41 +28,41 @@
["tda" date]
["tdu" duration])
test)
- (test (lux (time ["_;" instant]
- ["_;" duration]
- ["_;" date])))
+ (test (lux (time ["_." instant]
+ ["_." duration]
+ ["_." date])))
)
(def: gen-json
- (r;Random @;JSON)
- (r;rec (function [gen-json]
- (do r;Monad<Random>
- [size (:: @ map (n/% +2) r;nat)]
- ($_ r;alt
+ (r.Random @.JSON)
+ (r.rec (function [gen-json]
+ (do r.Monad<Random>
+ [size (:: @ map (n/% +2) r.nat)]
+ ($_ r.alt
(:: @ wrap [])
- r;bool
- (|> r;frac (:: @ map (f/* 1_000_000.0)))
- (r;text size)
- (r;sequence size gen-json)
- (r;dict text;Hash<Text> size (r;text size) gen-json)
+ r.bool
+ (|> r.frac (:: @ map (f/* 1_000_000.0)))
+ (r.text size)
+ (r.sequence size gen-json)
+ (r.dict text.Hash<Text> size (r.text size) gen-json)
)))))
(context: "JSON"
(<| (times +100)
(do @
[sample gen-json
- #let [(^open "@/") @;Eq<JSON>
- (^open "@/") @;Codec<Text,JSON>]]
+ #let [(^open "@/") @.Eq<JSON>
+ (^open "@/") @.Codec<Text,JSON>]]
($_ seq
(test "Every JSON is equal to itself."
(@/= sample sample))
(test "Can encode/decode JSON."
(|> sample @/encode @/decode
- (case> (#;Right result)
+ (case> (#.Right result)
(@/= sample result)
- (#;Left _)
+ (#.Left _)
false)))
))))
@@ -84,82 +84,82 @@
## #list (List Frac)
## #variant Variant
## #tuple [Bool Frac Text]
- ## #dict (d;Dict Text Frac)
+ ## #dict (d.Dict Text Frac)
## #recursive Recursive
- #instant ti;Instant
- #duration tdu;Duration
- #date tda;Date
- #grams (unit;Qty unit;Gram)
+ #instant ti.Instant
+ #duration tdu.Duration
+ #date tda.Date
+ #grams (unit.Qty unit.Gram)
})
(def: gen-recursive
- (r;Random Recursive)
- (r;rec (function [gen-recursive]
- (r;alt r;frac
- (r;seq r;frac gen-recursive)))))
+ (r.Random Recursive)
+ (r.rec (function [gen-recursive]
+ (r.alt r.frac
+ (r.seq r.frac gen-recursive)))))
-(derived: (poly/eq;Eq<?> Recursive))
+(derived: (poly/eq.Eq<?> Recursive))
(def: (qty carrier)
- (All [unit] (-> unit (r;Random (unit;Qty unit))))
- (|> r;int
- (:: r;Monad<Random> map (unit;in carrier))))
+ (All [unit] (-> unit (r.Random (unit.Qty unit))))
+ (|> r.int
+ (:: r.Monad<Random> map (unit.in carrier))))
(def: gen-record
- (r;Random Record)
- (do r;Monad<Random>
- [size (:: @ map (n/% +2) r;nat)]
- ($_ r;seq
+ (r.Random Record)
+ (do r.Monad<Random>
+ [size (:: @ map (n/% +2) r.nat)]
+ ($_ r.seq
## (:: @ wrap [])
- ## r;bool
- ## r;frac
- ## (r;text size)
- ## (r;maybe r;frac)
- ## (r;list size r;frac)
- ## ($_ r;alt r;bool (r;text size) r;frac)
- ## ($_ r;seq r;bool r;frac (r;text size))
- ## (r;dict text;Hash<Text> size (r;text size) r;frac)
+ ## r.bool
+ ## r.frac
+ ## (r.text size)
+ ## (r.maybe r.frac)
+ ## (r.list size r.frac)
+ ## ($_ r.alt r.bool (r.text size) r.frac)
+ ## ($_ r.seq r.bool r.frac (r.text size))
+ ## (r.dict text.Hash<Text> size (r.text size) r.frac)
## gen-recursive
- _instant;instant
- _duration;duration
- _date;date
- (qty unit;@Gram)
+ _instant.instant
+ _duration.duration
+ _date.date
+ (qty unit.@Gram)
)))
-(derived: (poly/json;Codec<JSON,?> Record))
+(derived: (poly/json.Codec<JSON,?> Record))
(struct: _ (Eq Record)
(def: (= recL recR)
(let [variant/= (function [left right]
(case [left right]
[(#Case0 left') (#Case0 right')]
- (:: bool;Eq<Bool> = left' right')
+ (:: bool.Eq<Bool> = left' right')
[(#Case1 left') (#Case1 right')]
- (:: text;Eq<Text> = left' right')
+ (:: text.Eq<Text> = left' right')
[(#Case2 left') (#Case2 right')]
(f/= left' right')
_
false))]
- (and ## (:: bool;Eq<Bool> = (get@ #bool recL) (get@ #bool recR))
+ (and ## (:: bool.Eq<Bool> = (get@ #bool recL) (get@ #bool recR))
## (f/= (get@ #frac recL) (get@ #frac recR))
- ## (:: text;Eq<Text> = (get@ #text recL) (get@ #text recR))
- ## (:: (maybe;Eq<Maybe> number;Eq<Frac>) = (get@ #maybe recL) (get@ #maybe recR))
- ## (:: (list;Eq<List> number;Eq<Frac>) = (get@ #list recL) (get@ #list recR))
+ ## (:: text.Eq<Text> = (get@ #text recL) (get@ #text recR))
+ ## (:: (maybe.Eq<Maybe> number.Eq<Frac>) = (get@ #maybe recL) (get@ #maybe recR))
+ ## (:: (list.Eq<List> number.Eq<Frac>) = (get@ #list recL) (get@ #list recR))
## (variant/= (get@ #variant recL) (get@ #variant recR))
## (let [[tL0 tL1 tL2] (get@ #tuple recL)
## [tR0 tR1 tR2] (get@ #tuple recR)]
- ## (and (:: bool;Eq<Bool> = tL0 tR0)
+ ## (and (:: bool.Eq<Bool> = tL0 tR0)
## (f/= tL1 tR1)
- ## (:: text;Eq<Text> = tL2 tR2)))
- ## (:: (d;Eq<Dict> number;Eq<Frac>) = (get@ #dict recL) (get@ #dict recR))
+ ## (:: text.Eq<Text> = tL2 tR2)))
+ ## (:: (d.Eq<Dict> number.Eq<Frac>) = (get@ #dict recL) (get@ #dict recR))
## (:: Eq<Recursive> = (get@ #recursive recL) (get@ #recursive recR))
- (:: ti;Eq<Instant> = (get@ #instant recL) (get@ #instant recR))
- (:: tdu;Eq<Duration> = (get@ #duration recL) (get@ #duration recR))
- (:: tda;Eq<Date> = (get@ #date recL) (get@ #date recR))
- (:: unit;Eq<Unit> = (get@ #grams recL) (get@ #grams recR))
+ (:: ti.Eq<Instant> = (get@ #instant recL) (get@ #instant recR))
+ (:: tdu.Eq<Duration> = (get@ #duration recL) (get@ #duration recR))
+ (:: tda.Eq<Date> = (get@ #date recL) (get@ #date recR))
+ (:: unit.Eq<Unit> = (get@ #grams recL) (get@ #grams recR))
))))
(context: "Polytypism"
@@ -171,8 +171,8 @@
(^open "@/") Codec<JSON,Record>]]
(test "Can encode/decode arbitrary types."
(|> sample @/encode @/decode
- (case> (#e;Success result)
+ (case> (#e.Success result)
(@/= sample result)
- (#e;Error error)
+ (#e.Error error)
false))))))
diff --git a/stdlib/test/test/lux/data/format/xml.lux b/stdlib/test/test/lux/data/format/xml.lux
index 55709facc..fa8b719ca 100644
--- a/stdlib/test/test/lux/data/format/xml.lux
+++ b/stdlib/test/test/lux/data/format/xml.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -23,54 +23,54 @@
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
(def: xml-char^
- (r;Random Nat)
- (do r;Monad<Random>
- [idx (|> r;nat (:: @ map (n/% (text;size char-range))))]
- (wrap (maybe;assume (text;nth idx char-range)))))
+ (r.Random Nat)
+ (do r.Monad<Random>
+ [idx (|> r.nat (:: @ map (n/% (text.size char-range))))]
+ (wrap (maybe.assume (text.nth idx char-range)))))
(def: (size^ bottom top)
- (-> Nat Nat (r;Random Nat))
+ (-> Nat Nat (r.Random Nat))
(let [constraint (|>> (n/% top) (n/max bottom))]
- (r/map constraint r;nat)))
+ (r/map constraint r.nat)))
(def: (xml-text^ bottom top)
- (-> Nat Nat (r;Random Text))
- (do r;Monad<Random>
+ (-> Nat Nat (r.Random Text))
+ (do r.Monad<Random>
[size (size^ bottom top)]
- (r;text' xml-char^ size)))
+ (r.text' xml-char^ size)))
(def: xml-identifier^
- (r;Random Ident)
- (r;seq (xml-text^ +0 +10)
+ (r.Random Ident)
+ (r.seq (xml-text^ +0 +10)
(xml-text^ +1 +10)))
(def: gen-xml
- (r;Random &;XML)
- (r;rec (function [gen-xml]
- (r;alt (xml-text^ +1 +10)
- (do r;Monad<Random>
+ (r.Random &.XML)
+ (r.rec (function [gen-xml]
+ (r.alt (xml-text^ +1 +10)
+ (do r.Monad<Random>
[size (size^ +0 +2)]
- ($_ r;seq
+ ($_ r.seq
xml-identifier^
- (r;dict ident;Hash<Ident> size xml-identifier^ (xml-text^ +0 +10))
- (r;list size gen-xml)))))))
+ (r.dict ident.Hash<Ident> size xml-identifier^ (xml-text^ +0 +10))
+ (r.list size gen-xml)))))))
(context: "XML."
(<| (times +100)
(do @
[sample gen-xml
- #let [(^open "&/") &;Eq<XML>
- (^open "&/") &;Codec<Text,XML>]]
+ #let [(^open "&/") &.Eq<XML>
+ (^open "&/") &.Codec<Text,XML>]]
($_ seq
(test "Every XML is equal to itself."
(&/= sample sample))
(test "Can encode/decode XML."
(|> sample &/encode &/decode
- (case> (#;Right result)
+ (case> (#.Right result)
(&/= sample result)
- (#;Left error)
+ (#.Left error)
false)))
))))
@@ -78,41 +78,41 @@
(<| (times +100)
(do @
[text (xml-text^ +1 +10)
- num-children (|> r;nat (:: @ map (n/% +5)))
- children (r;list num-children (xml-text^ +1 +10))
+ num-children (|> r.nat (:: @ map (n/% +5)))
+ children (r.list num-children (xml-text^ +1 +10))
tag xml-identifier^
attr xml-identifier^
value (xml-text^ +1 +10)
- #let [node (#&;Node tag
- (dict;put attr value &;attrs)
- (L/map (|>> #&;Text) children))]]
+ #let [node (#&.Node tag
+ (dict.put attr value &.attrs)
+ (L/map (|>> #&.Text) children))]]
($_ seq
(test "Can parse text."
- (E;default false
- (do E;Monad<Error>
- [output (&;run (#&;Text text)
- &;text)]
+ (E.default false
+ (do E.Monad<Error>
+ [output (&.run (#&.Text text)
+ &.text)]
(wrap (text/= text output)))))
(test "Can parse attributes."
- (E;default false
- (do E;Monad<Error>
- [output (|> (&;attr attr)
- (p;before &;ignore)
- (&;run node))]
+ (E.default false
+ (do E.Monad<Error>
+ [output (|> (&.attr attr)
+ (p.before &.ignore)
+ (&.run node))]
(wrap (text/= value output)))))
(test "Can parse nodes."
- (E;default false
- (do E;Monad<Error>
- [_ (|> (&;node tag)
- (p;before &;ignore)
- (&;run node))]
+ (E.default false
+ (do E.Monad<Error>
+ [_ (|> (&.node tag)
+ (p.before &.ignore)
+ (&.run node))]
(wrap true))))
(test "Can parse children."
- (E;default false
- (do E;Monad<Error>
- [outputs (|> (&;children (p;some &;text))
- (&;run node))]
- (wrap (:: (list;Eq<List> text;Eq<Text>) =
+ (E.default false
+ (do E.Monad<Error>
+ [outputs (|> (&.children (p.some &.text))
+ (&.run node))]
+ (wrap (:: (list.Eq<List> text.Eq<Text>) =
children
outputs)))))
))))
diff --git a/stdlib/test/test/lux/data/ident.lux b/stdlib/test/test/lux/data/ident.lux
index 1f0554832..2e3b59853 100644
--- a/stdlib/test/test/lux/data/ident.lux
+++ b/stdlib/test/test/lux/data/ident.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -10,30 +10,30 @@
lux/test)
(def: (gen-part size)
- (-> Nat (r;Random Text))
- (|> (r;text size) (r;filter (|>> (text;contains? ";") not))))
+ (-> Nat (r.Random Text))
+ (|> (r.text size) (r.filter (|>> (text.contains? ".") not))))
(context: "Idents"
(<| (times +100)
(do @
[## First Ident
- sizeM1 (|> r;nat (:: @ map (n/% +100)))
- sizeN1 (|> r;nat (:: @ map (|>> (n/% +100) (n/max +1))))
+ sizeM1 (|> r.nat (:: @ map (n/% +100)))
+ sizeN1 (|> r.nat (:: @ map (|>> (n/% +100) (n/max +1))))
module1 (gen-part sizeM1)
name1 (gen-part sizeN1)
#let [ident1 [module1 name1]]
## Second Ident
- sizeM2 (|> r;nat (:: @ map (n/% +100)))
- sizeN2 (|> r;nat (:: @ map (|>> (n/% +100) (n/max +1))))
+ sizeM2 (|> r.nat (:: @ map (n/% +100)))
+ sizeN2 (|> r.nat (:: @ map (|>> (n/% +100) (n/max +1))))
module2 (gen-part sizeM2)
name2 (gen-part sizeN2)
#let [ident2 [module2 name2]]
- #let [(^open "&/") &;Eq<Ident>
- (^open "&/") &;Codec<Text,Ident>]]
+ #let [(^open "&/") &.Eq<Ident>
+ (^open "&/") &.Codec<Text,Ident>]]
($_ seq
(test "Can get the module & name parts of an ident."
- (and (is module1 (&;module ident1))
- (is name1 (&;name ident1))))
+ (and (is module1 (&.module ident1))
+ (is name1 (&.name ident1))))
(test "Can compare idents for equality."
(and (&/= ident1 ident1)
@@ -46,26 +46,26 @@
(test "Can encode idents as text."
(|> ident1
&/encode &/decode
- (case> (#;Right dec-ident) (&/= ident1 dec-ident)
+ (case> (#.Right dec-ident) (&/= ident1 dec-ident)
_ false)))
(test "Encoding an ident without a module component results in text equal to the name of the ident."
- (if (text;empty? module1)
+ (if (text.empty? module1)
(text/= name1 (&/encode ident1))
true))
))))
(context: "Ident-related macros."
- (let [(^open "&/") &;Eq<Ident>]
+ (let [(^open "&/") &.Eq<Ident>]
($_ seq
(test "Can obtain Ident from symbol."
- (and (&/= ["lux" "yolo"] (ident-for ;yolo))
- (&/= ["test/lux/data/ident" "yolo"] (ident-for ;;yolo))
+ (and (&/= ["lux" "yolo"] (ident-for .yolo))
+ (&/= ["test/lux/data/ident" "yolo"] (ident-for ..yolo))
(&/= ["" "yolo"] (ident-for yolo))
- (&/= ["lux/test" "yolo"] (ident-for lux/test;yolo))))
+ (&/= ["lux/test" "yolo"] (ident-for lux/test.yolo))))
(test "Can obtain Ident from tag."
- (and (&/= ["lux" "yolo"] (ident-for #;yolo))
- (&/= ["test/lux/data/ident" "yolo"] (ident-for #;;yolo))
+ (and (&/= ["lux" "yolo"] (ident-for #.yolo))
+ (&/= ["test/lux/data/ident" "yolo"] (ident-for #..yolo))
(&/= ["" "yolo"] (ident-for #yolo))
- (&/= ["lux/test" "yolo"] (ident-for #lux/test;yolo)))))))
+ (&/= ["lux/test" "yolo"] (ident-for #lux/test.yolo)))))))
diff --git a/stdlib/test/test/lux/data/identity.lux b/stdlib/test/test/lux/data/identity.lux
index 494811947..7ab4a6399 100644
--- a/stdlib/test/test/lux/data/identity.lux
+++ b/stdlib/test/test/lux/data/identity.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad]
@@ -8,8 +8,8 @@
lux/test)
(context: "Identity"
- (let [(^open "&/") &;Monad<Identity>
- (^open "&/") &;CoMonad<Identity>]
+ (let [(^open "&/") &.Monad<Identity>
+ (^open "&/") &.CoMonad<Identity>]
($_ seq
(test "Functor does not affect values."
(Text/= "yololol" (&/map (Text/compose "yolo") "lol")))
@@ -19,7 +19,7 @@
(Text/= "yololol" (&/apply (&/wrap (Text/compose "yolo")) (&/wrap "lol")))))
(test "Monad does not affect values."
- (Text/= "yololol" (do &;Monad<Identity>
+ (Text/= "yololol" (do &.Monad<Identity>
[f (wrap Text/compose)
a (wrap "yolo")
b (wrap "lol")]
@@ -27,7 +27,7 @@
(test "CoMonad does not affect values."
(and (Text/= "yololol" (&/unwrap "yololol"))
- (Text/= "yololol" (be &;CoMonad<Identity>
+ (Text/= "yololol" (be &.CoMonad<Identity>
[f Text/compose
a "yolo"
b "lol"]
diff --git a/stdlib/test/test/lux/data/lazy.lux b/stdlib/test/test/lux/data/lazy.lux
index 52e850d80..c007990de 100644
--- a/stdlib/test/test/lux/data/lazy.lux
+++ b/stdlib/test/test/lux/data/lazy.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -9,49 +9,49 @@
(context: "Lazy."
(<| (times +100)
(do @
- [left r;nat
- right r;nat
- #let [lazy (&;freeze (n/* left right))
+ [left r.nat
+ right r.nat
+ #let [lazy (&.freeze (n/* left right))
expected (n/* left right)]]
($_ seq
(test "Lazying does not alter the expected value."
(n/= expected
- (&;thaw lazy)))
+ (&.thaw lazy)))
(test "Lazy values only evaluate once."
(and (not (is expected
- (&;thaw lazy)))
- (is (&;thaw lazy)
- (&;thaw lazy))))
+ (&.thaw lazy)))
+ (is (&.thaw lazy)
+ (&.thaw lazy))))
))))
(context: "Functor, Applicative, Monad."
(<| (times +100)
(do @
- [sample r;nat]
+ [sample r.nat]
($_ seq
(test "Functor map."
- (|> (&;freeze sample)
- (:: &;Functor<Lazy> map n/inc)
- &;thaw
+ (|> (&.freeze sample)
+ (:: &.Functor<Lazy> map n/inc)
+ &.thaw
(n/= (n/inc sample))))
(test "Applicative wrap."
(|> sample
- (:: &;Applicative<Lazy> wrap)
- &;thaw
+ (:: &.Applicative<Lazy> wrap)
+ &.thaw
(n/= sample)))
(test "Applicative apply."
- (let [(^open "&/") &;Applicative<Lazy>]
+ (let [(^open "&/") &.Applicative<Lazy>]
(|> (&/apply (&/wrap n/inc) (&/wrap sample))
- &;thaw
+ &.thaw
(n/= (n/inc sample)))))
(test "Monad."
- (|> (do &;Monad<Lazy>
+ (|> (do &.Monad<Lazy>
[f (wrap n/inc)
a (wrap sample)]
(wrap (f a)))
- &;thaw
+ &.thaw
(n/= (n/inc sample))))
))))
diff --git a/stdlib/test/test/lux/data/maybe.lux b/stdlib/test/test/lux/data/maybe.lux
index 16d5c850d..4a2c98ab7 100644
--- a/stdlib/test/test/lux/data/maybe.lux
+++ b/stdlib/test/test/lux/data/maybe.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad]
@@ -9,35 +9,35 @@
lux/test)
(context: "Maybe"
- (let [(^open "&/") &;Monoid<Maybe>
- (^open "&/") &;Monad<Maybe>
- (^open "Maybe/") (&;Eq<Maybe> text;Eq<Text>)]
+ (let [(^open "&/") &.Monoid<Maybe>
+ (^open "&/") &.Monad<Maybe>
+ (^open "Maybe/") (&.Eq<Maybe> text.Eq<Text>)]
($_ seq
(test "Can compare Maybe values."
- (and (Maybe/= #;None #;None)
- (Maybe/= (#;Some "yolo") (#;Some "yolo"))
- (not (Maybe/= (#;Some "yolo") (#;Some "lol")))
- (not (Maybe/= (#;Some "yolo") #;None))))
+ (and (Maybe/= #.None #.None)
+ (Maybe/= (#.Some "yolo") (#.Some "yolo"))
+ (not (Maybe/= (#.Some "yolo") (#.Some "lol")))
+ (not (Maybe/= (#.Some "yolo") #.None))))
(test "Monoid respects Maybe."
- (and (Maybe/= #;None &/identity)
- (Maybe/= (#;Some "yolo") (&/compose (#;Some "yolo") (#;Some "lol")))
- (Maybe/= (#;Some "yolo") (&/compose (#;Some "yolo") #;None))
- (Maybe/= (#;Some "lol") (&/compose #;None (#;Some "lol")))
- (Maybe/= #;None (: (Maybe Text) (&/compose #;None #;None)))))
+ (and (Maybe/= #.None &/identity)
+ (Maybe/= (#.Some "yolo") (&/compose (#.Some "yolo") (#.Some "lol")))
+ (Maybe/= (#.Some "yolo") (&/compose (#.Some "yolo") #.None))
+ (Maybe/= (#.Some "lol") (&/compose #.None (#.Some "lol")))
+ (Maybe/= #.None (: (Maybe Text) (&/compose #.None #.None)))))
(test "Functor respects Maybe."
- (and (Maybe/= #;None (&/map (Text/compose "yolo") #;None))
- (Maybe/= (#;Some "yololol") (&/map (Text/compose "yolo") (#;Some "lol")))))
+ (and (Maybe/= #.None (&/map (Text/compose "yolo") #.None))
+ (Maybe/= (#.Some "yololol") (&/map (Text/compose "yolo") (#.Some "lol")))))
(test "Applicative respects Maybe."
- (and (Maybe/= (#;Some "yolo") (&/wrap "yolo"))
- (Maybe/= (#;Some "yololol")
+ (and (Maybe/= (#.Some "yolo") (&/wrap "yolo"))
+ (Maybe/= (#.Some "yololol")
(&/apply (&/wrap (Text/compose "yolo")) (&/wrap "lol")))))
(test "Monad respects Maybe."
- (Maybe/= (#;Some "yololol")
- (do &;Monad<Maybe>
+ (Maybe/= (#.Some "yololol")
+ (do &.Monad<Maybe>
[f (wrap Text/compose)
a (wrap "yolo")
b (wrap "lol")]
@@ -45,12 +45,12 @@
)))
(context: "Monad transformer"
- (let [lift (&;lift io;Monad<IO>)
- (^open "io/") io;Monad<IO>]
+ (let [lift (&.lift io.Monad<IO>)
+ (^open "io/") io.Monad<IO>]
(test "Can add maybe functionality to any monad."
- (|> (io;run (do (&;MaybeT io;Monad<IO>)
+ (|> (io.run (do (&.MaybeT io.Monad<IO>)
[a (lift (io/wrap 123))
b (wrap 456)]
(wrap (i/+ a b))))
- (case> (#;Some 579) true
+ (case> (#.Some 579) true
_ false)))))
diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux
index 7522f46ef..0f14bee64 100644
--- a/stdlib/test/test/lux/data/number.lux
+++ b/stdlib/test/test/lux/data/number.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad]
@@ -20,10 +20,10 @@
(:: <Order> < y x)
(:: <Order> > y x)))))))]
- ["Nat" r;nat Eq<Nat> Order<Nat>]
- ["Int" r;int Eq<Int> Order<Int>]
- ["Frac" r;frac Eq<Frac> Order<Frac>]
- ["Deg" r;deg Eq<Deg> Order<Deg>]
+ ["Nat" r.nat Eq<Nat> Order<Nat>]
+ ["Int" r.int Eq<Int> Order<Int>]
+ ["Frac" r.frac Eq<Frac> Order<Frac>]
+ ["Deg" r.deg Eq<Deg> Order<Deg>]
)
(do-template [category rand-gen <Number> <Order>]
@@ -43,10 +43,10 @@
(= x (* (signum x)
(abs x)))))))))]
- ## ["Nat" r;nat Number<Nat>]
- ["Int" r;int Number<Int> Order<Int>]
- ["Frac" r;frac Number<Frac> Order<Frac>]
- ["Deg" r;deg Number<Deg> Order<Deg>]
+ ## ["Nat" r.nat Number<Nat>]
+ ["Int" r.int Number<Int> Order<Int>]
+ ["Frac" r.frac Number<Frac> Order<Frac>]
+ ["Deg" r.deg Number<Deg> Order<Deg>]
)
(do-template [category rand-gen <Enum> <Number> <Order>]
@@ -67,32 +67,32 @@
(|> x (:: <Enum> succ) (:: <Enum> pred)))
))))))]
- ["Nat" r;nat Enum<Nat> Number<Nat> Order<Nat>]
- ["Int" r;int Enum<Int> Number<Int> Order<Int>]
+ ["Nat" r.nat Enum<Nat> Number<Nat> Order<Nat>]
+ ["Int" r.int Enum<Int> Number<Int> Order<Int>]
)
(do-template [category rand-gen <Number> <Order> <Interval> <test>]
[(context: (format "[" category "] " "Interval")
(<| (times +100)
(do @
- [x (|> rand-gen (r;filter <test>))
+ [x (|> rand-gen (r.filter <test>))
#let [(^open) <Number>
(^open) <Order>]]
(test "" (and (<= x (:: <Interval> bottom))
(>= x (:: <Interval> top)))))))]
- ["Nat" r;nat Number<Nat> Order<Nat> Interval<Nat> (function [_] true)]
- ["Int" r;int Number<Int> Order<Int> Interval<Int> (function [_] true)]
+ ["Nat" r.nat Number<Nat> Order<Nat> Interval<Nat> (function [_] true)]
+ ["Int" r.int Number<Int> Order<Int> Interval<Int> (function [_] true)]
## Both min and max values will be positive (thus, greater than zero)
- ["Frac" r;frac Number<Frac> Order<Frac> Interval<Frac> (f/> 0.0)]
- ["Deg" r;deg Number<Deg> Order<Deg> Interval<Deg> (function [_] true)]
+ ["Frac" r.frac Number<Frac> Order<Frac> Interval<Frac> (f/> 0.0)]
+ ["Deg" r.deg Number<Deg> Order<Deg> Interval<Deg> (function [_] true)]
)
(do-template [category rand-gen <Number> <Order> <Monoid> <cap> <test>]
[(context: (format "[" category "] " "Monoid")
(<| (times +100)
(do @
- [x (|> rand-gen (:: @ map (|>> (:: <Number> abs) <cap>)) (r;filter <test>))
+ [x (|> rand-gen (:: @ map (|>> (:: <Number> abs) <cap>)) (r.filter <test>))
#let [(^open) <Number>
(^open) <Order>
(^open) <Monoid>]]
@@ -101,22 +101,22 @@
(= x (compose x identity))
(= identity (compose identity identity)))))))]
- ["Nat/Add" r;nat Number<Nat> Order<Nat> Add@Monoid<Nat> (n/% +1000) (function [_] true)]
- ["Nat/Mul" r;nat Number<Nat> Order<Nat> Mul@Monoid<Nat> (n/% +1000) (function [_] true)]
- ["Nat/Min" r;nat Number<Nat> Order<Nat> Min@Monoid<Nat> (n/% +1000) (function [_] true)]
- ["Nat/Max" r;nat Number<Nat> Order<Nat> Max@Monoid<Nat> (n/% +1000) (function [_] true)]
- ["Int/Add" r;int Number<Int> Order<Int> Add@Monoid<Int> (i/% 1000) (function [_] true)]
- ["Int/Mul" r;int Number<Int> Order<Int> Mul@Monoid<Int> (i/% 1000) (function [_] true)]
- ["Int/Min" r;int Number<Int> Order<Int> Min@Monoid<Int> (i/% 1000) (function [_] true)]
- ["Int/Max" r;int Number<Int> Order<Int> Max@Monoid<Int> (i/% 1000) (function [_] true)]
- ["Frac/Add" r;frac Number<Frac> Order<Frac> Add@Monoid<Frac> (f/% 1000.0) (f/> 0.0)]
- ["Frac/Mul" r;frac Number<Frac> Order<Frac> Mul@Monoid<Frac> (f/% 1000.0) (f/> 0.0)]
- ["Frac/Min" r;frac Number<Frac> Order<Frac> Min@Monoid<Frac> (f/% 1000.0) (f/> 0.0)]
- ["Frac/Max" r;frac Number<Frac> Order<Frac> Max@Monoid<Frac> (f/% 1000.0) (f/> 0.0)]
- ["Deg/Add" r;deg Number<Deg> Order<Deg> Add@Monoid<Deg> (d/% .125) (function [_] true)]
- ## ["Deg/Mul" r;deg Number<Deg> Order<Deg> Mul@Monoid<Deg> (d/% .125) (function [_] true)]
- ["Deg/Min" r;deg Number<Deg> Order<Deg> Min@Monoid<Deg> (d/% .125) (function [_] true)]
- ["Deg/Max" r;deg Number<Deg> Order<Deg> Max@Monoid<Deg> (d/% .125) (function [_] true)]
+ ["Nat/Add" r.nat Number<Nat> Order<Nat> Add@Monoid<Nat> (n/% +1000) (function [_] true)]
+ ["Nat/Mul" r.nat Number<Nat> Order<Nat> Mul@Monoid<Nat> (n/% +1000) (function [_] true)]
+ ["Nat/Min" r.nat Number<Nat> Order<Nat> Min@Monoid<Nat> (n/% +1000) (function [_] true)]
+ ["Nat/Max" r.nat Number<Nat> Order<Nat> Max@Monoid<Nat> (n/% +1000) (function [_] true)]
+ ["Int/Add" r.int Number<Int> Order<Int> Add@Monoid<Int> (i/% 1000) (function [_] true)]
+ ["Int/Mul" r.int Number<Int> Order<Int> Mul@Monoid<Int> (i/% 1000) (function [_] true)]
+ ["Int/Min" r.int Number<Int> Order<Int> Min@Monoid<Int> (i/% 1000) (function [_] true)]
+ ["Int/Max" r.int Number<Int> Order<Int> Max@Monoid<Int> (i/% 1000) (function [_] true)]
+ ["Frac/Add" r.frac Number<Frac> Order<Frac> Add@Monoid<Frac> (f/% 1000.0) (f/> 0.0)]
+ ["Frac/Mul" r.frac Number<Frac> Order<Frac> Mul@Monoid<Frac> (f/% 1000.0) (f/> 0.0)]
+ ["Frac/Min" r.frac Number<Frac> Order<Frac> Min@Monoid<Frac> (f/% 1000.0) (f/> 0.0)]
+ ["Frac/Max" r.frac Number<Frac> Order<Frac> Max@Monoid<Frac> (f/% 1000.0) (f/> 0.0)]
+ ["Deg/Add" r.deg Number<Deg> Order<Deg> Add@Monoid<Deg> (d/% .125) (function [_] true)]
+ ## ["Deg/Mul" r.deg Number<Deg> Order<Deg> Mul@Monoid<Deg> (d/% .125) (function [_] true)]
+ ["Deg/Min" r.deg Number<Deg> Order<Deg> Min@Monoid<Deg> (d/% .125) (function [_] true)]
+ ["Deg/Max" r.deg Number<Deg> Order<Deg> Max@Monoid<Deg> (d/% .125) (function [_] true)]
)
(do-template [<category> <rand-gen> <Eq> <Codec>]
@@ -128,38 +128,38 @@
(|> x
(:: <Codec> encode)
(:: <Codec> decode)
- (case> (#;Right x')
+ (case> (#.Right x')
(:: <Eq> = x x')
- (#;Left _)
+ (#.Left _)
false))))))]
- ["Nat/Binary" r;nat Eq<Nat> Binary@Codec<Text,Nat>]
- ["Nat/Octal" r;nat Eq<Nat> Octal@Codec<Text,Nat>]
- ["Nat/Decimal" r;nat Eq<Nat> Codec<Text,Nat>]
- ["Nat/Hex" r;nat Eq<Nat> Hex@Codec<Text,Nat>]
-
- ["Int/Binary" r;int Eq<Int> Binary@Codec<Text,Int>]
- ["Int/Octal" r;int Eq<Int> Octal@Codec<Text,Int>]
- ["Int/Decimal" r;int Eq<Int> Codec<Text,Int>]
- ["Int/Hex" r;int Eq<Int> Hex@Codec<Text,Int>]
-
- ["Deg/Binary" r;deg Eq<Deg> Binary@Codec<Text,Deg>]
- ["Deg/Octal" r;deg Eq<Deg> Octal@Codec<Text,Deg>]
- ["Deg/Decimal" r;deg Eq<Deg> Codec<Text,Deg>]
- ["Deg/Hex" r;deg Eq<Deg> Hex@Codec<Text,Deg>]
-
- ["Frac/Binary" r;frac Eq<Frac> Binary@Codec<Text,Frac>]
- ["Frac/Octal" r;frac Eq<Frac> Octal@Codec<Text,Frac>]
- ["Frac/Decimal" r;frac Eq<Frac> Codec<Text,Frac>]
- ["Frac/Hex" r;frac Eq<Frac> Hex@Codec<Text,Frac>]
+ ["Nat/Binary" r.nat Eq<Nat> Binary@Codec<Text,Nat>]
+ ["Nat/Octal" r.nat Eq<Nat> Octal@Codec<Text,Nat>]
+ ["Nat/Decimal" r.nat Eq<Nat> Codec<Text,Nat>]
+ ["Nat/Hex" r.nat Eq<Nat> Hex@Codec<Text,Nat>]
+
+ ["Int/Binary" r.int Eq<Int> Binary@Codec<Text,Int>]
+ ["Int/Octal" r.int Eq<Int> Octal@Codec<Text,Int>]
+ ["Int/Decimal" r.int Eq<Int> Codec<Text,Int>]
+ ["Int/Hex" r.int Eq<Int> Hex@Codec<Text,Int>]
+
+ ["Deg/Binary" r.deg Eq<Deg> Binary@Codec<Text,Deg>]
+ ["Deg/Octal" r.deg Eq<Deg> Octal@Codec<Text,Deg>]
+ ["Deg/Decimal" r.deg Eq<Deg> Codec<Text,Deg>]
+ ["Deg/Hex" r.deg Eq<Deg> Hex@Codec<Text,Deg>]
+
+ ["Frac/Binary" r.frac Eq<Frac> Binary@Codec<Text,Frac>]
+ ["Frac/Octal" r.frac Eq<Frac> Octal@Codec<Text,Frac>]
+ ["Frac/Decimal" r.frac Eq<Frac> Codec<Text,Frac>]
+ ["Frac/Hex" r.frac Eq<Frac> Hex@Codec<Text,Frac>]
)
(context: "Can convert frac values to/from their bit patterns."
(<| (times +100)
(do @
- [raw r;frac
- factor (|> r;nat (:: @ map (|>> (n/% +1000) (n/max +1))))
+ [raw r.frac
+ factor (|> r.nat (:: @ map (|>> (n/% +1000) (n/max +1))))
#let [sample (|> factor nat-to-int int-to-frac (f/* raw))]]
(test "Can convert frac values to/from their bit patterns."
(|> sample frac-to-bits bits-to-frac (f/= sample))))))
diff --git a/stdlib/test/test/lux/data/number/complex.lux b/stdlib/test/test/lux/data/number/complex.lux
index e642256b9..3bc0d6e6d 100644
--- a/stdlib/test/test/lux/data/number/complex.lux
+++ b/stdlib/test/test/lux/data/number/complex.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -14,28 +14,28 @@
(def: margin-of-error Frac 1.0e-10)
(def: (within? margin standard value)
- (-> Frac &;Complex &;Complex Bool)
- (let [real-dist (frac/abs (f/- (get@ #&;real standard)
- (get@ #&;real value)))
- imgn-dist (frac/abs (f/- (get@ #&;imaginary standard)
- (get@ #&;imaginary value)))]
+ (-> Frac &.Complex &.Complex Bool)
+ (let [real-dist (frac/abs (f/- (get@ #&.real standard)
+ (get@ #&.real value)))
+ imgn-dist (frac/abs (f/- (get@ #&.imaginary standard)
+ (get@ #&.imaginary value)))]
(and (f/< margin real-dist)
(f/< margin imgn-dist))))
(def: gen-dim
- (r;Random Frac)
- (do r;Monad<Random>
- [factor (|> r;nat (:: @ map (|>> (n/% +1000) (n/max +1))))
- measure (|> r;frac (r;filter (f/> 0.0)))]
+ (r.Random Frac)
+ (do r.Monad<Random>
+ [factor (|> r.nat (:: @ map (|>> (n/% +1000) (n/max +1))))
+ measure (|> r.frac (r.filter (f/> 0.0)))]
(wrap (f/* (|> factor nat-to-int int-to-frac)
measure))))
(def: gen-complex
- (r;Random &;Complex)
- (do r;Monad<Random>
+ (r.Random &.Complex)
+ (do r.Monad<Random>
[real gen-dim
imaginary gen-dim]
- (wrap (&;complex real imaginary))))
+ (wrap (&.complex real imaginary))))
(context: "Construction"
(<| (times +100)
@@ -44,13 +44,13 @@
imaginary gen-dim]
($_ seq
(test "Can build and tear apart complex numbers"
- (let [r+i (&;complex real imaginary)]
- (and (f/= real (get@ #&;real r+i))
- (f/= imaginary (get@ #&;imaginary r+i)))))
+ (let [r+i (&.complex real imaginary)]
+ (and (f/= real (get@ #&.real r+i))
+ (f/= imaginary (get@ #&.imaginary r+i)))))
(test "If either the real part or the imaginary part is NaN, the composite is NaN."
- (and (&;not-a-number? (&;complex number;not-a-number imaginary))
- (&;not-a-number? (&;complex real number;not-a-number))))
+ (and (&.not-a-number? (&.complex number.not-a-number imaginary))
+ (&.not-a-number? (&.complex real number.not-a-number))))
))))
(context: "Absolute value"
@@ -60,20 +60,20 @@
imaginary gen-dim]
($_ seq
(test "Absolute value of complex >= absolute value of any of the parts."
- (let [r+i (&;complex real imaginary)
- abs (get@ #&;real (&;c/abs r+i))]
+ (let [r+i (&.complex real imaginary)
+ abs (get@ #&.real (&.c/abs r+i))]
(and (f/>= (frac/abs real) abs)
(f/>= (frac/abs imaginary) abs))))
(test "The absolute value of a complex number involving a NaN on either dimension, results in a NaN value."
- (and (number;not-a-number? (get@ #&;real (&;c/abs (&;complex number;not-a-number imaginary))))
- (number;not-a-number? (get@ #&;real (&;c/abs (&;complex real number;not-a-number))))))
+ (and (number.not-a-number? (get@ #&.real (&.c/abs (&.complex number.not-a-number imaginary))))
+ (number.not-a-number? (get@ #&.real (&.c/abs (&.complex real number.not-a-number))))))
(test "The absolute value of a complex number involving an infinity on either dimension, results in an infinite value."
- (and (f/= number;positive-infinity (get@ #&;real (&;c/abs (&;complex number;positive-infinity imaginary))))
- (f/= number;positive-infinity (get@ #&;real (&;c/abs (&;complex real number;positive-infinity))))
- (f/= number;positive-infinity (get@ #&;real (&;c/abs (&;complex number;negative-infinity imaginary))))
- (f/= number;positive-infinity (get@ #&;real (&;c/abs (&;complex real number;negative-infinity))))))
+ (and (f/= number.positive-infinity (get@ #&.real (&.c/abs (&.complex number.positive-infinity imaginary))))
+ (f/= number.positive-infinity (get@ #&.real (&.c/abs (&.complex real number.positive-infinity))))
+ (f/= number.positive-infinity (get@ #&.real (&.c/abs (&.complex number.negative-infinity imaginary))))
+ (f/= number.positive-infinity (get@ #&.real (&.c/abs (&.complex real number.negative-infinity))))))
))))
(context: "Addidion, substraction, multiplication and division"
@@ -84,40 +84,40 @@
factor gen-dim]
($_ seq
(test "Adding 2 complex numbers is the same as adding their parts."
- (let [z (&;c/+ y x)]
- (and (&;c/= z
- (&;complex (f/+ (get@ #&;real y)
- (get@ #&;real x))
- (f/+ (get@ #&;imaginary y)
- (get@ #&;imaginary x)))))))
+ (let [z (&.c/+ y x)]
+ (and (&.c/= z
+ (&.complex (f/+ (get@ #&.real y)
+ (get@ #&.real x))
+ (f/+ (get@ #&.imaginary y)
+ (get@ #&.imaginary x)))))))
(test "Subtracting 2 complex numbers is the same as adding their parts."
- (let [z (&;c/- y x)]
- (and (&;c/= z
- (&;complex (f/- (get@ #&;real y)
- (get@ #&;real x))
- (f/- (get@ #&;imaginary y)
- (get@ #&;imaginary x)))))))
+ (let [z (&.c/- y x)]
+ (and (&.c/= z
+ (&.complex (f/- (get@ #&.real y)
+ (get@ #&.real x))
+ (f/- (get@ #&.imaginary y)
+ (get@ #&.imaginary x)))))))
(test "Subtraction is the inverse of addition."
- (and (|> x (&;c/+ y) (&;c/- y) (within? margin-of-error x))
- (|> x (&;c/- y) (&;c/+ y) (within? margin-of-error x))))
+ (and (|> x (&.c/+ y) (&.c/- y) (within? margin-of-error x))
+ (|> x (&.c/- y) (&.c/+ y) (within? margin-of-error x))))
(test "Division is the inverse of multiplication."
- (|> x (&;c/* y) (&;c// y) (within? margin-of-error x)))
+ (|> x (&.c/* y) (&.c// y) (within? margin-of-error x)))
(test "Scalar division is the inverse of scalar multiplication."
- (|> x (&;c/*' factor) (&;c//' factor) (within? margin-of-error x)))
+ (|> x (&.c/*' factor) (&.c//' factor) (within? margin-of-error x)))
(test "If you subtract the remainder, all divisions must be exact."
- (let [rem (&;c/% y x)
- quotient (|> x (&;c/- rem) (&;c// y))
+ (let [rem (&.c/% y x)
+ quotient (|> x (&.c/- rem) (&.c// y))
floored (|> quotient
- (update@ #&;real math;floor)
- (update@ #&;imaginary math;floor))]
+ (update@ #&.real math.floor)
+ (update@ #&.imaginary math.floor))]
(within? 0.000000000001
x
- (|> quotient (&;c/* y) (&;c/+ rem)))))
+ (|> quotient (&.c/* y) (&.c/+ rem)))))
))))
(context: "Conjugate, reciprocal, signum, negation"
@@ -126,33 +126,33 @@
[x gen-complex]
($_ seq
(test "Conjugate has same real part as original, and opposite of imaginary part."
- (let [cx (&;conjugate x)]
- (and (f/= (get@ #&;real x)
- (get@ #&;real cx))
- (f/= (frac/negate (get@ #&;imaginary x))
- (get@ #&;imaginary cx)))))
+ (let [cx (&.conjugate x)]
+ (and (f/= (get@ #&.real x)
+ (get@ #&.real cx))
+ (f/= (frac/negate (get@ #&.imaginary x))
+ (get@ #&.imaginary cx)))))
(test "The reciprocal functions is its own inverse."
- (|> x &;reciprocal &;reciprocal (within? margin-of-error x)))
+ (|> x &.reciprocal &.reciprocal (within? margin-of-error x)))
(test "x*(x^-1) = 1"
- (|> x (&;c/* (&;reciprocal x)) (within? margin-of-error &;one)))
+ (|> x (&.c/* (&.reciprocal x)) (within? margin-of-error &.one)))
(test "Absolute value of signum is always root2(2), 1 or 0."
- (let [signum-abs (|> x &;c/signum &;c/abs (get@ #&;real))]
+ (let [signum-abs (|> x &.c/signum &.c/abs (get@ #&.real))]
(or (f/= 0.0 signum-abs)
(f/= 1.0 signum-abs)
- (f/= (math;root2 2.0) signum-abs))))
+ (f/= (math.root2 2.0) signum-abs))))
(test "Negation is its own inverse."
- (let [there (&;c/negate x)
- back-again (&;c/negate there)]
- (and (not (&;c/= there x))
- (&;c/= back-again x))))
+ (let [there (&.c/negate x)
+ back-again (&.c/negate there)]
+ (and (not (&.c/= there x))
+ (&.c/= back-again x))))
(test "Negation doesn't change the absolute value."
- (f/= (get@ #&;real (&;c/abs x))
- (get@ #&;real (&;c/abs (&;c/negate x)))))
+ (f/= (get@ #&.real (&.c/abs x))
+ (get@ #&.real (&.c/abs (&.c/negate x)))))
))))
(context: "Trigonometry"
@@ -161,13 +161,13 @@
[x gen-complex]
($_ seq
(test "Arc-sine is the inverse of sine."
- (|> x &;sin &;asin (within? margin-of-error x)))
+ (|> x &.sin &.asin (within? margin-of-error x)))
(test "Arc-cosine is the inverse of cosine."
- (|> x &;cos &;acos (within? margin-of-error x)))
+ (|> x &.cos &.acos (within? margin-of-error x)))
(test "Arc-tangent is the inverse of tangent."
- (|> x &;tan &;atan (within? margin-of-error x)))))))
+ (|> x &.tan &.atan (within? margin-of-error x)))))))
(context: "Power 2 and exponential/logarithm"
(<| (times +100)
@@ -175,19 +175,19 @@
[x gen-complex]
($_ seq
(test "Square root is inverse of power 2.0"
- (|> x (&;pow' 2.0) &;root2 (within? margin-of-error x)))
+ (|> x (&.pow' 2.0) &.root2 (within? margin-of-error x)))
(test "Logarithm is inverse of exponentiation."
- (|> x &;log &;exp (within? margin-of-error x)))
+ (|> x &.log &.exp (within? margin-of-error x)))
))))
(context: "Complex roots"
(<| (times +100)
(do @
[sample gen-complex
- degree (|> r;nat (:: @ map (|>> (n/max +1) (n/% +5))))]
+ degree (|> r.nat (:: @ map (|>> (n/max +1) (n/% +5))))]
(test "Can calculate the N roots for any complex number."
(|> sample
- (&;nth-roots degree)
- (list/map (&;pow' (|> degree nat-to-int int-to-frac)))
- (list;every? (within? margin-of-error sample)))))))
+ (&.nth-roots degree)
+ (list/map (&.pow' (|> degree nat-to-int int-to-frac)))
+ (list.every? (within? margin-of-error sample)))))))
diff --git a/stdlib/test/test/lux/data/number/ratio.lux b/stdlib/test/test/lux/data/number/ratio.lux
index c6fb2ac68..93081cd14 100644
--- a/stdlib/test/test/lux/data/number/ratio.lux
+++ b/stdlib/test/test/lux/data/number/ratio.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -8,17 +8,17 @@
lux/test)
(def: gen-part
- (r;Random Nat)
- (|> r;nat (:: r;Monad<Random> map (|>> (n/% +1000) (n/max +1)))))
+ (r.Random Nat)
+ (|> r.nat (:: r.Monad<Random> map (|>> (n/% +1000) (n/max +1)))))
(def: gen-ratio
- (r;Random &;Ratio)
- (do r;Monad<Random>
+ (r.Random &.Ratio)
+ (do r.Monad<Random>
[numerator gen-part
denominator (|> gen-part
- (r;filter (|>> (n/= +0) not))
- (r;filter (|>> (n/= numerator) not)))]
- (wrap (&;ratio numerator denominator))))
+ (r.filter (|>> (n/= +0) not))
+ (r.filter (|>> (n/= numerator) not)))]
+ (wrap (&.ratio numerator denominator))))
(context: "Normalization"
(<| (times +100)
@@ -28,11 +28,11 @@
sample gen-ratio]
($_ seq
(test "All zeroes are the same."
- (&;r/= (&;ratio +0 denom1)
- (&;ratio +0 denom2)))
+ (&.r/= (&.ratio +0 denom1)
+ (&.ratio +0 denom2)))
(test "All ratios are built normalized."
- (|> sample &;normalize (&;r/= sample)))
+ (|> sample &.normalize (&.r/= sample)))
))))
(context: "Arithmetic"
@@ -40,29 +40,29 @@
(do @
[x gen-ratio
y gen-ratio
- #let [min (&;r/min x y)
- max (&;r/max x y)]]
+ #let [min (&.r/min x y)
+ max (&.r/max x y)]]
($_ seq
(test "Addition and subtraction are opposites."
- (and (|> max (&;r/- min) (&;r/+ min) (&;r/= max))
- (|> max (&;r/+ min) (&;r/- min) (&;r/= max))))
+ (and (|> max (&.r/- min) (&.r/+ min) (&.r/= max))
+ (|> max (&.r/+ min) (&.r/- min) (&.r/= max))))
(test "Multiplication and division are opposites."
- (and (|> max (&;r// min) (&;r/* min) (&;r/= max))
- (|> max (&;r/* min) (&;r// min) (&;r/= max))))
+ (and (|> max (&.r// min) (&.r/* min) (&.r/= max))
+ (|> max (&.r/* min) (&.r// min) (&.r/= max))))
(test "Modulus by a larger ratio doesn't change the value."
- (|> min (&;r/% max) (&;r/= min)))
+ (|> min (&.r/% max) (&.r/= min)))
(test "Modulus by a smaller ratio results in a value smaller than the limit."
- (|> max (&;r/% min) (&;r/< min)))
+ (|> max (&.r/% min) (&.r/< min)))
(test "Can get the remainder of a division."
- (let [remainder (&;r/% min max)
- multiple (&;r/- remainder max)
- factor (&;r// min multiple)]
- (and (|> factor (get@ #&;denominator) (n/= +1))
- (|> factor (&;r/* min) (&;r/+ remainder) (&;r/= max)))))
+ (let [remainder (&.r/% min max)
+ multiple (&.r/- remainder max)
+ factor (&.r// min multiple)]
+ (and (|> factor (get@ #&.denominator) (n/= +1))
+ (|> factor (&.r/* min) (&.r/+ remainder) (&.r/= max)))))
))))
(context: "Negation, absolute value and signum"
@@ -73,14 +73,14 @@
(test "Negation is it's own inverse."
(let [there (&/negate sample)
back-again (&/negate there)]
- (and (not (&;r/= there sample))
- (&;r/= back-again sample))))
+ (and (not (&.r/= there sample))
+ (&.r/= back-again sample))))
(test "All ratios are already at their absolute value."
- (|> sample &/abs (&;r/= sample)))
+ (|> sample &/abs (&.r/= sample)))
(test "Signum is the identity."
- (|> sample (&;r/* (&/signum sample)) (&;r/= sample)))
+ (|> sample (&.r/* (&/signum sample)) (&.r/= sample)))
))))
(context: "Order"
@@ -90,21 +90,21 @@
y gen-ratio]
($_ seq
(test "Can compare ratios."
- (and (or (&;r/<= y x)
- (&;r/> y x))
- (or (&;r/>= y x)
- (&;r/< y x))))
+ (and (or (&.r/<= y x)
+ (&.r/> y x))
+ (or (&.r/>= y x)
+ (&.r/< y x))))
))))
(context: "Codec"
(<| (times +100)
(do @
[sample gen-ratio
- #let [(^open "&/") &;Codec<Text,Ratio>]]
+ #let [(^open "&/") &.Codec<Text,Ratio>]]
(test "Can encode/decode ratios."
(|> sample &/encode &/decode
- (case> (#;Right output)
- (&;r/= sample output)
+ (case> (#.Right output)
+ (&.r/= sample output)
_
false))))))
diff --git a/stdlib/test/test/lux/data/product.lux b/stdlib/test/test/lux/data/product.lux
index 11f394af6..0bf0cdedd 100644
--- a/stdlib/test/test/lux/data/product.lux
+++ b/stdlib/test/test/lux/data/product.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad])
diff --git a/stdlib/test/test/lux/data/sum.lux b/stdlib/test/test/lux/data/sum.lux
index b5e4db76e..367c010de 100644
--- a/stdlib/test/test/lux/data/sum.lux
+++ b/stdlib/test/test/lux/data/sum.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad]
@@ -10,7 +10,7 @@
lux/test)
(context: "Sum operations"
- (let [(^open "List/") (list;Eq<List> text;Eq<Text>)]
+ (let [(^open "List/") (list.Eq<List> text.Eq<Text>)]
($_ seq
(test "Can inject values into Either."
(and (|> (left "Hello") (case> (+0 "Hello") true _ false))
diff --git a/stdlib/test/test/lux/data/text.lux b/stdlib/test/test/lux/data/text.lux
index ea6c1185b..42685e03f 100644
--- a/stdlib/test/test/lux/data/text.lux
+++ b/stdlib/test/test/lux/data/text.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -13,40 +13,40 @@
(context: "Size"
(<| (times +100)
(do @
- [size (:: @ map (n/% +100) r;nat)
- sample (r;text size)]
+ [size (:: @ map (n/% +100) r.nat)
+ sample (r.text size)]
(test "" (or (and (n/= +0 size)
- (&;empty? sample))
- (n/= size (&;size sample)))))))
+ (&.empty? sample))
+ (n/= size (&.size sample)))))))
(def: bounded-size
- (r;Random Nat)
- (|> r;nat
- (:: r;Monad<Random> map (|>> (n/% +20) (n/+ +1)))))
+ (r.Random Nat)
+ (|> r.nat
+ (:: r.Monad<Random> map (|>> (n/% +20) (n/+ +1)))))
(context: "Locations"
(<| (times +100)
(do @
[size bounded-size
- idx (:: @ map (n/% size) r;nat)
- sample (r;text size)]
+ idx (:: @ map (n/% size) r.nat)
+ sample (r.text size)]
(test "" (|> sample
- (&;nth idx)
- (case> (^multi (#;Some char)
- [(&;from-code char) char]
- [[(&;index-of char sample)
- (&;last-index-of char sample)
- (&;index-of' char idx sample)
- (&;last-index-of' char idx sample)]
- [(#;Some io) (#;Some lio)
- (#;Some io') (#;Some lio')]])
+ (&.nth idx)
+ (case> (^multi (#.Some char)
+ [(&.from-code char) char]
+ [[(&.index-of char sample)
+ (&.last-index-of char sample)
+ (&.index-of' char idx sample)
+ (&.last-index-of' char idx sample)]
+ [(#.Some io) (#.Some lio)
+ (#.Some io') (#.Some lio')]])
(and (n/<= idx io)
(n/>= idx lio)
(n/= idx io')
(n/>= idx lio')
- (&;contains? char sample))
+ (&.contains? char sample))
_
false
@@ -58,34 +58,34 @@
(do @
[sizeL bounded-size
sizeR bounded-size
- sampleL (r;text sizeL)
- sampleR (r;text sizeR)
- #let [sample (&;concat (list sampleL sampleR))
- fake-sample (&;join-with " " (list sampleL sampleR))
- dup-sample (&;join-with "" (list sampleL sampleR))
- enclosed-sample (&;enclose [sampleR sampleR] sampleL)
- (^open) &;Eq<Text>]]
+ sampleL (r.text sizeL)
+ sampleR (r.text sizeR)
+ #let [sample (&.concat (list sampleL sampleR))
+ fake-sample (&.join-with " " (list sampleL sampleR))
+ dup-sample (&.join-with "" (list sampleL sampleR))
+ enclosed-sample (&.enclose [sampleR sampleR] sampleL)
+ (^open) &.Eq<Text>]]
(test "" (and (not (= sample fake-sample))
(= sample dup-sample)
- (&;starts-with? sampleL sample)
- (&;ends-with? sampleR sample)
+ (&.starts-with? sampleL sample)
+ (&.ends-with? sampleR sample)
(= enclosed-sample
- (&;enclose' sampleR sampleL))
+ (&.enclose' sampleR sampleL))
- (|> (&;split sizeL sample)
- (case> (#;Right [_l _r])
+ (|> (&.split sizeL sample)
+ (case> (#.Right [_l _r])
(and (= sampleL _l)
(= sampleR _r)
- (= sample (&;concat (list _l _r))))
+ (= sample (&.concat (list _l _r))))
_
false))
- (|> [(&;clip +0 sizeL sample)
- (&;clip sizeL (&;size sample) sample)
- (&;clip' sizeL sample)
- (&;clip' +0 sample)]
- (case> [(#;Right _l) (#;Right _r) (#;Right _r') (#;Right _f)]
+ (|> [(&.clip +0 sizeL sample)
+ (&.clip sizeL (&.size sample) sample)
+ (&.clip' sizeL sample)
+ (&.clip' +0 sample)]
+ (case> [(#.Right _l) (#.Right _r) (#.Right _r') (#.Right _f)]
(and (= sampleL _l)
(= sampleR _r)
(= _r _r')
@@ -104,35 +104,35 @@
#let [## The wider unicode charset includes control characters that
## can make text replacement work improperly.
## Because of that, I restrict the charset.
- normal-char-gen (|> r;nat (:: @ map (|>> (n/% +128) (n/max +1))))]
- sep1 (r;text' normal-char-gen +1)
- sep2 (r;text' normal-char-gen +1)
- #let [part-gen (|> (r;text' normal-char-gen sizeP)
- (r;filter (|>> (&;contains? sep1) not)))]
- parts (r;list sizeL part-gen)
- #let [sample1 (&;concat (list;interpose sep1 parts))
- sample2 (&;concat (list;interpose sep2 parts))
- (^open "&/") &;Eq<Text>]]
+ normal-char-gen (|> r.nat (:: @ map (|>> (n/% +128) (n/max +1))))]
+ sep1 (r.text' normal-char-gen +1)
+ sep2 (r.text' normal-char-gen +1)
+ #let [part-gen (|> (r.text' normal-char-gen sizeP)
+ (r.filter (|>> (&.contains? sep1) not)))]
+ parts (r.list sizeL part-gen)
+ #let [sample1 (&.concat (list.interpose sep1 parts))
+ sample2 (&.concat (list.interpose sep2 parts))
+ (^open "&/") &.Eq<Text>]]
($_ seq
(test "Can split text through a separator."
- (n/= (list;size parts)
- (list;size (&;split-all-with sep1 sample1))))
+ (n/= (list.size parts)
+ (list.size (&.split-all-with sep1 sample1))))
(test "Can replace occurrences of a piece of text inside a larger text."
(&/= sample2
- (&;replace-all sep1 sep2 sample1)))
+ (&.replace-all sep1 sep2 sample1)))
))))
(context: "Other text functions"
- (let [(^open "&/") &;Eq<Text>]
+ (let [(^open "&/") &.Eq<Text>]
($_ seq
(test "Can transform texts in certain ways."
- (and (&/= "abc" (&;lower-case "ABC"))
- (&/= "ABC" (&;upper-case "abc"))))
+ (and (&/= "abc" (&.lower-case "ABC"))
+ (&/= "ABC" (&.upper-case "abc"))))
)))
(context: "Structures"
- (let [(^open "&/") &;Order<Text>]
+ (let [(^open "&/") &.Order<Text>]
($_ seq
(test "" (&/< "bcd" "abc"))
(test "" (not (&/< "abc" "abc")))
diff --git a/stdlib/test/test/lux/data/text/format.lux b/stdlib/test/test/lux/data/text/format.lux
index d1f7fc9f0..8232fe82d 100644
--- a/stdlib/test/test/lux/data/text/format.lux
+++ b/stdlib/test/test/lux/data/text/format.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -8,7 +8,7 @@
lux/test)
(context: "Formatters"
- (let [(^open "&/") text;Eq<Text>]
+ (let [(^open "&/") text.Eq<Text>]
($_ seq
(test "Can format common values simply."
(and (&/= "true" (%b true))
diff --git a/stdlib/test/test/lux/data/text/lexer.lux b/stdlib/test/test/lux/data/text/lexer.lux
index 331ca42ea..7cf084158 100644
--- a/stdlib/test/test/lux/data/text/lexer.lux
+++ b/stdlib/test/test/lux/data/text/lexer.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux (control [monad #+ do Monad]
pipe
@@ -14,39 +14,39 @@
## [Utils]
(def: (should-fail input)
- (All [a] (-> (E;Error a) Bool))
+ (All [a] (-> (E.Error a) Bool))
(case input
- (#;Left _) true
+ (#.Left _) true
_ false))
(def: (should-passT test input)
- (-> Text (E;Error Text) Bool)
+ (-> Text (E.Error Text) Bool)
(case input
- (#;Right output)
+ (#.Right output)
(text/= test output)
_
false))
(def: (should-passL test input)
- (-> (List Text) (E;Error (List Text)) Bool)
- (let [(^open "list/") (list;Eq<List> text;Eq<Text>)]
+ (-> (List Text) (E.Error (List Text)) Bool)
+ (let [(^open "list/") (list.Eq<List> text.Eq<Text>)]
(case input
- (#;Right output)
+ (#.Right output)
(list/= test output)
_
false)))
(def: (should-passE test input)
- (-> (Either Text Text) (E;Error (Either Text Text)) Bool)
+ (-> (Either Text Text) (E.Error (Either Text Text)) Bool)
(case input
- (#;Right output)
+ (#.Right output)
(case [test output]
- [(#;Left test) (#;Left output)]
+ [(#.Left test) (#.Left output)]
(text/= test output)
- [(#;Right test) (#;Right output)]
+ [(#.Right test) (#.Right output)]
(text/= test output)
_
@@ -59,144 +59,144 @@
(context: "End"
($_ seq
(test "Can detect the end of the input."
- (|> (&;run ""
- &;end)
- (case> (#;Right _) true _ false)))
+ (|> (&.run ""
+ &.end)
+ (case> (#.Right _) true _ false)))
(test "Won't mistake non-empty text for no more input."
- (|> (&;run "YOLO"
- &;end)
- (case> (#;Left _) true _ false)))
+ (|> (&.run "YOLO"
+ &.end)
+ (case> (#.Left _) true _ false)))
))
(context: "Literals"
(<| (times +100)
(do @
- [size (|> r;nat (:: @ map (|>> (n/% +100) (n/max +10))))
- sample (r;text size)
- non-sample (|> (r;text size)
- (r;filter (|>> (text/= sample) not)))]
+ [size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +10))))
+ sample (r.text size)
+ non-sample (|> (r.text size)
+ (r.filter (|>> (text/= sample) not)))]
($_ seq
(test "Can find literal text fragments."
- (and (|> (&;run sample
- (&;this sample))
- (case> (#;Right []) true _ false))
- (|> (&;run non-sample
- (&;this sample))
- (case> (#;Left _) true _ false))))
+ (and (|> (&.run sample
+ (&.this sample))
+ (case> (#.Right []) true _ false))
+ (|> (&.run non-sample
+ (&.this sample))
+ (case> (#.Left _) true _ false))))
))))
(context: "Custom lexers"
($_ seq
(test "Can lex anything"
- (and (should-passT "A" (&;run "A"
- &;any))
- (should-fail (&;run ""
- &;any))))
+ (and (should-passT "A" (&.run "A"
+ &.any))
+ (should-fail (&.run ""
+ &.any))))
(test "Can lex characters ranges."
- (and (should-passT "Y" (&;run "Y"
- (&;range (char "X") (char "Z"))))
- (should-fail (&;run "M"
- (&;range (char "X") (char "Z"))))))
+ (and (should-passT "Y" (&.run "Y"
+ (&.range (char "X") (char "Z"))))
+ (should-fail (&.run "M"
+ (&.range (char "X") (char "Z"))))))
- (test "Can lex upper-case and &;lower-case letters."
- (and (should-passT "Y" (&;run "Y"
- &;upper))
- (should-fail (&;run "m"
- &;upper))
+ (test "Can lex upper-case and &.lower-case letters."
+ (and (should-passT "Y" (&.run "Y"
+ &.upper))
+ (should-fail (&.run "m"
+ &.upper))
- (should-passT "y" (&;run "y"
- &;lower))
- (should-fail (&;run "M"
- &;lower))))
+ (should-passT "y" (&.run "y"
+ &.lower))
+ (should-fail (&.run "M"
+ &.lower))))
(test "Can lex numbers."
- (and (should-passT "1" (&;run "1"
- &;decimal))
- (should-fail (&;run " "
- &;decimal))
-
- (should-passT "7" (&;run "7"
- &;octal))
- (should-fail (&;run "8"
- &;octal))
-
- (should-passT "1" (&;run "1"
- &;hexadecimal))
- (should-passT "a" (&;run "a"
- &;hexadecimal))
- (should-passT "A" (&;run "A"
- &;hexadecimal))
- (should-fail (&;run " "
- &;hexadecimal))
+ (and (should-passT "1" (&.run "1"
+ &.decimal))
+ (should-fail (&.run " "
+ &.decimal))
+
+ (should-passT "7" (&.run "7"
+ &.octal))
+ (should-fail (&.run "8"
+ &.octal))
+
+ (should-passT "1" (&.run "1"
+ &.hexadecimal))
+ (should-passT "a" (&.run "a"
+ &.hexadecimal))
+ (should-passT "A" (&.run "A"
+ &.hexadecimal))
+ (should-fail (&.run " "
+ &.hexadecimal))
))
(test "Can lex alphabetic characters."
- (and (should-passT "A" (&;run "A"
- &;alpha))
- (should-passT "a" (&;run "a"
- &;alpha))
- (should-fail (&;run "1"
- &;alpha))))
+ (and (should-passT "A" (&.run "A"
+ &.alpha))
+ (should-passT "a" (&.run "a"
+ &.alpha))
+ (should-fail (&.run "1"
+ &.alpha))))
(test "Can lex alphanumeric characters."
- (and (should-passT "A" (&;run "A"
- &;alpha-num))
- (should-passT "a" (&;run "a"
- &;alpha-num))
- (should-passT "1" (&;run "1"
- &;alpha-num))
- (should-fail (&;run " "
- &;alpha-num))))
+ (and (should-passT "A" (&.run "A"
+ &.alpha-num))
+ (should-passT "a" (&.run "a"
+ &.alpha-num))
+ (should-passT "1" (&.run "1"
+ &.alpha-num))
+ (should-fail (&.run " "
+ &.alpha-num))))
(test "Can lex white-space."
- (and (should-passT " " (&;run " "
- &;space))
- (should-fail (&;run "8"
- &;space))))
+ (and (should-passT " " (&.run " "
+ &.space))
+ (should-fail (&.run "8"
+ &.space))))
))
(context: "Combinators"
($_ seq
(test "Can combine lexers sequentially."
- (and (|> (&;run "YO"
- (p;seq &;any &;any))
- (case> (#;Right ["Y" "O"]) true
+ (and (|> (&.run "YO"
+ (p.seq &.any &.any))
+ (case> (#.Right ["Y" "O"]) true
_ false))
- (should-fail (&;run "Y"
- (p;seq &;any &;any)))))
+ (should-fail (&.run "Y"
+ (p.seq &.any &.any)))))
(test "Can create the opposite of a lexer."
- (and (should-passT "a" (&;run "a"
- (&;not (p;alt &;decimal &;upper))))
- (should-fail (&;run "A"
- (&;not (p;alt &;decimal &;upper))))))
+ (and (should-passT "a" (&.run "a"
+ (&.not (p.alt &.decimal &.upper))))
+ (should-fail (&.run "A"
+ (&.not (p.alt &.decimal &.upper))))))
(test "Can select from among a set of characters."
- (and (should-passT "C" (&;run "C"
- (&;one-of "ABC")))
- (should-fail (&;run "D"
- (&;one-of "ABC")))))
+ (and (should-passT "C" (&.run "C"
+ (&.one-of "ABC")))
+ (should-fail (&.run "D"
+ (&.one-of "ABC")))))
(test "Can avoid a set of characters."
- (and (should-passT "D" (&;run "D"
- (&;none-of "ABC")))
- (should-fail (&;run "C"
- (&;none-of "ABC")))))
+ (and (should-passT "D" (&.run "D"
+ (&.none-of "ABC")))
+ (should-fail (&.run "C"
+ (&.none-of "ABC")))))
(test "Can lex using arbitrary predicates."
- (and (should-passT "D" (&;run "D"
- (&;satisfies (function [c] true))))
- (should-fail (&;run "C"
- (&;satisfies (function [c] false))))))
+ (and (should-passT "D" (&.run "D"
+ (&.satisfies (function [c] true))))
+ (should-fail (&.run "C"
+ (&.satisfies (function [c] false))))))
(test "Can apply a lexer multiple times."
- (and (should-passT "0123456789ABCDEF" (&;run "0123456789ABCDEF"
- (&;many &;hexadecimal)))
- (should-fail (&;run "yolo"
- (&;many &;hexadecimal)))
+ (and (should-passT "0123456789ABCDEF" (&.run "0123456789ABCDEF"
+ (&.many &.hexadecimal)))
+ (should-fail (&.run "yolo"
+ (&.many &.hexadecimal)))
- (should-passT "" (&;run ""
- (&;some &;hexadecimal)))))
+ (should-passT "" (&.run ""
+ (&.some &.hexadecimal)))))
))
diff --git a/stdlib/test/test/lux/data/text/regex.lux b/stdlib/test/test/lux/data/text/regex.lux
index 34d752d5a..7323aeb79 100644
--- a/stdlib/test/test/lux/data/text/regex.lux
+++ b/stdlib/test/test/lux/data/text/regex.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -17,31 +17,31 @@
## [Utils]
(def: (should-pass regex input)
- (-> (lexer;Lexer Text) Text Bool)
- (|> (lexer;run input regex)
- (case> (#;Right parsed)
+ (-> (lexer.Lexer Text) Text Bool)
+ (|> (lexer.run input regex)
+ (case> (#.Right parsed)
(T/= parsed input)
_
false)))
(def: (should-passT test regex input)
- (-> Text (lexer;Lexer Text) Text Bool)
- (|> (lexer;run input regex)
- (case> (#;Right parsed)
+ (-> Text (lexer.Lexer Text) Text Bool)
+ (|> (lexer.run input regex)
+ (case> (#.Right parsed)
(T/= test parsed)
_
false)))
(def: (should-fail regex input)
- (All [a] (-> (lexer;Lexer a) Text Bool))
- (|> (lexer;run input regex)
- (case> (#;Left _) true _ false)))
+ (All [a] (-> (lexer.Lexer a) Text Bool))
+ (|> (lexer.run input regex)
+ (case> (#.Left _) true _ false)))
(syntax: (should-check pattern regex input)
- (wrap (list (` (|> (lexer;run (~ input) (~ regex))
- (case> (^ (#;Right (~ pattern)))
+ (wrap (list (` (|> (lexer.run (~ input) (~ regex))
+ (case> (^ (#.Right (~ pattern)))
true
(~' _)
@@ -50,230 +50,230 @@
## [Tests]
(context: "Regular Expressions [Basics]"
(test "Can parse character literals."
- (and (should-pass (&;regex "a") "a")
- (should-fail (&;regex "a") ".")
- (should-pass (&;regex "\\.") ".")
- (should-fail (&;regex "\\.") "a"))))
+ (and (should-pass (&.regex "a") "a")
+ (should-fail (&.regex "a") ".")
+ (should-pass (&.regex "\\.") ".")
+ (should-fail (&.regex "\\.") "a"))))
(context: "Regular Expressions [System character classes]"
($_ seq
(test "Can parse anything."
- (should-pass (&;regex ".") "a"))
+ (should-pass (&.regex ".") "a"))
(test "Can parse digits."
- (and (should-pass (&;regex "\\d") "0")
- (should-fail (&;regex "\\d") "m")))
+ (and (should-pass (&.regex "\\d") "0")
+ (should-fail (&.regex "\\d") "m")))
(test "Can parse non digits."
- (and (should-pass (&;regex "\\D") "m")
- (should-fail (&;regex "\\D") "0")))
+ (and (should-pass (&.regex "\\D") "m")
+ (should-fail (&.regex "\\D") "0")))
(test "Can parse white-space."
- (and (should-pass (&;regex "\\s") " ")
- (should-fail (&;regex "\\s") "m")))
+ (and (should-pass (&.regex "\\s") " ")
+ (should-fail (&.regex "\\s") "m")))
(test "Can parse non white-space."
- (and (should-pass (&;regex "\\S") "m")
- (should-fail (&;regex "\\S") " ")))
+ (and (should-pass (&.regex "\\S") "m")
+ (should-fail (&.regex "\\S") " ")))
(test "Can parse word characters."
- (and (should-pass (&;regex "\\w") "_")
- (should-fail (&;regex "\\w") "^")))
+ (and (should-pass (&.regex "\\w") "_")
+ (should-fail (&.regex "\\w") "^")))
(test "Can parse non word characters."
- (and (should-pass (&;regex "\\W") ".")
- (should-fail (&;regex "\\W") "a")))
+ (and (should-pass (&.regex "\\W") ".")
+ (should-fail (&.regex "\\W") "a")))
))
(context: "Regular Expressions [Special system character classes : Part 1]"
($_ seq
(test "Can parse using special character classes."
- (and (and (should-pass (&;regex "\\p{Lower}") "m")
- (should-fail (&;regex "\\p{Lower}") "M"))
+ (and (and (should-pass (&.regex "\\p{Lower}") "m")
+ (should-fail (&.regex "\\p{Lower}") "M"))
- (and (should-pass (&;regex "\\p{Upper}") "M")
- (should-fail (&;regex "\\p{Upper}") "m"))
+ (and (should-pass (&.regex "\\p{Upper}") "M")
+ (should-fail (&.regex "\\p{Upper}") "m"))
- (and (should-pass (&;regex "\\p{Alpha}") "M")
- (should-fail (&;regex "\\p{Alpha}") "0"))
+ (and (should-pass (&.regex "\\p{Alpha}") "M")
+ (should-fail (&.regex "\\p{Alpha}") "0"))
- (and (should-pass (&;regex "\\p{Digit}") "1")
- (should-fail (&;regex "\\p{Digit}") "n"))
+ (and (should-pass (&.regex "\\p{Digit}") "1")
+ (should-fail (&.regex "\\p{Digit}") "n"))
- (and (should-pass (&;regex "\\p{Alnum}") "1")
- (should-fail (&;regex "\\p{Alnum}") "."))
+ (and (should-pass (&.regex "\\p{Alnum}") "1")
+ (should-fail (&.regex "\\p{Alnum}") "."))
- (and (should-pass (&;regex "\\p{Space}") " ")
- (should-fail (&;regex "\\p{Space}") "."))
+ (and (should-pass (&.regex "\\p{Space}") " ")
+ (should-fail (&.regex "\\p{Space}") "."))
))
))
(context: "Regular Expressions [Special system character classes : Part 2]"
($_ seq
(test "Can parse using special character classes."
- (and (and (should-pass (&;regex "\\p{HexDigit}") "a")
- (should-fail (&;regex "\\p{HexDigit}") "."))
+ (and (and (should-pass (&.regex "\\p{HexDigit}") "a")
+ (should-fail (&.regex "\\p{HexDigit}") "."))
- (and (should-pass (&;regex "\\p{OctDigit}") "6")
- (should-fail (&;regex "\\p{OctDigit}") "."))
+ (and (should-pass (&.regex "\\p{OctDigit}") "6")
+ (should-fail (&.regex "\\p{OctDigit}") "."))
- (and (should-pass (&;regex "\\p{Blank}") "\t")
- (should-fail (&;regex "\\p{Blank}") "."))
+ (and (should-pass (&.regex "\\p{Blank}") "\t")
+ (should-fail (&.regex "\\p{Blank}") "."))
- (and (should-pass (&;regex "\\p{ASCII}") "\t")
- (should-fail (&;regex "\\p{ASCII}") "\u1234"))
+ (and (should-pass (&.regex "\\p{ASCII}") "\t")
+ (should-fail (&.regex "\\p{ASCII}") "\u1234"))
- (and (should-pass (&;regex "\\p{Contrl}") "\u0012")
- (should-fail (&;regex "\\p{Contrl}") "a"))
+ (and (should-pass (&.regex "\\p{Contrl}") "\u0012")
+ (should-fail (&.regex "\\p{Contrl}") "a"))
- (and (should-pass (&;regex "\\p{Punct}") "@")
- (should-fail (&;regex "\\p{Punct}") "a"))
+ (and (should-pass (&.regex "\\p{Punct}") "@")
+ (should-fail (&.regex "\\p{Punct}") "a"))
- (and (should-pass (&;regex "\\p{Graph}") "@")
- (should-fail (&;regex "\\p{Graph}") " "))
+ (and (should-pass (&.regex "\\p{Graph}") "@")
+ (should-fail (&.regex "\\p{Graph}") " "))
- (and (should-pass (&;regex "\\p{Print}") "\u0020")
- (should-fail (&;regex "\\p{Print}") "\u1234"))
+ (and (should-pass (&.regex "\\p{Print}") "\u0020")
+ (should-fail (&.regex "\\p{Print}") "\u1234"))
))
))
(context: "Regular Expressions [Custom character classes : Part 1]"
($_ seq
(test "Can parse using custom character classes."
- (and (should-pass (&;regex "[abc]") "a")
- (should-fail (&;regex "[abc]") "m")))
+ (and (should-pass (&.regex "[abc]") "a")
+ (should-fail (&.regex "[abc]") "m")))
(test "Can parse using character ranges."
- (and (should-pass (&;regex "[a-z]") "a")
- (should-pass (&;regex "[a-z]") "m")
- (should-pass (&;regex "[a-z]") "z")))
+ (and (should-pass (&.regex "[a-z]") "a")
+ (should-pass (&.regex "[a-z]") "m")
+ (should-pass (&.regex "[a-z]") "z")))
(test "Can combine character ranges."
- (and (should-pass (&;regex "[a-zA-Z]") "a")
- (should-pass (&;regex "[a-zA-Z]") "m")
- (should-pass (&;regex "[a-zA-Z]") "z")
- (should-pass (&;regex "[a-zA-Z]") "A")
- (should-pass (&;regex "[a-zA-Z]") "M")
- (should-pass (&;regex "[a-zA-Z]") "Z")))
+ (and (should-pass (&.regex "[a-zA-Z]") "a")
+ (should-pass (&.regex "[a-zA-Z]") "m")
+ (should-pass (&.regex "[a-zA-Z]") "z")
+ (should-pass (&.regex "[a-zA-Z]") "A")
+ (should-pass (&.regex "[a-zA-Z]") "M")
+ (should-pass (&.regex "[a-zA-Z]") "Z")))
))
(context: "Regular Expressions [Custom character classes : Part 2]"
($_ seq
(test "Can negate custom character classes."
- (and (should-fail (&;regex "[^abc]") "a")
- (should-pass (&;regex "[^abc]") "m")))
+ (and (should-fail (&.regex "[^abc]") "a")
+ (should-pass (&.regex "[^abc]") "m")))
(test "Can negate character ranges.."
- (and (should-fail (&;regex "[^a-z]") "a")
- (should-pass (&;regex "[^a-z]") "0")))
+ (and (should-fail (&.regex "[^a-z]") "a")
+ (should-pass (&.regex "[^a-z]") "0")))
(test "Can parse negate combinations of character ranges."
- (and (should-fail (&;regex "[^a-zA-Z]") "a")
- (should-pass (&;regex "[^a-zA-Z]") "0")))
+ (and (should-fail (&.regex "[^a-zA-Z]") "a")
+ (should-pass (&.regex "[^a-zA-Z]") "0")))
))
(context: "Regular Expressions [Custom character classes : Part 3]"
($_ seq
(test "Can make custom character classes more specific."
- (and (let [RE (&;regex "[a-z&&[def]]")]
+ (and (let [RE (&.regex "[a-z&&[def]]")]
(and (should-fail RE "a")
(should-pass RE "d")))
- (let [RE (&;regex "[a-z&&[^bc]]")]
+ (let [RE (&.regex "[a-z&&[^bc]]")]
(and (should-pass RE "a")
(should-fail RE "b")))
- (let [RE (&;regex "[a-z&&[^m-p]]")]
+ (let [RE (&.regex "[a-z&&[^m-p]]")]
(and (should-pass RE "a")
(should-fail RE "m")
(should-fail RE "p")))))
))
(context: "Regular Expressions [Reference]"
- (let [number (&;regex "\\d+")]
+ (let [number (&.regex "\\d+")]
(test "Can build complex regexs by combining simpler ones."
- (should-check ["809-345-6789" "809" "345" "6789"] (&;regex "(\\@<number>)-(\\@<number>)-(\\@<number>)") "809-345-6789"))))
+ (should-check ["809-345-6789" "809" "345" "6789"] (&.regex "(\\@<number>)-(\\@<number>)-(\\@<number>)") "809-345-6789"))))
(context: "Regular Expressions [Fuzzy Quantifiers]"
($_ seq
(test "Can sequentially combine patterns."
- (should-passT "aa" (&;regex "aa") "aa"))
+ (should-passT "aa" (&.regex "aa") "aa"))
(test "Can match patterns optionally."
- (and (should-passT "a" (&;regex "a?") "a")
- (should-passT "" (&;regex "a?") "")))
+ (and (should-passT "a" (&.regex "a?") "a")
+ (should-passT "" (&.regex "a?") "")))
(test "Can match a pattern 0 or more times."
- (and (should-passT "aaa" (&;regex "a*") "aaa")
- (should-passT "" (&;regex "a*") "")))
+ (and (should-passT "aaa" (&.regex "a*") "aaa")
+ (should-passT "" (&.regex "a*") "")))
(test "Can match a pattern 1 or more times."
- (and (should-passT "aaa" (&;regex "a+") "aaa")
- (should-passT "a" (&;regex "a+") "a")
- (should-fail (&;regex "a+") "")))
+ (and (should-passT "aaa" (&.regex "a+") "aaa")
+ (should-passT "a" (&.regex "a+") "a")
+ (should-fail (&.regex "a+") "")))
))
(context: "Regular Expressions [Crisp Quantifiers]"
($_ seq
(test "Can match a pattern N times."
- (and (should-passT "aa" (&;regex "a{2}") "aa")
- (should-passT "a" (&;regex "a{1}") "a")
- (should-fail (&;regex "a{3}") "aa")))
+ (and (should-passT "aa" (&.regex "a{2}") "aa")
+ (should-passT "a" (&.regex "a{1}") "a")
+ (should-fail (&.regex "a{3}") "aa")))
(test "Can match a pattern at-least N times."
- (and (should-passT "aa" (&;regex "a{1,}") "aa")
- (should-passT "aa" (&;regex "a{2,}") "aa")
- (should-fail (&;regex "a{3,}") "aa")))
+ (and (should-passT "aa" (&.regex "a{1,}") "aa")
+ (should-passT "aa" (&.regex "a{2,}") "aa")
+ (should-fail (&.regex "a{3,}") "aa")))
(test "Can match a pattern at-most N times."
- (and (should-passT "aa" (&;regex "a{,2}") "aa")
- (should-passT "aa" (&;regex "a{,3}") "aa")))
+ (and (should-passT "aa" (&.regex "a{,2}") "aa")
+ (should-passT "aa" (&.regex "a{,3}") "aa")))
(test "Can match a pattern between N and M times."
- (and (should-passT "a" (&;regex "a{1,2}") "a")
- (should-passT "aa" (&;regex "a{1,2}") "aa")))
+ (and (should-passT "a" (&.regex "a{1,2}") "a")
+ (should-passT "aa" (&.regex "a{1,2}") "aa")))
))
(context: "Regular Expressions [Groups]"
($_ seq
(test "Can extract groups of sub-matches specified in a pattern."
- (and (should-check ["abc" "b"] (&;regex "a(.)c") "abc")
- (should-check ["abbbbbc" "bbbbb"] (&;regex "a(b+)c") "abbbbbc")
- (should-check ["809-345-6789" "809" "345" "6789"] (&;regex "(\\d{3})-(\\d{3})-(\\d{4})") "809-345-6789")
- (should-check ["809-345-6789" "809" "6789"] (&;regex "(\\d{3})-(?:\\d{3})-(\\d{4})") "809-345-6789")
- (should-check ["809-809-6789" "809" "6789"] (&;regex "(\\d{3})-\\0-(\\d{4})") "809-809-6789")
- (should-check ["809-809-6789" "809" "6789"] (&;regex "(?<code>\\d{3})-\\k<code>-(\\d{4})") "809-809-6789")
- (should-check ["809-809-6789-6789" "809" "6789"] (&;regex "(?<code>\\d{3})-\\k<code>-(\\d{4})-\\0") "809-809-6789-6789")))
+ (and (should-check ["abc" "b"] (&.regex "a(.)c") "abc")
+ (should-check ["abbbbbc" "bbbbb"] (&.regex "a(b+)c") "abbbbbc")
+ (should-check ["809-345-6789" "809" "345" "6789"] (&.regex "(\\d{3})-(\\d{3})-(\\d{4})") "809-345-6789")
+ (should-check ["809-345-6789" "809" "6789"] (&.regex "(\\d{3})-(?:\\d{3})-(\\d{4})") "809-345-6789")
+ (should-check ["809-809-6789" "809" "6789"] (&.regex "(\\d{3})-\\0-(\\d{4})") "809-809-6789")
+ (should-check ["809-809-6789" "809" "6789"] (&.regex "(?<code>\\d{3})-\\k<code>-(\\d{4})") "809-809-6789")
+ (should-check ["809-809-6789-6789" "809" "6789"] (&.regex "(?<code>\\d{3})-\\k<code>-(\\d{4})-\\0") "809-809-6789-6789")))
(test "Can specify groups within groups."
- (should-check ["809-345-6789" "809" ["345-6789" "345" "6789"]] (&;regex "(\\d{3})-((\\d{3})-(\\d{4}))") "809-345-6789"))
+ (should-check ["809-345-6789" "809" ["345-6789" "345" "6789"]] (&.regex "(\\d{3})-((\\d{3})-(\\d{4}))") "809-345-6789"))
))
(context: "Regular Expressions [Alternation]"
($_ seq
(test "Can specify alternative patterns."
- (and (should-check ["a" (+0 [])] (&;regex "a|b") "a")
- (should-check ["b" (+1 [])] (&;regex "a|b") "b")
- (should-fail (&;regex "a|b") "c")))
+ (and (should-check ["a" (+0 [])] (&.regex "a|b") "a")
+ (should-check ["b" (+1 [])] (&.regex "a|b") "b")
+ (should-fail (&.regex "a|b") "c")))
(test "Can have groups within alternations."
- (and (should-check ["abc" (+0 ["b" "c"])] (&;regex "a(.)(.)|b(.)(.)") "abc")
- (should-check ["bcd" (+1 ["c" "d"])] (&;regex "a(.)(.)|b(.)(.)") "bcd")
- (should-fail (&;regex "a(.)(.)|b(.)(.)") "cde")
+ (and (should-check ["abc" (+0 ["b" "c"])] (&.regex "a(.)(.)|b(.)(.)") "abc")
+ (should-check ["bcd" (+1 ["c" "d"])] (&.regex "a(.)(.)|b(.)(.)") "bcd")
+ (should-fail (&.regex "a(.)(.)|b(.)(.)") "cde")
(should-check ["809-345-6789" (+0 ["809" "345-6789" "345" "6789"])]
- (&;regex "(\\d{3})-((\\d{3})-(\\d{4}))|b(.)d")
+ (&.regex "(\\d{3})-((\\d{3})-(\\d{4}))|b(.)d")
"809-345-6789")))
))
(context: "Pattern-matching"
(<| (times +100)
(do @
- [sample1 (r;text +3)
- sample2 (r;text +3)
- sample3 (r;text +4)]
+ [sample1 (r.text +3)
+ sample2 (r.text +3)
+ sample3 (r.text +4)]
(case (format sample1 "-" sample2 "-" sample3)
- (&;^regex "(.{3})-(.{3})-(.{4})"
+ (&.^regex "(.{3})-(.{3})-(.{4})"
[_ match1 match2 match3])
(test "Can pattern-match using regular-expressions."
(and (T/= sample1 match1)
diff --git a/stdlib/test/test/lux/host.jvm.lux b/stdlib/test/test/lux/host.jvm.lux
index 7025bdc2a..4ed187c36 100644
--- a/stdlib/test/test/lux/host.jvm.lux
+++ b/stdlib/test/test/lux/host.jvm.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -11,17 +11,17 @@
["r" math/random])
lux/test)
-(&;import (java/util/concurrent/Callable a))
+(&.import (java/util/concurrent/Callable a))
-(&;import java/lang/Exception
+(&.import java/lang/Exception
(new [String]))
-(&;import java/lang/Object)
+(&.import java/lang/Object)
-(&;import (java/lang/Class a)
+(&.import (java/lang/Class a)
(getName [] String))
-(&;import java/lang/System
+(&.import java/lang/System
(#static out java/io/PrintStream)
(#static currentTimeMillis [] #io long)
(#static getenv [String] #io #? String))
@@ -62,7 +62,7 @@
(context: "Conversions"
(<| (times +100)
(do @
- [sample r;int]
+ [sample r.int]
(with-expansions
[<int-convs> (do-template [<to> <from> <message>]
[(test <message>
@@ -70,12 +70,12 @@
(let [capped-sample (|> sample <to> <from>)]
(|> capped-sample <to> <from> (i/= capped-sample)))))]
- [&;l2b &;b2l "Can succesfully convert to/from byte."]
- [&;l2s &;s2l "Can succesfully convert to/from short."]
- [&;l2i &;i2l "Can succesfully convert to/from int."]
- [&;l2f &;f2l "Can succesfully convert to/from float."]
- [&;l2d &;d2l "Can succesfully convert to/from double."]
- [(<| &;i2c &;l2i) (<| &;i2l &;c2i) "Can succesfully convert to/from char."]
+ [&.l2b &.b2l "Can succesfully convert to/from byte."]
+ [&.l2s &.s2l "Can succesfully convert to/from short."]
+ [&.l2i &.i2l "Can succesfully convert to/from int."]
+ [&.l2f &.f2l "Can succesfully convert to/from float."]
+ [&.l2d &.d2l "Can succesfully convert to/from double."]
+ [(<| &.i2c &.l2i) (<| &.i2l &.c2i) "Can succesfully convert to/from char."]
)]
($_ seq
<int-convs>
@@ -84,41 +84,41 @@
(context: "Miscellaneous"
($_ seq
(test "Can check if an object is of a certain class."
- (and (&;instance? String "")
- (not (&;instance? Long ""))
- (&;instance? Object "")
- (not (&;instance? Object (&;null)))))
+ (and (&.instance? String "")
+ (not (&.instance? Long ""))
+ (&.instance? Object "")
+ (not (&.instance? Object (&.null)))))
(test "Can run code in a \"synchronized\" block."
- (&;synchronized "" true))
+ (&.synchronized "" true))
(test "Can access Class instances."
- (text/= "java.lang.Class" (Class::getName [] (&;class-for java/lang/Class))))
+ (text/= "java.lang.Class" (Class::getName [] (&.class-for java/lang/Class))))
(test "Can check if a value is null."
- (and (&;null? (&;null))
- (not (&;null? ""))))
+ (and (&.null? (&.null))
+ (not (&.null? ""))))
(test "Can safely convert nullable references into Maybe values."
- (and (|> (: (Maybe Object) (&;??? (&;null)))
- (case> #;None true
+ (and (|> (: (Maybe Object) (&.??? (&.null)))
+ (case> #.None true
_ false))
- (|> (: (Maybe Object) (&;??? ""))
- (case> (#;Some _) true
+ (|> (: (Maybe Object) (&.??? ""))
+ (case> (#.Some _) true
_ false))))
))
(context: "Arrays"
(<| (times +100)
(do @
- [size (|> r;nat (:: @ map (|>> (n/% +100) (n/max +1))))
- idx (|> r;nat (:: @ map (n/% size)))
- value r;int]
+ [size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +1))))
+ idx (|> r.nat (:: @ map (n/% size)))
+ value r.int]
($_ seq
(test "Can create arrays of some length."
- (n/= size (&;array-length (&;array Long size))))
+ (n/= size (&.array-length (&.array Long size))))
(test "Can set and get array values."
- (let [arr (&;array Long size)]
- (exec (&;array-write idx value arr)
- (i/= value (&;array-read idx arr)))))))))
+ (let [arr (&.array Long size)]
+ (exec (&.array-write idx value arr)
+ (i/= value (&.array-read idx arr)))))))))
diff --git a/stdlib/test/test/lux/io.lux b/stdlib/test/test/lux/io.lux
index 30eda396f..20b3be116 100644
--- a/stdlib/test/test/lux/io.lux
+++ b/stdlib/test/test/lux/io.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux ["&" io]
(control ["M" monad #+ do Monad])
@@ -9,12 +9,12 @@
(context: "I/O"
($_ seq
- (test "" (Text/= "YOLO" (&;run (&;io "YOLO"))))
- (test "" (i/= 11 (&;run (:: &;Functor<IO> map i/inc (&;io 10)))))
- (test "" (i/= 10 (&;run (:: &;Applicative<IO> wrap 10))))
- (test "" (i/= 30 (&;run (let [(^open "&/") &;Applicative<IO>]
+ (test "" (Text/= "YOLO" (&.run (&.io "YOLO"))))
+ (test "" (i/= 11 (&.run (:: &.Functor<IO> map i/inc (&.io 10)))))
+ (test "" (i/= 10 (&.run (:: &.Applicative<IO> wrap 10))))
+ (test "" (i/= 30 (&.run (let [(^open "&/") &.Applicative<IO>]
(&/apply (&/wrap (i/+ 10)) (&/wrap 20))))))
- (test "" (i/= 30 (&;run (do &;Monad<IO>
+ (test "" (i/= 30 (&.run (do &.Monad<IO>
[f (wrap i/+)
x (wrap 10)
y (wrap 20)]
diff --git a/stdlib/test/test/lux/lang/syntax.lux b/stdlib/test/test/lux/lang/syntax.lux
index cc1338374..eaba58d0f 100644
--- a/stdlib/test/test/lux/lang/syntax.lux
+++ b/stdlib/test/test/lux/lang/syntax.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do])
@@ -16,62 +16,62 @@
(def: default-cursor
Cursor
- {#;module ""
- #;line +0
- #;column +0})
+ {#.module ""
+ #.line +0
+ #.column +0})
(def: ident-part^
- (r;Random Text)
- (do r;Monad<Random>
+ (r.Random Text)
+ (do r.Monad<Random>
[#let [digits "0123456789"
- delimiters "()[]{}#;\""
+ delimiters "()[]{}#.\""
space "\t\v \n\r\f"
invalid-range (format digits delimiters space)
- char-gen (|> r;nat
- (r;filter (function [sample]
- (not (text;contains? (text;from-code sample)
+ char-gen (|> r.nat
+ (r.filter (function [sample]
+ (not (text.contains? (text.from-code sample)
invalid-range)))))]
- size (|> r;nat (:: @ map (|>> (n/% +20) (n/max +1))))]
- (r;text' char-gen size)))
+ size (|> r.nat (:: @ map (|>> (n/% +20) (n/max +1))))]
+ (r.text' char-gen size)))
(def: ident^
- (r;Random Ident)
- (r;seq ident-part^ ident-part^))
+ (r.Random Ident)
+ (r.seq ident-part^ ident-part^))
(def: code^
- (r;Random Code)
- (let [numeric^ (: (r;Random Code)
- ($_ r;either
- (|> r;bool (r/map (|>> #;Bool [default-cursor])))
- (|> r;nat (r/map (|>> #;Nat [default-cursor])))
- (|> r;int (r/map (|>> #;Int [default-cursor])))
- (|> r;deg (r/map (|>> #;Deg [default-cursor])))
- (|> r;frac (r/map (|>> #;Frac [default-cursor])))))
- textual^ (: (r;Random Code)
- ($_ r;either
- (do r;Monad<Random>
- [size (|> r;nat (r/map (n/% +20)))]
- (|> (r;text size) (r/map (|>> #;Text [default-cursor]))))
- (|> ident^ (r/map (|>> #;Symbol [default-cursor])))
- (|> ident^ (r/map (|>> #;Tag [default-cursor])))))
- simple^ (: (r;Random Code)
- ($_ r;either
+ (r.Random Code)
+ (let [numeric^ (: (r.Random Code)
+ ($_ r.either
+ (|> r.bool (r/map (|>> #.Bool [default-cursor])))
+ (|> r.nat (r/map (|>> #.Nat [default-cursor])))
+ (|> r.int (r/map (|>> #.Int [default-cursor])))
+ (|> r.deg (r/map (|>> #.Deg [default-cursor])))
+ (|> r.frac (r/map (|>> #.Frac [default-cursor])))))
+ textual^ (: (r.Random Code)
+ ($_ r.either
+ (do r.Monad<Random>
+ [size (|> r.nat (r/map (n/% +20)))]
+ (|> (r.text size) (r/map (|>> #.Text [default-cursor]))))
+ (|> ident^ (r/map (|>> #.Symbol [default-cursor])))
+ (|> ident^ (r/map (|>> #.Tag [default-cursor])))))
+ simple^ (: (r.Random Code)
+ ($_ r.either
numeric^
textual^))]
- (r;rec
+ (r.rec
(function [code^]
- (let [multi^ (do r;Monad<Random>
- [size (|> r;nat (r/map (n/% +3)))]
- (r;list size code^))
- composite^ (: (r;Random Code)
- ($_ r;either
- (|> multi^ (r/map (|>> #;Form [default-cursor])))
- (|> multi^ (r/map (|>> #;Tuple [default-cursor])))
- (do r;Monad<Random>
- [size (|> r;nat (r/map (n/% +3)))]
- (|> (r;list size (r;seq code^ code^))
- (r/map (|>> #;Record [default-cursor]))))))]
- (r;either simple^
+ (let [multi^ (do r.Monad<Random>
+ [size (|> r.nat (r/map (n/% +3)))]
+ (r.list size code^))
+ composite^ (: (r.Random Code)
+ ($_ r.either
+ (|> multi^ (r/map (|>> #.Form [default-cursor])))
+ (|> multi^ (r/map (|>> #.Tuple [default-cursor])))
+ (do r.Monad<Random>
+ [size (|> r.nat (r/map (n/% +3)))]
+ (|> (r.list size (r.seq code^ code^))
+ (r/map (|>> #.Record [default-cursor]))))))]
+ (r.either simple^
composite^))))))
(context: "Lux code syntax."
@@ -82,29 +82,29 @@
other code^]
($_ seq
(test "Can parse Lux code."
- (case (&;read "" (dict;new text;Hash<Text>)
- [default-cursor +0 (code;to-text sample)])
- (#e;Error error)
+ (case (&.read "" (dict.new text.Hash<Text>)
+ [default-cursor +0 (code.to-text sample)])
+ (#e.Error error)
false
- (#e;Success [_ parsed])
- (:: code;Eq<Code> = parsed sample)))
+ (#e.Success [_ parsed])
+ (:: code.Eq<Code> = parsed sample)))
(test "Can parse Lux multiple code nodes."
- (case (&;read "" (dict;new text;Hash<Text>)
- [default-cursor +0 (format (code;to-text sample) " "
- (code;to-text other))])
- (#e;Error error)
+ (case (&.read "" (dict.new text.Hash<Text>)
+ [default-cursor +0 (format (code.to-text sample) " "
+ (code.to-text other))])
+ (#e.Error error)
false
- (#e;Success [remaining =sample])
- (case (&;read "" (dict;new text;Hash<Text>)
+ (#e.Success [remaining =sample])
+ (case (&.read "" (dict.new text.Hash<Text>)
remaining)
- (#e;Error error)
+ (#e.Error error)
false
- (#e;Success [_ =other])
- (and (:: code;Eq<Code> = sample =sample)
- (:: code;Eq<Code> = other =other)))))
+ (#e.Success [_ =other])
+ (and (:: code.Eq<Code> = sample =sample)
+ (:: code.Eq<Code> = other =other)))))
))))
(def: nat-to-frac
@@ -114,18 +114,18 @@
(context: "Frac special syntax."
(<| (times +100)
(do @
- [numerator (|> r;nat (:: @ map (|>> (n/% +100) nat-to-frac)))
- denominator (|> r;nat (:: @ map (|>> (n/% +100) (n/max +1) nat-to-frac)))
- signed? r;bool
+ [numerator (|> r.nat (:: @ map (|>> (n/% +100) nat-to-frac)))
+ denominator (|> r.nat (:: @ map (|>> (n/% +100) (n/max +1) nat-to-frac)))
+ signed? r.bool
#let [expected (|> numerator (f// denominator) (f/* (if signed? -1.0 1.0)))]]
(test "Can parse frac ratio syntax."
- (case (&;read "" (dict;new text;Hash<Text>)
+ (case (&.read "" (dict.new text.Hash<Text>)
[default-cursor +0
(format (if signed? "-" "")
(%i (frac-to-int numerator))
"/"
(%i (frac-to-int denominator)))])
- (#e;Success [_ [_ (#;Frac actual)]])
+ (#e.Success [_ [_ (#.Frac actual)]])
(f/= expected actual)
_
@@ -135,12 +135,12 @@
(context: "Nat special syntax."
(<| (times +100)
(do @
- [expected (|> r;nat (:: @ map (n/% +1_000)))]
+ [expected (|> r.nat (:: @ map (n/% +1_000)))]
(test "Can parse nat char syntax."
- (case (&;read "" (dict;new text;Hash<Text>)
+ (case (&.read "" (dict.new text.Hash<Text>)
[default-cursor +0
- (format "#" (%t (text;from-code expected)) "")])
- (#e;Success [_ [_ (#;Nat actual)]])
+ (format "#" (%t (text.from-code expected)) "")])
+ (#e.Success [_ [_ (#.Nat actual)]])
(n/= expected actual)
_
@@ -148,24 +148,24 @@
))))
(def: comment-text^
- (r;Random Text)
- (let [char-gen (|> r;nat (r;filter (function [value]
- (not (or (text;space? value)
+ (r.Random Text)
+ (let [char-gen (|> r.nat (r.filter (function [value]
+ (not (or (text.space? value)
(n/= (char "#") value)
(n/= (char "(") value)
(n/= (char ")") value))))))]
- (do r;Monad<Random>
- [size (|> r;nat (r/map (n/% +20)))]
- (r;text' char-gen size))))
+ (do r.Monad<Random>
+ [size (|> r.nat (r/map (n/% +20)))]
+ (r.text' char-gen size))))
(def: comment^
- (r;Random Text)
- (r;either (do r;Monad<Random>
+ (r.Random Text)
+ (r.either (do r.Monad<Random>
[comment comment-text^]
(wrap (format "## " comment "\n")))
- (r;rec (function [nested^]
- (do r;Monad<Random>
- [comment (r;either comment-text^
+ (r.rec (function [nested^]
+ (do r.Monad<Random>
+ [comment (r.either comment-text^
nested^)]
(wrap (format "#( " comment " )#")))))))
@@ -173,74 +173,74 @@
(<| (seed +6749851812188286456)
## (times +100)
(do @
- [#let [char-gen (|> r;nat (r;filter (function [value]
- (not (or (text;space? value)
+ [#let [char-gen (|> r.nat (r.filter (function [value]
+ (not (or (text.space? value)
(n/= (char "\"") value))))))]
x char-gen
y char-gen
z char-gen
- offset-size (|> r;nat (r/map (|>> (n/% +10) (n/max +1))))
- #let [offset (text;join-with "" (list;repeat offset-size " "))]
+ offset-size (|> r.nat (r/map (|>> (n/% +10) (n/max +1))))
+ #let [offset (text.join-with "" (list.repeat offset-size " "))]
sample code^
comment comment^
unbalanced-comment comment-text^]
($_ seq
(test "Will reject invalid multi-line text."
- (let [bad-match (format (text;from-code x) "\n"
- (text;from-code y) "\n"
- (text;from-code z))]
- (case (&;read "" (dict;new text;Hash<Text>)
+ (let [bad-match (format (text.from-code x) "\n"
+ (text.from-code y) "\n"
+ (text.from-code z))]
+ (case (&.read "" (dict.new text.Hash<Text>)
[default-cursor +0
(format "\"" bad-match "\"")])
- (#e;Error error)
+ (#e.Error error)
true
- (#e;Success [_ parsed])
+ (#e.Success [_ parsed])
false)))
(test "Will accept valid multi-line text"
- (let [good-input (format (text;from-code x) "\n"
- offset (text;from-code y) "\n"
- offset (text;from-code z))
- good-output (format (text;from-code x) "\n"
- (text;from-code y) "\n"
- (text;from-code z))]
- (case (&;read "" (dict;new text;Hash<Text>)
- [(|> default-cursor (update@ #;column (n/+ (n/dec offset-size))))
+ (let [good-input (format (text.from-code x) "\n"
+ offset (text.from-code y) "\n"
+ offset (text.from-code z))
+ good-output (format (text.from-code x) "\n"
+ (text.from-code y) "\n"
+ (text.from-code z))]
+ (case (&.read "" (dict.new text.Hash<Text>)
+ [(|> default-cursor (update@ #.column (n/+ (n/dec offset-size))))
+0
(format "\"" good-input "\"")])
- (#e;Error error)
+ (#e.Error error)
false
- (#e;Success [_ parsed])
- (:: code;Eq<Code> =
+ (#e.Success [_ parsed])
+ (:: code.Eq<Code> =
parsed
- (code;text good-output)))))
+ (code.text good-output)))))
(test "Can handle comments."
- (case (&;read "" (dict;new text;Hash<Text>)
+ (case (&.read "" (dict.new text.Hash<Text>)
[default-cursor +0
- (format comment (code;to-text sample))])
- (#e;Error error)
+ (format comment (code.to-text sample))])
+ (#e.Error error)
false
- (#e;Success [_ parsed])
- (:: code;Eq<Code> = parsed sample)))
+ (#e.Success [_ parsed])
+ (:: code.Eq<Code> = parsed sample)))
(test "Will reject unbalanced multi-line comments."
- (and (case (&;read "" (dict;new text;Hash<Text>)
+ (and (case (&.read "" (dict.new text.Hash<Text>)
[default-cursor +0
(format "#(" "#(" unbalanced-comment ")#"
- (code;to-text sample))])
- (#e;Error error)
+ (code.to-text sample))])
+ (#e.Error error)
true
- (#e;Success [_ parsed])
+ (#e.Success [_ parsed])
false)
- (case (&;read "" (dict;new text;Hash<Text>)
+ (case (&.read "" (dict.new text.Hash<Text>)
[default-cursor +0
(format "#(" unbalanced-comment ")#" ")#"
- (code;to-text sample))])
- (#e;Error error)
+ (code.to-text sample))])
+ (#e.Error error)
true
- (#e;Success [_ parsed])
+ (#e.Success [_ parsed])
false)))
))))
diff --git a/stdlib/test/test/lux/lang/type.lux b/stdlib/test/test/lux/lang/type.lux
index 81a0a3cd9..3adc4d43d 100644
--- a/stdlib/test/test/lux/lang/type.lux
+++ b/stdlib/test/test/lux/lang/type.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control ["M" monad #+ do Monad]
@@ -14,33 +14,33 @@
## [Utils]
(def: gen-name
- (r;Random Text)
- (do r;Monad<Random>
- [size (|> r;nat (:: @ map (n/% +10)))]
- (r;text size)))
+ (r.Random Text)
+ (do r.Monad<Random>
+ [size (|> r.nat (:: @ map (n/% +10)))]
+ (r.text size)))
(def: gen-ident
- (r;Random Ident)
- (r;seq gen-name gen-name))
+ (r.Random Ident)
+ (r.seq gen-name gen-name))
(def: gen-type
- (r;Random Type)
- (let [(^open "R/") r;Monad<Random>]
- (r;rec (function [gen-type]
- ($_ r;alt
- (r;seq gen-name (R/wrap (list)))
+ (r.Random Type)
+ (let [(^open "R/") r.Monad<Random>]
+ (r.rec (function [gen-type]
+ ($_ r.alt
+ (r.seq gen-name (R/wrap (list)))
(R/wrap [])
(R/wrap [])
- (r;seq gen-type gen-type)
- (r;seq gen-type gen-type)
- (r;seq gen-type gen-type)
- r;nat
- r;nat
- r;nat
- (r;seq (R/wrap (list)) gen-type)
- (r;seq (R/wrap (list)) gen-type)
- (r;seq gen-type gen-type)
- (r;seq gen-ident gen-type)
+ (r.seq gen-type gen-type)
+ (r.seq gen-type gen-type)
+ (r.seq gen-type gen-type)
+ r.nat
+ r.nat
+ r.nat
+ (r.seq (R/wrap (list)) gen-type)
+ (r.seq (R/wrap (list)) gen-type)
+ (r.seq gen-type gen-type)
+ (r.seq gen-ident gen-type)
)))))
## [Tests]
@@ -49,53 +49,53 @@
(do @
[sample gen-type]
(test "Every type is equal to itself."
- (:: &;Eq<Type> = sample sample)))))
+ (:: &.Eq<Type> = sample sample)))))
(context: "Type application"
(test "Can apply quantified types (universal and existential quantification)."
- (and (maybe;default false
- (do maybe;Monad<Maybe>
- [partial (&;apply (list Bool) Ann)
- full (&;apply (list Int) partial)]
- (wrap (:: &;Eq<Type> = full (#;Product Bool Int)))))
- (|> (&;apply (list Bool) Text)
- (case> #;None true _ false)))))
+ (and (maybe.default false
+ (do maybe.Monad<Maybe>
+ [partial (&.apply (list Bool) Ann)
+ full (&.apply (list Int) partial)]
+ (wrap (:: &.Eq<Type> = full (#.Product Bool Int)))))
+ (|> (&.apply (list Bool) Text)
+ (case> #.None true _ false)))))
(context: "Naming"
- (let [base (#;Named ["" "a"] (#;Product Bool Int))
- aliased (#;Named ["" "c"]
- (#;Named ["" "b"]
+ (let [base (#.Named ["" "a"] (#.Product Bool Int))
+ aliased (#.Named ["" "c"]
+ (#.Named ["" "b"]
base))]
($_ seq
(test "Can remove aliases from an already-named type."
- (:: &;Eq<Type> =
+ (:: &.Eq<Type> =
base
- (&;un-alias aliased)))
+ (&.un-alias aliased)))
(test "Can remove all names from a type."
- (and (not (:: &;Eq<Type> =
+ (and (not (:: &.Eq<Type> =
base
- (&;un-name aliased)))
- (:: &;Eq<Type> =
- (&;un-name base)
- (&;un-name aliased)))))))
+ (&.un-name aliased)))
+ (:: &.Eq<Type> =
+ (&.un-name base)
+ (&.un-name aliased)))))))
(context: "Type construction [structs]"
(<| (times +100)
(do @
- [size (|> r;nat (:: @ map (n/% +3)))
+ [size (|> r.nat (:: @ map (n/% +3)))
members (|> gen-type
- (r;filter (function [type]
+ (r.filter (function [type]
(case type
- (^or (#;Sum _) (#;Product _))
+ (^or (#.Sum _) (#.Product _))
false
_
true)))
- (list;repeat size)
- (M;seq @))
- #let [(^open "&/") &;Eq<Type>
- (^open "L/") (list;Eq<List> &;Eq<Type>)]]
+ (list.repeat size)
+ (M.seq @))
+ #let [(^open "&/") &.Eq<Type>
+ (^open "L/") (list.Eq<List> &.Eq<Type>)]]
(with-expansions
[<struct-tests> (do-template [<desc> <ctor> <dtor> <unit>]
[(test (format "Can build and tear-down " <desc> " types.")
@@ -104,8 +104,8 @@
(and (L/= (list) members)
(L/= (list <unit>) flat)))))]
- ["variant" &;variant &;flatten-variant Void]
- ["tuple" &;tuple &;flatten-tuple Unit]
+ ["variant" &.variant &.flatten-variant Void]
+ ["tuple" &.tuple &.flatten-tuple Unit]
)]
($_ seq
<struct-tests>
@@ -114,42 +114,42 @@
(context: "Type construction [parameterized]"
(<| (times +100)
(do @
- [size (|> r;nat (:: @ map (n/% +3)))
- members (M;seq @ (list;repeat size gen-type))
+ [size (|> r.nat (:: @ map (n/% +3)))
+ members (M.seq @ (list.repeat size gen-type))
extra (|> gen-type
- (r;filter (function [type]
+ (r.filter (function [type]
(case type
- (^or (#;Function _) (#;Apply _))
+ (^or (#.Function _) (#.Apply _))
false
_
true))))
- #let [(^open "&/") &;Eq<Type>
- (^open "L/") (list;Eq<List> &;Eq<Type>)]]
+ #let [(^open "&/") &.Eq<Type>
+ (^open "L/") (list.Eq<List> &.Eq<Type>)]]
($_ seq
(test "Can build and tear-down function types."
- (let [[inputs output] (|> (&;function members extra) &;flatten-function)]
+ (let [[inputs output] (|> (&.function members extra) &.flatten-function)]
(and (L/= members inputs)
(&/= extra output))))
(test "Can build and tear-down application types."
- (let [[tfunc tparams] (|> extra (&;application members) &;flatten-application)]
- (n/= (list;size members) (list;size tparams))))
+ (let [[tfunc tparams] (|> extra (&.application members) &.flatten-application)]
+ (n/= (list.size members) (list.size tparams))))
))))
(context: "Type construction [higher order]"
(<| (times +100)
(do @
- [size (|> r;nat (:: @ map (n/% +3)))
+ [size (|> r.nat (:: @ map (n/% +3)))
extra (|> gen-type
- (r;filter (function [type]
+ (r.filter (function [type]
(case type
- (^or (#;UnivQ _) (#;ExQ _))
+ (^or (#.UnivQ _) (#.ExQ _))
false
_
true))))
- #let [(^open "&/") &;Eq<Type>]]
+ #let [(^open "&/") &.Eq<Type>]]
(with-expansions
[<quant-tests> (do-template [<desc> <ctor> <dtor>]
[(test (format "Can build and tear-down " <desc> " types.")
@@ -157,8 +157,8 @@
(and (n/= size flat-size)
(&/= extra flat-body))))]
- ["universally-quantified" &;univ-q &;flatten-univ-q]
- ["existentially-quantified" &;ex-q &;flatten-ex-q]
+ ["universally-quantified" &.univ-q &.flatten-univ-q]
+ ["existentially-quantified" &.ex-q &.flatten-ex-q]
)]
($_ seq
<quant-tests>
diff --git a/stdlib/test/test/lux/lang/type/check.lux b/stdlib/test/test/lux/lang/type/check.lux
index 188c73823..d63444b52 100644
--- a/stdlib/test/test/lux/lang/type/check.lux
+++ b/stdlib/test/test/lux/lang/type/check.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -17,111 +17,111 @@
## [Utils]
(def: gen-name
- (r;Random Text)
- (do r;Monad<Random>
- [size (|> r;nat (:: @ map (n/% +10)))]
- (r;text size)))
+ (r.Random Text)
+ (do r.Monad<Random>
+ [size (|> r.nat (:: @ map (n/% +10)))]
+ (r.text size)))
(def: gen-ident
- (r;Random Ident)
- (r;seq gen-name gen-name))
+ (r.Random Ident)
+ (r.seq gen-name gen-name))
(def: gen-type
- (r;Random Type)
- (let [(^open "r/") r;Monad<Random>]
- (r;rec (function [gen-type]
- ($_ r;alt
- (r;seq gen-name (r/wrap (list)))
+ (r.Random Type)
+ (let [(^open "r/") r.Monad<Random>]
+ (r.rec (function [gen-type]
+ ($_ r.alt
+ (r.seq gen-name (r/wrap (list)))
(r/wrap [])
(r/wrap [])
- (r;seq gen-type gen-type)
- (r;seq gen-type gen-type)
- (r;seq gen-type gen-type)
- r;nat
- r;nat
- r;nat
- (r;seq (r/wrap (list)) gen-type)
- (r;seq (r/wrap (list)) gen-type)
- (r;seq gen-type gen-type)
- (r;seq gen-ident gen-type)
+ (r.seq gen-type gen-type)
+ (r.seq gen-type gen-type)
+ (r.seq gen-type gen-type)
+ r.nat
+ r.nat
+ r.nat
+ (r.seq (r/wrap (list)) gen-type)
+ (r.seq (r/wrap (list)) gen-type)
+ (r.seq gen-type gen-type)
+ (r.seq gen-ident gen-type)
)))))
(def: (valid-type? type)
(-> Type Bool)
(case type
- (#;Primitive name params)
- (list;every? valid-type? params)
+ (#.Primitive name params)
+ (list.every? valid-type? params)
- (^or #;Void #;Unit (#;Ex id))
+ (^or #.Void #.Unit (#.Ex id))
true
(^template [<tag>]
(<tag> left right)
(and (valid-type? left) (valid-type? right)))
- ([#;Sum] [#;Product] [#;Function])
+ ([#.Sum] [#.Product] [#.Function])
- (#;Named name type')
+ (#.Named name type')
(valid-type? type')
_
false))
(def: (type-checks? input)
- (-> (@;Check []) Bool)
- (case (@;run @;fresh-context input)
- (#;Right [])
+ (-> (@.Check []) Bool)
+ (case (@.run @.fresh-context input)
+ (#.Right [])
true
- (#;Left error)
+ (#.Left error)
false))
## [Tests]
(context: "Top and Bottom."
(<| (times +100)
(do @
- [sample (|> gen-type (r;filter valid-type?))]
+ [sample (|> gen-type (r.filter valid-type?))]
($_ seq
(test "Top is the super-type of everything."
- (@;checks? Top sample))
+ (@.checks? Top sample))
(test "Bottom is the sub-type of everything."
- (@;checks? sample Bottom))
+ (@.checks? sample Bottom))
))))
(context: "Simple type-checking."
($_ seq
(test "Unit and Void match themselves."
- (and (@;checks? Void Void)
- (@;checks? Unit Unit)))
+ (and (@.checks? Void Void)
+ (@.checks? Unit Unit)))
(test "Existential types only match with themselves."
- (and (type-checks? (do @;Monad<Check>
- [[_ exT] @;existential]
- (@;check exT exT)))
- (not (type-checks? (do @;Monad<Check>
- [[_ exTL] @;existential
- [_ exTR] @;existential]
- (@;check exTL exTR))))))
+ (and (type-checks? (do @.Monad<Check>
+ [[_ exT] @.existential]
+ (@.check exT exT)))
+ (not (type-checks? (do @.Monad<Check>
+ [[_ exTL] @.existential
+ [_ exTR] @.existential]
+ (@.check exTL exTR))))))
(test "Names do not affect type-checking."
- (and (type-checks? (do @;Monad<Check>
- [[_ exT] @;existential]
- (@;check (#;Named ["module" "name"] exT)
+ (and (type-checks? (do @.Monad<Check>
+ [[_ exT] @.existential]
+ (@.check (#.Named ["module" "name"] exT)
exT)))
- (type-checks? (do @;Monad<Check>
- [[_ exT] @;existential]
- (@;check exT
- (#;Named ["module" "name"] exT))))
- (type-checks? (do @;Monad<Check>
- [[_ exT] @;existential]
- (@;check (#;Named ["module" "name"] exT)
- (#;Named ["module" "name"] exT))))))
+ (type-checks? (do @.Monad<Check>
+ [[_ exT] @.existential]
+ (@.check exT
+ (#.Named ["module" "name"] exT))))
+ (type-checks? (do @.Monad<Check>
+ [[_ exT] @.existential]
+ (@.check (#.Named ["module" "name"] exT)
+ (#.Named ["module" "name"] exT))))))
(test "Functions are covariant on inputs and contravariant on outputs."
- (and (@;checks? (#;Function Bottom Top)
- (#;Function Top Bottom))
- (not (@;checks? (#;Function Top Bottom)
- (#;Function Bottom Top)))))
+ (and (@.checks? (#.Function Bottom Top)
+ (#.Function Top Bottom))
+ (not (@.checks? (#.Function Top Bottom)
+ (#.Function Bottom Top)))))
))
(context: "Type application."
@@ -130,74 +130,74 @@
[meta gen-type
data gen-type]
(test "Can type-check type application."
- (and (@;checks? (|> Ann (#;Apply meta) (#;Apply data))
- (type;tuple (list meta data)))
- (@;checks? (type;tuple (list meta data))
- (|> Ann (#;Apply meta) (#;Apply data))))))))
+ (and (@.checks? (|> Ann (#.Apply meta) (#.Apply data))
+ (type.tuple (list meta data)))
+ (@.checks? (type.tuple (list meta data))
+ (|> Ann (#.Apply meta) (#.Apply data))))))))
(context: "Primitive types."
(<| (times +100)
(do @
[nameL gen-name
- nameR (|> gen-name (r;filter (|>> (text/= nameL) not)))
+ nameR (|> gen-name (r.filter (|>> (text/= nameL) not)))
paramL gen-type
- paramR (|> gen-type (r;filter (|>> (@;checks? paramL) not)))]
+ paramR (|> gen-type (r.filter (|>> (@.checks? paramL) not)))]
($_ seq
(test "Primitive types match when they have the same name and the same parameters."
- (@;checks? (#;Primitive nameL (list paramL))
- (#;Primitive nameL (list paramL))))
+ (@.checks? (#.Primitive nameL (list paramL))
+ (#.Primitive nameL (list paramL))))
(test "Names matter to primitive types."
- (not (@;checks? (#;Primitive nameL (list paramL))
- (#;Primitive nameR (list paramL)))))
+ (not (@.checks? (#.Primitive nameL (list paramL))
+ (#.Primitive nameR (list paramL)))))
(test "Parameters matter to primitive types."
- (not (@;checks? (#;Primitive nameL (list paramL))
- (#;Primitive nameL (list paramR)))))
+ (not (@.checks? (#.Primitive nameL (list paramL))
+ (#.Primitive nameL (list paramR)))))
))))
(context: "Type variables."
($_ seq
(test "Type-vars check against themselves."
- (type-checks? (do @;Monad<Check>
- [[id var] @;var]
- (@;check var var))))
+ (type-checks? (do @.Monad<Check>
+ [[id var] @.var]
+ (@.check var var))))
(test "Can bind unbound type-vars by type-checking against them."
- (and (type-checks? (do @;Monad<Check>
- [[id var] @;var]
- (@;check var #;Unit)))
- (type-checks? (do @;Monad<Check>
- [[id var] @;var]
- (@;check #;Unit var)))))
+ (and (type-checks? (do @.Monad<Check>
+ [[id var] @.var]
+ (@.check var #.Unit)))
+ (type-checks? (do @.Monad<Check>
+ [[id var] @.var]
+ (@.check #.Unit var)))))
(test "Cannot rebind already bound type-vars."
- (not (type-checks? (do @;Monad<Check>
- [[id var] @;var
- _ (@;check var #;Unit)]
- (@;check var #;Void)))))
+ (not (type-checks? (do @.Monad<Check>
+ [[id var] @.var
+ _ (@.check var #.Unit)]
+ (@.check var #.Void)))))
(test "If the type bound to a var is a super-type to another, then the var is also a super-type."
- (type-checks? (do @;Monad<Check>
- [[id var] @;var
- _ (@;check var Top)]
- (@;check var #;Unit))))
+ (type-checks? (do @.Monad<Check>
+ [[id var] @.var
+ _ (@.check var Top)]
+ (@.check var #.Unit))))
(test "If the type bound to a var is a sub-type of another, then the var is also a sub-type."
- (type-checks? (do @;Monad<Check>
- [[id var] @;var
- _ (@;check var Bottom)]
- (@;check #;Unit var))))
+ (type-checks? (do @.Monad<Check>
+ [[id var] @.var
+ _ (@.check var Bottom)]
+ (@.check #.Unit var))))
))
(def: (build-ring num-connections)
- (-> Nat (@;Check [[Nat Type] (List [Nat Type]) [Nat Type]]))
- (do @;Monad<Check>
- [[head-id head-type] @;var
- ids+types (monad;seq @ (list;repeat num-connections @;var))
- [tail-id tail-type] (monad;fold @ (function [[tail-id tail-type] [_head-id _head-type]]
+ (-> Nat (@.Check [[Nat Type] (List [Nat Type]) [Nat Type]]))
+ (do @.Monad<Check>
+ [[head-id head-type] @.var
+ ids+types (monad.seq @ (list.repeat num-connections @.var))
+ [tail-id tail-type] (monad.fold @ (function [[tail-id tail-type] [_head-id _head-type]]
(do @
- [_ (@;check head-type tail-type)]
+ [_ (@.check head-type tail-type)]
(wrap [tail-id tail-type])))
[head-id head-type]
ids+types)]
@@ -206,57 +206,57 @@
(context: "Rings of type variables."
(<| (times +100)
(do @
- [num-connections (|> r;nat (:: @ map (n/% +100)))
- boundT (|> gen-type (r;filter (|>> (case> (#;Var _) false _ true))))
- pick-pcg (r;seq r;nat r;nat)]
+ [num-connections (|> r.nat (:: @ map (n/% +100)))
+ boundT (|> gen-type (r.filter (|>> (case> (#.Var _) false _ true))))
+ pick-pcg (r.seq r.nat r.nat)]
($_ seq
(test "Can create rings of variables."
- (type-checks? (do @;Monad<Check>
+ (type-checks? (do @.Monad<Check>
[[[head-id head-type] ids+types [tail-id tail-type]] (build-ring num-connections)
- #let [ids (list/map product;left ids+types)]
- headR (@;ring head-id)
- tailR (@;ring tail-id)]
- (@;assert ""
- (let [same-rings? (:: set;Eq<Set> = headR tailR)
- expected-size? (n/= (n/inc num-connections) (set;size headR))
- same-vars? (|> (set;to-list headR)
- (list;sort n/<)
- (:: (list;Eq<List> number;Eq<Nat>) = (list;sort n/< (#;Cons head-id ids))))]
+ #let [ids (list/map product.left ids+types)]
+ headR (@.ring head-id)
+ tailR (@.ring tail-id)]
+ (@.assert ""
+ (let [same-rings? (:: set.Eq<Set> = headR tailR)
+ expected-size? (n/= (n/inc num-connections) (set.size headR))
+ same-vars? (|> (set.to-list headR)
+ (list.sort n/<)
+ (:: (list.Eq<List> number.Eq<Nat>) = (list.sort n/< (#.Cons head-id ids))))]
(and same-rings?
expected-size?
same-vars?))))))
(test "When a var in a ring is bound, all the ring is bound."
- (type-checks? (do @;Monad<Check>
+ (type-checks? (do @.Monad<Check>
[[[head-id headT] ids+types tailT] (build-ring num-connections)
- #let [ids (list/map product;left ids+types)]
- _ (@;check headT boundT)
- head-bound (@;read head-id)
- tail-bound (monad;map @ @;read ids)
- headR (@;ring head-id)
- tailR+ (monad;map @ @;ring ids)]
- (let [rings-were-erased? (and (set;empty? headR)
- (list;every? set;empty? tailR+))
- same-types? (list;every? (type/= boundT) (list& (maybe;default headT head-bound)
+ #let [ids (list/map product.left ids+types)]
+ _ (@.check headT boundT)
+ head-bound (@.read head-id)
+ tail-bound (monad.map @ @.read ids)
+ headR (@.ring head-id)
+ tailR+ (monad.map @ @.ring ids)]
+ (let [rings-were-erased? (and (set.empty? headR)
+ (list.every? set.empty? tailR+))
+ same-types? (list.every? (type/= boundT) (list& (maybe.default headT head-bound)
(list/map (function [[tail-id ?tailT]]
- (maybe;default (#;Var tail-id) ?tailT))
- (list;zip2 ids tail-bound))))]
- (@;assert ""
+ (maybe.default (#.Var tail-id) ?tailT))
+ (list.zip2 ids tail-bound))))]
+ (@.assert ""
(and rings-were-erased?
same-types?))))))
(test "Can merge multiple rings of variables."
- (type-checks? (do @;Monad<Check>
+ (type-checks? (do @.Monad<Check>
[[[head-idL headTL] ids+typesL [tail-idL tailTL]] (build-ring num-connections)
[[head-idR headTR] ids+typesR [tail-idR tailTR]] (build-ring num-connections)
- headRL-pre (@;ring head-idL)
- headRR-pre (@;ring head-idR)
- _ (@;check headTL headTR)
- headRL-post (@;ring head-idL)
- headRR-post (@;ring head-idR)]
- (@;assert ""
- (let [same-rings? (:: set;Eq<Set> = headRL-post headRR-post)
+ headRL-pre (@.ring head-idL)
+ headRR-pre (@.ring head-idR)
+ _ (@.check headTL headTR)
+ headRL-post (@.ring head-idL)
+ headRR-post (@.ring head-idR)]
+ (@.assert ""
+ (let [same-rings? (:: set.Eq<Set> = headRL-post headRR-post)
expected-size? (n/= (n/* +2 (n/inc num-connections))
- (set;size headRL-post))
- union? (:: set;Eq<Set> = headRL-post (set;union headRL-pre headRR-pre))]
+ (set.size headRL-post))
+ union? (:: set.Eq<Set> = headRL-post (set.union headRL-pre headRR-pre))]
(and same-rings?
expected-size?
union?))))))
diff --git a/stdlib/test/test/lux/macro/code.lux b/stdlib/test/test/lux/macro/code.lux
index 64bdf5f1c..08160c7e2 100644
--- a/stdlib/test/test/lux/macro/code.lux
+++ b/stdlib/test/test/lux/macro/code.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -13,20 +13,20 @@
(with-expansions
[<tests> (do-template [<expr> <text>]
[(test (format "Can produce Code node: " <text>)
- (and (T/= <text> (&;to-text <expr>))
- (:: &;Eq<Code> = <expr> <expr>)))]
+ (and (T/= <text> (&.to-text <expr>))
+ (:: &.Eq<Code> = <expr> <expr>)))]
- [(&;bool true) "true"]
- [(&;bool false) "false"]
- [(&;int 123) "123"]
- [(&;frac 123.0) "123.0"]
- [(&;text "\n") "\"\\n\""]
- [(&;tag ["yolo" "lol"]) "#yolo;lol"]
- [(&;symbol ["yolo" "lol"]) "yolo;lol"]
- [(&;form (list (&;bool true) (&;int 123))) "(true 123)"]
- [(&;tuple (list (&;bool true) (&;int 123))) "[true 123]"]
- [(&;record (list [(&;bool true) (&;int 123)])) "{true 123}"]
- [(&;local-tag "lol") "#lol"]
- [(&;local-symbol "lol") "lol"]
+ [(&.bool true) "true"]
+ [(&.bool false) "false"]
+ [(&.int 123) "123"]
+ [(&.frac 123.0) "123.0"]
+ [(&.text "\n") "\"\\n\""]
+ [(&.tag ["yolo" "lol"]) "#yolo.lol"]
+ [(&.symbol ["yolo" "lol"]) "yolo.lol"]
+ [(&.form (list (&.bool true) (&.int 123))) "(true 123)"]
+ [(&.tuple (list (&.bool true) (&.int 123))) "[true 123]"]
+ [(&.record (list [(&.bool true) (&.int 123)])) "{true 123}"]
+ [(&.local-tag "lol") "#lol"]
+ [(&.local-symbol "lol") "lol"]
)]
($_ seq <tests>)))
diff --git a/stdlib/test/test/lux/macro/poly/eq.lux b/stdlib/test/test/lux/macro/poly/eq.lux
index bd3239cf6..8867732c0 100644
--- a/stdlib/test/test/lux/macro/poly/eq.lux
+++ b/stdlib/test/test/lux/macro/poly/eq.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -38,29 +38,29 @@
#recursive Recursive})
(def: gen-recursive
- (r;Random Recursive)
- (r;rec (function [gen-recursive]
- (r;alt r;frac
- (r;seq r;frac gen-recursive)))))
+ (r.Random Recursive)
+ (r.rec (function [gen-recursive]
+ (r.alt r.frac
+ (r.seq r.frac gen-recursive)))))
(def: gen-record
- (r;Random Record)
- (do r;Monad<Random>
- [size (:: @ map (n/% +2) r;nat)
- #let [gen-int (|> r;int (:: @ map (|>> int/abs (i/% 1_000_000))))]]
- ($_ r;seq
+ (r.Random Record)
+ (do r.Monad<Random>
+ [size (:: @ map (n/% +2) r.nat)
+ #let [gen-int (|> r.int (:: @ map (|>> int/abs (i/% 1_000_000))))]]
+ ($_ r.seq
(:: @ wrap [])
- r;bool
+ r.bool
gen-int
- r;frac
- (r;text size)
- (r;maybe gen-int)
- (r;list size gen-int)
- ($_ r;alt r;bool gen-int r;frac)
- ($_ r;seq gen-int r;frac (r;text size))
+ r.frac
+ (r.text size)
+ (r.maybe gen-int)
+ (r.list size gen-int)
+ ($_ r.alt r.bool gen-int r.frac)
+ ($_ r.seq gen-int r.frac (r.text size))
gen-recursive)))
-(derived: (&;Eq<?> Record))
+(derived: (&.Eq<?> Record))
## [Tests]
(context: "Eq polytypism"
diff --git a/stdlib/test/test/lux/macro/poly/functor.lux b/stdlib/test/test/lux/macro/poly/functor.lux
index d1c42cde5..3cb6653a5 100644
--- a/stdlib/test/test/lux/macro/poly/functor.lux
+++ b/stdlib/test/test/lux/macro/poly/functor.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -17,13 +17,13 @@
lux/test)
## [Utils]
-(derived: (&;Functor<?> ;Maybe))
+(derived: (&.Functor<?> .Maybe))
-(derived: (&;Functor<?> ;List))
+(derived: (&.Functor<?> .List))
-(derived: (&;Functor<?> state;State))
+(derived: (&.Functor<?> state.State))
-(derived: (&;Functor<?> identity;Identity))
+(derived: (&.Functor<?> identity.Identity))
## [Tests]
(context: "Functor polytypism."
diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux
index b159bf999..f53af1cb7 100644
--- a/stdlib/test/test/lux/macro/syntax.lux
+++ b/stdlib/test/test/lux/macro/syntax.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -19,8 +19,8 @@
## [Utils]
(def: (enforced? parser input)
(-> (Syntax []) (List Code) Bool)
- (case (p;run input parser)
- (#;Right [_ []])
+ (case (p.run input parser)
+ (#.Right [_ []])
true
_
@@ -28,8 +28,8 @@
(def: (found? parser input)
(-> (Syntax Bool) (List Code) Bool)
- (case (p;run input parser)
- (#;Right [_ true])
+ (case (p.run input parser)
+ (#.Right [_ true])
true
_
@@ -37,17 +37,17 @@
(def: (is? Eq<a> test parser input)
(All [a] (-> (Eq a) a (Syntax a) (List Code) Bool))
- (case (p;run input parser)
- (#;Right [_ output])
+ (case (p.run input parser)
+ (#.Right [_ output])
(:: Eq<a> = test output)
_
false))
(def: (fails? input)
- (All [a] (-> (E;Error a) Bool))
+ (All [a] (-> (E.Error a) Bool))
(case input
- (#;Left _)
+ (#.Left _)
true
_
@@ -55,7 +55,7 @@
(syntax: (match pattern input)
(wrap (list (` (case (~ input)
- (^ (#;Right [(~' _) (~ pattern)]))
+ (^ (#.Right [(~' _) (~ pattern)]))
true
(~' _)
@@ -67,34 +67,34 @@
[<simple-tests> (do-template [<assertion> <value> <ctor> <Eq> <get>]
[(test <assertion>
(and (is? <Eq> <value> <get> (list (<ctor> <value>)))
- (found? (s;this? (<ctor> <value>)) (list (<ctor> <value>)))
- (enforced? (s;this (<ctor> <value>)) (list (<ctor> <value>)))))]
-
- ["Can parse Bool syntax." true code;bool bool;Eq<Bool> s;bool]
- ["Can parse Nat syntax." +123 code;nat number;Eq<Nat> s;nat]
- ["Can parse Int syntax." 123 code;int number;Eq<Int> s;int]
- ["Can parse Deg syntax." .123 code;deg number;Eq<Deg> s;deg]
- ["Can parse Frac syntax." 123.0 code;frac number;Eq<Frac> s;frac]
- ["Can parse Text syntax." "\n" code;text text;Eq<Text> s;text]
- ["Can parse Symbol syntax." ["yolo" "lol"] code;symbol ident;Eq<Ident> s;symbol]
- ["Can parse Tag syntax." ["yolo" "lol"] code;tag ident;Eq<Ident> s;tag]
+ (found? (s.this? (<ctor> <value>)) (list (<ctor> <value>)))
+ (enforced? (s.this (<ctor> <value>)) (list (<ctor> <value>)))))]
+
+ ["Can parse Bool syntax." true code.bool bool.Eq<Bool> s.bool]
+ ["Can parse Nat syntax." +123 code.nat number.Eq<Nat> s.nat]
+ ["Can parse Int syntax." 123 code.int number.Eq<Int> s.int]
+ ["Can parse Deg syntax." .123 code.deg number.Eq<Deg> s.deg]
+ ["Can parse Frac syntax." 123.0 code.frac number.Eq<Frac> s.frac]
+ ["Can parse Text syntax." "\n" code.text text.Eq<Text> s.text]
+ ["Can parse Symbol syntax." ["yolo" "lol"] code.symbol ident.Eq<Ident> s.symbol]
+ ["Can parse Tag syntax." ["yolo" "lol"] code.tag ident.Eq<Ident> s.tag]
)]
($_ seq
<simple-tests>
(test "Can parse symbols belonging to the current namespace."
(and (match "yolo"
- (p;run (list (code;local-symbol "yolo"))
- s;local-symbol))
- (fails? (p;run (list (code;symbol ["yolo" "lol"]))
- s;local-symbol))))
+ (p.run (list (code.local-symbol "yolo"))
+ s.local-symbol))
+ (fails? (p.run (list (code.symbol ["yolo" "lol"]))
+ s.local-symbol))))
(test "Can parse tags belonging to the current namespace."
(and (match "yolo"
- (p;run (list (code;local-tag "yolo"))
- s;local-tag))
- (fails? (p;run (list (code;tag ["yolo" "lol"]))
- s;local-tag))))
+ (p.run (list (code.local-tag "yolo"))
+ s.local-tag))
+ (fails? (p.run (list (code.tag ["yolo" "lol"]))
+ s.local-tag))))
)))
(context: "Complex value syntax."
@@ -102,52 +102,52 @@
[<group-tests> (do-template [<type> <parser> <ctor>]
[(test (format "Can parse " <type> " syntax.")
(and (match [true 123]
- (p;run (list (<ctor> (list (code;bool true) (code;int 123))))
- (<parser> (p;seq s;bool s;int))))
+ (p.run (list (<ctor> (list (code.bool true) (code.int 123))))
+ (<parser> (p.seq s.bool s.int))))
(match true
- (p;run (list (<ctor> (list (code;bool true))))
- (<parser> s;bool)))
- (fails? (p;run (list (<ctor> (list (code;bool true) (code;int 123))))
- (<parser> s;bool)))
- (match (#;Left true)
- (p;run (list (<ctor> (list (code;bool true))))
- (<parser> (p;alt s;bool s;int))))
- (match (#;Right 123)
- (p;run (list (<ctor> (list (code;int 123))))
- (<parser> (p;alt s;bool s;int))))
- (fails? (p;run (list (<ctor> (list (code;frac 123.0))))
- (<parser> (p;alt s;bool s;int))))))]
-
- ["form" s;form code;form]
- ["tuple" s;tuple code;tuple])]
+ (p.run (list (<ctor> (list (code.bool true))))
+ (<parser> s.bool)))
+ (fails? (p.run (list (<ctor> (list (code.bool true) (code.int 123))))
+ (<parser> s.bool)))
+ (match (#.Left true)
+ (p.run (list (<ctor> (list (code.bool true))))
+ (<parser> (p.alt s.bool s.int))))
+ (match (#.Right 123)
+ (p.run (list (<ctor> (list (code.int 123))))
+ (<parser> (p.alt s.bool s.int))))
+ (fails? (p.run (list (<ctor> (list (code.frac 123.0))))
+ (<parser> (p.alt s.bool s.int))))))]
+
+ ["form" s.form code.form]
+ ["tuple" s.tuple code.tuple])]
($_ seq
<group-tests>
(test "Can parse record syntax."
(match [true 123]
- (p;run (list (code;record (list [(code;bool true) (code;int 123)])))
- (s;record (p;seq s;bool s;int)))))
+ (p.run (list (code.record (list [(code.bool true) (code.int 123)])))
+ (s.record (p.seq s.bool s.int)))))
)))
(context: "Combinators"
($_ seq
(test "Can parse any Code."
- (match [_ (#;Bool true)]
- (p;run (list (code;bool true) (code;int 123))
- s;any)))
+ (match [_ (#.Bool true)]
+ (p.run (list (code.bool true) (code.int 123))
+ s.any)))
(test "Can check whether the end has been reached."
(and (match true
- (p;run (list)
- s;end?))
+ (p.run (list)
+ s.end?))
(match false
- (p;run (list (code;bool true))
- s;end?))))
+ (p.run (list (code.bool true))
+ s.end?))))
(test "Can ensure the end has been reached."
(and (match []
- (p;run (list)
- s;end!))
- (fails? (p;run (list (code;bool true))
- s;end!))))
+ (p.run (list)
+ s.end!))
+ (fails? (p.run (list (code.bool true))
+ s.end!))))
))
diff --git a/stdlib/test/test/lux/math.lux b/stdlib/test/test/lux/math.lux
index 3852ace0d..3dda899c5 100644
--- a/stdlib/test/test/lux/math.lux
+++ b/stdlib/test/test/lux/math.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -18,53 +18,53 @@
(context: "Trigonometry"
(<| (seed +4611737486687492590)
(do @
- [angle (|> r;frac (:: @ map (f/* &;tau)))]
+ [angle (|> r.frac (:: @ map (f/* &.tau)))]
($_ seq
(test "Sine and arc-sine are inverse functions."
- (|> angle &;sin &;asin (within? margin angle)))
+ (|> angle &.sin &.asin (within? margin angle)))
(test "Cosine and arc-cosine are inverse functions."
- (|> angle &;cos &;acos (within? margin angle)))
+ (|> angle &.cos &.acos (within? margin angle)))
(test "Tangent and arc-tangent are inverse functions."
- (|> angle &;tan &;atan (within? margin angle)))
+ (|> angle &.tan &.atan (within? margin angle)))
))))
(context: "Roots"
(<| (times +100)
(do @
- [factor (|> r;nat (:: @ map (|>> (n/% +1000)
+ [factor (|> r.nat (:: @ map (|>> (n/% +1000)
(n/max +1)
nat-to-int
int-to-frac)))
- base (|> r;frac (:: @ map (f/* factor)))]
+ base (|> r.frac (:: @ map (f/* factor)))]
($_ seq
(test "Square-root is inverse of square."
- (|> base (&;pow 2.0) &;root2 (f/= base)))
+ (|> base (&.pow 2.0) &.root2 (f/= base)))
(test "Cubic-root is inverse of cube."
- (|> base (&;pow 3.0) &;root3 (f/= base)))
+ (|> base (&.pow 3.0) &.root3 (f/= base)))
))))
(context: "Rounding"
(<| (times +100)
(do @
- [sample (|> r;frac (:: @ map (f/* 1000.0)))]
+ [sample (|> r.frac (:: @ map (f/* 1000.0)))]
($_ seq
(test "The ceiling will be an integer value, and will be >= the original."
- (let [ceil'd (&;ceil sample)]
+ (let [ceil'd (&.ceil sample)]
(and (|> ceil'd frac-to-int int-to-frac (f/= ceil'd))
(f/>= sample ceil'd)
(f/<= 1.0 (f/- sample ceil'd)))))
(test "The floor will be an integer value, and will be <= the original."
- (let [floor'd (&;floor sample)]
+ (let [floor'd (&.floor sample)]
(and (|> floor'd frac-to-int int-to-frac (f/= floor'd))
(f/<= sample floor'd)
(f/<= 1.0 (f/- floor'd sample)))))
(test "The round will be an integer value, and will be < or > or = the original."
- (let [round'd (&;round sample)]
+ (let [round'd (&.round sample)]
(and (|> round'd frac-to-int int-to-frac (f/= round'd))
(f/<= 1.0 (frac/abs (f/- sample round'd))))))
))))
@@ -72,24 +72,24 @@
(context: "Exponentials and logarithms"
(<| (times +100)
(do @
- [sample (|> r;frac (:: @ map (f/* 10.0)))]
+ [sample (|> r.frac (:: @ map (f/* 10.0)))]
(test "Logarithm is the inverse of exponential."
- (|> sample &;exp &;log (within? 1.0e-15 sample))))))
+ (|> sample &.exp &.log (within? 1.0e-15 sample))))))
(context: "Greatest-Common-Divisor and Least-Common-Multiple"
(<| (times +100)
(do @
- [#let [gen-nat (|> r;nat (:: @ map (|>> (n/% +1000) (n/max +1))))]
+ [#let [gen-nat (|> r.nat (:: @ map (|>> (n/% +1000) (n/max +1))))]
x gen-nat
y gen-nat]
($_ (test "GCD"
- (let [gcd (&;gcd x y)]
+ (let [gcd (&.gcd x y)]
(and (n/= +0 (n/% gcd x))
(n/= +0 (n/% gcd y))
(n/>= +1 gcd))))
(test "LCM"
- (let [lcm (&;lcm x y)]
+ (let [lcm (&.lcm x y)]
(and (n/= +0 (n/% x lcm))
(n/= +0 (n/% y lcm))
(n/<= (n/* x y) lcm))))
@@ -98,36 +98,36 @@
(context: "Infix syntax"
(<| (times +100)
(do @
- [x r;nat
- y r;nat
- z r;nat
- theta r;frac
+ [x r.nat
+ y r.nat
+ z r.nat
+ theta r.frac
#let [top (|> x (n/max y) (n/max z))
bottom (|> x (n/min y) (n/min z))]]
($_ seq
(test "Constant values don't change."
(n/= x
- (&;infix x)))
+ (&.infix x)))
(test "Can call binary functions."
- (n/= (&;gcd y x)
- (&;infix [x &;gcd y])))
+ (n/= (&.gcd y x)
+ (&.infix [x &.gcd y])))
(test "Can call unary functions."
- (f/= (&;sin theta)
- (&;infix [&;sin theta])))
+ (f/= (&.sin theta)
+ (&.infix [&.sin theta])))
(test "Can use regular syntax in the middle of infix code."
- (n/= (&;gcd +450 (n/* +3 +9))
- (&;infix [(n/* +3 +9) &;gcd +450])))
+ (n/= (&.gcd +450 (n/* +3 +9))
+ (&.infix [(n/* +3 +9) &.gcd +450])))
(test "Can use non-numerical functions/macros as operators."
(bool/= (and (n/< y x) (n/< z y))
- (&;infix [[x n/< y] and [y n/< z]])))
+ (&.infix [[x n/< y] and [y n/< z]])))
(test "Can combine boolean operations in special ways via special keywords."
(and (bool/= (and (n/< y x) (n/< z y))
- (&;infix [#and x n/< y n/< z]))
+ (&.infix [#and x n/< y n/< z]))
(bool/= (and (n/< y x) (n/> z y))
- (&;infix [#and x n/< y n/> z]))))
+ (&.infix [#and x n/< y n/> z]))))
))))
diff --git a/stdlib/test/test/lux/math/logic/continuous.lux b/stdlib/test/test/lux/math/logic/continuous.lux
index 0bf2aabcf..68ddc376c 100644
--- a/stdlib/test/test/lux/math/logic/continuous.lux
+++ b/stdlib/test/test/lux/math/logic/continuous.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -9,25 +9,25 @@
(context: "Operations"
(<| (times +100)
(do @
- [left r;deg
- right r;deg]
+ [left r.deg
+ right r.deg]
($_ seq
(test "AND is the minimum."
- (let [result (&;~and left right)]
+ (let [result (&.~and left right)]
(and (d/<= left result)
(d/<= right result))))
(test "OR is the maximum."
- (let [result (&;~or left right)]
+ (let [result (&.~or left right)]
(and (d/>= left result)
(d/>= right result))))
(test "Double negation results in the original value."
- (d/= left (&;~not (&;~not left))))
+ (d/= left (&.~not (&.~not left))))
(test "Every value is equivalent to itself."
(and (d/>= left
- (&;~= left left))
+ (&.~= left left))
(d/>= right
- (&;~= right right))))
+ (&.~= right right))))
))))
diff --git a/stdlib/test/test/lux/math/logic/fuzzy.lux b/stdlib/test/test/lux/math/logic/fuzzy.lux
index 7be4d05f0..50423a973 100644
--- a/stdlib/test/test/lux/math/logic/fuzzy.lux
+++ b/stdlib/test/test/lux/math/logic/fuzzy.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -16,15 +16,15 @@
[(context: (format "[" <desc> "] " "Triangles")
(<| (times +100)
(do @
- [values (r;set <hash> +3 <gen>)
- #let [[x y z] (case (set;to-list values)
+ [values (r.set <hash> +3 <gen>)
+ #let [[x y z] (case (set.to-list values)
(^ (list x y z))
[x y z]
_
(undefined))]
sample <gen>
- #let [[bottom middle top] (case (list;sort <lt> (list x y z))
+ #let [[bottom middle top] (case (list.sort <lt> (list x y z))
(^ (list bottom middle top))
[bottom middle top]
@@ -33,40 +33,40 @@
triangle (<triangle> x y z)]]
($_ seq
(test "The middle value will always have maximum membership."
- (d/= ~true (&;membership middle triangle)))
+ (d/= ~true (&.membership middle triangle)))
(test "Boundary values will always have 0 membership."
- (and (d/= ~false (&;membership bottom triangle))
- (d/= ~false (&;membership top triangle))))
+ (and (d/= ~false (&.membership bottom triangle))
+ (d/= ~false (&.membership top triangle))))
(test "Values within range, will have membership > 0."
- (B/= (d/> ~false (&;membership sample triangle))
+ (B/= (d/> ~false (&.membership sample triangle))
(and (<gt> bottom sample)
(<lt> top sample))))
(test "Values outside of range, will have membership = 0."
- (B/= (d/= ~false (&;membership sample triangle))
+ (B/= (d/= ~false (&.membership sample triangle))
(or (<lte> bottom sample)
(<gte> top sample))))
))))]
- ["Frac" number;Hash<Frac> r;frac &;f/triangle f/< f/<= f/> f/>=]
- ["Deg" number;Hash<Deg> r;deg &;d/triangle d/< d/<= d/> d/>=]
+ ["Frac" number.Hash<Frac> r.frac &.f/triangle f/< f/<= f/> f/>=]
+ ["Deg" number.Hash<Deg> r.deg &.d/triangle d/< d/<= d/> d/>=]
)
(do-template [<desc> <hash> <gen> <trapezoid> <lt> <lte> <gt> <gte>]
[(context: (format "[" <desc> "] " "Trapezoids")
(<| (times +100)
(do @
- [values (r;set <hash> +4 <gen>)
- #let [[w x y z] (case (set;to-list values)
+ [values (r.set <hash> +4 <gen>)
+ #let [[w x y z] (case (set.to-list values)
(^ (list w x y z))
[w x y z]
_
(undefined))]
sample <gen>
- #let [[bottom middle-bottom middle-top top] (case (list;sort <lt> (list w x y z))
+ #let [[bottom middle-bottom middle-top top] (case (list.sort <lt> (list w x y z))
(^ (list bottom middle-bottom middle-top top))
[bottom middle-bottom middle-top top]
@@ -75,115 +75,115 @@
trapezoid (<trapezoid> w x y z)]]
($_ seq
(test "The middle values will always have maximum membership."
- (and (d/= ~true (&;membership middle-bottom trapezoid))
- (d/= ~true (&;membership middle-top trapezoid))))
+ (and (d/= ~true (&.membership middle-bottom trapezoid))
+ (d/= ~true (&.membership middle-top trapezoid))))
(test "Boundary values will always have 0 membership."
- (and (d/= ~false (&;membership bottom trapezoid))
- (d/= ~false (&;membership top trapezoid))))
+ (and (d/= ~false (&.membership bottom trapezoid))
+ (d/= ~false (&.membership top trapezoid))))
(test "Values within inner range will have membership = 1"
- (B/= (d/= ~true (&;membership sample trapezoid))
+ (B/= (d/= ~true (&.membership sample trapezoid))
(and (<gte> middle-bottom sample)
(<lte> middle-top sample))))
(test "Values within range, will have membership > 0."
- (B/= (d/> ~false (&;membership sample trapezoid))
+ (B/= (d/> ~false (&.membership sample trapezoid))
(and (<gt> bottom sample)
(<lt> top sample))))
(test "Values outside of range, will have membership = 0."
- (B/= (d/= ~false (&;membership sample trapezoid))
+ (B/= (d/= ~false (&.membership sample trapezoid))
(or (<lte> bottom sample)
(<gte> top sample))))
))))]
- ["Frac" number;Hash<Frac> r;frac &;f/trapezoid f/< f/<= f/> f/>=]
- ["Deg" number;Hash<Deg> r;deg &;d/trapezoid d/< d/<= d/> d/>=]
+ ["Frac" number.Hash<Frac> r.frac &.f/trapezoid f/< f/<= f/> f/>=]
+ ["Deg" number.Hash<Deg> r.deg &.d/trapezoid d/< d/<= d/> d/>=]
)
(context: "Gaussian"
(<| (times +100)
(do @
- [deviation (|> r;frac (r;filter (f/> 0.0)))
- center r;frac
- #let [gaussian (&;gaussian deviation center)]]
+ [deviation (|> r.frac (r.filter (f/> 0.0)))
+ center r.frac
+ #let [gaussian (&.gaussian deviation center)]]
(test "The center value will always have maximum membership."
- (d/= ~true (&;membership center gaussian))))))
+ (d/= ~true (&.membership center gaussian))))))
(def: gen-triangle
- (r;Random (&;Fuzzy Frac))
- (do r;Monad<Random>
- [x r;frac
- y r;frac
- z r;frac]
- (wrap (&;f/triangle x y z))))
+ (r.Random (&.Fuzzy Frac))
+ (do r.Monad<Random>
+ [x r.frac
+ y r.frac
+ z r.frac]
+ (wrap (&.f/triangle x y z))))
(context: "Combinators"
(<| (times +100)
(do @
[left gen-triangle
right gen-triangle
- sample r;frac]
+ sample r.frac]
($_ seq
(test "Union membership as as high as membership in any of its members."
- (let [combined (&;union left right)
- combined-membership (&;membership sample combined)]
- (and (d/>= (&;membership sample left)
+ (let [combined (&.union left right)
+ combined-membership (&.membership sample combined)]
+ (and (d/>= (&.membership sample left)
combined-membership)
- (d/>= (&;membership sample right)
+ (d/>= (&.membership sample right)
combined-membership))))
(test "Intersection membership as as low as membership in any of its members."
- (let [combined (&;intersection left right)
- combined-membership (&;membership sample combined)]
- (and (d/<= (&;membership sample left)
+ (let [combined (&.intersection left right)
+ combined-membership (&.membership sample combined)]
+ (and (d/<= (&.membership sample left)
combined-membership)
- (d/<= (&;membership sample right)
+ (d/<= (&.membership sample right)
combined-membership))))
(test "Complement membership is the opposite of normal membership."
- (d/= (&;membership sample left)
- (~not (&;membership sample (&;complement left)))))
+ (d/= (&.membership sample left)
+ (~not (&.membership sample (&.complement left)))))
(test "Membership in the difference will never be higher than in the set being subtracted."
- (B/= (d/> (&;membership sample right)
- (&;membership sample left))
- (d/< (&;membership sample left)
- (&;membership sample (&;difference left right)))))
+ (B/= (d/> (&.membership sample right)
+ (&.membership sample left))
+ (d/< (&.membership sample left)
+ (&.membership sample (&.difference left right)))))
))))
(context: "From predicates and sets"
(<| (times +100)
(do @
- [#let [set-10 (set;from-list number;Hash<Nat> (list;n/range +0 +10))]
- sample (|> r;nat (:: @ map (n/% +20)))]
+ [#let [set-10 (set.from-list number.Hash<Nat> (list.n/range +0 +10))]
+ sample (|> r.nat (:: @ map (n/% +20)))]
($_ seq
(test "Values that satisfy a predicate have membership = 1.
Values that don't have membership = 0."
- (B/= (d/= ~true (&;membership sample (&;from-predicate n/even?)))
+ (B/= (d/= ~true (&.membership sample (&.from-predicate n/even?)))
(n/even? sample)))
(test "Values that belong to a set have membership = 1.
Values that don't have membership = 0."
- (B/= (d/= ~true (&;membership sample (&;from-set set-10)))
- (set;member? set-10 sample)))
+ (B/= (d/= ~true (&.membership sample (&.from-set set-10)))
+ (set.member? set-10 sample)))
))))
(context: "Thresholds"
(<| (times +100)
(do @
[fuzzy gen-triangle
- sample r;frac
- threshold r;deg
- #let [vip-fuzzy (&;cut threshold fuzzy)
- member? (&;to-predicate threshold fuzzy)]]
+ sample r.frac
+ threshold r.deg
+ #let [vip-fuzzy (&.cut threshold fuzzy)
+ member? (&.to-predicate threshold fuzzy)]]
($_ seq
(test "Can increase the threshold of membership of a fuzzy set."
- (B/= (d/> ~false (&;membership sample vip-fuzzy))
- (d/> threshold (&;membership sample fuzzy))))
+ (B/= (d/> ~false (&.membership sample vip-fuzzy))
+ (d/> threshold (&.membership sample fuzzy))))
(test "Can turn fuzzy sets into predicates through a threshold."
(B/= (member? sample)
- (d/> threshold (&;membership sample fuzzy))))
+ (d/> threshold (&.membership sample fuzzy))))
))))
diff --git a/stdlib/test/test/lux/math/random.lux b/stdlib/test/test/lux/math/random.lux
index 5fc91db75..b5e305ff7 100644
--- a/stdlib/test/test/lux/math/random.lux
+++ b/stdlib/test/test/lux/math/random.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -17,40 +17,40 @@
(context: "Random."
(<| (times +100)
(do @
- [size (|> r;nat (:: @ map (|>> (n/% +100) (n/max +10))))
- _list (r;list size r;nat)
- _sequence (r;sequence size r;nat)
- _array (r;array size r;nat)
- _queue (r;queue size r;nat)
- _stack (r;stack size r;nat)
- _set (r;set number;Hash<Nat> size r;nat)
- _dict (r;dict number;Hash<Nat> size r;nat r;nat)
- top r;nat
- filtered (|> r;nat (r;filter (n/<= top)))
- shuffle-seed r;nat
- #let [sorted (|> _sequence sequence;to-list (list;sort n/<))
- shuffled (|> sorted sequence;from-list (r;shuffle shuffle-seed))
- re-sorted (|> shuffled sequence;to-list (list;sort n/<))]]
+ [size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +10))))
+ _list (r.list size r.nat)
+ _sequence (r.sequence size r.nat)
+ _array (r.array size r.nat)
+ _queue (r.queue size r.nat)
+ _stack (r.stack size r.nat)
+ _set (r.set number.Hash<Nat> size r.nat)
+ _dict (r.dict number.Hash<Nat> size r.nat r.nat)
+ top r.nat
+ filtered (|> r.nat (r.filter (n/<= top)))
+ shuffle-seed r.nat
+ #let [sorted (|> _sequence sequence.to-list (list.sort n/<))
+ shuffled (|> sorted sequence.from-list (r.shuffle shuffle-seed))
+ re-sorted (|> shuffled sequence.to-list (list.sort n/<))]]
($_ seq
(test "Can produce lists."
- (n/= size (list;size _list)))
+ (n/= size (list.size _list)))
(test "Can produce sequences."
- (n/= size (sequence;size _sequence)))
+ (n/= size (sequence.size _sequence)))
(test "Can produce arrays."
- (n/= size (array;size _array)))
+ (n/= size (array.size _array)))
(test "Can produce queues."
- (n/= size (queue;size _queue)))
+ (n/= size (queue.size _queue)))
(test "Can produce stacks."
- (n/= size (stack;size _stack)))
+ (n/= size (stack.size _stack)))
(test "Can produce sets."
- (n/= size (set;size _set)))
+ (n/= size (set.size _set)))
(test "Can produce dicts."
- (n/= size (dict;size _dict)))
+ (n/= size (dict.size _dict)))
(test "Can filter values."
(n/<= top filtered))
(test "Can shuffle sequences."
- (let [(^open "v/") (sequence;Eq<Sequence> number;Eq<Nat>)
- sorted (sequence;from-list sorted)]
+ (let [(^open "v/") (sequence.Eq<Sequence> number.Eq<Nat>)
+ sorted (sequence.from-list sorted)]
(and (not (v/= sorted shuffled))
- (v/= sorted (sequence;from-list re-sorted)))))
+ (v/= sorted (sequence.from-list re-sorted)))))
))))
diff --git a/stdlib/test/test/lux/time/date.lux b/stdlib/test/test/lux/time/date.lux
index 634984bbc..7d7ca03fe 100644
--- a/stdlib/test/test/lux/time/date.lux
+++ b/stdlib/test/test/lux/time/date.lux
@@ -1,35 +1,35 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
[pipe])
(data ["E" error])
(math ["r" random "r/" Monad<Random>])
- (time ["@;" instant]
+ (time ["@." instant]
["@" date]))
lux/test
- (test (lux (time ["_;" instant]))))
+ (test (lux (time ["_." instant]))))
(def: month
- (r;Random @;Month)
- (r;either (r;either (r;either (r/wrap #@;January)
- (r;either (r/wrap #@;February)
- (r/wrap #@;March)))
- (r;either (r/wrap #@;April)
- (r;either (r/wrap #@;May)
- (r/wrap #@;June))))
- (r;either (r;either (r/wrap #@;July)
- (r;either (r/wrap #@;August)
- (r/wrap #@;September)))
- (r;either (r/wrap #@;October)
- (r;either (r/wrap #@;November)
- (r/wrap #@;December))))))
+ (r.Random @.Month)
+ (r.either (r.either (r.either (r/wrap #@.January)
+ (r.either (r/wrap #@.February)
+ (r/wrap #@.March)))
+ (r.either (r/wrap #@.April)
+ (r.either (r/wrap #@.May)
+ (r/wrap #@.June))))
+ (r.either (r.either (r/wrap #@.July)
+ (r.either (r/wrap #@.August)
+ (r/wrap #@.September)))
+ (r.either (r/wrap #@.October)
+ (r.either (r/wrap #@.November)
+ (r/wrap #@.December))))))
(context: "(Month) Eq."
(<| (times +100)
(do @
[sample month
- #let [(^open "@/") @;Eq<Month>]]
+ #let [(^open "@/") @.Eq<Month>]]
(test "Every value equals itself."
(@/= sample sample)))))
@@ -38,7 +38,7 @@
(do @
[reference month
sample month
- #let [(^open "@/") @;Order<Month>]]
+ #let [(^open "@/") @.Order<Month>]]
(test "Valid Order."
(and (or (@/< reference sample)
(@/>= reference sample))
@@ -49,7 +49,7 @@
(<| (times +100)
(do @
[sample month
- #let [(^open "@/") @;Enum<Month>]]
+ #let [(^open "@/") @.Enum<Month>]]
(test "Valid Enum."
(and (not (@/= (@/succ sample)
sample))
@@ -59,20 +59,20 @@
(|> sample @/pred @/succ (@/= sample)))))))
(def: day
- (r;Random @;Day)
- (r;either (r;either (r;either (r/wrap #@;Sunday)
- (r/wrap #@;Monday))
- (r;either (r/wrap #@;Tuesday)
- (r/wrap #@;Wednesday)))
- (r;either (r;either (r/wrap #@;Thursday)
- (r/wrap #@;Friday))
- (r/wrap #@;Saturday))))
+ (r.Random @.Day)
+ (r.either (r.either (r.either (r/wrap #@.Sunday)
+ (r/wrap #@.Monday))
+ (r.either (r/wrap #@.Tuesday)
+ (r/wrap #@.Wednesday)))
+ (r.either (r.either (r/wrap #@.Thursday)
+ (r/wrap #@.Friday))
+ (r/wrap #@.Saturday))))
(context: "(Day) Eq."
(<| (times +100)
(do @
[sample day
- #let [(^open "@/") @;Eq<Day>]]
+ #let [(^open "@/") @.Eq<Day>]]
(test "Every value equals itself."
(@/= sample sample)))))
@@ -81,7 +81,7 @@
(do @
[reference day
sample day
- #let [(^open "@/") @;Order<Day>]]
+ #let [(^open "@/") @.Order<Day>]]
(test "Valid Order."
(and (or (@/< reference sample)
(@/>= reference sample))
@@ -92,7 +92,7 @@
(<| (times +100)
(do @
[sample day
- #let [(^open "@/") @;Enum<Day>]]
+ #let [(^open "@/") @.Enum<Day>]]
(test "Valid Enum."
(and (not (@/= (@/succ sample)
sample))
@@ -102,14 +102,14 @@
(|> sample @/pred @/succ (@/= sample)))))))
(def: #export date
- (r;Random @;Date)
- (|> _instant;instant (:: r;Monad<Random> map @instant;date)))
+ (r.Random @.Date)
+ (|> _instant.instant (:: r.Monad<Random> map @instant.date)))
(context: "(Date) Eq."
(<| (times +100)
(do @
[sample date
- #let [(^open "@/") @;Eq<Date>]]
+ #let [(^open "@/") @.Eq<Date>]]
(test "Every value equals itself."
(@/= sample sample)))))
@@ -118,7 +118,7 @@
(do @
[reference date
sample date
- #let [(^open "@/") @;Order<Date>]]
+ #let [(^open "@/") @.Order<Date>]]
(test "Valid Order."
(and (or (@/< reference sample)
(@/>= reference sample))
@@ -129,14 +129,14 @@
(<| (seed +1501531301120)
(do @
[sample date
- #let [(^open "@/") @;Eq<Date>
- (^open "@/") @;Codec<Text,Date>]]
+ #let [(^open "@/") @.Eq<Date>
+ (^open "@/") @.Codec<Text,Date>]]
(test "Can encode/decode dates."
(|> sample
@/encode
@/decode
- (pipe;case> (#E;Success decoded)
+ (pipe.case> (#E.Success decoded)
(@/= sample decoded)
- (#E;Error error)
+ (#E.Error error)
false))))))
diff --git a/stdlib/test/test/lux/time/duration.lux b/stdlib/test/test/lux/time/duration.lux
index e84ef6471..3529852a0 100644
--- a/stdlib/test/test/lux/time/duration.lux
+++ b/stdlib/test/test/lux/time/duration.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad])
@@ -8,21 +8,21 @@
lux/test)
(def: #export duration
- (r;Random @;Duration)
- (|> r;int (:: r;Monad<Random> map @;from-millis)))
+ (r.Random @.Duration)
+ (|> r.int (:: r.Monad<Random> map @.from-millis)))
(context: "Conversion."
(<| (times +100)
(do @
- [millis r;int]
+ [millis r.int]
(test "Can convert from/to milliseconds."
- (|> millis @;from-millis @;to-millis (i/= millis))))))
+ (|> millis @.from-millis @.to-millis (i/= millis))))))
(context: "Equality"
(<| (times +100)
(do @
[sample duration
- #let [(^open "@/") @;Eq<Duration>]]
+ #let [(^open "@/") @.Eq<Duration>]]
(test "Every duration equals itself."
(@/= sample sample)))))
@@ -31,7 +31,7 @@
(do @
[reference duration
sample duration
- #let [(^open "@/") @;Order<Duration>]]
+ #let [(^open "@/") @.Order<Duration>]]
(test "Can compare times."
(and (or (@/< reference sample)
(@/>= reference sample))
@@ -41,42 +41,42 @@
(context: "Arithmetic."
(<| (times +100)
(do @
- [sample (|> duration (:: @ map (@;frame @;day)))
+ [sample (|> duration (:: @ map (@.frame @.day)))
frame duration
- factor (|> r;int (:: @ map (|>> (i/% 10) (i/max 1))))
- #let [(^open "@/") @;Order<Duration>]]
+ factor (|> r.int (:: @ map (|>> (i/% 10) (i/max 1))))
+ #let [(^open "@/") @.Order<Duration>]]
($_ seq
(test "Can scale a duration."
- (|> sample (@;scale factor) (@;query sample) (i/= factor)))
+ (|> sample (@.scale factor) (@.query sample) (i/= factor)))
(test "Scaling a duration by one does not change it."
- (|> sample (@;scale 1) (@/= sample)))
+ (|> sample (@.scale 1) (@/= sample)))
(test "Merging with the empty duration changes nothing."
- (|> sample (@;merge @;empty) (@/= sample)))
+ (|> sample (@.merge @.empty) (@/= sample)))
(test "Merging a duration with it's opposite yields an empty duration."
- (|> sample (@;merge (@;scale -1 sample)) (@/= @;empty)))
+ (|> sample (@.merge (@.scale -1 sample)) (@/= @.empty)))
(test "Can frame a duration in terms of another."
- (cond (and (@;positive? frame) (@;positive? sample))
- (|> sample (@;frame frame) (@/< frame))
+ (cond (and (@.positive? frame) (@.positive? sample))
+ (|> sample (@.frame frame) (@/< frame))
- (and (@;negative? frame) (@;negative? sample))
- (|> sample (@;frame frame) (@/> frame))
+ (and (@.negative? frame) (@.negative? sample))
+ (|> sample (@.frame frame) (@/> frame))
- (or (or (@;neutral? frame) (@;neutral? sample))
+ (or (or (@.neutral? frame) (@.neutral? sample))
(|> sample
- (@;frame frame)
- (@;scale -1)
- (@/< (if (@;negative? frame)
- (@;scale -1 frame)
+ (@.frame frame)
+ (@.scale -1)
+ (@/< (if (@.negative? frame)
+ (@.scale -1 frame)
frame))))))))))
(context: "Codec"
(<| (times +100)
(do @
[sample duration
- #let [(^open "@/") @;Eq<Duration>
- (^open "@/") @;Codec<Text,Duration>]]
+ #let [(^open "@/") @.Eq<Duration>
+ (^open "@/") @.Codec<Text,Duration>]]
(test "Can encode/decode durations."
- (E;default false
- (do E;Monad<Error>
+ (E.default false
+ (do E.Monad<Error>
[decoded (|> sample @/encode @/decode)]
(wrap (@/= sample decoded))))))))
diff --git a/stdlib/test/test/lux/time/instant.lux b/stdlib/test/test/lux/time/instant.lux
index d56ef1062..a264e6155 100644
--- a/stdlib/test/test/lux/time/instant.lux
+++ b/stdlib/test/test/lux/time/instant.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -12,26 +12,26 @@
["@d" duration]
["@date" date]))
lux/test
- (// ["_;" duration]))
+ (// ["_." duration]))
(def: boundary Int 99_999_999_999_999)
(def: #export instant
- (r;Random @;Instant)
- (|> r;int (:: r;Monad<Random> map (|>> (i/% boundary) @;from-millis))))
+ (r.Random @.Instant)
+ (|> r.int (:: r.Monad<Random> map (|>> (i/% boundary) @.from-millis))))
(context: "Conversion."
(<| (times +100)
(do @
- [millis r;int]
+ [millis r.int]
(test "Can convert from/to milliseconds."
- (|> millis @;from-millis @;to-millis (i/= millis))))))
+ (|> millis @.from-millis @.to-millis (i/= millis))))))
(context: "Equality"
(<| (times +100)
(do @
[sample instant
- #let [(^open "@/") @;Eq<Instant>]]
+ #let [(^open "@/") @.Eq<Instant>]]
(test "Every instant equals itself."
(@/= sample sample)))))
@@ -40,7 +40,7 @@
(do @
[reference instant
sample instant
- #let [(^open "@/") @;Order<Instant>]]
+ #let [(^open "@/") @.Order<Instant>]]
(test "Can compare instants."
(and (or (@/< reference sample)
(@/>= reference sample))
@@ -51,7 +51,7 @@
(<| (times +100)
(do @
[sample instant
- #let [(^open "@/") @;Enum<Instant>]]
+ #let [(^open "@/") @.Enum<Instant>]]
(test "Valid Enum."
(and (not (@/= (@/succ sample)
sample))
@@ -64,32 +64,32 @@
(<| (times +100)
(do @
[sample instant
- span _duration;duration
- #let [(^open "@/") @;Eq<Instant>
- (^open "@d/") @d;Eq<Duration>]]
+ span _duration.duration
+ #let [(^open "@/") @.Eq<Instant>
+ (^open "@d/") @d.Eq<Duration>]]
($_ seq
(test "The span of a instant and itself has an empty duration."
- (|> sample (@;span sample) (@d/= @d;empty)))
+ (|> sample (@.span sample) (@d/= @d.empty)))
(test "Can shift a instant by a duration."
- (|> sample (@;shift span) (@;span sample) (@d/= span)))
+ (|> sample (@.shift span) (@.span sample) (@d/= span)))
(test "Can obtain the time-span between the epoch and an instant."
- (|> sample @;relative @;absolute (@/= sample)))
+ (|> sample @.relative @.absolute (@/= sample)))
(test "All instants are relative to the epoch."
- (|> @;epoch (@;shift (@;relative sample)) (@/= sample)))))))
+ (|> @.epoch (@.shift (@.relative sample)) (@/= sample)))))))
(context: "Codec"
(<| (seed +9863552679229274604)
## (times +100)
(do @
[sample instant
- #let [(^open "@/") @;Eq<Instant>
- (^open "@/") @;Codec<Text,Instant>]]
+ #let [(^open "@/") @.Eq<Instant>
+ (^open "@/") @.Codec<Text,Instant>]]
(test "Can encode/decode instants."
(|> sample
@/encode
@/decode
- (case> (#E;Success decoded)
+ (case> (#E.Success decoded)
(@/= sample decoded)
- (#E;Error error)
+ (#E.Error error)
false))))))
diff --git a/stdlib/test/test/lux/type/implicit.lux b/stdlib/test/test/lux/type/implicit.lux
index 662c2df80..a4dee260e 100644
--- a/stdlib/test/test/lux/type/implicit.lux
+++ b/stdlib/test/test/lux/type/implicit.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do Monad]
@@ -15,24 +15,24 @@
(context: "Automatic structure selection"
(<| (times +100)
(do @
- [x r;nat
- y r;nat]
+ [x r.nat
+ y r.nat]
($_ seq
(test "Can automatically select first-order structures."
- (let [(^open "list/") (list;Eq<List> number;Eq<Nat>)]
- (and (bool/= (:: number;Eq<Nat> = x y)
+ (let [(^open "list/") (list.Eq<List> number.Eq<Nat>)]
+ (and (bool/= (:: number.Eq<Nat> = x y)
(::: = x y))
- (list/= (list;n/range +1 +10)
- (::: map n/inc (list;n/range +0 +9)))
+ (list/= (list.n/range +1 +10)
+ (::: map n/inc (list.n/range +0 +9)))
)))
(test "Can automatically select second-order structures."
(::: =
- (list;n/range +1 +10)
- (list;n/range +1 +10)))
+ (list.n/range +1 +10)
+ (list.n/range +1 +10)))
(test "Can automatically select third-order structures."
- (let [lln (::: map (list;n/range +1)
- (list;n/range +1 +10))]
+ (let [lln (::: map (list.n/range +1)
+ (list.n/range +1 +10))]
(::: = lln lln)))
))))
diff --git a/stdlib/test/test/lux/type/object.lux b/stdlib/test/test/lux/type/object.lux
index 4884f342a..7ca601792 100644
--- a/stdlib/test/test/lux/type/object.lux
+++ b/stdlib/test/test/lux/type/object.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux (data (coll [list]))
(type object)))
@@ -37,10 +37,10 @@
(List a)
(def: (add elem)
- (update@Collection (|>> (#;Cons elem))))
+ (update@Collection (|>> (#.Cons elem))))
(def: size
- (|>> get@Collection list;size)))
+ (|>> get@Collection list.size)))
(interface: (Iterable a)
#super (Collection a)
diff --git a/stdlib/test/test/lux/world/blob.lux b/stdlib/test/test/lux/world/blob.lux
index c478818c0..bd185d16f 100644
--- a/stdlib/test/test/lux/world/blob.lux
+++ b/stdlib/test/test/lux/world/blob.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do]
@@ -11,99 +11,99 @@
lux/test)
(def: (succeed result)
- (-> (e;Error Bool) Bool)
+ (-> (e.Error Bool) Bool)
(case result
- (#e;Error _)
+ (#e.Error _)
false
- (#e;Success output)
+ (#e.Success output)
output))
(def: #export (blob size)
- (-> Nat (r;Random @;Blob))
- (let [blob (@;create size)]
- (do r;Monad<Random>
+ (-> Nat (r.Random @.Blob))
+ (let [blob (@.create size)]
+ (do r.Monad<Random>
[]
(loop [idx +0]
(if (n/< size idx)
(do @
- [byte r;nat]
- (exec (e;assume (@;write-8 idx byte blob))
+ [byte r.nat]
+ (exec (e.assume (@.write-8 idx byte blob))
(recur (n/inc idx))))
(wrap blob))))))
(context: "Blob."
(<| (times +100)
(do @
- [blob-size (|> r;nat (:: @ map (|>> (n/% +100) (n/max +8))))
+ [blob-size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +8))))
random-blob (blob blob-size)
- #let [clean-blob (@;create blob-size)
- size (@;size clean-blob)]
- value r;nat
- idx (|> r;nat (:: @ map (n/% size)))
- [from to] (|> (r;list +2 (|> r;nat (:: @ map (n/% size))))
+ #let [clean-blob (@.create blob-size)
+ size (@.size clean-blob)]
+ value r.nat
+ idx (|> r.nat (:: @ map (n/% size)))
+ [from to] (|> (r.list +2 (|> r.nat (:: @ map (n/% size))))
(:: @ map
- (|>> (list;sort n/<)
- (pipe;case> (^ (list from to))
+ (|>> (list.sort n/<)
+ (pipe.case> (^ (list from to))
[from to]
_
(undefined)))))
- #let [value-8 (n/% (bit;shift-left +8 +1) value)
- value-16 (n/% (bit;shift-left +16 +1) value)
- value-32 (n/% (bit;shift-left +32 +1) value)
+ #let [value-8 (n/% (bit.shift-left +8 +1) value)
+ value-16 (n/% (bit.shift-left +16 +1) value)
+ value-32 (n/% (bit.shift-left +32 +1) value)
value-64 value
slice-size (|> to (n/- from) n/inc)
- random-slice (e;assume (@;slice from to random-blob))]]
+ random-slice (e.assume (@.slice from to random-blob))]]
($_ seq
(test "Has equality."
- (and (:: @;Eq<Blob> = clean-blob clean-blob)
- (:: @;Eq<Blob> =
- (e;assume (@;slice from to clean-blob))
- (e;assume (@;slice from to clean-blob)))))
+ (and (:: @.Eq<Blob> = clean-blob clean-blob)
+ (:: @.Eq<Blob> =
+ (e.assume (@.slice from to clean-blob))
+ (e.assume (@.slice from to clean-blob)))))
(test "Can get size of blob."
(n/= blob-size size))
(test "Can read/write 8-bit values."
(succeed
- (do e;Monad<Error>
- [_ (@;write-8 idx value-8 clean-blob)
- output-8 (@;read-8 idx clean-blob)]
+ (do e.Monad<Error>
+ [_ (@.write-8 idx value-8 clean-blob)
+ output-8 (@.read-8 idx clean-blob)]
(wrap (n/= value-8 output-8)))))
(test "Can read/write 16-bit values."
(or (n/>= size (n/+ +1 idx))
(succeed
- (do e;Monad<Error>
- [_ (@;write-16 idx value-16 clean-blob)
- output-16 (@;read-16 idx clean-blob)]
+ (do e.Monad<Error>
+ [_ (@.write-16 idx value-16 clean-blob)
+ output-16 (@.read-16 idx clean-blob)]
(wrap (n/= value-16 output-16))))))
(test "Can read/write 32-bit values."
(or (n/>= size (n/+ +3 idx))
(succeed
- (do e;Monad<Error>
- [_ (@;write-32 idx value-32 clean-blob)
- output-32 (@;read-32 idx clean-blob)]
+ (do e.Monad<Error>
+ [_ (@.write-32 idx value-32 clean-blob)
+ output-32 (@.read-32 idx clean-blob)]
(wrap (n/= value-32 output-32))))))
(test "Can read/write 64-bit values."
(or (n/>= size (n/+ +7 idx))
(succeed
- (do e;Monad<Error>
- [_ (@;write-64 idx value-64 clean-blob)
- output-64 (@;read-64 idx clean-blob)]
+ (do e.Monad<Error>
+ [_ (@.write-64 idx value-64 clean-blob)
+ output-64 (@.read-64 idx clean-blob)]
(wrap (n/= value-64 output-64))))))
(test "Can slice blobs."
- (and (n/= slice-size (@;size random-slice))
+ (and (n/= slice-size (@.size random-slice))
(loop [idx +0]
(let [loop-recur recur]
(if (n/< slice-size idx)
(and (succeed
- (do e;Monad<Error>
- [reference (@;read-8 (n/+ from idx) random-blob)
- sample (@;read-8 idx random-slice)]
+ (do e.Monad<Error>
+ [reference (@.read-8 (n/+ from idx) random-blob)
+ sample (@.read-8 idx random-slice)]
(wrap (n/= reference sample))))
(loop-recur (n/inc idx)))
true)))))
(test "Slicing the whole blob does not change anything."
- (:: @;Eq<Blob> =
+ (:: @.Eq<Blob> =
random-blob
- (e;assume (@;slice +0 (n/dec blob-size) random-blob))))
+ (e.assume (@.slice +0 (n/dec blob-size) random-blob))))
))))
diff --git a/stdlib/test/test/lux/world/file.lux b/stdlib/test/test/lux/world/file.lux
index b33978531..1721c8cbb 100644
--- a/stdlib/test/test/lux/world/file.lux
+++ b/stdlib/test/test/lux/world/file.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do])
@@ -14,149 +14,149 @@
[blob])
["r" math/random])
lux/test
- (// ["_;" blob]))
+ (// ["_." blob]))
(def: truncate-millis
(|>> (i// 1_000) (i/* 1_000)))
(context: "File system."
(do @
- [file-size (|> r;nat (:: @ map (|>> (n/% +100) (n/max +10))))
- dataL (_blob;blob file-size)
- dataR (_blob;blob file-size)
- code r;nat
- last-modified (|> r;int (:: @ map (|>> (:: number;Number<Int> abs)
+ [file-size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +10))))
+ dataL (_blob.blob file-size)
+ dataR (_blob.blob file-size)
+ code r.nat
+ last-modified (|> r.int (:: @ map (|>> (:: number.Number<Int> abs)
truncate-millis
- d;from-millis
- i;absolute)))]
+ d.from-millis
+ i.absolute)))]
($_ seq
- (wrap (do P;Monad<Promise>
+ (wrap (do P.Monad<Promise>
[#let [file (format "temp_file_" (%n (n/+ +0 code)))]
- result (do T;Monad<Task>
- [pre (@;exists? file)
- _ (@;write dataL file)
- post (@;exists? file)
- deleted? (@;delete file)
- remains? (@;exists? file)]
+ result (do T.Monad<Task>
+ [pre (@.exists? file)
+ _ (@.write dataL file)
+ post (@.exists? file)
+ deleted? (@.delete file)
+ remains? (@.exists? file)]
(wrap (and (not pre) post
deleted? (not remains?))))]
(assert "Can create/delete files."
- (E;default false result))))
- (wrap (do P;Monad<Promise>
+ (E.default false result))))
+ (wrap (do P.Monad<Promise>
[#let [file (format "temp_file_" (%n (n/+ +1 code)))]
- result (do T;Monad<Task>
- [_ (@;write dataL file)
- output (@;read file)
- _ (@;delete file)]
- (wrap (:: blob;Eq<Blob> = dataL output)))]
+ result (do T.Monad<Task>
+ [_ (@.write dataL file)
+ output (@.read file)
+ _ (@.delete file)]
+ (wrap (:: blob.Eq<Blob> = dataL output)))]
(assert "Can write/read files."
- (E;default false result))))
- (wrap (do P;Monad<Promise>
+ (E.default false result))))
+ (wrap (do P.Monad<Promise>
[#let [file (format "temp_file_" (%n (n/+ +2 code)))]
- result (do T;Monad<Task>
- [_ (@;write dataL file)
- read-size (@;size file)
- _ (@;delete file)]
+ result (do T.Monad<Task>
+ [_ (@.write dataL file)
+ read-size (@.size file)
+ _ (@.delete file)]
(wrap (n/= file-size read-size)))]
(assert "Can read file size."
- (E;default false result))))
- (wrap (do P;Monad<Promise>
+ (E.default false result))))
+ (wrap (do P.Monad<Promise>
[#let [file (format "temp_file_" (%n (n/+ +3 code)))]
- result (do T;Monad<Task>
- [_ (@;write dataL file)
- _ (@;append dataR file)
- output (@;read file)
- read-size (@;size file)
- _ (@;delete file)]
+ result (do T.Monad<Task>
+ [_ (@.write dataL file)
+ _ (@.append dataR file)
+ output (@.read file)
+ read-size (@.size file)
+ _ (@.delete file)]
(wrap (and (n/= (n/* +2 file-size) read-size)
- (:: blob;Eq<Blob> = dataL (E;assume (blob;slice +0 (n/dec file-size) output)))
- (:: blob;Eq<Blob> = dataR (E;assume (blob;slice file-size (n/dec read-size) output))))))]
+ (:: blob.Eq<Blob> = dataL (E.assume (blob.slice +0 (n/dec file-size) output)))
+ (:: blob.Eq<Blob> = dataR (E.assume (blob.slice file-size (n/dec read-size) output))))))]
(assert "Can append to files."
- (E;default false result))))
- (wrap (do P;Monad<Promise>
+ (E.default false result))))
+ (wrap (do P.Monad<Promise>
[#let [dir (format "temp_dir_" (%n (n/+ +4 code)))]
- result (do T;Monad<Task>
- [pre (@;exists? dir)
- _ (@;make-dir dir)
- post (@;exists? dir)
- deleted? (@;delete dir)
- remains? (@;exists? dir)]
+ result (do T.Monad<Task>
+ [pre (@.exists? dir)
+ _ (@.make-dir dir)
+ post (@.exists? dir)
+ deleted? (@.delete dir)
+ remains? (@.exists? dir)]
(wrap (and (not pre) post
deleted? (not remains?))))]
(assert "Can create/delete directories."
- (E;default false result))))
- (wrap (do P;Monad<Promise>
+ (E.default false result))))
+ (wrap (do P.Monad<Promise>
[#let [file (format "temp_file_" (%n (n/+ +5 code)))
dir (format "temp_dir_" (%n (n/+ +5 code)))]
- result (do T;Monad<Task>
- [_ (@;write dataL file)
- file-is-file (@;file? file)
- file-is-directory (@;directory? file)
- _ (@;delete file)
- _ (@;make-dir dir)
- directory-is-file (@;file? dir)
- directory-is-directory (@;directory? dir)
- _ (@;delete dir)]
+ result (do T.Monad<Task>
+ [_ (@.write dataL file)
+ file-is-file (@.file? file)
+ file-is-directory (@.directory? file)
+ _ (@.delete file)
+ _ (@.make-dir dir)
+ directory-is-file (@.file? dir)
+ directory-is-directory (@.directory? dir)
+ _ (@.delete dir)]
(wrap (and file-is-file (not file-is-directory)
(not directory-is-file) directory-is-directory)))]
(assert "Can differentiate files from directories."
- (E;default false result))))
- (wrap (do P;Monad<Promise>
+ (E.default false result))))
+ (wrap (do P.Monad<Promise>
[#let [file (format "temp_file_" (%n (n/+ +6 code)))
dir (format "temp_dir_" (%n (n/+ +6 code)))]
- result (do T;Monad<Task>
- [_ (@;make-dir dir)
+ result (do T.Monad<Task>
+ [_ (@.make-dir dir)
#let [file' (format dir "/" file)]
- _ (@;write dataL file')
- read-size (@;size file')
- deleted-file (@;delete file')
- deleted-dir (@;delete dir)]
+ _ (@.write dataL file')
+ read-size (@.size file')
+ deleted-file (@.delete file')
+ deleted-dir (@.delete dir)]
(wrap (and (n/= file-size read-size)
deleted-file
deleted-dir)))]
(assert "Can create files inside of directories."
- (E;default false result))))
- (wrap (do P;Monad<Promise>
+ (E.default false result))))
+ (wrap (do P.Monad<Promise>
[#let [file (format "temp_file_" (%n (n/+ +7 code)))
dir (format "temp_dir_" (%n (n/+ +7 code)))]
- result (do T;Monad<Task>
- [_ (@;make-dir dir)
+ result (do T.Monad<Task>
+ [_ (@.make-dir dir)
#let [file' (format dir "/" file)]
- _ (@;write dataL file')
- children (@;files dir)
- _ (@;delete file')
- _ (@;delete dir)]
+ _ (@.write dataL file')
+ children (@.files dir)
+ _ (@.delete file')
+ _ (@.delete dir)]
(wrap (case children
(^ (list child))
- (text;ends-with? file' child)
+ (text.ends-with? file' child)
_
false)))]
(assert "Can list files inside a directory."
- (E;default false result))))
- (wrap (do P;Monad<Promise>
+ (E.default false result))))
+ (wrap (do P.Monad<Promise>
[#let [file (format "temp_file_" (%n (n/+ +8 code)))]
- result (do T;Monad<Task>
- [_ (@;write dataL file)
- was-modified? (@;set-last-modified last-modified file)
- time-read (@;get-last-modified file)
- _ (@;delete file)]
+ result (do T.Monad<Task>
+ [_ (@.write dataL file)
+ was-modified? (@.set-last-modified last-modified file)
+ time-read (@.get-last-modified file)
+ _ (@.delete file)]
(wrap (and was-modified?
- (:: i;Eq<Instant> = last-modified time-read))))]
+ (:: i.Eq<Instant> = last-modified time-read))))]
(assert "Can change the time of last modification."
- (E;default false result))))
- (wrap (do P;Monad<Promise>
+ (E.default false result))))
+ (wrap (do P.Monad<Promise>
[#let [file0 (format "temp_file_" (%n (n/+ +9 code)) "0")
file1 (format "temp_file_" (%n (n/+ +9 code)) "1")]
- result (do T;Monad<Task>
- [_ (@;write dataL file0)
- pre (@;exists? file0)
- moved? (@;move file1 file0)
- post (@;exists? file0)
- confirmed? (@;exists? file1)
- deleted? (@;delete file1)]
+ result (do T.Monad<Task>
+ [_ (@.write dataL file0)
+ pre (@.exists? file0)
+ moved? (@.move file1 file0)
+ post (@.exists? file0)
+ confirmed? (@.exists? file1)
+ deleted? (@.delete file1)]
(wrap (and pre moved? (not post)
confirmed? deleted?)))]
(assert "Can move a file from one path to another."
- (E;default false result))))
+ (E.default false result))))
)))
diff --git a/stdlib/test/test/lux/world/net/tcp.lux b/stdlib/test/test/lux/world/net/tcp.lux
index a57ab0544..785b1a66b 100644
--- a/stdlib/test/test/lux/world/net/tcp.lux
+++ b/stdlib/test/test/lux/world/net/tcp.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do]
@@ -14,57 +14,57 @@
(net ["@" tcp]))
["r" math/random])
lux/test
- (/// ["_;" blob]))
+ (/// ["_." blob]))
-(def: localhost net;Address "127.0.0.1")
+(def: localhost net.Address "127.0.0.1")
(def: port
- (r;Random net;Port)
- (|> r;nat
- (:: r;Monad<Random> map
+ (r.Random net.Port)
+ (|> r.nat
+ (:: r.Monad<Random> map
(|>> (n/% +1000)
(n/+ +8000)))))
(exception: Empty-Channel)
(def: (head channel)
- (All [a] (-> (frp;Channel a) (T;Task a)))
- (do P;Monad<Promise>
+ (All [a] (-> (frp.Channel a) (T.Task a)))
+ (do P.Monad<Promise>
[head+tail channel]
(case head+tail
- (#;Some [head tail])
- (wrap (ex;return head))
+ (#.Some [head tail])
+ (wrap (ex.return head))
- #;None
- (wrap (ex;throw Empty-Channel "")))))
+ #.None
+ (wrap (ex.throw Empty-Channel "")))))
(context: "TCP networking."
(do @
- [port ;;port
- size (|> r;nat (:: @ map (|>> (n/% +100) (n/max +10))))
- from (_blob;blob size)
- to (_blob;blob size)
- #let [temp (blob;create size)]]
+ [port ..port
+ size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +10))))
+ from (_blob.blob size)
+ to (_blob.blob size)
+ #let [temp (blob.create size)]]
($_ seq
- (wrap (do P;Monad<Promise>
- [result (do T;Monad<Task>
- [server (@;server port)
- client (@;client localhost port)
+ (wrap (do P.Monad<Promise>
+ [result (do T.Monad<Task>
+ [server (@.server port)
+ client (@.client localhost port)
####################
- _ (@;write from +0 size client)
+ _ (@.write from +0 size client)
socket (head server)
- bytes-from (@;read temp +0 size socket)
+ bytes-from (@.read temp +0 size socket)
#let [from-worked? (and (n/= size bytes-from)
- (:: blob;Eq<Blob> = from temp))]
+ (:: blob.Eq<Blob> = from temp))]
####################
- _ (@;write to +0 size socket)
- bytes-to (@;read temp +0 size client)
+ _ (@.write to +0 size socket)
+ bytes-to (@.read temp +0 size client)
#let [to-worked? (and (n/= size bytes-to)
- (:: blob;Eq<Blob> = to temp))]
+ (:: blob.Eq<Blob> = to temp))]
####################
- _ (@;close client)
- _ (T;from-promise (P;future (frp;close server)))]
+ _ (@.close client)
+ _ (T.from-promise (P.future (frp.close server)))]
(wrap (and from-worked?
to-worked?)))]
(assert "Can communicate between client and server."
- (E;default false result))))
+ (E.default false result))))
)))
diff --git a/stdlib/test/test/lux/world/net/udp.lux b/stdlib/test/test/lux/world/net/udp.lux
index cc3ad6fc7..aa600e0b5 100644
--- a/stdlib/test/test/lux/world/net/udp.lux
+++ b/stdlib/test/test/lux/world/net/udp.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux [io]
(control [monad #+ do]
@@ -14,57 +14,57 @@
(net ["@" udp]))
["r" math/random])
lux/test
- (/// ["_;" blob]))
+ (/// ["_." blob]))
-(def: localhost net;Address "127.0.0.1")
+(def: localhost net.Address "127.0.0.1")
(def: port
- (r;Random net;Port)
- (|> r;nat
- (:: r;Monad<Random> map
+ (r.Random net.Port)
+ (|> r.nat
+ (:: r.Monad<Random> map
(|>> (n/% +1000)
(n/+ +8000)))))
(exception: Empty-Channel)
(def: (head channel)
- (All [a] (-> (frp;Channel a) (T;Task a)))
- (do P;Monad<Promise>
+ (All [a] (-> (frp.Channel a) (T.Task a)))
+ (do P.Monad<Promise>
[head+tail channel]
(case head+tail
- (#;Some [head tail])
- (wrap (ex;return head))
+ (#.Some [head tail])
+ (wrap (ex.return head))
- #;None
- (wrap (ex;throw Empty-Channel "")))))
+ #.None
+ (wrap (ex.throw Empty-Channel "")))))
(context: "UDP networking."
(do @
- [port ;;port
- size (|> r;nat (:: @ map (|>> (n/% +100) (n/max +10))))
- from (_blob;blob size)
- to (_blob;blob size)
- #let [temp (blob;create size)]]
+ [port ..port
+ size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +10))))
+ from (_blob.blob size)
+ to (_blob.blob size)
+ #let [temp (blob.create size)]]
($_ seq
- (wrap (do P;Monad<Promise>
- [result (do T;Monad<Task>
- [server (@;server port)
- client (@;client [])
+ (wrap (do P.Monad<Promise>
+ [result (do T.Monad<Task>
+ [server (@.server port)
+ client (@.client [])
####################
- _ (@;write localhost port from +0 size client)
- [bytes-from from-address from-port] (@;read temp +0 size server)
+ _ (@.write localhost port from +0 size client)
+ [bytes-from from-address from-port] (@.read temp +0 size server)
#let [from-worked? (and (n/= size bytes-from)
- (:: blob;Eq<Blob> = from temp))]
+ (:: blob.Eq<Blob> = from temp))]
####################
- _ (@;write from-address from-port to +0 size server)
- [bytes-to to-address to-port] (@;read temp +0 size client)
+ _ (@.write from-address from-port to +0 size server)
+ [bytes-to to-address to-port] (@.read temp +0 size client)
#let [to-worked? (and (n/= size bytes-to)
- (:: blob;Eq<Blob> = to temp)
+ (:: blob.Eq<Blob> = to temp)
(n/= port to-port))]
####################
- _ (@;close client)
- _ (@;close server)]
+ _ (@.close client)
+ _ (@.close server)]
(wrap (and from-worked?
to-worked?)))]
(assert "Can communicate between client and server."
- (E;default false result))))
+ (E.default false result))))
)))
diff --git a/stdlib/test/tests.lux b/stdlib/test/tests.lux
index 26dfa0ac7..2efff3c71 100644
--- a/stdlib/test/tests.lux
+++ b/stdlib/test/tests.lux
@@ -1,81 +1,80 @@
-(;module:
+(.module:
lux
(lux (control monad)
[io]
(concurrency [promise])
[cli #+ program:]
[test])
- (test ["_;" lux]
- (lux ["_;" cli]
- ["_;" host]
- ["_;" io]
- (time ["_;" instant]
- ["_;" duration]
- ["_;" date])
- (concurrency ["_;" actor]
- ["_;" space]
- ["_;" atom]
- ["_;" frp]
- ["_;" promise]
- ["_;" stm])
- (control ["_;" exception]
- ["_;" interval]
- ["_;" pipe]
- ["_;" cont]
- ["_;" reader]
- ["_;" writer]
- ["_;" state]
- ["_;" parser])
- (data ["_;" bit]
- ["_;" bool]
- ["_;" error]
- ["_;" ident]
- ["_;" identity]
- ["_;" maybe]
- ["_;" number]
- ["_;" product]
- ["_;" sum]
- ["_;" text]
- ["_;" lazy]
- ["_;" color]
- (number ["_;" ratio]
- ["_;" complex])
- (format ["_;" json]
- ["_;" xml])
- (coll ["_;" array]
- ["_;" dict]
- ["_;" list]
- ["_;" queue]
- ["_;" set]
- ["_;" stack]
- ["_;" sequence]
- ["_;" priority-queue]
- ["_;" stream]
- (tree ["tree_;" rose]
- ["tree_;" zipper])
- (ordered ["ordered_;" dict]
- ["ordered_;" set]))
- (text ["_;" format]
- ["_;" lexer]
- ["_;" regex]))
- ["_;" math]
- (math ["_;" random]
- (logic ["_;" continuous]
- ["_;" fuzzy]))
- (macro ["_;" code]
- ["_;" syntax]
- (poly ["poly_;" eq]
- ["poly_;" functor]))
- (type ["_;" implicit]
- ["_;" object])
- (lang ["lang_;" syntax]
- ["_;" type]
- (type ["_;" check]))
- (world ["_;" blob]
- ["_;" file]
- (net ["_;" tcp]
- ["_;" udp]))
- ))
+ (test ["_." lux]
+ (lux ["_." cli]
+ ["_." host]
+ ["_." io]
+ (time ["_." instant]
+ ["_." duration]
+ ["_." date])
+ (concurrency ["_." actor]
+ ["_." space]
+ ["_." atom]
+ ["_." frp]
+ ["_." promise]
+ ["_." stm])
+ (control ["_." exception]
+ ["_." interval]
+ ["_." pipe]
+ ["_." cont]
+ ["_." reader]
+ ["_." writer]
+ ["_." state]
+ ["_." parser])
+ (data ["_." bit]
+ ["_." bool]
+ ["_." error]
+ ["_." ident]
+ ["_." identity]
+ ["_." maybe]
+ ["_." number]
+ ["_." product]
+ ["_." sum]
+ ["_." text]
+ ["_." lazy]
+ ["_." color]
+ (number ["_." ratio]
+ ["_." complex])
+ (format ["_." json]
+ ["_." xml])
+ (coll ["_." array]
+ ["_." dict]
+ ["_." list]
+ ["_." queue]
+ ["_." set]
+ ["_." stack]
+ ["_." sequence]
+ ["_." priority-queue]
+ ["_." stream]
+ (tree ["tree_." rose]
+ ["tree_." zipper])
+ (ordered ["ordered_." dict]
+ ["ordered_." set]))
+ (text ["_." format]
+ ["_." lexer]
+ ["_." regex]))
+ ["_." math]
+ (math ["_." random]
+ (logic ["_." continuous]
+ ["_." fuzzy]))
+ (macro ["_." code]
+ ["_." syntax]
+ (poly ["poly_." eq]
+ ["poly_." functor]))
+ (type ["_." implicit]
+ ["_." object])
+ (lang ["lang_." syntax]
+ ["_." type]
+ (type ["_." check]))
+ (world ["_." blob]
+ ["_." file]
+ (net ["_." tcp]
+ ["_." udp]))))
(lux (control [contract]
[concatenative])
(concurrency [space])
@@ -86,7 +85,7 @@
(format [context]
[html]
[css])
- (coll (tree ["tree_;" parser])))
+ (coll (tree ["tree_." parser])))
(math [random])
[macro]
(type [unit])
@@ -95,4 +94,4 @@
)
(program: args
- (test;run))
+ (test.run))