remove outplace version of 'merge' for CountTables (#13377)
* remove outplace version of 'merge' for CountTables * remove 'merge' tests
This commit is contained in:
parent
2fee89f7db
commit
ceb3d5ad68
2 changed files with 16 additions and 18 deletions
|
|
@ -21,6 +21,10 @@
|
||||||
compiler type trait instead of macro. `distinctBase` in sugar module is now deprecated.
|
compiler type trait instead of macro. `distinctBase` in sugar module is now deprecated.
|
||||||
- `CountTable.mget` has been removed from `tables.nim`. It didn't work, and it
|
- `CountTable.mget` has been removed from `tables.nim`. It didn't work, and it
|
||||||
was an oversight to be included in v1.0.
|
was an oversight to be included in v1.0.
|
||||||
|
- `tables.merge(CountTable, CountTable): CountTable` has been removed.
|
||||||
|
It didn't work well together with the existing inplace version of the same proc
|
||||||
|
(`tables.merge(var CountTable, CountTable)`).
|
||||||
|
It was an oversight to be included in v1.0.
|
||||||
|
|
||||||
|
|
||||||
### Breaking changes in the compiler
|
### Breaking changes in the compiler
|
||||||
|
|
|
||||||
|
|
@ -2487,7 +2487,8 @@ proc merge*[A](s: var CountTable[A], t: CountTable[A]) =
|
||||||
for key, value in t:
|
for key, value in t:
|
||||||
s.inc(key, value)
|
s.inc(key, value)
|
||||||
|
|
||||||
proc merge*[A](s, t: CountTable[A]): CountTable[A] =
|
when (NimMajor, NimMinor) <= (1, 0):
|
||||||
|
proc merge*[A](s, t: CountTable[A]): CountTable[A] =
|
||||||
## Merges the two tables into a new one.
|
## Merges the two tables into a new one.
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
let
|
let
|
||||||
|
|
@ -3006,13 +3007,6 @@ when isMainModule:
|
||||||
t2l.inc("foo", 4)
|
t2l.inc("foo", 4)
|
||||||
t2l.inc("bar")
|
t2l.inc("bar")
|
||||||
t2l.inc("baz", 11)
|
t2l.inc("baz", 11)
|
||||||
let
|
|
||||||
t1merging = t1l
|
|
||||||
t2merging = t2l
|
|
||||||
let merged = merge(t1merging, t2merging)
|
|
||||||
assert(merged["foo"] == 5)
|
|
||||||
assert(merged["bar"] == 3)
|
|
||||||
assert(merged["baz"] == 14)
|
|
||||||
|
|
||||||
block:
|
block:
|
||||||
const testKey = "TESTKEY"
|
const testKey = "TESTKEY"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue