From 02f78b1ff29982bea8c93fe6252593ba3942f38b Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 12 Dec 2016 22:33:22 -0400 Subject: - Renamed "==" function to "is". --- stdlib/source/lux.lux | 6 +++--- stdlib/source/lux/concurrency/stm.lux | 8 ++++---- stdlib/source/lux/data/struct/dict.lux | 4 ++-- stdlib/source/lux/type/check.lux | 2 +- stdlib/test/test/lux.lux | 10 +++++----- stdlib/test/test/lux/data/ident.lux | 4 ++-- stdlib/test/test/lux/data/number.lux | 9 ++++----- stdlib/test/test/lux/data/struct/array.lux | 6 +++--- stdlib/test/test/lux/data/struct/stack.lux | 4 ++-- stdlib/test/test/lux/data/struct/vector.lux | 2 +- stdlib/test/test/lux/data/struct/zipper.lux | 30 ++++++++++++++--------------- 11 files changed, 42 insertions(+), 43 deletions(-) diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index dd8e70ab6..168afa397 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -5352,14 +5352,14 @@ _ (fail "Wrong syntax for $"))) -(def: #export (== left right) +(def: #export (is left right) {#;doc (doc "Tests whether the 2 values are identical (not just \"equal\")." "This one should succeed:" (let [value 5] - (== 5 5)) + (is 5 5)) "This one should fail:" - (== 5 (i.+ 2 3)))} + (is 5 (i.+ 2 3)))} (All [a] (-> a a Bool)) (_lux_proc ["lux" "=="] [left right])) diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux index 89bbab2af..c3e5fad3a 100644 --- a/stdlib/source/lux/concurrency/stm.lux +++ b/stdlib/source/lux/concurrency/stm.lux @@ -55,7 +55,7 @@ (All [a] (-> (Var a) Tx (Maybe a))) (|> tx (find (lambda [[_var _original _current]] - (== (:! (Var Unit) var) + (is (:! (Var Unit) var) (:! (Var Unit) _var)))) (:: Monad map (lambda [[_var _original _current]] _current)) @@ -87,7 +87,7 @@ #;Nil (#;Cons [_var _original _current] tx') - (if (== (:! (Var ($ +0)) var) + (if (is (:! (Var ($ +0)) var) (:! (Var ($ +0)) _var)) (#;Cons [(:! (Var ($ +0)) _var) (:! ($ +0) _original) @@ -201,12 +201,12 @@ (def: (can-commit? tx) (-> Tx Bool) (every? (lambda [[_var _original _current]] - (== _original (raw-read _var))) + (is _original (raw-read _var))) tx)) (def: (commit-var [_var _original _current]) (-> (Ex [a] (Tx-Frame a)) Unit) - (if (== _original _current) + (if (is _original _current) [] (io;run (write! _current _var)))) diff --git a/stdlib/source/lux/data/struct/dict.lux b/stdlib/source/lux/data/struct/dict.lux index d4cbaa7ec..38cfe7efa 100644 --- a/stdlib/source/lux/data/struct/dict.lux +++ b/stdlib/source/lux/data/struct/dict.lux @@ -397,7 +397,7 @@ (#;Some sub-node) (let [sub-node' (remove' (level-up level) hash key Hash sub-node)] ## Then check if a removal was actually done. - (if (== sub-node sub-node') + (if (is sub-node sub-node') ## If not, then there's nothing to change here either. node ## But if the sub-removal yielded an empty sub-node... @@ -426,7 +426,7 @@ (#;Some (#;Left sub-node)) (let [sub-node' (remove' (level-up level) hash key Hash sub-node)] ## Verify that it was removed. - (if (== sub-node sub-node') + (if (is sub-node sub-node') ## If not, there's also nothing to change here. node ## But if it came out empty... diff --git a/stdlib/source/lux/type/check.lux b/stdlib/source/lux/type/check.lux index 88f165cb3..951586bb0 100644 --- a/stdlib/source/lux/type/check.lux +++ b/stdlib/source/lux/type/check.lux @@ -359,7 +359,7 @@ (def: #export (check expected actual) (-> Type Type (Check [])) - (if (== expected actual) + (if (is expected actual) success (case [expected actual] [(#;VarT e-id) (#;VarT a-id)] diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index a9f638c73..24954fa2f 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -20,11 +20,11 @@ y (R;text size)] ($_ seq (assert "Every value is identical to itself, and the 'id' function doesn't change values in any way." - (and (== x x) - (== x (id x)))) + (and (is x x) + (is x (id x)))) (assert "Values created separately can't be identical." - (not (== x y))) + (not (is x y))) )) (do-template [category rand-gen inc dec even? odd? = < >] @@ -165,9 +165,9 @@ false))) (assert "Can have defaults for Maybe values." - (and (== "yolo" (default "yolo" + (and (is "yolo" (default "yolo" #;None)) - (== "lol" (default "yolo" + (is "lol" (default "yolo" (#;Some "lol"))))) )) diff --git a/stdlib/test/test/lux/data/ident.lux b/stdlib/test/test/lux/data/ident.lux index e0c066f04..6c435686f 100644 --- a/stdlib/test/test/lux/data/ident.lux +++ b/stdlib/test/test/lux/data/ident.lux @@ -30,8 +30,8 @@ (^open "&/") &;Codec]] ($_ seq (assert "Can get the module & name parts of an ident." - (and (== module1 (&;module ident1)) - (== name1 (&;name ident1)))) + (and (is module1 (&;module ident1)) + (is name1 (&;name ident1)))) (assert "Can compare idents for equality." (and (&/= ident1 ident1) diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux index d5b74888b..5b9adcf98 100644 --- a/stdlib/test/test/lux/data/number.lux +++ b/stdlib/test/test/lux/data/number.lux @@ -116,13 +116,12 @@ (:: = x x') (#;Left _) - (exec (log! (format (%n x) " == " (:: encode x))) - false)))))] + false))))] ["Nat" R;nat Number Codec] - ## ["Int" R;int Number Codec] - ## ["Real" R;real Number Codec] - ## ["Frac" R;frac Number Codec] + ["Int" R;int Number Codec] + ["Real" R;real Number Codec] + ["Frac" R;frac Number Codec] ) (do-template [ ] diff --git a/stdlib/test/test/lux/data/struct/array.lux b/stdlib/test/test/lux/data/struct/array.lux index 6decd910f..1b81ecf47 100644 --- a/stdlib/test/test/lux/data/struct/array.lux +++ b/stdlib/test/test/lux/data/struct/array.lux @@ -32,11 +32,11 @@ (n.= size (&;size original))) (assert "Cloning an array should yield and identical array, but not the same one." (and (:: (&;Eq number;Eq) = original clone) - (not (== original clone)))) + (not (is original clone)))) (assert "Full-range manual copies should give the same result as cloning." (exec (&;copy size +0 original +0 copy) (and (:: (&;Eq number;Eq) = original copy) - (not (== original copy))))) + (not (is original copy))))) (assert "Array folding should go over all values." (exec (:: &;Fold fold (lambda [x idx] @@ -104,7 +104,7 @@ (assert "Functor shouldn't alter original array." (let [copy (map id array)] (and (= array copy) - (not (== array copy))))) + (not (is array copy))))) (assert "Functor should go over all available array elements." (let [there (map n.inc array) back-again (map n.dec there)] diff --git a/stdlib/test/test/lux/data/struct/stack.lux b/stdlib/test/test/lux/data/struct/stack.lux index 427c5c04d..375c19b4b 100644 --- a/stdlib/test/test/lux/data/struct/stack.lux +++ b/stdlib/test/test/lux/data/struct/stack.lux @@ -40,9 +40,9 @@ )) (assert "Pushing onto a stack always increases it by 1, adding a new value at the top." - (and (== sample + (and (is sample (&;pop (&;push new-top sample))) (n.= (n.inc (&;size sample)) (&;size (&;push new-top sample))) (|> (&;push new-top sample) &;peek (default (undefined)) - (== new-top)))) + (is new-top)))) )) diff --git a/stdlib/test/test/lux/data/struct/vector.lux b/stdlib/test/test/lux/data/struct/vector.lux index fe1350ce0..76e4f7580 100644 --- a/stdlib/test/test/lux/data/struct/vector.lux +++ b/stdlib/test/test/lux/data/struct/vector.lux @@ -43,7 +43,7 @@ (&;put idx non-member) (&;at idx) (default (undefined)) - (== non-member))) + (is non-member))) (assert "Can update elements of vectors." (|> sample diff --git a/stdlib/test/test/lux/data/struct/zipper.lux b/stdlib/test/test/lux/data/struct/zipper.lux index 6e1a168c2..a1045f44f 100644 --- a/stdlib/test/test/lux/data/struct/zipper.lux +++ b/stdlib/test/test/lux/data/struct/zipper.lux @@ -55,9 +55,9 @@ (if (&;branch? zipper) (let [child (|> zipper &;down)] (and (not (Tree/= sample (&;to-tree child))) - (|> child &;parent (default (undefined)) (== zipper)) - (|> child &;up (== zipper)) - (|> child &;root (== zipper)))) + (|> child &;parent (default (undefined)) (is zipper)) + (|> child &;up (is zipper)) + (|> child &;root (is zipper)))) (and (&;leaf? zipper) (|> zipper (&;prepend-child new-val) &;branch?))))) @@ -68,12 +68,12 @@ zipper (|> zipper (&;prepend-child pre-val) (&;append-child post-val))] - (and (|> zipper &;down &;value (== pre-val)) - (|> zipper &;down &;right &;value (== mid-val)) - (|> zipper &;down &;right &;right &;value (== post-val)) - (|> zipper &;down &;rightmost &;leftmost &;value (== pre-val)) - (|> zipper &;down &;right &;left &;value (== mid-val)) - (|> zipper &;down &;rightmost &;value (== 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 mid-val)) + (|> zipper &;down &;rightmost &;value (is post-val)))) true))) (assert "Can insert children around a node (unless it's root)." @@ -87,12 +87,12 @@ (&;insert-right post-val) (default (undefined)) &;up)] - (and (|> zipper &;down &;value (== pre-val)) - (|> zipper &;down &;right &;value (== mid-val)) - (|> zipper &;down &;right &;right &;value (== post-val)) - (|> zipper &;down &;rightmost &;leftmost &;value (== pre-val)) - (|> zipper &;down &;right &;left &;value (== mid-val)) - (|> zipper &;down &;rightmost &;value (== 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 mid-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 -- cgit v1.2.3