10 Commits

Author SHA1 Message Date
metagn
ae9287c4f3 symmetric difference operation for sets via xor (#24286)
closes https://github.com/nim-lang/RFCs/issues/554

Adds a symmetric difference operation to the language bitset type. This
maps to a simple `xor` operation on the backend and thus is likely
faster than the current alternatives, namely `(a - b) + (b - a)` or `a +
b - a * b`. The compiler VM implementation of bitsets already
implemented this via `symdiffSets` but it was never used.

The standalone binary operation is added to `setutils`, named
`symmetricDifference` in line with [hash
sets](https://nim-lang.org/docs/sets.html#symmetricDifference%2CHashSet%5BA%5D%2CHashSet%5BA%5D).
An operator version `-+-` and an in-place version like `toggle` as
described in the RFC are also added, implemented as trivial sugar.
2024-10-19 10:07:00 +02:00
ringabout
4d11d0619d complete std prefixes for stdlib (#22887)
follow up https://github.com/nim-lang/Nim/pull/22851
follow up https://github.com/nim-lang/Nim/pull/22873
2023-10-30 17:03:04 +01:00
flywind
2aeac26f08 correct licence header (#18935)
* rename licence

* spaces
2021-10-01 13:57:06 +02:00
Timothee Cour
36d24846b6 typo: enmRange => enumElementsAsSet (#18394) 2021-06-29 18:08:50 -07:00
Andreas Rumpf
a9b62de895 CIs: attempt to use csources_v1 (#16282)
* CIs: attempt to use csources_v1
* also updated the BSDs
* also updated azure pipelines
* std modules should not itself use the 'std/' import dir...
* compiler has to be careful with std/ for v1 booting
2021-04-21 07:41:33 +02:00
Timothee Cour
93cb5d6896 add setutils.[]= (#17272)
* add setutils.[]=
* address comments
* proc => func (for other symbols too)
2021-03-08 10:39:39 +01:00
Timothee Cour
6b3bdd798d enable bsd for tsetutils; improve setutils API (#17098) 2021-02-20 18:02:57 +01:00
Jason Beetham
35ded02074 Add setutils.complement, setutils.fullSet (#17066) 2021-02-18 17:33:28 -08:00
konsumlamm
72bbd07ec1 Add std/setutils to lib.rst (#16791)
* Add std/setutils to lib.rst

Improve doc comments for setutils

* Adhere to the RST spec

Use no UFCS in toSet
2021-01-22 13:13:18 +01:00
Jason Beetham
1082d62b08 Adds toSet to create sets from iterables (#16276) 2020-12-14 15:20:21 -08:00