summary refs log tree commit diff stats
path: root/lib/pure/collections/sets.nim
diff options
context:
space:
mode:
authorGrzegorz Adam Hankiewicz <gradha@imap.cc>2014-07-26 18:59:59 +0200
committerGrzegorz Adam Hankiewicz <gradha@imap.cc>2014-07-26 22:11:26 +0200
commitdd47fa90375f9bd6172625ec8f97f04cdb04e990 (patch)
tree5daf40f0b098a847bdea167a2e67877f4bab25d3 /lib/pure/collections/sets.nim
parentcdecac11c2f2311349083049a5947c467ef0e92b (diff)
downloadNim-dd47fa90375f9bd6172625ec8f97f04cdb04e990.tar.gz
Moves TSet procs to their code block.
Diffstat (limited to 'lib/pure/collections/sets.nim')
-rw-r--r--lib/pure/collections/sets.nim42
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/pure/collections/sets.nim b/lib/pure/collections/sets.nim
index 9e6aa80af..c3895b8fa 100644
--- a/lib/pure/collections/sets.nim
+++ b/lib/pure/collections/sets.nim
@@ -238,6 +238,27 @@ proc disjoint*[A](s1, s2: TSet[A]): bool =
     if item in s2: return false
   return true
 
+proc `<`*[A](s, t: TSet[A]): bool =
+  ## Is s a strict subset of t?
+  s.counter != t.counter and s <= t
+
+proc `<=`*[A](s, t: TSet[A]): bool =
+  ## Is s a subset of t?
+  result = false
+  if s.counter > t.counter: return
+  result = true
+  for item in s:
+    if not(t.contains(item)):
+      result = false
+      return
+
+proc `==`*[A](s, t: TSet[A]): bool =
+  s.counter == t.counter and s <= t
+
+proc map*[A, B](data: TSet[A], op: proc (x: A): B {.closure.}): TSet[B] =
+  result = initSet[B]()
+  for item in data: result.incl(op(item))
+
 # ------------------------------ ordered set ------------------------------
 
 type
@@ -351,27 +372,6 @@ proc `$`*[A](s: TOrderedSet[A]): string =
   assert s.isValid, "The set needs to be initialized."
   dollarImpl()
 
-proc `<`*[A](s, t: TSet[A]): bool =
-  ## Is s a strict subset of t?
-  s.counter != t.counter and s <= t
-
-proc `<=`*[A](s, t: TSet[A]): bool =
-  ## Is s a subset of t?
-  result = false
-  if s.counter > t.counter: return
-  result = true
-  for item in s:
-    if not(t.contains(item)):
-      result = false
-      return
-      
-proc `==`*[A](s, t: TSet[A]): bool =
-  s.counter == t.counter and s <= t
-
-proc map*[A, B](data: TSet[A], op: proc (x: A): B {.closure.}): TSet[B] =
-  result = initSet[B]()
-  for item in data: result.incl(op(item))
-
 proc testModule() =
   ## Internal micro test to validate docstrings and such.
   block isValidTest: