diff options
author | Simon Hafner <hafnersimon@gmail.com> | 2015-03-26 03:40:39 +0500 |
---|---|---|
committer | Simon Hafner <hafnersimon@gmail.com> | 2015-03-26 03:40:39 +0500 |
commit | 6dfb13b2b8d724b5bdfe4e4f7d78a3c8872cbc9b (patch) | |
tree | 8d000f1f685596099d0efeff73a9aaed8e7cae61 /lib/pure/collections/tables.nim | |
parent | 73655e3dd66606f4dbac57ac0e859b1ef10d62f9 (diff) | |
download | Nim-6dfb13b2b8d724b5bdfe4e4f7d78a3c8872cbc9b.tar.gz |
doc comments for merge
Diffstat (limited to 'lib/pure/collections/tables.nim')
-rw-r--r-- | lib/pure/collections/tables.nim | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index 3cb4c27f0..a32abdb0f 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: |