@@ -17,85 +17,85 @@ module Dict =
1717 /// <remarks>This is a function wrapper for the IDictionary.TryGetValue method,
1818 /// representing the result as an Option<value> instead of a bool plus an out-value.
1919 /// </remarks>
20- /// <param name="k ">The key whose value you wish to find.</param>
21- /// <param name="dct ">The input dictionary.</param>
20+ /// <param name="key ">The key whose value you wish to find.</param>
21+ /// <param name="source ">The input dictionary.</param>
2222 ///
2323 /// <returns>An option wrapped value</returns>
24- let tryGetValue k ( dct : IDictionary < 'Key , 'Value >) =
25- match dct .TryGetValue k with
24+ let tryGetValue key ( source : IDictionary < 'Key , 'Value >) =
25+ match source .TryGetValue key with
2626 | true , v -> Some v
2727 | _ -> None
2828
2929 /// <summary>Does the dictionary contain the given key?</summary>
3030 /// <remarks>Note: this is a function wrapper for the IDictionary.ContainsKey method</remarks>
31- /// <param name="k ">The key to find.</param>
32- /// <param name="dct ">The input dictionary.</param>
31+ /// <param name="key ">The key to find.</param>
32+ /// <param name="source ">The input dictionary.</param>
3333 ///
3434 /// <returns>A bool indicating if the key was found</returns>
35- let containsKey k ( dct : IDictionary < 'Key , 'Value >) = dct .ContainsKey k
35+ let containsKey key ( source : IDictionary < 'Key , 'Value >) = source .ContainsKey key
3636
3737 /// <summary>Returns the keys of the given dictionary.</summary>
3838 /// <param name="source">The input dictionary.</param>
3939 ///
4040 /// <returns>A seq of the keys in the dictionary.</returns>
41- let keys ( source : IDictionary < _ , _ >) = Seq.map ( fun ( KeyValue ( k , _ )) -> k) source
41+ let keys ( source : IDictionary < _ , _ >) = Seq.map ( fun ( KeyValue ( k , _ )) -> k) source
4242
4343 /// <summary>Returns the values of the given dictionary.</summary>
4444 /// <param name="source">The input dictionary.</param>
4545 ///
4646 /// <returns>A seq of the values in the dictionary.</returns>
47- let values ( source : IDictionary < _ , _ >) = Seq.map ( fun ( KeyValue ( _ , v )) -> v) source
47+ let values ( source : IDictionary < _ , _ >) = Seq.map ( fun ( KeyValue ( _ , v )) -> v) source
4848
4949 /// <summary>Maps the given function over each value in the dictionary.</summary>
50- /// <param name="f ">The mapping function.</param>
51- /// <param name="x ">The input dictionary.</param>
50+ /// <param name="mapper ">The mapping function.</param>
51+ /// <param name="source ">The input dictionary.</param>
5252 ///
5353 /// <returns>The mapped dictionary.</returns>
54- let map f ( x : IDictionary < 'Key , 'T >) =
54+ let map mapper ( source : IDictionary < 'Key , 'T >) =
5555 let dct = Dictionary< 'Key, 'U> ()
56- for KeyValue( k, v) in x do
57- dct.Add ( k, f v)
56+ for KeyValue( k, v) in source do
57+ dct.Add ( k, mapper v)
5858 dct :> IDictionary< 'Key, 'U>
5959
6060 /// <summary>Creates a Dictionary value from a pair of Dictionaries, using a function to combine them.</summary>
6161 /// <remarks>Keys that are not present on both dictionaries are dropped.</remarks>
62- /// <param name="f ">The mapping function.</param>
63- /// <param name="x ">The first input dictionary.</param>
64- /// <param name="y ">The second input dictionary.</param>
62+ /// <param name="mapper ">The mapping function.</param>
63+ /// <param name="source1 ">The first input dictionary.</param>
64+ /// <param name="source2 ">The second input dictionary.</param>
6565 ///
6666 /// <returns>The combined dictionary.</returns>
67- let map2 f ( x : IDictionary < 'Key , 'T1 >) ( y : IDictionary < 'Key , 'T2 >) =
67+ let map2 mapper ( source1 : IDictionary < 'Key , 'T1 >) ( source2 : IDictionary < 'Key , 'T2 >) =
6868 let dct = Dictionary< 'Key, 'U> ()
69- let f = OptimizedClosures.FSharpFunc<_,_, _>. Adapt f
70- for KeyValue( k, vx) in x do
71- match tryGetValue k y with
69+ let f = OptimizedClosures.FSharpFunc<_, _, _>. Adapt mapper
70+ for KeyValue( k, vx) in source1 do
71+ match tryGetValue k source2 with
7272 | Some vy -> dct.Add ( k, f.Invoke ( vx, vy))
7373 | None -> ()
7474 dct :> IDictionary< 'Key, 'U>
7575
7676 /// <summary>Applies given function to each value of the given dictionary.</summary>
77- /// <param name="f ">The mapping function.</param>
78- /// <param name="x ">The input dictionary.</param>
77+ /// <param name="chooser ">The mapping function.</param>
78+ /// <param name="source ">The input dictionary.</param>
7979 ///
8080 /// <returns>Returns dictionary with values x for each dictionary value where the function returns Some(x).</returns>
81- let chooseValues f ( x : IDictionary < 'Key , 'T >) =
81+ let chooseValues chooser ( source : IDictionary < 'Key , 'T >) =
8282 let dct = Dictionary< 'Key, 'U> ()
83- for KeyValue( k, v) in x do
84- match f v with
83+ for KeyValue( k, v) in source do
84+ match chooser v with
8585 | Some v -> dct.Add ( k, v)
8686 | None -> ()
8787 dct :> IDictionary< 'Key, 'U>
8888
8989 /// <summary>Tuples values of two dictionaries.</summary>
9090 /// <remarks>Keys that are not present on both dictionaries are dropped.</remarks>
91- /// <param name="x ">The first input dictionary.</param>
92- /// <param name="y ">The second input dictionary.</param>
91+ /// <param name="source1 ">The first input dictionary.</param>
92+ /// <param name="source2 ">The second input dictionary.</param>
9393 ///
9494 /// <returns>The tupled dictionary.</returns>
95- let zip ( x : IDictionary < 'Key , 'T1 >) ( y : IDictionary < 'Key , 'T2 >) =
95+ let zip ( source1 : IDictionary < 'Key , 'T1 >) ( source2 : IDictionary < 'Key , 'T2 >) =
9696 let dct = Dictionary< 'Key, 'T1 * 'T2> ()
97- for KeyValue( k, vx) in x do
98- match tryGetValue k y with
97+ for KeyValue( k, vx) in source1 do
98+ match tryGetValue k source2 with
9999 | Some vy -> dct.Add ( k, ( vx, vy))
100100 | None -> ()
101101 dct :> IDictionary< 'Key, 'T1 * 'T2>
@@ -133,7 +133,7 @@ module Dict =
133133 .ToDictionary(( fun x -> x.Key), ( fun y -> y.Value)) :> IDictionary< 'Key, 'T>
134134
135135 /// Returns the intersection of two Dicts, using the combiner function for duplicate keys.
136- let intersectWith combiner ( source1 : IDictionary < 'Key , 'T >) ( source2 : IDictionary < 'Key , 'T >) =
136+ let intersectWith combiner ( source1 : IDictionary < 'Key , 'T >) ( source2 : IDictionary < 'Key , 'T >) =
137137 Enumerable
138138 .Join(
139139 source1,
@@ -145,19 +145,19 @@ module Dict =
145145 .ToDictionary(( fun x -> x.Key), ( fun y -> y.Value)) :> IDictionary< 'Key, 'T>
146146
147147 ///Returns the intersection of two Dicts, preferring values from the first in case of duplicate keys.
148- let intersect ( source1 : IDictionary < 'Key , 'T >) ( source2 : IDictionary < 'Key , 'T >) =
148+ let intersect ( source1 : IDictionary < 'Key , 'T >) ( source2 : IDictionary < 'Key , 'T >) =
149149 intersectWith ( fun a _ -> a) source1 source2
150150 #endif
151151
152152 /// <summary>Choose with access to the key.</summary>
153- /// <param name="f ">The mapping function, taking key and element as parameters.</param>
154- /// <param name="x ">The input dictionary.</param>
153+ /// <param name="chooser ">The mapping function, taking key and element as parameters.</param>
154+ /// <param name="source ">The input dictionary.</param>
155155 ///
156156 /// <returns>Dictionary with values (k, x) for each dictionary value where the function returns Some(x).</returns>
157- let choosei f ( x : IDictionary < 'Key , 'T >) =
157+ let choosei chooser ( source : IDictionary < 'Key , 'T >) =
158158 let dct = Dictionary< 'Key, 'U> ()
159- for KeyValue( k, v) in x do
160- match f k v with
159+ for KeyValue( k, v) in source do
160+ match chooser k v with
161161 | Some v -> dct.Add ( k, v)
162162 | None -> ()
163163 dct :> IDictionary< 'Key, 'U>
0 commit comments