Skip to content

Commit 73840d8

Browse files
xperiandriclaude
andcommitted
fixup! docs: FrozenSet in the changelog and the collection table
The changelog gives `(FrozenSet.forComparer (FrozenSet.comparer set)).ofSeq elements` as the way to pass a sequence to `IsSubsetOf`, `IsProperSubsetOf`, `IsSupersetOf`, `IsProperSupersetOf`, `Overlaps` and `SetEquals`, because the members compare the elements in the comparer of the frozen set. `FrozenSet.ofSeq elements` converts them with the default comparer, which merges the elements that it finds equal before the relation sees them. The answer is the one of the member when the comparer of the frozen set finds equal every pair of elements that the default comparer finds equal, as the default comparer and `StringComparer.OrdinalIgnoreCase` do. It can differ when the comparer tells such elements apart, as `HashIdentity.Reference` does for two strings with the same text: a frozen set that compares by reference and holds both is a subset of the sequence of both, but not of the frozen set that the default comparer makes of it, which keeps one of them. `Overlaps` and `IsSupersetOf` with a sequence stay `Seq.exists` and `Seq.forall` with `FrozenSet.contains`, which compare in the comparer of the frozen set for every comparer. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent bf56850 commit 73840d8

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
102102
* The members of `FrozenSet<'T>` map to the module as follows. `TryGetValue(x, out v)` is `tryGetValue x set`, which
103103
returns a `voption` (`Option.FrozenSet.tryGetValue` returns an `option`). `Items` is `toFlatList`, and `CopyTo` is
104104
`toFlatList` followed by `FlatList.blit` or `FlatList.asSpan`. `IsSubsetOf`, `IsProperSubsetOf`, `IsSupersetOf`,
105-
`IsProperSupersetOf`, `Overlaps` and `SetEquals` take frozen sets in the module, as the `Set` functions do: pass
106-
`FrozenSet.ofSeq elements`, or `(FrozenSet.forComparer (FrozenSet.comparer set)).ofSeq elements` to give the elements
107-
the comparer of the first frozen set; `Overlaps` and `IsSupersetOf` with a sequence are `Seq.exists` and `Seq.forall`
108-
with `FrozenSet.contains`. The mutating members of the interfaces, such as `ISet<T>.UnionWith` and `ICollection<T>.Add`,
109-
throw `NotSupportedException` on the BCL type and have no function.
105+
`IsProperSupersetOf`, `Overlaps` and `SetEquals` take frozen sets in the module, as the `Set` functions do. To pass a
106+
sequence, convert it with `(FrozenSet.forComparer (FrozenSet.comparer set)).ofSeq elements`: the elements get the
107+
comparer of the first frozen set, as they do in the members. `FrozenSet.ofSeq elements` converts them with the default
108+
comparer instead, which merges the elements that it finds equal before the relation sees them. The answer is that of
109+
the member when the comparer of `set` finds equal every pair of elements that the default comparer finds equal, as the
110+
default comparer and `StringComparer.OrdinalIgnoreCase` do. It can differ when the comparer of `set` tells such
111+
elements apart, as `HashIdentity.Reference` does for two strings with the same text. `Overlaps` and `IsSupersetOf`
112+
with a sequence are `Seq.exists` and `Seq.forall` with `FrozenSet.contains`, for every comparer. The mutating members
113+
of the interfaces, such as `ISet<T>.UnionWith` and `ICollection<T>.Add`, throw `NotSupportedException` on the BCL type
114+
and have no function.
110115
* `FrozenSet`: the element that stays when the comparer finds two elements equal follows the BCL. `union` keeps the
111116
element of the first frozen set, `intersect` keeps the elements of the second one, as `ImmutableHashSet.Intersect` and
112117
`ImmutableSortedSet.Intersect` do, because `FrozenSet<'T>` has no such member, and the creation functions keep the

0 commit comments

Comments
 (0)