summary refs log tree commit diff stats
path: root/lib/pure/hashes.nim
diff options
context:
space:
mode:
authorBillingsly Wetherfordshire <phowl.mouth@gmail.com>2013-05-04 03:15:22 -0500
committerBillingsly Wetherfordshire <phowl.mouth@gmail.com>2013-05-04 03:15:22 -0500
commit6aabf9b7dd1d7522ba574225992537ea57c9aadb (patch)
tree6767416f025d8660283d1eaa506b42d49831cebe /lib/pure/hashes.nim
parent05fd46cdd1ce26b714888182ab69dcf2cd3d6ed2 (diff)
downloadNim-6aabf9b7dd1d7522ba574225992537ea57c9aadb.tar.gz
add hashing for seqs
Diffstat (limited to 'lib/pure/hashes.nim')
-rw-r--r--lib/pure/hashes.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/pure/hashes.nim b/lib/pure/hashes.nim
index cf0777ff7..0e9e3600d 100644
--- a/lib/pure/hashes.nim
+++ b/lib/pure/hashes.nim
@@ -126,3 +126,6 @@ proc hash*(x: float): THash {.inline.} =
   var y = x + 1.0
   result = cast[ptr THash](addr(y))[]
 
+proc hash*[A](x: seq[A]): THash =
+  for it in items(x): result = result !& hash(it)
+  result = !$result