summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-09-01 01:39:31 -0700
committerAraq <rumpf_a@web.de>2013-09-01 01:39:31 -0700
commit62ed6b0aaff64e3a1294f629b482d837dc4a0c83 (patch)
tree4e67c6fdf09fd201216285c2405cc0d9b5ce8eee /lib/system.nim
parent0464a1071eb09fd77893a8981a155e33a899137e (diff)
parentb7b19348a72c2ea7695aa9ded0f11d3e2ae34111 (diff)
downloadNim-62ed6b0aaff64e3a1294f629b482d837dc4a0c83.tar.gz
Merge pull request #580 from gradha/pr_adds_equality_for_arrays
Adds equality comparison for arrays.
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 40a9be2d4..4ff1f1577 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1464,6 +1464,12 @@ proc isNil*[T: proc](x: T): bool {.noSideEffect, magic: "IsNil".}
   ## Fast check whether `x` is nil. This is sometimes more efficient than
   ## ``== nil``.
 
+proc `==` *[I, T](x, y: array[I, T]): bool =
+  for f in low(x)..high(x):
+    if x[f] != y[f]:
+      return
+  result = true
+
 proc `@`*[T](a: openArray[T]): seq[T] = 
   ## turns an openarray into a sequence. This is not as efficient as turning
   ## a fixed length array into a sequence as it always copies every element