From 0765ddaa5dfebba732c06ac563df0e55d08fc6fc Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 28 Jan 2017 22:21:58 -0400 Subject: - Some refactorings. --- stdlib/source/lux/data/text/format.lux | 2 +- stdlib/source/lux/math/logic/continuous.lux | 26 +++++++++++++------------- stdlib/test/test/lux/math/complex.lux | 4 +--- stdlib/test/test/lux/math/logic/continuous.lux | 10 +++++----- stdlib/test/test/lux/math/simple.lux | 4 ++-- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/stdlib/source/lux/data/text/format.lux b/stdlib/source/lux/data/text/format.lux index 69928366d..153ef4fe3 100644 --- a/stdlib/source/lux/data/text/format.lux +++ b/stdlib/source/lux/data/text/format.lux @@ -35,7 +35,7 @@ [%b Bool (:: bool;Codec encode)] [%n Nat (:: number;Codec encode)] [%i Int (:: number;Codec encode)] - [%f Deg (:: number;Codec encode)] + [%d Deg (:: number;Codec encode)] [%r Real (:: number;Codec encode)] [%c Char (:: char;Codec encode)] [%t Text (:: text;Codec encode)] diff --git a/stdlib/source/lux/math/logic/continuous.lux b/stdlib/source/lux/math/logic/continuous.lux index c81f5e526..0546cb46c 100644 --- a/stdlib/source/lux/math/logic/continuous.lux +++ b/stdlib/source/lux/math/logic/continuous.lux @@ -2,38 +2,38 @@ lux (lux (data [number "Deg/" Interval]))) -(def: #export TRUE Deg Deg/top) -(def: #export FALSE Deg Deg/bottom) +(def: #export ~true Deg Deg/top) +(def: #export ~false Deg Deg/bottom) (do-template [ ] [(def: #export (-> Deg Deg Deg) )] - [and~ d.min] - [or~ d.max] + [~and d.min] + [~or d.max] ) -(def: #export (not~ input) +(def: #export (~not input) (-> Deg Deg) - (d.- input TRUE)) + (d.- input ~true)) -(def: #export (implies~ consequent antecedent) +(def: #export (~implies consequent antecedent) (-> Deg Deg Deg) - (or~ (not~ antecedent) + (~or (~not antecedent) consequent)) (def: #export (includes~ sub super) (-> Deg Deg Deg) - (let [-sub (not~ sub) + (let [-sub (~not sub) sum (d.+ -sub super) no-overflow? (and (d.>= -sub sum) (d.>= super sum))] (if no-overflow? sum - TRUE))) + ~true))) -(def: #export (=~ left right) +(def: #export (~= left right) (-> Deg Deg Deg) - (and~ (or~ (not~ left) right) - (or~ left (not~ right)))) + (~and (~or (~not left) right) + (~or left (~not right)))) diff --git a/stdlib/test/test/lux/math/complex.lux b/stdlib/test/test/lux/math/complex.lux index 0cb5be426..9fba68dc9 100644 --- a/stdlib/test/test/lux/math/complex.lux +++ b/stdlib/test/test/lux/math/complex.lux @@ -82,9 +82,7 @@ (test: "Addidion, substraction, multiplication and division" [x gen-complex y gen-complex - factor gen-dim - #let [rem (&;c.% (&;complex 3.0 5.0) - (&;complex 6.0 4.0))]] + factor gen-dim] ($_ seq (assert "Adding 2 complex numbers is the same as adding their parts." (let [z (&;c.+ y x)] diff --git a/stdlib/test/test/lux/math/logic/continuous.lux b/stdlib/test/test/lux/math/logic/continuous.lux index 7e4d10973..2c13e123e 100644 --- a/stdlib/test/test/lux/math/logic/continuous.lux +++ b/stdlib/test/test/lux/math/logic/continuous.lux @@ -13,21 +13,21 @@ right R;deg] ($_ seq (assert "AND is the minimum." - (let [result (&;and~ left right)] + (let [result (&;~and left right)] (and (d.<= left result) (d.<= right result)))) (assert "OR is the maximum." - (let [result (&;or~ left right)] + (let [result (&;~or left right)] (and (d.>= left result) (d.>= right result)))) (assert "Double negation results in the original value." - (d.= left (&;not~ (&;not~ left)))) + (d.= left (&;~not (&;~not left)))) (assert "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/simple.lux b/stdlib/test/test/lux/math/simple.lux index ae48cd07b..ddd914bdf 100644 --- a/stdlib/test/test/lux/math/simple.lux +++ b/stdlib/test/test/lux/math/simple.lux @@ -98,6 +98,6 @@ (b/= ( x) (&;odd? x))) ))] - ["Nat" R;nat n.even? n.odd?] - ["Int" R;int i.even? i.odd?] + ["Nat" R;nat n.even? n.odd?] + ["Int" R;int i.even? i.odd?] ) -- cgit v1.2.3