Commit Graph
83 Commits
Author SHA1 Message Date
Karoy Lorentey bd1a622735 [CMake, Xcode] Update buid configurations 2023-10-18 15:54:07 -07:00
Karoy Lorentey 09c09f0f73 Fix CustomStringConvertible/CustomDebugStringConvertible conformances
- For CustomStringConvertible, `description` should print elements using `String(reflecting:)` rather than `String(describing:)`, to avoid element output from interfering with syntactically relevant punctuation within structured list displays.
- To make this work without making displays overly verbose, make `debugDescription` mostly the same as `description`, except for escaping raw string displays when and if needed.
- Avoid printing type names in `debugDescription` — it is generally not helpful, as the type is already easily accessible elsewhere. Including it makes for overly verbose displays when the type serves as an Element of a collection.
- Avoid having `debugDescription` return the empty string — it can be confusing when such a description appears in list displays.

Resolves #301.
2023-07-06 17:25:11 -07:00
Karoy Lorentey de0f594185 [BitSet] Fix a thinko in BitSet.isEqualSet 2023-05-18 18:36:29 -07:00
Karoy Lorentey a8dad62bc9 Remove obsolete swift(>=5.5)/swift(>=5.6) checks 2023-04-10 18:33:52 -07:00
Karoy Lorentey 8ca5c0367f Merge pull request #263 from lorentey/bitcollections-finalization
BitArray API refinements & additions
2023-04-10 17:32:10 -07:00
Karoy Lorentey 3cbf81976d Merge pull request #266 from lorentey/monomodule-support
Monomodule support
2023-03-23 13:54:45 -07:00
Karoy Lorentey e6ecdac581 Fix off by one error in BitSet 2023-03-22 21:45:46 -07:00
Karoy Lorentey cbab9e3737 Introduce COLLECTIONS_SINGLE_MODULE condition 2023-03-21 18:42:33 -07:00
Karoy Lorentey a360969ec6 [BitArray] Add masking and resizing shifts 2023-01-31 18:04:30 -08:00
Karoy Lorentey 866d00798f [BitArray] Add LosslessStringConvertible conformance 2023-01-31 18:02:16 -08:00
Karoy Lorentey 17343b752a [BitArray] fill(in:with:), insert(repeating:count:at:), append(repeating:count:) 2023-01-31 18:01:46 -08:00
Karoy Lorentey a90b73966a [BitArray] Add conformance to ExpressibleByStringLiteral 2023-01-31 18:00:27 -08:00
Karoy Lorentey a8bde63439 [BitArray] Add toggleAll(), toggleAll(in:) 2023-01-31 17:59:56 -08:00
Karoy Lorentey c15b0d9889 [BitArray] Add BitArray → BinaryInteger conversion initializers
extension BinaryInteger {
  public init(truncatingIfNeeded source: BitArray)
  public init?(exactly source: BitArray)
  public init(_ source: BitArray)
}
2023-01-31 17:59:24 -08:00
Karoy Lorentey c15e484f5a [BitArray] Add init(minimumCapacity:) 2023-01-31 17:43:06 -08:00
Karoy Lorentey 4281dc4482 [BitArray] Change description to print bit arrays as binary numerals
This matches std::bitset, and it seems to be the more logical option.
2023-01-31 17:39:46 -08:00
Karoy Lorentey 03b62ffb6e [BitArray] random(count:using:) → randomBits(count:using:) 2023-01-31 17:33:55 -08:00
Karoy Lorentey 6cb03fee98 [BitCollections] Update file headers 2023-01-31 17:30:39 -08:00
Karoy Lorentey 8c7b8536ea [cmake] Update CMake configuration 2022-11-30 16:34:49 -08:00
Karoy Lorentey 69768b6eac [OrderedCollections, BitCollections] Fix more warnings in development versions of Swift 2022-11-28 21:53:06 -08:00
Karoy Lorentey a2f4b18ae0 [BitSet, OrderedCollections] Unify UnsafeBitSet implementations 2022-11-28 16:30:55 -08:00
Karoy Lorentey 581490a735 [CMake] Update CMakeLists.txts 2022-10-31 15:10:11 -07:00
Karoy Lorentey 8f7d5fd505 [SetAlgebra types] isEqual(to:) → isEqualSet(to:)
The `isEqual(to:)` methods are a bit too confusing — they implement
mathematical set comparisons (ignoring element ordering and, in the
case of the Sequence variant, even element multiplicities), so it
seems better to highlight this by putting a `Set` in the name.
2022-10-31 15:05:12 -07:00
Karoy Lorentey 5e80c92941 Merge pull request #230 from lorentey/update-cmake
Update CMake build configuration
2022-10-28 18:20:21 -07:00
Karoy Lorentey d19fb14c46 [CMake] Update CMake configuration 2022-10-28 18:18:39 -07:00
Karoy Lorentey b2f254384d [doc] Add some flesh to DocC structure
# Conflicts:
#	Sources/BitCollections/BitCollections.docc/Extensions/BitArray.md
#	Sources/BitCollections/BitCollections.docc/Extensions/BitSet.Counted.md
#	Sources/BitCollections/BitCollections.docc/Extensions/BitSet.md
#	Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.UnorderedView.md
#	Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.md
2022-10-28 12:34:14 -07:00
Karoy Lorentey 0120dd1d79 [BitCollections] Categorize member APIs 2022-10-28 12:34:14 -07:00
Karoy Lorentey 86bce28835 [docs] Start working on DocC support 2022-10-28 12:34:14 -07:00
Karoy Lorentey 2dae70dba7 [OrderedSet, BitSet] Fix display style of custom mirror 2022-10-27 18:29:32 -07:00
Karoy Lorentey e3cc498060 [BitSet.Counted] Review, test, fix, and document binary set operations & predicates 2022-10-21 19:49:14 -07:00
Karoy Lorentey 1355d478af [BitSet] Review, test, extend, and document binary set operations 2022-10-21 19:49:07 -07:00
Karoy Lorentey 9cd030f21e [BitSet] Add missing Custom[Debug]StringConvertable conformances, review existing ones
Add `Custom[Debug]StringConvertible` conformance on `BitSet.Index`.
2022-10-20 17:14:52 -07:00
Karoy Lorentey 3c6cb8cd56 Update CMake configuration 2022-10-19 17:35:13 -07:00
Karoy Lorentey 001df8e325 [BitSet] Review, test, fix, and document set relation predicates
- Update documentation
- Improve performance where possible
- Add missing test coverage where needed
2022-10-19 15:20:17 -07:00
Karoy Lorentey 291623d391 [BitSet] Implement isEqual(to:) family of functions 2022-10-19 01:40:06 -07:00
Karoy Lorentey 86d429604c [BitSet] Doc updates 2022-10-19 01:40:06 -07:00
Karoy Lorentey 51a1554f89 Introduce _UniqueCollection & _SortedCollection
These marker-like protocols will allow certain
generic operations to get a performance boost
if the passed-in value happens to be guaranteed
to contain unique elements or to be sorted.

Also, review API checker protocols for Sets and
sorted collections and adjust things as needed.

BitSet gains custom implementations for min()
and max() as part of these improvements.
2022-10-19 01:40:06 -07:00
Karoy Lorentey f76630db8e [Internals] Add missing internal checking predicates & docs for all 2022-10-18 22:13:19 -07:00
Karoy Lorentey 5aed92655d [CMake] Update CMake build configuration 2022-10-11 13:11:37 -07:00
Karoy Lorentey 6286cd0b99 Restore support for building with Swift 5.5
This is mostly about adding more type declarations to deal with type checker limitations in the older compiler.
This also includes workarounds that allow better support for CodingKeyRepresentable in PersistentDictionary, and it fixes a couple of small oversights on various #else branches.
2022-10-10 18:07:49 -07:00
Karoy Lorentey 541bd53958 [BitCollections] Move shared utilities to _CollectionsUtilities 2022-10-09 20:11:51 -07:00
Karoy Lorentey 1b71d2cd94 [BitSet] Fix invariant violation in member subscript 2022-10-09 16:12:17 -07:00
Karoy Lorentey 78ac2eaed7 [BitSet] Add remove(at:) implementation 2022-10-09 13:20:12 -07:00
Karoy Lorentey d2d2da6f3f [BitSet] BitSet, BitSet.Iterator, BitSet.Index, BitSet.Counted: Explicitly conform to Sendable 2022-10-05 11:33:49 -07:00
Karoy Lorentey 14432582dc [BitArray] Explicitly conform to Sendable 2022-10-05 11:33:31 -07:00
Karoy Lorentey 19c9f282c9 Delete _FastMembershipCheckable
We don’t actually need this, as `_customContainsEquatableElement`
returning non-nil is a perfectly suitable indication that containment
checking is fast.
2022-09-29 17:37:48 -07:00
Karoy Lorentey ac35613ea9 Merge pull request #184 from lorentey/PersistentCollections-updates
Persistent collections updates (part 8)
2022-09-26 16:38:04 -07:00
Karoy Lorentey 778b8ae977 [BitSet] Fix decoding an 32-bit architectures 2022-09-25 01:35:44 -07:00
Karoy Lorentey 3d10964905 [PersistentSet] Flesh out isSubset/iSuperset/isDisjoint/etc overloads (untested)
This adds an experimental _FastMembershipCheckable protocol to speed
up these relationship predicates when possible — having separate
overloads for each known collection with a fast containment check
is not going to scale for long.

This commit also introduces a set of isEqual(to:) methods that
generalize ==.
2022-09-24 17:02:16 -07:00
Karoy Lorentey 59858a7721 [BitSet.Counted] Fix invariant checking (d’oh) 2022-09-23 11:15:37 -07:00