From c36d7ffc7c771fcece05bf882fee02fae4261edf Mon Sep 17 00:00:00 2001 From: Konstantin Molchanov Date: Wed, 27 Dec 2017 13:30:32 +0400 Subject: [PATCH] Tables: make `toCountTable` actually count the elements of the input openArray. --- lib/pure/collections/tables.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index 01767956ea..d8c133bce3 100644 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -968,7 +968,7 @@ proc initCountTable*[A](initialSize=64): CountTable[A] = proc toCountTable*[A](keys: openArray[A]): CountTable[A] = ## creates a new count table with every key in `keys` having a count of 1. result = initCountTable[A](rightSize(keys.len)) - for key in items(keys): result[key] = 1 + for key in items(keys): result.inc key proc `$`*[A](t: CountTable[A]): string = ## The `$` operator for count tables.