@@ -27,10 +27,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727 value, as ` ImmutableArray<'T>.Builder.Replace ` does, where ` FlatList.replace ` throws ` ArgumentException ` .
2828* ` flatList { } ` builds a flat list.
2929* ` HashMap ` has every function of the FSharp.Core ` Map ` module that applies to a hash map, with its semantics and
30- exceptions, except ` add ` , which stays the ` Add ` of ` ImmutableDictionary ` ; plus ` choose ` and ` singleton ` , the builder
31- functions ` build ` , ` builder ` , ` ofBuilder ` , ` toBuilder ` and ` update ` , and the wrappers of the ` ImmutableDictionary `
32- members ` add ` , ` addRange ` , ` clear ` , ` containsBinding ` , ` containsValue ` , ` keyComparer ` , ` ofReadOnlySpan ` , ` ofSeqBy ` ,
33- ` removeRange ` , ` setItem ` , ` setItems ` , ` tryGetKey ` and ` valueComparer ` , which keep the semantics of the BCL.
30+ exceptions, except ` add ` , which stays the ` Add ` of ` ImmutableDictionary ` , as in 1.0.0; plus ` choose ` and ` singleton ` ,
31+ the builder functions ` build ` and ` update ` , and the wrappers of the ` ImmutableDictionary ` members ` addRange ` ,
32+ ` containsBinding ` , ` containsValue ` , ` ofReadOnlySpan ` , ` ofSeqBy ` , ` removeRange ` , ` setItem ` , ` setItems ` , ` tryGetKey ` and
33+ ` valueComparer ` , which keep the semantics of the BCL.
34+ * The transformations of ` HashMap ` keep the key comparer of the map, and the value comparer when the type of the values
35+ does not change.
3436* ` HashMap.containsBinding ` and ` IMap.containsBinding ` tell whether a key is bound to a value, comparing the value with the
3537 value comparer of the map, as ` Contains ` of a ` KeyValuePair ` does. ` tryFind ` followed by ` = ` compares with F# equality,
3638 which can differ from the value comparer, and an ` IMap ` does not expose its value comparer.
@@ -42,13 +44,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4244 converts to either parameter under the same condition.
4345* ` HashMap.build ` creates a hash map with a builder that an action fills, ` HashMap.update ` changes a hash map with a
4446 builder, and the member ` build ` of ` CustomComparersHashMap ` does the first with its comparers.
45- * ` HashMap.ofArray ` , ` HashMap.ofList ` and ` HashMap.ofSeq ` take the bindings as ` KeyValuePair ` s, reference tuples or struct
46- tuples: they are static members of ` ImmutableDictionary<'Key, 'Value> ` in the auto-opened ` HashMapExtensions ` module, one
47- overload per shape, and every shape keeps the last binding of a repeated key, as ` Map.ofSeq ` does, unless the value
48- comparer finds the two values equal. They take a dictionary, an F# ` Map ` or another hash map too. C# does not see them
49- as members of ` ImmutableDictionary ` ; it calls the public static methods ` HashMapExtensions.OfArray ` , ` OfList ` and
50- ` OfSeq ` , or the members of the struct below. A reflection over the ` HashMap ` module does not list them. To reject
51- another value of a repeated key, as ` ImmutableDictionary.CreateRange ` does, add the bindings to an empty map:
47+ * ` HashMap.ofArray ` and ` HashMap.ofList ` are new, and ` HashMap.ofSeq ` , which took ` KeyValuePair ` s, takes tuples too. The
48+ three take the bindings as ` KeyValuePair ` s, reference tuples or struct tuples: they are static members of
49+ ` ImmutableDictionary<'Key, 'Value> ` in the auto-opened ` HashMapExtensions ` module, one overload per shape, and every
50+ shape keeps the last binding of a repeated key, as ` Map.ofSeq ` does, unless the value comparer finds the two values
51+ equal. They take a dictionary, an F# ` Map ` or another hash map too. C# does not see them as members of
52+ ` ImmutableDictionary ` ; it calls the public static methods ` HashMapExtensions.OfArray ` , ` OfList ` and ` OfSeq ` , or the
53+ members of the struct below. A reflection over the ` HashMap ` module does not list them. To reject another value of a
54+ repeated key, as ` ImmutableDictionary.CreateRange ` does, add the bindings to an empty map:
5255 ` HashMap.empty |> HashMap.addRange pairs ` .
5356* ` HashMap.forComparers ` and ` HashMap.forKeyComparer ` return a ` CustomComparersHashMap<'Key, 'Value> ` struct whose members
5457 ` build ` , ` builder ` , ` empty ` , ` ofArray ` , ` ofList ` , ` ofReadOnlySpan ` , ` ofSeq ` , ` ofSeqBy ` , ` ofSpan ` and ` singleton ` create
@@ -61,10 +64,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6164 map: ` HashMap.forComparers keyComparer (HashMap.valueComparer table) ` .
6265* ` HashMap.addRange ` and ` HashMap.setItems ` take ` KeyValuePair ` s; the nested modules ` HashMap.Tuple ` and
6366 ` HashMap.ValueTuple ` take reference and struct tuples: ` HashMap.Tuple.addRange pairs table ` .
64- * The single-key idioms of the BCL are functions of the module: ` tryFind ` is ` TryGetValue ` , ` tryFind ` followed by
65- ` ValueOption.defaultValue ` is ` GetValueOrDefault ` , and ` change ` with a function that keeps an existing value adds a
66- binding only when the key has none, as ` ImmutableInterlocked.TryAdd ` does. ` ToImmutableDictionary ` with an element
67- selector has no function; to reject a repeated key like the BCL does, add the mapped pairs to an empty map,
67+ * ` HashMap ` and ` IMap ` keep the convention of ` ImmutableDictionary ` where it differs from ` Map ` : a new value of a key that
68+ the value comparer finds equal to the current one leaves the binding as it is, its key included, in ` add ` , ` change ` ,
69+ ` setItem ` , ` setItems ` , ` addRange ` , the creation functions and members, and ` hashMap { } ` . ` add ` is the ` Add ` of
70+ ` ImmutableDictionary ` , as it was in 1.0.0: it throws ` ArgumentException ` for a key that is bound to a value that the
71+ value comparer finds different, and returns the input itself for the same binding; ` setItem ` replaces the value.
72+ * ` change ` with a function that keeps an existing value adds a binding only when the key has none, as
73+ ` ImmutableInterlocked.TryAdd ` does. The other single-key idioms of the BCL need no new function: ` tryFind ` is
74+ ` TryGetValue ` , and ` tryFind ` followed by ` ValueOption.defaultValue ` is ` GetValueOrDefault ` . ` ToImmutableDictionary ` with
75+ an element selector has no function; to reject a repeated key like the BCL does, add the mapped pairs to an empty map,
6876 ` HashMap.empty |> HashMap.addRange (source |> Seq.map (fun x -> KeyValuePair (key x, element x))) ` , and ` HashMap.ofSeq `
6977 of the mapped pairs lets the last binding win. Maps have no builder module: call ` Add ` , ` AddRange ` , ` Remove ` ,
7078 ` RemoveRange ` , the indexer and the other members on the builder.
@@ -90,19 +98,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9098* ` FlatList.sub ` has the meaning of ` Array.sub ` : ` sub array startIndex count ` returns ` count ` elements from ` startIndex ` .
9199 It was ` sub start stop list ` .
92100* The nested ` FlatList.Builder ` module is now the ` FlatListBuilder ` module.
93- * ` HashMap ` : ` tryFind ` and ` tryPick ` return ` voption ` , and ` pick ` and ` tryPick ` take choosers that return ` voption ` .
94- ` toArray ` , ` toList ` and ` toSeq ` return struct tuples instead of ` KeyValuePair ` s.
95- * ` HashMap ` follows the FSharp.Core ` Map ` module: ` ofArray ` and ` ofSeq ` keep the last binding of a repeated key instead of
96- throwing, ` filter ` returns a map instead of a sequence, ` map ` keeps the keys and takes a function of the key and the
97- value, ` singleton ` takes the key and the value curried, and ` find ` , ` findKey ` and ` pick ` throw the ` KeyNotFoundException `
98- of ` Map ` . A ` null ` map throws ` ArgumentNullException ` .
99- * ` HashMap ` and ` IMap ` keep the convention of ` ImmutableDictionary ` where it differs from ` Map ` : a new value of a key that
100- the value comparer finds equal to the current one leaves the binding as it is, its key included, in ` add ` , ` change ` ,
101- ` setItem ` , ` setItems ` , ` addRange ` , the creation functions and members, and ` hashMap { } ` . ` add ` is the ` Add ` of
102- ` ImmutableDictionary ` , as it was in 1.0.0: it throws ` ArgumentException ` for a key that is bound to a value that the
103- value comparer finds different, and returns the input itself for the same binding; ` setItem ` replaces the value.
104- * ` HashMap ` : every transformation keeps the key comparer of the map, and the value comparer when the type of the values
105- does not change.
101+ * ` HashMap.tryFind ` returns a ` voption ` , where it returned an ` option ` ;
102+ ` FSharp.Collections.Immutable.Option.HashMap.tryFind ` returns the ` option ` .
103+ * ` HashMap.ofSeq ` keeps the last binding of a repeated key, where it threw ` ArgumentException ` for a key that is bound to
104+ two different values.
105+ * ` HashMap.filter ` returns the bindings that satisfy the predicate, where it returned all the bindings of the hash map.
106106
107107### Removed
108108
@@ -120,15 +120,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
120120 compared in F# structural equality. The removed functions did not remove the elements that satisfy a predicate: use
121121 ` filter ` with the negated predicate for that.
122122* ` FlatList.removeRange ` : use ` removeManyAt ` .
123- * ` Seq.ofHashMap ` and ` Seq.toHashMap ` : use ` HashMap.toSeq ` and ` HashMap.ofSeq ` . ` toSeq ` yields struct tuples
124- instead of ` KeyValuePair ` s, and a hash map is itself a ` seq<KeyValuePair<_, _>> ` , so ` Seq.toArray table ` gives the old
125- shape.
126- * ` HashMap.length ` , ` append ` , ` except ` and ` where ` : use ` count ` , ` addRange ` , ` removeRange ` and ` filter ` .
127- * ` HashMap.ofKeyComparer ` , ` ofComparers ` , ` builderWithKeyComparer ` and ` builderWithComparers ` : use the members ` empty ` and
128- ` builder ` of ` HashMap.forKeyComparer ` and ` HashMap.forComparers ` .
129- * ` HashMap.vTryFind ` , ` vTryPick ` and ` ofSeqWith ` : use ` tryFind ` , ` tryPick ` and ` ofSeqBy ` .
130- * ` HashMap.ofSeqGroupBy ` , ` HashMap.check ` and the ` HashMapBuilder ` abbreviation: group with the ` groupBy ` of a collection
131- module and pass the groups to ` HashMap.ofSeq ` , and use ` HashMap<'Key, 'Value>.Builder ` .
123+ * ` HashMap.length ` , ` append ` and ` except ` : use ` count ` , ` addRange ` and ` removeRange ` . ` addRange pairs table ` takes the
124+ bindings before the hash map, where ` append map pairs ` took the hash map first.
125+ * ` HashMap.check ` : no replacement is needed, because every function of the module throws ` ArgumentNullException ` for a
126+ ` null ` hash map.
127+ * The ` HashMapBuilder<'Key, 'Value> ` type abbreviation: use ` HashMap<'Key, 'Value>.Builder ` .
132128
133129## [ 1.0.0] - 2020-02-23
134130
0 commit comments