Skip to content

Commit d61c19f

Browse files
xperiandriclaude
andcommitted
fixup! docs: HashMap and IMap in the changelog, the collection table and the tutorial
The changelog lists `HashMap.ofSpan` and the member `ofSpan` of `CustomComparersHashMap`, and says why the pair exists: F# converts a `Span` to the parameter of `ofReadOnlySpan` only when it has inferred the types of the call. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent e86b69f commit d61c19f

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
* `HashMap.containsBinding` and `IMap.containsBinding` tell whether a key is bound to a value, comparing the value with the
2626
value comparer of the map, as `Contains` of a `KeyValuePair` does. `tryFind` followed by `=` compares with F# equality,
2727
which can differ from the value comparer, and an `IMap` does not expose its value comparer.
28-
* `HashMap.ofReadOnlySpan` creates a hash map from a `ReadOnlySpan<KeyValuePair<'Key, 'Value>>` with
29-
`ImmutableDictionary.CreateRangeWithOverwrite`, and the member `ofReadOnlySpan` of `CustomComparersHashMap` does so with
30-
its comparers. A repeated key never throws: the last binding wins, unless the value comparer finds the two values equal.
31-
A `Span` or an array converts to the parameter only when the types of the call are known; otherwise pass a
32-
`ReadOnlySpan`.
28+
* `HashMap.ofReadOnlySpan` and `HashMap.ofSpan` create a hash map from a `ReadOnlySpan` or a `Span` of
29+
`KeyValuePair<'Key, 'Value>` with `ImmutableDictionary.CreateRangeWithOverwrite`, which takes a read-only span only, and
30+
the members `ofReadOnlySpan` and `ofSpan` of `CustomComparersHashMap` do so with its comparers. A repeated key never
31+
throws: the last binding wins, unless the value comparer finds the two values equal. F# converts a `Span` to the
32+
parameter of `ofReadOnlySpan` only when it has inferred the types of the call, which is why `ofSpan` exists; an array
33+
converts to either parameter under the same condition.
3334
* `HashMap.build` creates a hash map with a builder that an action fills, `HashMap.update` changes a hash map with a
3435
builder, and the member `build` of `CustomComparersHashMap` does the first with its comparers.
3536
* `HashMap.ofArray`, `HashMap.ofList` and `HashMap.ofSeq` take the bindings as `KeyValuePair`s, reference tuples or struct
@@ -41,9 +42,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4142
another value of a repeated key, as `ImmutableDictionary.CreateRange` does, add the bindings to an empty map:
4243
`HashMap.empty |> HashMap.addRange pairs`.
4344
* `HashMap.forComparers` and `HashMap.forKeyComparer` return a `CustomComparersHashMap<'Key, 'Value>` struct whose members
44-
`build`, `builder`, `empty`, `ofArray`, `ofList`, `ofReadOnlySpan`, `ofSeq`, `ofSeqBy` and `singleton` create hash maps
45-
with its comparers: `(HashMap.forKeyComparer StringComparer.OrdinalIgnoreCase).ofSeq pairs`. A `null` comparer throws
46-
`ArgumentNullException`.
45+
`build`, `builder`, `empty`, `ofArray`, `ofList`, `ofReadOnlySpan`, `ofSeq`, `ofSeqBy`, `ofSpan` and `singleton` create
46+
hash maps with its comparers: `(HashMap.forKeyComparer StringComparer.OrdinalIgnoreCase).ofSeq pairs`. A `null`
47+
comparer throws `ArgumentNullException`.
4748
* `ofSeq` of that struct also gives an existing hash map other comparers, as `WithComparers` does, with three differences.
4849
It takes O(1) only when the key comparer of the map is the instance of the struct, and rebuilds the map otherwise.
4950
Keys that the new comparer makes equal merge, the later binding winning, where `WithComparers` throws. And

0 commit comments

Comments
 (0)