From 6dfb13b2b8d724b5bdfe4e4f7d78a3c8872cbc9b Mon Sep 17 00:00:00 2001 From: Simon Hafner Date: Thu, 26 Mar 2015 03:40:39 +0500 Subject: [PATCH] doc comments for merge --- lib/pure/collections/tables.nim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index 3cb4c27f00..a32abdb0f0 100644 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -985,16 +985,19 @@ proc sort*[A](t: CountTableRef[A]) = t[].sort proc merge*[A](s: var CountTable[A], t: CountTable[A]) = + ## merges the second table into the first one for key, value in t: s.inc(key, value) proc merge*[A](s, t: CountTable[A]): CountTable[A] = + ## merges the two tables into a new one result = initCountTable[A](nextPowerOfTwo(max(s.len, t.len))) for table in @[s, t]: for key, value in table: result.inc(key, value) proc merge*[A](s, t: CountTableRef[A]) = + ## merges the second table into the first one s[].merge(t[]) when isMainModule: