mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-01 10:52:14 +00:00
fixes '==' for TTTable
This commit is contained in:
@@ -191,7 +191,13 @@ proc `$`*[A, B](t: TTable[A, B]): string =
|
||||
dollarImpl()
|
||||
|
||||
proc `==`*[A, B](s, t: TTable[A, B]): bool =
|
||||
s.counter == t.counter and s.data == t.data
|
||||
if s.counter == t.counter:
|
||||
# different insertion orders mean different 'data' seqs, so we have
|
||||
# to use the slow route here:
|
||||
for key, val in a:
|
||||
if not hasKey(t, key): return false
|
||||
if mget(t, key) != val: return false
|
||||
return true
|
||||
|
||||
proc indexBy*[A, B, C](collection: A, index: proc(x: B): C): TTable[C, B] =
|
||||
## Index the collection with the proc provided.
|
||||
|
||||
Reference in New Issue
Block a user