Dominik Picheta
082b071683
Merge pull request #7075 from lcrees/get_default
...
Add default argument to tables.getOrDefault
2018-03-29 11:41:25 +01:00
konqoro
b0637bc373
Fix toCountTable and newCountTable
2018-02-21 13:22:41 +02:00
lcrees
1e55d92009
Add default argument to 'tables.getOrDefault'
2018-01-13 16:06:08 -07:00
Konstantin Molchanov
b592f069bb
Tables: toCountTable: Update docs.
2017-12-27 13:44:47 +04:00
Konstantin Molchanov
c36d7ffc7c
Tables: make toCountTable actually count the elements of the input openArray.
2017-12-27 13:30:32 +04:00
GULPF
cf9bee1702
Fix counttable smallest loop start ( #6917 )
...
* Fix counttable smallest
* Fix counttable smallest loop start
2017-12-15 13:59:32 +01:00
Fabian Keller
6df6ec27ec
Improved collection-to-string behavior ( #6825 )
2017-12-14 14:02:13 +01:00
GULPF
542d45f882
Fix counttable smallest ( #6912 )
2017-12-13 02:52:35 +01:00
Araq
6f8e98cff2
improve the docs for tables.add
2017-12-12 19:55:46 +01:00
Daniil Yarancev
6ce6883fad
Fix #4366 ( #6290 )
2017-09-02 21:23:00 +02:00
Andreas Rumpf
6467e55ae8
tables.nim: use proper spacing
2017-08-31 13:42:22 +02:00
David Krause
0e276be301
fixes #6250 ( #6251 )
2017-08-17 13:38:10 +02:00
Parashurama
cd51628f57
fix orderedtable enlarge proc. ( #5937 )
...
This fixes issue #5917
2017-06-05 13:16:30 +02:00
Ruslan Mustakov
78315792d3
Implement 'take' for Table and TableRef ( #5773 )
2017-05-04 22:33:52 +02:00
Zach Smith
fa592f3aad
Minor: spelling correction in tables.nim ( #5727 )
2017-04-19 00:35:44 +02:00
David Krause
7dc8dcb581
fixes #5487 ( #5494 )
2017-03-07 16:58:38 +01:00
David Krause
643b7f8650
Fix for #5482 , let OrderedTable accept multiple keys ( #5485 )
2017-03-05 20:17:43 +01:00
Arne Döring
2c6c865b35
reenabled clear test, made clear working ( #5323 )
2017-02-02 23:06:13 +01:00
Paweł Świątkowski
11db362d86
Fix description of CountTable's smallest proc
2016-12-11 19:05:39 +01:00
Yuriy Glukhov
10292a2626
Corrected test case for #5057 .
2016-11-27 13:34:24 +02:00
Yuriy Glukhov
41205493c0
Fixes #5057
2016-11-26 12:43:36 +02:00
Felix Krause
93a998204c
Fixes #5035
2016-11-18 23:42:15 +01:00
Felix Krause
af4c75a893
Fixes #4974
2016-10-31 20:46:50 +01:00
andri lim
a42e9b11a7
fixes #4940
2016-10-27 11:32:14 +07:00
Felix Krause
7476e4fcb2
Fixes #4946
2016-10-24 22:36:21 +02:00
Felix Krause
73b0bb52bb
Table fixes. fixes #4901
...
* added `==` for OrderedTable, CountTable and the *Ref types
* added missing documentation to all `==` procs
* fixed clear() for OrderedTables, which did not work because `var`
does not work well with `|`
* added tests
2016-10-23 11:21:52 +02:00
Araq
80ad3d3441
fixes #4844
2016-10-08 10:47:47 +02:00
Andreas Rumpf
4077050a42
fixes a critical tables bug that caused 'enlarge' to crash after 'add'
2016-09-05 08:51:38 +02:00
Andreas Rumpf
1e134aed49
Merge pull request #4367 from kierdavis/4365-tables-clear
...
Improvements to tables.clear()
2016-08-25 16:46:53 +02:00
Andreas Rumpf
a8edf67a28
make nim bootstrap again for older versions
2016-07-30 00:50:38 +02:00
Andreas Rumpf
60b187513e
stdlib and compiler don't use .immediate anymore
2016-07-29 23:51:01 +02:00
Andreas Rumpf
358f582939
Merge pull request #4463 from flyx/tables-equals-no-KeyError
...
`==` in tables should not raise KeyError
2016-07-19 00:16:58 +02:00
Axel Pahl
6de1333a26
use table literal syntax
2016-07-12 10:45:54 +02:00
Axel Pahl
8d4614b5ab
explain difference between Table and TableRef in tables.nim
2016-07-12 09:43:31 +02:00
Kier Davis
449960bf7e
Add a fix for clear() on non-ref types by adding a missing 'var' annotation to the type signature
...
However, this fix won't take effect until a compiler bug (#4448 ) is fixed. Until then, the codebase functions identically to
how it did before this commit (calls to clear() fail to compile for Table/OrderedTable/CountTable as the argument is
immutable).
2016-07-09 17:34:01 +01:00
Felix Krause
9f8cdf2560
Use getOrDefault for tables.==
2016-07-08 10:41:37 +02:00
Felix Krause
4455e5d4b6
== in tables should not raise KeyError
...
* With previous code, the compiler deduced that equalsImpl may raise
a KeyError. While this could only actually happen in a nasty
multi-threaded environment, I fixed the code so that it will never happen.
2016-07-07 18:13:12 +02:00
Kier Davis
acbb03ee5e
Implement clear() for CountTableRef. Fixes #4325 .
2016-06-13 17:23:56 +01:00
Dominik Picheta
2b162c04b1
Implements tables.clear.
2016-06-02 18:25:10 +01:00
cheatfate
49c50e4e21
Introduce template withValue() for tables.nim too.
2016-05-27 01:00:05 +03:00
Yuriy Glukhov
b48d98b846
Added del for OrderedTable and OrderedTableRef
2016-04-13 13:41:32 +03:00
Sloane Simmons
aa0d65ed70
Fix CountTableRef#getOrDefault
...
Fixes issue with CountTableRef and getOrDefault:
```{nimrod}
import tables
proc main() =
const testKey = "TESTKEY"
let t: CountTableRef[string] = newCountTable[string]()
# Before, does not compile with error message:
#test_counttable.nim(7, 43) template/generic instantiation from here
#lib/pure/collections/tables.nim(117, 21) template/generic instantiation from here
#lib/pure/collections/tableimpl.nim(32, 27) Error: undeclared field: 'hcode'
echo "Count of " & testKey & " is " & $t.getOrDefault(testKey)
t.inc(testKey,3)
echo "Count of " & testKey & " is " & $t.getOrDefault(testKey)
when isMainModule:
main()
```
Previously, `getOrDefault` for CountTableRef objects was calling the
`getOrDefaultImpl` template, which used the t.data.hcode object -
assuming a Table or similar object. Because CountTableRef didn't have
an hcode in its data tuples, this wouldn't compile. Changed to be the
same as `CountTable#getOrDefault`.
2016-01-09 21:46:47 -06:00
Araq
8be9e46403
udpated the compiler and tester to use getOrDefault
2015-10-13 14:10:33 +02:00
Araq
2fda95a4d6
added getOrDefault; bootstrapping works again
2015-10-13 03:03:05 +02:00
Araq
d8b0edc323
Merge branch 'mget' of https://github.com/def-/Nim into def--mget
...
Conflicts:
lib/pure/collections/critbits.nim
lib/pure/collections/tables.nim
lib/pure/xmltree.nim
lib/system/sets.nim
tests/collections/ttables.nim
tests/collections/ttablesref.nim
2015-10-13 00:22:27 +02:00
Araq
c733b3181e
breaking change: symbol lookups in generics follows spec more closely; fixes #2664
2015-08-07 21:28:45 +02:00
Araq
28de800d61
Merge branch 'more_concurrency' into devel
...
Conflicts:
doc/tut1.txt
lib/core/locks.nim
lib/pure/collections/tables.nim
lib/pure/selectors.nim
2015-06-30 12:50:24 +02:00
pdw
192ba3bbc0
lib/pure/a-c - Dropped 'T' from types
2015-06-04 13:17:11 +02:00
Araq
21ea8e6913
some progress on making async multithreaded
2015-05-28 12:49:08 +02:00
Jonathan
8e4af5ace0
Add contains proc for tables to allow usage of in
2015-05-05 23:26:58 +01:00