diff options
author | Eduardo Julian | 2016-12-02 21:39:11 -0400 |
---|---|---|
committer | Eduardo Julian | 2016-12-02 21:39:11 -0400 |
commit | 60d3952d9550cc4d6fd0f5fc8312104b21024799 (patch) | |
tree | 9f73d65b332e87214267055bc71e8e1be593688d /stdlib/test/test/lux.lux | |
parent | 55e411f34d81d8deb0b7d0e25c987dbe16035354 (diff) |
- Changed the names of math op functions to make them more consistent and similar.
Diffstat (limited to '')
-rw-r--r-- | stdlib/test/test/lux.lux | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index f507e1e9a..a9f638c73 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -15,7 +15,7 @@ (macro ["s" syntax #+ syntax:]))) (test: "Value identity." - [size (|> R;nat (:: @ map (|>. (%+ +100) (max+ +10)))) + [size (|> R;nat (:: @ map (|>. (n.% +100) (n.max +10)))) x (R;text size) y (R;text size)] ($_ seq @@ -47,8 +47,8 @@ (and (|> value inc even?) (|> value dec even?)))))] - ["Nat" R;nat inc+ dec+ even?+ odd?+ =+ <+ >+] - ["Int" R;int inc dec even? odd? = < >] + ["Nat" R;nat n.inc n.dec n.even? n.odd? n.= n.< n.>] + ["Int" R;int i.inc i.dec i.even? i.odd? i.= i.< i.>] ) (do-template [category rand-gen = < > <= >= min max] @@ -71,10 +71,10 @@ (>= y (max x y))) )))] - ["Int" R;int = < > <= >= min max] - ["Nat" R;nat =+ <+ >+ <=+ >=+ min+ max+] - ["Real" R;real =. <. >. <=. >=. min. max.] - ["Frac" R;frac =.. <.. >.. <=.. >=.. min.. max..] + ["Int" R;int i.= i.< i.> i.<= i.>= i.min i.max] + ["Nat" R;nat n.= n.< n.> n.<= n.>= n.min n.max] + ["Real" R;real r.= r.< r.> r.<= r.>= r.min r.max] + ["Frac" R;frac f.= f.< f.> f.<= f.>= f.min f.max] ) (do-template [category rand-gen = + - * / <%> > <0> <1> <10> %x <cap> <prep>] @@ -120,9 +120,9 @@ (|> x' (/ y) (* y) (= x'))) ))] - ["Nat" R;nat =+ ++ -+ *+ /+ ;%+ >+ +0 +1 +1000000 %n (;%+ +1000) id] - ["Int" R;int = + - * / ;% > 0 1 1000000 %i (;% 1000) id] - ["Real" R;real =. +. -. *. /. ;%. >. 0.0 1.0 1000000.0 %r id math;floor] + ["Nat" R;nat n.= n.+ n.- n.* n./ n.% n.> +0 +1 +1000000 %n (n.% +1000) id] + ["Int" R;int i.= i.+ i.- i.* i./ i.% i.> 0 1 1000000 %i (i.% 1000) id] + ["Real" R;real r.= r.+ r.- r.* r./ r.% r.> 0.0 1.0 1000000.0 %r id math;floor] ) (do-template [category rand-gen -> <- = <cap> %a %z] @@ -132,22 +132,22 @@ (assert "" (|> value -> <- (= value))))] - ["Int->Nat" R;int int-to-nat nat-to-int = (;% 1000000) %i %n] - ["Nat->Int" R;nat nat-to-int int-to-nat =+ (;%+ +1000000) %n %i] - ["Int->Real" R;int int-to-real real-to-int = (;% 1000000) %i %r] - ["Real->Int" R;real real-to-int int-to-real =. math;floor %r %i] - ## [R;real real-to-frac frac-to-real =. (;%. 1.0) %r %f] + ["Int->Nat" R;int int-to-nat nat-to-int i.= (i.% 1000000) %i %n] + ["Nat->Int" R;nat nat-to-int int-to-nat n.= (n.% +1000000) %n %i] + ["Int->Real" R;int int-to-real real-to-int i.= (i.% 1000000) %i %r] + ["Real->Int" R;real real-to-int int-to-real r.= math;floor %r %i] + ## [R;real real-to-frac frac-to-real r.= (r.% 1.0) %r %f] ) (test: "Simple macros and constructs" ($_ seq (assert "Can write easy loops for iterative programming." - (= 1000 - (loop [counter 0 - value 1] - (if (< 3 counter) - (recur (inc counter) (* 10 value)) - value)))) + (i.= 1000 + (loop [counter 0 + value 1] + (if (i.< 3 counter) + (recur (i.inc counter) (i.* 10 value)) + value)))) (assert "Can create lists easily through macros." (and (case (list 1 2 3) |