summary refs log tree commit diff stats
path: root/lib/pure/collections/tables.nim
diff options
context:
space:
mode:
authorGrzegorz Adam Hankiewicz <gradha@imap.cc>2014-06-06 19:53:39 +0200
committerGrzegorz Adam Hankiewicz <gradha@imap.cc>2014-06-06 19:53:39 +0200
commit9009841d623d268c649f96bd0215b3013de35eeb (patch)
treeb636f9709aca52c02560c39dde3ae7a5d9dc133d /lib/pure/collections/tables.nim
parent7da3c5e71e485ef4326dcf415a297267a47ab971 (diff)
downloadNim-9009841d623d268c649f96bd0215b3013de35eeb.tar.gz
Avoids temporal string in tables hashing example.
Diffstat (limited to 'lib/pure/collections/tables.nim')
-rw-r--r--lib/pure/collections/tables.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim
index 848f4b8ba..b5fc1737a 100644
--- a/lib/pure/collections/tables.nim
+++ b/lib/pure/collections/tables.nim
@@ -37,7 +37,8 @@
 ##     ## Piggyback on the already available string hash proc.
 ##     ##
 ##     ## Without this proc nothing works!
-##     result = hash(x.firstName & x.lastName)
+##     result = x.firstName.hash !& x.lastName.hash
+##     result = !$result
 ##
 ##   var
 ##     salaries = initTable[Person, int]()
@@ -841,7 +842,8 @@ when isMainModule:
     ## Piggyback on the already available string hash proc.
     ##
     ## Without this proc nothing works!
-    result = hash(x.firstName & x.lastName)
+    result = x.firstName.hash !& x.lastName.hash
+    result = !$result
 
   var
     salaries = initTable[Person, int]()