summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFelix Krause <flyx@isobeef.org>2014-06-26 20:48:13 +0200
committerFelix Krause <flyx@isobeef.org>2014-06-26 20:55:46 +0200
commitac3f872fa3a29effc1338008f45fe3d7332efc0e (patch)
treea7c8dd0c06c7ed9e28eb21446bce18c0e6346647
parent84643abd3e68de6c5a19db2407d08def3aa85461 (diff)
downloadNim-ac3f872fa3a29effc1338008f45fe3d7332efc0e.tar.gz
Fixed TSet proc names to conform with set
-rw-r--r--lib/pure/collections/sets.nim6
-rw-r--r--tests/sets/tsets3.nim22
2 files changed, 14 insertions, 14 deletions
diff --git a/lib/pure/collections/sets.nim b/lib/pure/collections/sets.nim
index 992cb9486..4ba67cb2e 100644
--- a/lib/pure/collections/sets.nim
+++ b/lib/pure/collections/sets.nim
@@ -174,15 +174,15 @@ proc symmetricDifference*[A](s1, s2: TSet[A]): TSet[A] =
   for item in s2:
     if containsOrIncl(result, item): excl(result, item)
 
-proc `or`*[A](s1, s2: TSet[A]): TSet[A] {.inline.} =
+proc `+`*[A](s1, s2: TSet[A]): TSet[A] {.inline.} =
   ## alias for `union`
   result = union(s1, s2)
 
-proc `and`*[A](s1, s2: TSet[A]): TSet[A] {.inline.} =
+proc `*`*[A](s1, s2: TSet[A]): TSet[A] {.inline.} =
   ## alias for `intersection`
   result = intersection(s1, s2)
 
-proc `xor`*[A](s1, s2: TSet[A]): TSet[A] {.inline.} =
+proc `-+-`*[A](s1, s2: TSet[A]): TSet[A] {.inline.} =
   ## alias for `symmetricDifference`
   result = symmetricDifference(s1, s2)
 
diff --git a/tests/sets/tsets3.nim b/tests/sets/tsets3.nim
index 5d14a1d8f..d2b15d72d 100644
--- a/tests/sets/tsets3.nim
+++ b/tests/sets/tsets3.nim
@@ -8,8 +8,8 @@ let
 block union:
   let
     s1_s2 = union(s1, s2)
-    s1_s3 = s1 or s3
-    s2_s3 = s2 or s3
+    s1_s3 = s1 + s3
+    s2_s3 = s2 + s3
 
   assert s1_s2.len == 7
   assert s1_s3.len == 8
@@ -25,14 +25,14 @@ block union:
     assert i in s1_s3
     assert i in s2_s3
 
-  assert((s1 or s1) == s1)
-  assert((s2 or s1) == s1_s2)
+  assert((s1 + s1) == s1)
+  assert((s2 + s1) == s1_s2)
 
 block intersection:
   let
     s1_s2 = intersection(s1, s2)
     s1_s3 = intersection(s1, s3)
-    s2_s3 = s2 and s3
+    s2_s3 = s2 * s3
 
   assert s1_s2.len == 3
   assert s1_s3.len == 0
@@ -48,14 +48,14 @@ block intersection:
     assert i in s2
     assert i in s3
 
-  assert((s2 and s2) == s2)
-  assert((s3 and s2) == s2_s3)
+  assert((s2 * s2) == s2)
+  assert((s3 * s2) == s2_s3)
 
 block symmetricDifference:
   let
     s1_s2 = symmetricDifference(s1, s2)
-    s1_s3 = s1 xor s3
-    s2_s3 = s2 xor s3
+    s1_s3 = s1 -+- s3
+    s2_s3 = s2 -+- s3
 
   assert s1_s2.len == 4
   assert s1_s3.len == 8
@@ -71,8 +71,8 @@ block symmetricDifference:
     assert i in s1_s3 xor i in s1
     assert i in s2_s3 xor i in s2
 
-  assert((s3 xor s3) == initSet[int]())
-  assert((s3 xor s1) == s1_s3)
+  assert((s3 -+- s3) == initSet[int]())
+  assert((s3 -+- s1) == s1_s3)
 
 block disjoint:
   assert(not disjoint(s1, s2))