Commit graph

43 commits

Author SHA1 Message Date
Miran
e616675c41
various small documentation improvements (#18602) 2021-07-28 14:31:13 +02:00
Andreas Rumpf
0300203e81
intsets are here to stay (#16751) 2021-01-19 14:17:22 +01:00
konsumlamm
44ceefa9fe
Improve documentation for packedsets (#16715)
* Improve documentation for packedsets

Add more runnableExamples
Add deprecated pragma to intsets
Replace intsets with packedsets in lib.rst

* Apply suggested changes
2021-01-16 16:09:53 +01:00
landerlo
c39fa0d495
Make IntSet a generic ordinal set OrdSet[A] (#15564)
* Make IntSet an ordinal set OrdSet[A: Ordinal]

Backward compatibility with IntSet is maintained.
IntSet is an alias for OrdSet[int]

* move ordsets to new file, intsets exports it
* ordset, move to lib/std folder

* Fix `$` for ordsets and test cleanup
* Fix ordsets compilation in doc example
* Rename ordsets to packedsets
2020-11-13 14:12:51 +01:00
ee7
d48b356e49
intsets.nim: Add toIntSet proc (#15460)
Similar to:
- `critbits.toCritBitTree`
- `deques.toDeque`
- `sets.toHashSet`
- `tables.toTable`
2020-10-02 21:10:24 +02:00
c-blake
b1aa3b1eea
Unwind just the "pseudorandom probing" part of recent sets,tables changes (#13816)
* Unwind just the "pseudorandom probing" (whole hash-code-keyed variable
stride double hashing) part of recent sets & tables changes (which has
still been causing bugs over a month later (e.g., two days ago
https://github.com/nim-lang/Nim/issues/13794) as well as still having
several "figure this out" implementation question comments in them (see
just diffs of this PR).

This topic has been discussed in many places:
  https://github.com/nim-lang/Nim/issues/13393
  https://github.com/nim-lang/Nim/pull/13418
  https://github.com/nim-lang/Nim/pull/13440
  https://github.com/nim-lang/Nim/issues/13794

Alternative/non-mandatory stronger integer hashes (or vice-versa opt-in
identity hashes) are a better solution that is more general (no illusion
of one hard-coded sequence solving all problems) while retaining the
virtues of linear probing such as cache obliviousness and age-less tables
under delete-heavy workloads (still untested after a month of this change).

The only real solution for truly adversarial keys is a hash keyed off of
data unobservable to attackers.  That all fits better with a few families
of user-pluggable/define-switchable hashes which can be provided in a
separate PR more about `hashes.nim`.

This PR carefully preserves the better (but still hard coded!) probing
of the  `intsets` and other recent fixes like `move` annotations, hash
order invariant tests, `intsets.missingOrExcl` fixing, and the move of
`rightSize` into `hashcommon.nim`.

* Fix `data.len` -> `dataLen` problem.
2020-03-31 19:18:45 +02:00
Timothee Cour
42dad3a836
tables/sharedtables/intsets/etc: fix #13496, #13504, #13505; add lots of tests (#13498) [backport]
* fix #13496 handle tombstones
* add test
* more tests
* fix #13504; add SharedTable tests
* fix #https://github.com/nim-lang/Nim/issues/13505 intsets.missingOrExcl silently gave wrong results sometimes
* add test for tintsets
2020-02-26 22:07:09 +01:00
Timothee Cour
8c22518d67
[backport] pseudorandom probing for hash collision (#13418) 2020-02-19 17:19:55 +01:00
Andreas Rumpf
f728614ef8
fixes #12366 [backport] (#12393) 2019-10-09 14:48:42 +02:00
Araq
07d465ca42 [refactoring] remove unused imports in the compiler and in some stdlib modules 2019-07-18 00:36:03 +02:00
Miran
2255d8795b
[other] prettify collections (#11695) 2019-07-09 22:45:23 +02:00
Arne Döring
88b5dd3362 right shift is now by default sign preserving (#11322)
* right shift is now by default sign preserving
* fix hashString and semfold
* enable arithmetic shift right globally for CI
* fix typo
* remove xxx
* use oldShiftRight as flag
* apply feedback
* add changelog entry
2019-05-29 16:48:00 +02:00
narimiran
83caa58c7a docs: fix trailing comma in links 2019-01-25 09:43:47 +01:00
Miran
39e1cd2bf6 Better docs for sets and intsets (#10362)
* better docs: sets

* better docs: intsets
2019-01-22 10:18:12 +01:00
Miran
214f48eae9
Remove long deprecated stuff (#10332) 2019-01-18 07:18:32 +01:00
Andreas Rumpf
2ee2022c29 help Nim optimize intsets.initIntSet 2018-12-30 11:45:16 +01:00
Alexis Hope
bec493925f IntSet documentation notes (#10051) 2018-12-21 22:55:58 +01:00
Araq
3f6168b337 removes deprecated T/P types 2018-11-16 13:27:56 +01:00
Andreas Rumpf
dae5450947 WIP: disallow 'nil' for strings and seqs 2018-08-13 11:41:33 +02:00
Imran Hendley
df4f707743 add more functionality from sets to intsets (#7185)
* add more functionality from sets to intsets

* remove -+-

* < and == performance

* don't hardcode s.a.len

* remove shortcuts from < and ==
2018-02-12 21:20:17 +01:00
superfunc
d1f6ddfd64 Add counterpart to containsOrIncl for excl (#6360) 2017-09-15 10:49:32 +02:00
Andreas Rumpf
1539d9d95b optimized intsets to not allocate for the common cases 2017-07-25 10:01:37 +02:00
Arne Döring
000b8afd26 Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
Andreas Rumpf
50d2a5868a added intsets.clear proc 2016-03-04 22:19:11 +01:00
Araq
2fda95a4d6 added getOrDefault; bootstrapping works again 2015-10-13 03:03:05 +02:00
pdw
192ba3bbc0 lib/pure/a-c - Dropped 'T' from types 2015-06-04 13:17:11 +02:00
Oleh Prypin
22db40e5e4 Turn some test outputs into actual tests 2015-04-21 15:59:32 +03:00
Oleh Prypin
32109a7867 Don't run non-test code when defined(testing) 2015-04-21 14:37:29 +03:00
Oleh Prypin
27071319c6 Remove unneeded import os from intsets 2015-04-09 03:48:35 +03:00
def
22b4e4c2f2 Use more Natural and Positive numbers in proc parameters
- Didn't go through all modules, only the main ones I thought of
- Building the compiler and tests still work
2015-04-06 02:24:17 +02:00
Araq
9fe1aa6996 intsets.empty is wrong 2015-02-18 13:44:00 +01:00
Araq
dbe71c715e documented new C++ support 2015-01-28 12:59:04 +01:00
Araq
42f5a838a3 more modules updated 2014-08-28 02:06:11 +02:00
Araq
11b6958755 big rename 2014-08-27 23:42:51 +02:00
Araq
92b8fac94a case consistency part 4 2013-12-27 23:10:36 +01:00
Araq
2df9b442c6 case consistency part 1 2013-12-27 15:48:53 +01:00
Grzegorz Adam Hankiewicz
72a3e21f28 Removes executable bit for text files. 2013-03-16 23:53:07 +01:00
Araq
c98e3d2c27 implements 'export' feature 2012-12-01 19:10:47 +01:00
Araq
0171566c98 openarray/varargs split; breaks bootstrapping 2012-08-16 08:34:33 +02:00
Araq
4f1b89c30c year 2012 for most copyright headers 2012-01-02 23:07:35 +01:00
Araq
72651de710 bugfix: 'when' sections in generic objects now work, so TThread[void] compiles 2011-11-20 16:13:03 +01:00
Araq
5b96eaa953 preparations for 0.8.12 2011-07-10 15:48:13 +02:00
Araq
ade67f1abc intsets are now a proper module and part of the stdlib 2011-06-14 01:36:49 +02:00