Karoy Lorentey
bef610feb8
Merge pull request #224 from lorentey/finalize-PersistentCollections
...
Finalize persistent collections API
2022-10-28 12:32:57 -07:00
Karoy Lorentey
98d62d236b
[PersistentDictionary] More keys diffing APIs; additional documentation & testing
2022-10-28 12:19:08 -07:00
Karoy Lorentey
ba7e3927e7
[BitSet] Adjust test for updated mirror display style
2022-10-28 10:40:42 -07:00
Karoy Lorentey
2dae70dba7
[OrderedSet, BitSet] Fix display style of custom mirror
2022-10-27 18:29:32 -07:00
Karoy Lorentey
18a01247a3
[PersistentDictionary] Add missing documentation comments
2022-10-27 18:08:27 -07:00
Karoy Lorentey
6dd3756609
[PersistentDictionary] Remove init(uniqueKeys:values:)
...
This initializer was interesting for OrderedDictionary, where it made
for more efficient initialization of storage, but it’s less useful for
other dictionary types.
2022-10-27 18:08:27 -07:00
Karoy Lorentey
16687d78af
[PersistentSet] Add more tests
2022-10-27 18:08:27 -07:00
Karoy Lorentey
84356e58c7
[PersistentCollection] Back out BidirectionalCollection conformance
...
BidirectionalCollection has the connotation that the ordering
of elements is meaningful, which isn’t the case for PersistentSet
and PersistentDictionary.
2022-10-27 18:08:27 -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
0914e6f546
[OrderedSet] More test coverage for set operations; clarify docs
2022-10-21 18:24:08 -07:00
Karoy Lorentey
648aaa7f56
[PersistentSet] Review, test, fix, and document binary set operations
2022-10-21 18:24:08 -07:00
Karoy Lorentey
ab750075a2
[PersistentCollections] Add missing Custom[Debug]StringConvertable conformances, review existing ones
...
Add `Custom[Debug]StringConformance` conformances on:
- `PersistentDictionary.Keys`
- `PersistentDictionary.Values`
- `PersistentDictionary.Index`
- `PersistentSet.Index`
2022-10-20 17:14:52 -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
c12b454da1
[Heap] Add missing Custom[Debug]StringConvertable conformances, review existing ones
...
Add `Custom[Debug]StringConvertible` conformance on `Heap`.
2022-10-20 17:14:52 -07:00
Karoy Lorentey
7143421800
[OrderedCollections] Add missing Custom[Debug]StringConvertable conformances, review existing ones
...
Add `Custom[Debug]StringConvertible` conformance on:
- `OrderedDictionary.Values`
- `OrderedDictionary.Elements.Subsequence`
- `OrderedSet.SubSequence`
2022-10-20 17:14:52 -07:00
Karoy Lorentey
e74283a2fa
[PersistentCollections] Remove BitmapSmokeTests.swift
...
The underlying code no longer looks like what we had before,
and @testable imports need to be disabled in release builds.
We should be testing internals, but this isn’t carrying much
weight right now.
Also remove a couple of PersistentDictionary smoke tests that
are also relying on @testable.
2022-10-19 19:12:58 -07:00
Karoy Lorentey
5dfd51238c
[OrderedSet] Review, test, fix, and document set relation predicates
2022-10-19 15:20:30 -07:00
Karoy Lorentey
8ce8a6bc86
[PersistentSet] Review, test, fix, and document set relation predicates
2022-10-19 15:20:17 -07:00
Karoy Lorentey
f843bd40bf
[PersistentSet] Add update(_:at:)
2022-10-19 15:20:17 -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
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
2e9447fb1c
[_CollectionsTestSupport] Richer support for combinatorial testing
2022-10-13 15:45:08 -07:00
Karoy Lorentey
098495b4ab
[Heap] Add more exhaustive tests for some critical paths
2022-10-13 14:52:06 -07:00
Karoy Lorentey
5f70117c55
[Heap] Start using _CollectionsTestSupport for testing
2022-10-12 16:30:52 -07:00
Karoy Lorentey
7138144f37
[Heap] Remove unnecessary testing APIs
...
We do not need a _raw initializer in the Heap implementation. The
heapify algorithm will not modify storage if it’s already in the
expected shape, so we can simply define one locally that double checks
that the order remains unchanged.
2022-10-12 16:01:23 -07:00
Karoy Lorentey
92d808d179
Merge branch 'heap-replace-extrema' into release/1.1
2022-10-12 15:23:17 -07:00
Karoy Lorentey
b1506b6225
[SortedCollections] Remove for now
...
These are still on track for 1.2.0, but I’ll need to bump them from
the release/1.1 branch.
2022-10-11 17:55:35 -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
33b759b842
[Heap] PriorityQueueModule → HeapModule
2022-10-09 15:44:44 -07:00
Karoy Lorentey
0b86bb11d2
[PersistentSet] Flesh out API surface
...
Add customary overloads for high-level Set operations.
2022-10-09 15:26:32 -07:00
Karoy Lorentey
4604c1bc38
[test] Add SetAPIChecker protocol
...
This is useful for validating the API surface of set-like types,
ensuring that we haven’t forgotten to implement members that
are part of users’ baseline expectations.
To ensure maximum utility, this protocol refines neither Collection
nor SetAlgebra.
2022-10-09 13:33:23 -07:00
Karoy Lorentey
78ac2eaed7
[BitSet] Add remove(at:) implementation
2022-10-09 13:20:12 -07:00
Karoy Lorentey
f71ebd9494
[PersistentDictionary] Implement structural merge operations
...
Merging is best done in-place, as merging a non-empty dictionary will
always mutate the dictionary, so we don’t have to tiptoe around
uniqueness issues.
(The union operation on PersistentSet is vaguely similar, but not
quite — unlike with merge, union is able directly link shared subtrees
into the result. However, a similar optimization may be worthwhile for
symmetricDifference.)
2022-09-30 19:55:04 -07:00
Karoy Lorentey
81acdb7f8d
[PersistentSet] Implement structural symmetricDifference
...
I think this may be the last missing non-trivial algorithm for this module.
2022-09-29 17:33:10 -07:00
Karoy Lorentey
876177dbb5
[PersistentSet] Test & fix symmetricDifference
2022-09-28 18:38:14 -07:00
Karoy Lorentey
562b21e70f
[PersistentCollections] filter, intersection, subtracting: Don’t build a result node until we know for sure we won’t just clone self
2022-09-28 14:45:44 -07:00
Karoy Lorentey
4a4c4a75fd
[PersistentSet] Add tests for union; fix issues
2022-09-27 23:02:40 -07:00
Karoy Lorentey
03a4791766
[PersistentSet] Add tests for set predicates; fix issues
2022-09-27 14:18:40 -07:00
Karoy Lorentey
a887a77ef5
[PersistentSet] Add tests for intersection & subtracting; fix issues
2022-09-27 14:18:40 -07:00
Karoy Lorentey
6437aea75a
[PersistentCollections] Improve test coverage & fixtures
2022-09-27 14:18:40 -07:00
Karoy Lorentey
826e22c91e
[PersistentDictionary] Implement structural filter & compactMapValues
...
Plus add tests covering these as well and mapValues.
2022-09-24 17:09:36 -07:00
Karoy Lorentey
958fd47539
[PersistentSet] Start drafting the new type
2022-09-21 10:45:20 -07:00
Karoy Lorentey
c355812e53
[PersistentDictionary] Small cleanups
2022-09-21 10:45:20 -07:00
Karoy Lorentey
b7bfc52664
[test] Add Dictionary API checker protocol
...
This can be used to verify that a new dictionary implementation
provides all expected members.
2022-09-19 21:25:07 -07:00
Karoy Lorentey
a2491aac45
[PersistentDictionary] Improved copy & resize operations
...
Don’t copy the current node and then insert a new item into it.
Instead, create the copy with the new item already inserted.
Ditto for new collisions.
2022-09-19 21:25:07 -07:00
Karoy Lorentey
d9cff57f0c
[test][PersistentDictionary] Clean up fixture initialization
2022-09-19 21:25:07 -07:00
Karoy Lorentey
9da672fdf8
[PersistentDictionary] Fix index(forKey:) test
2022-09-19 21:25:07 -07:00
Karoy Lorentey
4c4154ca23
[SortedCollections] Just disable SortedDictionary tests for now
2022-09-19 21:10:36 -07:00