未验证 提交 be9280e6 编写于 作者: D Don Syme 提交者: GitHub

improve doc comments for FSharp.Core (#9844)

* improve xml doc spacing

* improve cref nodes

* fix broken xml doc

* fix more crefs

* doc improvements
上级 e2e29f37
......@@ -279,8 +279,10 @@ type VersionHelper() =
/// <summary>
/// Parses a version string of the form "major [ '.' minor [ '.' build [ '.' revision ] ] ]".
/// </summary>
///
/// <param name="s">The version string to parse.</param>
/// <param name="version">If parsing succeeds, the parsed version. Otherwise a version that represents as much of the input as could be parsed successfully.</param>
///
/// <returns>True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise.</returns>
static member TryParse(s: string, [<Out>] version: byref<Version>) =
VersionHelper.TryParse (s, false, UInt16.MaxValue, true, ref version)
......@@ -289,12 +291,14 @@ type VersionHelper() =
/// Parses a version string of the form "major [ '.' minor [ '.' ( '*' | ( build [ '.' ( '*' | revision ) ] ) ) ] ]"
/// as accepted by System.Reflection.AssemblyVersionAttribute.
/// </summary>
///
/// <param name="s">The version string to parse.</param>
/// <param name="allowWildcard">Indicates whether or not a wildcard is accepted as the terminal component.</param>
/// <param name="version">
/// If parsing succeeded, the parsed version. Otherwise a version instance with all parts set to zero.
/// If <paramref name="s"/> contains * the version build and/or revision numbers are set to <see cref="ushort.MaxValue"/>.
/// </param>
///
/// <returns>True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise.</returns>
static member TryParseAssemblyVersion (s: string, allowWildcard: bool, [<Out>] version: byref<Version>) =
......@@ -306,6 +310,7 @@ type VersionHelper() =
/// Parses a version string of the form "major [ '.' minor [ '.' ( '*' | ( build [ '.' ( '*' | revision ) ] ) ) ] ]"
/// as accepted by System.Reflection.AssemblyVersionAttribute.
/// </summary>
///
/// <param name="s">The version string to parse.</param>
/// <param name="allowWildcard">Indicates whether or not we're parsing an assembly version string. If so, wildcards are accepted and each component must be less than 65535.</param>
/// <param name="maxValue">The maximum value that a version component may have.</param>
......@@ -314,6 +319,7 @@ type VersionHelper() =
/// If parsing succeeded, the parsed version. When <paramref name="allowPartialParse"/> is true a version with values up to the first invalid character set. Otherwise a version with all parts set to zero.
/// If <paramref name="s"/> contains * and wildcard is allowed the version build and/or revision numbers are set to <see cref="ushort.MaxValue"/>.
/// </param>
///
/// <returns>True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise.</returns>
static member private TryParse(s: string, allowWildcard: bool, maxValue: uint16, allowPartialParse: bool, [<Out>] version: byref<Version>) =
Debug.Assert (not allowWildcard || maxValue < UInt16.MaxValue)
......
......@@ -117,6 +117,7 @@ module Nullable =
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
/// <param name="value">The input value.</param>
///
/// <returns>The converted byte</returns>
[<CompiledName("ToByte")>]
val inline byte : value:Nullable< ^T > -> Nullable<byte> when ^T : (static member op_Explicit : ^T -> byte) and default ^T : int
......@@ -124,7 +125,9 @@ module Nullable =
/// <summary>Converts the argument to byte. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted byte</returns>
[<CompiledName("ToUInt8")>]
val inline uint8 : value:Nullable< ^T > -> Nullable<uint8> when ^T : (static member op_Explicit : ^T -> uint8) and default ^T : int
......@@ -132,7 +135,9 @@ module Nullable =
/// <summary>Converts the argument to signed byte. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted sbyte</returns>
[<CompiledName("ToSByte")>]
val inline sbyte : value:Nullable< ^T > -> Nullable<sbyte> when ^T : (static member op_Explicit : ^T -> sbyte) and default ^T : int
......@@ -140,7 +145,9 @@ module Nullable =
/// <summary>Converts the argument to signed byte. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted sbyte</returns>
[<CompiledName("ToInt8")>]
val inline int8 : value:Nullable< ^T > -> Nullable<int8> when ^T : (static member op_Explicit : ^T -> int8) and default ^T : int
......@@ -148,7 +155,9 @@ module Nullable =
/// <summary>Converts the argument to signed 16-bit integer. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted int16</returns>
[<CompiledName("ToInt16")>]
val inline int16 : value:Nullable< ^T > -> Nullable<int16> when ^T : (static member op_Explicit : ^T -> int16) and default ^T : int
......@@ -156,7 +165,9 @@ module Nullable =
/// <summary>Converts the argument to unsigned 16-bit integer. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted uint16</returns>
[<CompiledName("ToUInt16")>]
val inline uint16 : value:Nullable< ^T > -> Nullable<uint16> when ^T : (static member op_Explicit : ^T -> uint16) and default ^T : int
......@@ -164,7 +175,9 @@ module Nullable =
/// <summary>Converts the argument to signed 32-bit integer. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted int</returns>
[<CompiledName("ToInt")>]
val inline int : value:Nullable< ^T > -> Nullable<int> when ^T : (static member op_Explicit : ^T -> int) and default ^T : int
......@@ -172,13 +185,17 @@ module Nullable =
/// <summary>Converts the argument to an unsigned 32-bit integer. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted unsigned integer</returns>
[<CompiledName("ToUInt")>]
val inline uint: value: Nullable< ^T > -> Nullable<uint> when ^T :(static member op_Explicit: ^T -> uint) and default ^T : uint
/// <summary>Converts the argument to a particular enum type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted enum type.</returns>
[<CompiledName("ToEnum")>]
val inline enum : value:Nullable< int32 > -> Nullable< ^U > when ^U : enum<int32>
......@@ -186,7 +203,9 @@ module Nullable =
/// <summary>Converts the argument to signed 32-bit integer. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted int32</returns>
[<CompiledName("ToInt32")>]
val inline int32 : value:Nullable< ^T > -> Nullable<int32> when ^T : (static member op_Explicit : ^T -> int32) and default ^T : int
......@@ -194,7 +213,9 @@ module Nullable =
/// <summary>Converts the argument to unsigned 32-bit integer. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted uint32</returns>
[<CompiledName("ToUInt32")>]
val inline uint32 : value:Nullable< ^T > -> Nullable<uint32> when ^T : (static member op_Explicit : ^T -> uint32) and default ^T : int
......@@ -202,7 +223,9 @@ module Nullable =
/// <summary>Converts the argument to signed 64-bit integer. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted int64</returns>
[<CompiledName("ToInt64")>]
val inline int64 : value:Nullable< ^T > -> Nullable<int64> when ^T : (static member op_Explicit : ^T -> int64) and default ^T : int
......@@ -210,7 +233,9 @@ module Nullable =
/// <summary>Converts the argument to unsigned 64-bit integer. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted uint64</returns>
[<CompiledName("ToUInt64")>]
val inline uint64 : value:Nullable< ^T > -> Nullable<uint64> when ^T : (static member op_Explicit : ^T -> uint64) and default ^T : int
......@@ -218,7 +243,9 @@ module Nullable =
/// <summary>Converts the argument to 32-bit float. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted float32</returns>
[<CompiledName("ToFloat32")>]
val inline float32 : value:Nullable< ^T > -> Nullable<float32> when ^T : (static member op_Explicit : ^T -> float32) and default ^T : int
......@@ -226,7 +253,9 @@ module Nullable =
/// <summary>Converts the argument to 64-bit float. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted float</returns>
[<CompiledName("ToFloat")>]
val inline float : value:Nullable< ^T > -> Nullable<float> when ^T : (static member op_Explicit : ^T -> float) and default ^T : int
......@@ -234,7 +263,9 @@ module Nullable =
/// <summary>Converts the argument to 32-bit float. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted float32</returns>
[<CompiledName("ToSingle")>]
val inline single : value:Nullable< ^T > -> Nullable<single> when ^T : (static member op_Explicit : ^T -> single) and default ^T : int
......@@ -242,7 +273,9 @@ module Nullable =
/// <summary>Converts the argument to 64-bit float. This is a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted float</returns>
[<CompiledName("ToDouble")>]
val inline double : value:Nullable< ^T > -> Nullable<double> when ^T : (static member op_Explicit : ^T -> double) and default ^T : int
......@@ -250,7 +283,9 @@ module Nullable =
/// <summary>Converts the argument to signed native integer. This is a direct conversion for all
/// primitive numeric types. Otherwise the operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted nativeint</returns>
[<CompiledName("ToIntPtr")>]
val inline nativeint : value:Nullable< ^T > -> Nullable<nativeint> when ^T : (static member op_Explicit : ^T -> nativeint) and default ^T : int
......@@ -258,7 +293,9 @@ module Nullable =
/// <summary>Converts the argument to unsigned native integer using a direct conversion for all
/// primitive numeric types. Otherwise the operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted unativeint</returns>
[<CompiledName("ToUIntPtr")>]
val inline unativeint : value:Nullable< ^T > -> Nullable<unativeint> when ^T : (static member op_Explicit : ^T -> unativeint) and default ^T : int
......@@ -266,14 +303,18 @@ module Nullable =
/// <summary>Converts the argument to System.Decimal using a direct conversion for all
/// primitive numeric types. The operation requires an appropriate
/// static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted decimal.</returns>
[<CompiledName("ToDecimal")>]
val inline decimal : value:Nullable< ^T > -> Nullable<decimal> when ^T : (static member op_Explicit : ^T -> decimal) and default ^T : int
/// <summary>Converts the argument to character. Numeric inputs are converted according to the UTF-16
/// encoding for characters. The operation requires an appropriate static conversion method on the input type.</summary>
///
/// <param name="value">The input value.</param>
///
/// <returns>The converted char.</returns>
[<CompiledName("ToChar")>]
val inline char : value:Nullable< ^T > -> Nullable<char> when ^T : (static member op_Explicit : ^T -> char) and default ^T : int
此差异已折叠。
......@@ -58,7 +58,7 @@ namespace Microsoft.FSharp.Collections
/// <param name="targetIndex2">The second-dimension index to begin copying into in the target array.</param>
/// <param name="length1">The number of elements to copy across the first dimension of the arrays.</param>
/// <param name="length2">The number of elements to copy across the second dimension of the arrays.</param>
/// <exception cref="System.ArgumentException">Thrown when any of the indices are negative or if either of
/// <exception cref="T:System.ArgumentException">Thrown when any of the indices are negative or if either of
/// the counts are larger than the dimensions of the array allow.</exception>
[<CompiledName("CopyTo")>]
val blit: source:'T[,] -> sourceIndex1:int -> sourceIndex2:int -> target:'T[,] -> targetIndex1:int -> targetIndex2:int -> length1:int -> length2:int -> unit
......@@ -70,7 +70,7 @@ namespace Microsoft.FSharp.Collections
/// <param name="initializer">A function to produce elements of the array given the two indices.</param>
///
/// <returns>The generated array.</returns>
/// <exception cref="System.ArgumentException">Thrown when either of the lengths is negative.</exception>
/// <exception cref="T:System.ArgumentException">Thrown when either of the lengths is negative.</exception>
[<CompiledName("Initialize")>]
val init: length1:int -> length2:int -> initializer:(int -> int -> 'T) -> 'T[,]
......@@ -81,7 +81,7 @@ namespace Microsoft.FSharp.Collections
/// <param name="value">The value to populate the new array.</param>
///
/// <returns>The created array.</returns>
/// <exception cref="System.ArgumentException">Thrown when length1 or length2 is negative.</exception>
/// <exception cref="T:System.ArgumentException">Thrown when length1 or length2 is negative.</exception>
[<CompiledName("Create")>]
val create: length1:int -> length2:int -> value:'T -> 'T[,]
......@@ -91,7 +91,7 @@ namespace Microsoft.FSharp.Collections
/// <param name="length2">The length of the second dimension of the array.</param>
///
/// <returns>The created array.</returns>
/// <exception cref="System.ArgumentException">Thrown when length1 or length2 is negative.</exception>
/// <exception cref="T:System.ArgumentException">Thrown when length1 or length2 is negative.</exception>
[<CompiledName("ZeroCreate")>]
val zeroCreate : length1:int -> length2:int -> 'T[,]
......@@ -104,7 +104,7 @@ namespace Microsoft.FSharp.Collections
/// <param name="initializer">A function to produce elements of the array given the two indices.</param>
///
/// <returns>The created array.</returns>
/// <exception cref="System.ArgumentException">Thrown when base1, base2, length1, or length2 is negative.</exception>
/// <exception cref="T:System.ArgumentException">Thrown when base1, base2, length1, or length2 is negative.</exception>
[<CompiledName("InitializeBased")>]
val initBased: base1:int -> base2:int -> length1:int -> length2:int -> initializer:(int -> int -> 'T) -> 'T[,]
......@@ -117,7 +117,7 @@ namespace Microsoft.FSharp.Collections
/// <param name="initial">The value to populate the new array.</param>
///
/// <returns>The created array.</returns>
/// <exception cref="System.ArgumentException">Thrown when base1, base2, length1, or length2 is negative.</exception>
/// <exception cref="T:System.ArgumentException">Thrown when base1, base2, length1, or length2 is negative.</exception>
[<CompiledName("CreateBased")>]
val createBased: base1:int -> base2:int -> length1:int -> length2:int -> initial: 'T -> 'T[,]
......@@ -129,7 +129,7 @@ namespace Microsoft.FSharp.Collections
/// <param name="length2">The length of the second dimension of the array.</param>
///
/// <returns>The created array.</returns>
/// <exception cref="System.ArgumentException">Thrown when base1, base2, length1, or length2 is negative.</exception>
/// <exception cref="T:System.ArgumentException">Thrown when base1, base2, length1, or length2 is negative.</exception>
[<CompiledName("ZeroCreateBased")>]
val zeroCreateBased : base1:int -> base2:int -> length1:int -> length2:int -> 'T[,]
......@@ -209,7 +209,7 @@ namespace Microsoft.FSharp.Collections
/// <param name="index1">The index along the first dimension.</param>
/// <param name="index2">The index along the second dimension.</param>
/// <param name="value">The value to set in the array.</param>
/// <exception cref="System.ArgumentException">Thrown when the indices are negative or exceed the bounds of the array.</exception>
/// <exception cref="T:System.ArgumentException">Thrown when the indices are negative or exceed the bounds of the array.</exception>
[<CompiledName("Set")>]
val set: array:'T[,] -> index1:int -> index2:int -> value:'T -> unit
......@@ -220,7 +220,7 @@ namespace Microsoft.FSharp.Collections
/// <param name="index2">The index along the second dimension.</param>
///
/// <returns>The value of the array at the given index.</returns>
/// <exception cref="System.ArgumentException">Thrown when the indices are negative or exceed the bounds of the array.</exception>
/// <exception cref="T:System.ArgumentException">Thrown when the indices are negative or exceed the bounds of the array.</exception>
[<CompiledName("Get")>]
val get: array:'T[,] -> index1:int -> index2:int -> 'T
......
......@@ -17,29 +17,35 @@ namespace Microsoft.FSharp.Collections
/// <param name="length2">The length of the second dimension.</param>
/// <param name="length3">The length of the third dimension.</param>
/// <param name="initial">The value of the array elements.</param>
///
/// <returns>The created array.</returns>
[<CompiledName("Create")>]
val create: length1:int -> length2:int -> length3:int -> initial:'T -> 'T[,,]
/// <summary>Creates an array given the dimensions and a generator function to compute the elements.</summary>
///
/// <param name="length1">The length of the first dimension.</param>
/// <param name="length2">The length of the second dimension.</param>
/// <param name="length3">The length of the third dimension.</param>
/// <param name="initializer">The function to create an initial value at each index into the array.</param>
///
/// <returns>The created array.</returns>
[<CompiledName("Initialize")>]
val init: length1:int -> length2:int -> length3:int -> initializer:(int -> int -> int -> 'T) -> 'T[,,]
/// <summary>Fetches an element from a 3D array. You can also use the syntax 'array.[index1,index2,index3]'</summary>
///
/// <param name="array">The input array.</param>
/// <param name="index1">The index along the first dimension.</param>
/// <param name="index2">The index along the second dimension.</param>
/// <param name="index3">The index along the third dimension.</param>
///
/// <returns>The value at the given index.</returns>
[<CompiledName("Get")>]
val get: array:'T[,,] -> index1:int -> index2:int -> index3:int -> 'T
/// <summary>Applies the given function to each element of the array.</summary>
///
/// <param name="action">The function to apply to each element of the array.</param>
/// <param name="array">The input array.</param>
[<CompiledName("Iterate")>]
......@@ -47,25 +53,32 @@ namespace Microsoft.FSharp.Collections
/// <summary>Applies the given function to each element of the array. The integer indices passed to the
/// function indicates the index of element.</summary>
///
/// <param name="action">The function to apply to each element of the array.</param>
/// <param name="array">The input array.</param>
[<CompiledName("IterateIndexed")>]
val iteri: action:(int -> int -> int -> 'T -> unit) -> array:'T[,,] -> unit
/// <summary>Returns the length of an array in the first dimension </summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the first dimension.</returns>
[<CompiledName("Length1")>]
val length1: array:'T[,,] -> int
/// <summary>Returns the length of an array in the second dimension.</summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the second dimension.</returns>
[<CompiledName("Length2")>]
val length2: array:'T[,,] -> int
/// <summary>Returns the length of an array in the third dimension.</summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the third dimension.</returns>
[<CompiledName("Length3")>]
val length3: array:'T[,,] -> int
......@@ -77,6 +90,7 @@ namespace Microsoft.FSharp.Collections
/// array.</remarks>
/// <param name="mapping">The function to transform each element of the array.</param>
/// <param name="array">The input array.</param>
///
/// <returns>The array created from the transformed elements.</returns>
[<CompiledName("Map")>]
val map: mapping:('T -> 'U) -> array:'T[,,] -> 'U[,,]
......@@ -89,12 +103,14 @@ namespace Microsoft.FSharp.Collections
/// array.</remarks>
/// <param name="mapping">The function to transform the elements at each index in the array.</param>
/// <param name="array">The input array.</param>
///
/// <returns>The array created from the transformed elements.</returns>
[<CompiledName("MapIndexed")>]
val mapi: mapping:(int -> int -> int -> 'T -> 'U) -> array:'T[,,] -> 'U[,,]
/// <summary>Sets the value of an element in an array. You can also
/// use the syntax 'array.[index1,index2,index3] &lt;- value'.</summary>
///
/// <param name="array">The input array.</param>
/// <param name="index1">The index along the first dimension.</param>
/// <param name="index2">The index along the second dimension.</param>
......@@ -104,9 +120,11 @@ namespace Microsoft.FSharp.Collections
val set: array:'T[,,] -> index1:int -> index2:int -> index3:int -> value:'T -> unit
/// <summary>Creates an array where the entries are initially the "default" value.</summary>
///
/// <param name="length1">The length of the first dimension.</param>
/// <param name="length2">The length of the second dimension.</param>
/// <param name="length3">The length of the third dimension.</param>
///
/// <returns>The created array.</returns>
[<CompiledName("ZeroCreate")>]
val zeroCreate: length1:int -> length2:int -> length3:int -> 'T[,,]
......@@ -119,70 +137,87 @@ namespace Microsoft.FSharp.Collections
module Array4D =
/// <summary>Creates an array whose elements are all initially the given value</summary>
///
/// <param name="length1">The length of the first dimension.</param>
/// <param name="length2">The length of the second dimension.</param>
/// <param name="length3">The length of the third dimension.</param>
/// <param name="length4">The length of the fourth dimension.</param>
/// <param name="initial">The initial value for each element of the array.</param>
///
/// <returns>The created array.</returns>
[<CompiledName("Create")>]
val create: length1:int -> length2:int -> length3:int -> length4:int -> initial:'T -> 'T[,,,]
/// <summary>Creates an array given the dimensions and a generator function to compute the elements.</summary>
///
/// <param name="length1">The length of the first dimension.</param>
/// <param name="length2">The length of the second dimension.</param>
/// <param name="length3">The length of the third dimension.</param>
/// <param name="length4">The length of the fourth dimension.</param>
/// <param name="initializer">The function to create an initial value at each index in the array.</param>
///
/// <returns>The created array.</returns>
[<CompiledName("Initialize")>]
val init: length1:int -> length2:int -> length3:int -> length4:int -> initializer:(int -> int -> int -> int -> 'T) -> 'T[,,,]
/// <summary>Returns the length of an array in the first dimension </summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the first dimension.</returns>
[<CompiledName("Length1")>]
val length1: array:'T[,,,] -> int
/// <summary>Returns the length of an array in the second dimension.</summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the second dimension.</returns>
[<CompiledName("Length2")>]
val length2: array:'T[,,,] -> int
/// <summary>Returns the length of an array in the third dimension.</summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the third dimension.</returns>
[<CompiledName("Length3")>]
val length3: array:'T[,,,] -> int
/// <summary>Returns the length of an array in the fourth dimension.</summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the fourth dimension.</returns>
[<CompiledName("Length4")>]
val length4: array:'T[,,,] -> int
/// <summary>Creates an array where the entries are initially the "default" value.</summary>
///
/// <param name="length1">The length of the first dimension.</param>
/// <param name="length2">The length of the second dimension.</param>
/// <param name="length3">The length of the third dimension.</param>
/// <param name="length4">The length of the fourth dimension.</param>
///
/// <returns>The created array.</returns>
[<CompiledName("ZeroCreate")>]
val zeroCreate: length1:int -> length2:int -> length3:int -> length4:int -> 'T[,,,]
/// <summary>Fetches an element from a 4D array. You can also use the syntax 'array.[index1,index2,index3,index4]'</summary>
///
/// <param name="array">The input array.</param>
/// <param name="index1">The index along the first dimension.</param>
/// <param name="index2">The index along the second dimension.</param>
/// <param name="index3">The index along the third dimension.</param>
/// <param name="index4">The index along the fourth dimension.</param>
///
/// <returns>The value at the given index.</returns>
[<CompiledName("Get")>]
val get: array:'T[,,,] -> index1:int -> index2:int -> index3:int -> index4:int -> 'T
/// <summary>Sets the value of an element in an array. You can also
/// use the syntax 'array.[index1,index2,index3,index4] &lt;- value'.</summary>
///
/// <param name="array">The input array.</param>
/// <param name="index1">The index along the first dimension.</param>
/// <param name="index2">The index along the second dimension.</param>
......
此差异已折叠。
......@@ -20,6 +20,7 @@ namespace Microsoft.FSharp.Collections
/// <summary>Compare using the given comparer function.</summary>
/// <param name="comparer">A function to compare two values.</param>
///
/// <returns>An object implementing IComparer using the supplied comparer.</returns>
val FromFunction : comparer:('T -> 'T -> int) -> IComparer<'T>
......@@ -42,8 +43,10 @@ namespace Microsoft.FSharp.Collections
val Reference<'T> : IEqualityComparer<'T> when 'T : not struct
/// <summary>Hash using the given hashing and equality functions.</summary>
///
/// <param name="hasher">A function to generate a hash code from a value.</param>
/// <param name="equality">A function to test equality of two values.</param>
///
/// <returns>An object implementing IEqualityComparer using the supplied functions.</returns>
// inline justification: allows inlining of hash functions
......
......@@ -27,6 +27,7 @@ namespace Microsoft.FSharp.Control
/// <returns>The created event.</returns>
new : unit -> Event<'Delegate,'Args>
/// <summary>Triggers the event using the given sender object and parameters. The sender object may be <c>null</c>.</summary>
///
/// <param name="sender">The object triggering the event.</param>
/// <param name="args">The parameters for the event.</param>
member Trigger : sender:obj * args:'Args -> unit
......@@ -41,6 +42,7 @@ namespace Microsoft.FSharp.Control
/// <returns>The created event.</returns>
new : unit -> Event<'T>
/// <summary>Triggers an observation using the given parameters.</summary>
///
/// <param name="arg">The event parameters.</param>
member Trigger : arg:'T -> unit
/// <summary>Publishes an observation as a first class value.</summary>
......
......@@ -12,21 +12,26 @@ namespace Microsoft.FSharp.Control
/// <summary>Fires the output event when either of the input events fire.</summary>
/// <param name="event1">The first input event.</param>
/// <param name="event2">The second input event.</param>
///
/// <returns>An event that fires when either of the input events fire.</returns>
[<CompiledName("Merge")>]
val merge: event1:IEvent<'Del1,'T> -> event2:IEvent<'Del2,'T> -> IEvent<'T>
/// <summary>Returns a new event that passes values transformed by the given function.</summary>
///
/// <param name="map">The function to transform event values.</param>
/// <param name="sourceEvent">The input event.</param>
///
/// <returns>An event that passes the transformed values.</returns>
[<CompiledName("Map")>]
val map: mapping:('T -> 'U) -> sourceEvent:IEvent<'Del,'T> -> IEvent<'U>
/// <summary>Returns a new event that listens to the original event and triggers the resulting
/// event only when the argument to the event passes the given function.</summary>
///
/// <param name="predicate">The function to determine which triggers from the event to propagate.</param>
/// <param name="sourceEvent">The input event.</param>
///
/// <returns>An event that only passes values that pass the predicate.</returns>
[<CompiledName("Filter")>]
val filter: predicate:('T -> bool) -> sourceEvent:IEvent<'Del,'T> -> IEvent<'T>
......@@ -34,8 +39,10 @@ namespace Microsoft.FSharp.Control
/// <summary>Returns a new event that listens to the original event and triggers the
/// first resulting event if the application of the predicate to the event arguments
/// returned true, and the second event if it returned false.</summary>
///
/// <param name="predicate">The function to determine which output event to trigger.</param>
/// <param name="sourceEvent">The input event.</param>
///
/// <returns>A tuple of events. The first is triggered when the predicate evaluates to true
/// and the second when the predicate evaluates to false.</returns>
[<CompiledName("Partition")>]
......@@ -44,8 +51,10 @@ namespace Microsoft.FSharp.Control
/// <summary>Returns a new event that listens to the original event and triggers the
/// first resulting event if the application of the function to the event arguments
/// returned a Choice1Of2, and the second event if it returns a Choice2Of2.</summary>
///
/// <param name="splitter">The function to transform event values into one of two types.</param>
/// <param name="sourceEvent">The input event.</param>
///
/// <returns>A tuple of events. The first fires whenever <c>splitter</c> evaluates to Choice1of1 and
/// the second fires whenever <c>splitter</c> evaluates to Choice2of2.</returns>
[<CompiledName("Split")>]
......@@ -53,8 +62,10 @@ namespace Microsoft.FSharp.Control
/// <summary>Returns a new event which fires on a selection of messages from the original event.
/// The selection function takes an original message to an optional new message.</summary>
///
/// <param name="chooser">The function to select and transform event values to pass on.</param>
/// <param name="sourceEvent">The input event.</param>
///
/// <returns>An event that fires only when the chooser returns Some.</returns>
[<CompiledName("Choose")>]
val choose: chooser:('T -> 'U option) -> sourceEvent:IEvent<'Del,'T> -> IEvent<'U>
......@@ -65,13 +76,16 @@ namespace Microsoft.FSharp.Control
/// records the current value of the state parameter. The internal state is not locked during the
/// execution of the accumulation function, so care should be taken that the
/// input IEvent not triggered by multiple threads simultaneously.</summary>
///
/// <param name="collector">The function to update the state with each event value.</param>
/// <param name="state">The initial state.</param>
/// <param name="sourceEvent">The input event.</param>
///
/// <returns>An event that fires on the updated state values.</returns>
val scan: collector:('U -> 'T -> 'U) -> state:'U -> sourceEvent:IEvent<'Del,'T> -> IEvent<'U>
/// <summary>Runs the given function each time the given event is triggered.</summary>
///
/// <param name="callback">The function to call when the event is triggered.</param>
/// <param name="sourceEvent">The input event.</param>
[<CompiledName("Add")>]
......@@ -81,7 +95,9 @@ namespace Microsoft.FSharp.Control
/// The Nth triggering of the input event passes the arguments from the N-1th and Nth triggering as
/// a pair. The argument passed to the N-1th triggering is held in hidden internal state until the
/// Nth triggering occurs.</summary>
///
/// <param name="sourceEvent">The input event.</param>
///
/// <returns>An event that triggers on pairs of consecutive values passed from the source event.</returns>
[<CompiledName("Pairwise")>]
val pairwise: sourceEvent:IEvent<'Del,'T> -> IEvent<'T * 'T>
......
......@@ -4,6 +4,7 @@
namespace Microsoft.FSharp.Core
[<AutoOpen>]
/// A set of extra operators and functions. This module is opened by default when compiling all F# code.
module ExtraTopLevelOperators =
open System
......@@ -14,57 +15,74 @@ module ExtraTopLevelOperators =
/// <summary>Print to <c>stdout</c> using the given format.</summary>
/// <param name="format">The formatter.</param>
///
/// <returns>The formatted result.</returns>
[<CompiledName("PrintFormat")>]
val printf : format:Printf.TextWriterFormat<'T> -> 'T
val printf: format:Printf.TextWriterFormat<'T> -> 'T
/// <summary>Print to <c>stdout</c> using the given format, and add a newline.</summary>
///
/// <param name="format">The formatter.</param>
///
/// <returns>The formatted result.</returns>
[<CompiledName("PrintFormatLine")>]
val printfn : format:Printf.TextWriterFormat<'T> -> 'T
val printfn: format:Printf.TextWriterFormat<'T> -> 'T
/// <summary>Print to <c>stderr</c> using the given format.</summary>
///
/// <param name="format">The formatter.</param>
///
/// <returns>The formatted result.</returns>
[<CompiledName("PrintFormatToError")>]
val eprintf : format:Printf.TextWriterFormat<'T> -> 'T
val eprintf: format:Printf.TextWriterFormat<'T> -> 'T
/// <summary>Print to <c>stderr</c> using the given format, and add a newline.</summary>
///
/// <param name="format">The formatter.</param>
///
/// <returns>The formatted result.</returns>
[<CompiledName("PrintFormatLineToError")>]
val eprintfn : format:Printf.TextWriterFormat<'T> -> 'T
val eprintfn: format:Printf.TextWriterFormat<'T> -> 'T
/// <summary>Print to a string using the given format.</summary>
///
/// <param name="format">The formatter.</param>
///
/// <returns>The formatted result.</returns>
[<CompiledName("PrintFormatToString")>]
val sprintf : format:Printf.StringFormat<'T> -> 'T
val sprintf: format:Printf.StringFormat<'T> -> 'T
/// <summary>Print to a string buffer and raise an exception with the given
/// result. Helper printers must return strings.</summary>
/// result. Helper printers must return strings.</summary>
///
/// <param name="format">The formatter.</param>
///
/// <returns>The formatted result.</returns>
[<CompiledName("PrintFormatToStringThenFail")>]
val failwithf: format:Printf.StringFormat<'T,'Result> -> 'T
/// <summary>Print to a file using the given format.</summary>
///
/// <param name="textWriter">The file TextWriter.</param>
/// <param name="format">The formatter.</param>
///
/// <returns>The formatted result.</returns>
[<CompiledName("PrintFormatToTextWriter")>]
val fprintf : textWriter:System.IO.TextWriter -> format:Printf.TextWriterFormat<'T> -> 'T
/// <summary>Print to a file using the given format, and add a newline.</summary>
///
/// <param name="textWriter">The file TextWriter.</param>
/// <param name="format">The formatter.</param>
///
/// <returns>The formatted result.</returns>
[<CompiledName("PrintFormatLineToTextWriter")>]
val fprintfn : textWriter:System.IO.TextWriter -> format:Printf.TextWriterFormat<'T> -> 'T
/// <summary>Builds a set from a sequence of objects. The objects are indexed using generic comparison.</summary>
///
/// <param name="elements">The input sequence of elements.</param>
///
/// <returns>The created set.</returns>
[<CompiledName("CreateSet")>]
val set : elements:seq<'T> -> Set<'T>
......@@ -285,7 +303,9 @@ namespace Microsoft.FSharp.Core.CompilerServices
/// <summary>
/// Get the static parameters for a provided type.
/// </summary>
///
/// <param name="typeWithoutArguments">A type returned by GetTypes or ResolveTypeName</param>
///
/// <returns></returns>
abstract GetStaticParameters : typeWithoutArguments:Type -> ParameterInfo[]
......@@ -296,14 +316,17 @@ namespace Microsoft.FSharp.Core.CompilerServices
/// <param name="typeWithoutArguments">the provided type definition which has static parameters</param>
/// <param name="typePathWithArguments">the full path of the type, including encoded representations of static parameters</param>
/// <param name="staticArguments">the static parameters, indexed by name</param>
///
/// <returns></returns>
abstract ApplyStaticArguments : typeWithoutArguments:Type * typePathWithArguments:string[] * staticArguments:obj[] -> Type
/// <summary>
/// Called by the compiler to ask for an Expression tree to replace the given MethodBase with.
/// </summary>
///
/// <param name="syntheticMethodBase">MethodBase that was given to the compiler by a type returned by a GetType(s) call.</param>
/// <param name="parameters">Expressions that represent the parameters to this call.</param>
///
/// <returns>An expression that the compiler will use in place of the given method base.</returns>
abstract GetInvokerExpression : syntheticMethodBase:MethodBase * parameters:Expr[] -> Expr
......@@ -324,7 +347,9 @@ namespace Microsoft.FSharp.Core.CompilerServices
/// <summary>
/// Get the static parameters for a provided method.
/// </summary>
///
/// <param name="methodWithoutArguments">A method returned by GetMethod on a provided type</param>
///
/// <returns>The static parameters of the provided method, if any</returns>
abstract GetStaticParametersForMethod : methodWithoutArguments:MethodBase -> ParameterInfo[]
......@@ -336,6 +361,7 @@ namespace Microsoft.FSharp.Core.CompilerServices
/// <param name="methodWithoutArguments">the provided method definition which has static parameters</param>
/// <param name="methodNameWithArguments">the full name of the method that must be returned, including encoded representations of static parameters</param>
/// <param name="staticArguments">the values of the static parameters, indexed by name</param>
///
/// <returns>The provided method definition corresponding to the given static parameter values</returns>
abstract ApplyStaticArgumentsForMethod : methodWithoutArguments:MethodBase * methodNameWithArguments:string * staticArguments:obj[] -> MethodBase
此差异已折叠。
......@@ -28,23 +28,28 @@ namespace Microsoft.FSharp.Control
/// <summary>Creates an agent. The <c>body</c> function is used to generate the asynchronous
/// computation executed by the agent. This function is not executed until
/// <c>Start</c> is called.</summary>
///
/// <param name="body">The function to produce an asynchronous computation that will be executed
/// as the read loop for the MailboxProcessor when Start is called.</param>
/// <param name="cancellationToken">An optional cancellation token for the <c>body</c>.
/// Defaults to <c>Async.DefaultCancellationToken</c>.</param>
///
/// <returns>The created MailboxProcessor.</returns>
new : body:(MailboxProcessor<'Msg> -> Async<unit>) * ?cancellationToken: CancellationToken -> MailboxProcessor<'Msg>
/// <summary>Creates and starts an agent. The <c>body</c> function is used to generate the asynchronous
/// computation executed by the agent.</summary>
///
/// <param name="body">The function to produce an asynchronous computation that will be executed
/// as the read loop for the MailboxProcessor when Start is called.</param>
/// <param name="cancellationToken">An optional cancellation token for the <c>body</c>.
/// Defaults to <c>Async.DefaultCancellationToken</c>.</param>
///
/// <returns>The created MailboxProcessor.</returns>
static member Start : body:(MailboxProcessor<'Msg> -> Async<unit>) * ?cancellationToken: CancellationToken -> MailboxProcessor<'Msg>
/// <summary>Posts a message to the message queue of the MailboxProcessor, asynchronously.</summary>
///
/// <param name="message">The message to post.</param>
member Post : message:'Msg -> unit
......@@ -56,7 +61,8 @@ namespace Microsoft.FSharp.Control
/// <param name="buildMessage">The function to incorporate the AsyncReplyChannel into
/// the message to be sent.</param>
/// <param name="timeout">An optional timeout parameter (in milliseconds) to wait for a reply message.
/// Defaults to -1 which corresponds to <c>System.Threading.Timeout.Infinite</c>.</param>
/// Defaults to -1 which corresponds to <see cref="F:System.Threading.Timeout.Infinite"/>.</param>
///
/// <returns>The reply from the agent.</returns>
member PostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> 'Reply
......@@ -68,23 +74,28 @@ namespace Microsoft.FSharp.Control
/// <param name="buildMessage">The function to incorporate the AsyncReplyChannel into
/// the message to be sent.</param>
/// <param name="timeout">An optional timeout parameter (in milliseconds) to wait for a reply message.
/// Defaults to -1 which corresponds to <c>System.Threading.Timeout.Infinite</c>.</param>
/// Defaults to -1 which corresponds to <see cref="F:System.Threading.Timeout.Infinite"/>.</param>
///
/// <returns>An asynchronous computation that will wait for the reply from the agent.</returns>
member PostAndAsyncReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> Async<'Reply>
/// <summary>Like PostAndReply, but returns None if no reply within the timeout period.</summary>
///
/// <param name="buildMessage">The function to incorporate the AsyncReplyChannel into
/// the message to be sent.</param>
/// <param name="timeout">An optional timeout parameter (in milliseconds) to wait for a reply message.
/// Defaults to -1 which corresponds to <c>System.Threading.Timeout.Infinite</c>.</param>
/// Defaults to -1 which corresponds to <see cref="F:System.Threading.Timeout.Infinite"/>.</param>
///
/// <returns>The reply from the agent or None if the timeout expires.</returns>
member TryPostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> 'Reply option
/// <summary>Like AsyncPostAndReply, but returns None if no reply within the timeout period.</summary>
///
/// <param name="buildMessage">The function to incorporate the AsyncReplyChannel into
/// the message to be sent.</param>
/// <param name="timeout">An optional timeout parameter (in milliseconds) to wait for a reply message.
/// Defaults to -1 which corresponds to <c>System.Threading.Timeout.Infinite</c>.</param>
/// Defaults to -1 which corresponds to <see cref="F:System.Threading.Timeout.Infinite"/>.</param>
///
/// <returns>An asynchronous computation that will return the reply or None if the timeout expires.</returns>
member PostAndTryAsyncReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> Async<'Reply option>
......@@ -96,9 +107,10 @@ namespace Microsoft.FSharp.Control
/// one concurrent reader may be active, so no more than one concurrent call to
/// Receive, TryReceive, Scan and/or TryScan may be active.</remarks>
/// <param name="timeout">An optional timeout in milliseconds. Defaults to -1 which corresponds
/// to <c>System.Threading.Timeout.Infinite</c>.</param>
/// to <see cref="F:System.Threading.Timeout.Infinite"/>.</param>
///
/// <returns>An asynchronous computation that returns the received message.</returns>
/// <exception cref="System.TimeoutException">Thrown when the timeout is exceeded.</exception>
/// <exception cref="T:System.TimeoutException">Thrown when the timeout is exceeded.</exception>
member Receive : ?timeout:int -> Async<'Msg>
/// <summary>Waits for a message. This will consume the first message in arrival order.</summary>
......@@ -111,7 +123,8 @@ namespace Microsoft.FSharp.Control
/// one concurrent reader may be active, so no more than one concurrent call to
/// Receive, TryReceive, Scan and/or TryScan may be active.</remarks>
/// <param name="timeout">An optional timeout in milliseconds. Defaults to -1 which
/// corresponds to <c>System.Threading.Timeout.Infinite</c>.</param>
/// corresponds to <see cref="F:System.Threading.Timeout.Infinite"/>.</param>
///
/// <returns>An asynchronous computation that returns the received message or
/// None if the timeout is exceeded.</returns>
member TryReceive : ?timeout:int -> Async<'Msg option>
......@@ -127,9 +140,10 @@ namespace Microsoft.FSharp.Control
/// <param name="scanner">The function to return None if the message is to be skipped
/// or Some if the message is to be processed and removed from the queue.</param>
/// <param name="timeout">An optional timeout in milliseconds. Defaults to -1 which corresponds
/// to <c>System.Threading.Timeout.Infinite</c>.</param>
/// to <see cref="F:System.Threading.Timeout.Infinite"/>.</param>
///
/// <returns>An asynchronous computation that <c>scanner</c> built off the read message.</returns>
/// <exception cref="System.TimeoutException">Thrown when the timeout is exceeded.</exception>
/// <exception cref="T:System.TimeoutException">Thrown when the timeout is exceeded.</exception>
member Scan : scanner:('Msg -> (Async<'T>) option) * ?timeout:int -> Async<'T>
/// <summary>Scans for a message by looking through messages in arrival order until <c>scanner</c>
......@@ -141,7 +155,8 @@ namespace Microsoft.FSharp.Control
/// <param name="scanner">The function to return None if the message is to be skipped
/// or Some if the message is to be processed and removed from the queue.</param>
/// <param name="timeout">An optional timeout in milliseconds. Defaults to -1 which corresponds
/// to <c>System.Threading.Timeout.Infinite</c>.</param>
/// to <see cref="F:System.Threading.Timeout.Infinite"/>.</param>
///
/// <returns>An asynchronous computation that <c>scanner</c> built off the read message.</returns>
member TryScan : scanner:('Msg -> (Async<'T>) option) * ?timeout:int -> Async<'T option>
......
......@@ -19,12 +19,15 @@ namespace Microsoft.FSharp.Collections
/// <summary>Returns a new map with the binding added to the given map.
/// If a binding with the given key already exists in the input map, the existing binding is replaced by the new binding in the result map.</summary>
/// <param name="key">The input key.</param>
///
/// <returns>The resulting map.</returns>
member Add: key:'Key * value:'Value -> Map<'Key,'Value>
/// <summary>Returns a new map with the value stored under key changed according to f.</summary>
///
/// <param name="key">The input key.</param>
/// <param name="f">The change function.</param>
///
/// <returns>The resulting map.</returns>
member Change: key:'Key * f:('Value option -> 'Value option) -> Map<'Key,'Value>
......@@ -32,12 +35,16 @@ namespace Microsoft.FSharp.Collections
member IsEmpty: bool
/// <summary>Builds a map that contains the bindings of the given IEnumerable.</summary>
///
/// <param name="elements">The input sequence of key/value pairs.</param>
///
/// <returns>The resulting map.</returns>
new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
/// <summary>Tests if an element is in the domain of the map.</summary>
///
/// <param name="key">The input key.</param>
///
/// <returns>True if the map contains the given key.</returns>
member ContainsKey: key:'Key -> bool
......@@ -46,26 +53,34 @@ namespace Microsoft.FSharp.Collections
/// <summary>Lookup an element in the map. Raise <c>KeyNotFoundException</c> if no binding
/// exists in the map.</summary>
///
/// <param name="key">The input key.</param>
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown when the key is not found.</exception>
/// <exception cref="T:System.Collections.Generic.KeyNotFoundException">Thrown when the key is not found.</exception>
///
/// <returns>The value mapped to the key.</returns>
member Item : key:'Key -> 'Value with get
/// <summary>Removes an element from the domain of the map. No exception is raised if the element is not present.</summary>
///
/// <param name="key">The input key.</param>
///
/// <returns>The resulting map.</returns>
member Remove: key:'Key -> Map<'Key,'Value>
/// <summary>Lookup an element in the map, returning a <c>Some</c> value if the element is in the domain
/// of the map and <c>None</c> if not.</summary>
///
/// <param name="key">The input key.</param>
///
/// <returns>The mapped value, or None if the key is not in the map.</returns>
member TryFind: key:'Key -> 'Value option
/// <summary>Lookup an element in the map, assigning to <c>value</c> if the element is in the domain
/// of the map and returning <c>false</c> if not.</summary>
///
/// <param name="key">The input key.</param>
/// <param name="value">A reference to the output value.</param>
///
/// <returns><c>true</c> if the value is present, <c>false</c> if not.</returns>
member TryGetValue: key:'Key * [<System.Runtime.InteropServices.Out>] value:byref<'Value> -> bool
......@@ -81,66 +96,85 @@ namespace Microsoft.FSharp.Collections
/// <summary>Functional programming operators related to the <c>Map&lt;_,_&gt;</c> type.</summary>
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
[<RequireQualifiedAccess>]
/// <summary>Basic operations on values of type <see cref="T:Microsoft.FSharp.Collections.Map`2"/>.</summary>
module Map =
/// <summary>Returns a new map with the binding added to the given map.
/// If a binding with the given key already exists in the input map, the existing binding is replaced by the new binding in the result map.</summary>
///
/// <param name="key">The input key.</param>
/// <param name="value">The input value.</param>
/// <param name="table">The input map.</param>
///
/// <returns>The resulting map.</returns>
[<CompiledName("Add")>]
val add: key:'Key -> value:'T -> table:Map<'Key,'T> -> Map<'Key,'T>
/// <summary>Returns a new map with the value stored under key changed according to f.</summary>
///
/// <param name="key">The input key.</param>
/// <param name="f">The change function.</param>
/// <param name="table">The input map.</param>
///
/// <returns>The resulting map.</returns>
[<CompiledName("Change")>]
val change: key:'Key -> f:('T option -> 'T option) -> table:Map<'Key,'T> -> Map<'Key,'T>
/// <summary>Returns a new map made from the given bindings.</summary>
///
/// <param name="elements">The input list of key/value pairs.</param>
///
/// <returns>The resulting map.</returns>
[<CompiledName("OfList")>]
val ofList: elements:('Key * 'T) list -> Map<'Key,'T>
/// <summary>Returns a new map made from the given bindings.</summary>
///
/// <param name="elements">The input array of key/value pairs.</param>
///
/// <returns>The resulting map.</returns>
[<CompiledName("OfArray")>]
val ofArray: elements:('Key * 'T)[] -> Map<'Key,'T>
/// <summary>Returns a new map made from the given bindings.</summary>
///
/// <param name="elements">The input sequence of key/value pairs.</param>
///
/// <returns>The resulting map.</returns>
[<CompiledName("OfSeq")>]
val ofSeq: elements:seq<'Key * 'T> -> Map<'Key,'T>
/// <summary>Views the collection as an enumerable sequence of pairs.
/// The sequence will be ordered by the keys of the map.</summary>
///
/// <param name="table">The input map.</param>
///
/// <returns>The sequence of key/value pairs.</returns>
[<CompiledName("ToSeq")>]
val toSeq: table:Map<'Key,'T> -> seq<'Key * 'T>
/// <summary>Returns a list of all key-value pairs in the mapping.
/// The list will be ordered by the keys of the map.</summary>
///
/// <param name="table">The input map.</param>
///
/// <returns>The list of key/value pairs.</returns>
[<CompiledName("ToList")>]
val toList: table:Map<'Key,'T> -> ('Key * 'T) list
/// <summary>Returns an array of all key-value pairs in the mapping.
/// The array will be ordered by the keys of the map.</summary>
///
/// <param name="table">The input map.</param>
///
/// <returns>The array of key/value pairs.</returns>
[<CompiledName("ToArray")>]
val toArray: table:Map<'Key,'T> -> ('Key * 'T)[]
/// <summary>Is the map empty?</summary>
///
/// <param name="table">The input map.</param>
///
/// <returns>True if the map is empty.</returns>
[<CompiledName("IsEmpty")>]
val isEmpty: table:Map<'Key,'T> -> bool
......@@ -152,44 +186,55 @@ namespace Microsoft.FSharp.Collections
/// <summary>Lookup an element in the map, raising <c>KeyNotFoundException</c> if no binding
/// exists in the map.</summary>
///
/// <param name="key">The input key.</param>
/// <param name="table">The input map.</param>
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown when the key does not exist in the map.</exception>
/// <exception cref="T:System.Collections.Generic.KeyNotFoundException">Thrown when the key does not exist in the map.</exception>
///
/// <returns>The value mapped to the given key.</returns>
[<CompiledName("Find")>]
val find: key:'Key -> table:Map<'Key,'T> -> 'T
/// <summary>Searches the map looking for the first element where the given function returns a <c>Some</c> value.</summary>
///
/// <param name="chooser">The function to generate options from the key/value pairs.</param>
/// <param name="table">The input map.</param>
///
/// <returns>The first result.</returns>
[<CompiledName("TryPick")>]
val tryPick: chooser:('Key -> 'T -> 'U option) -> table:Map<'Key,'T> -> 'U option
/// <summary>Searches the map looking for the first element where the given function returns a <c>Some</c> value</summary>
///
/// <param name="chooser">The function to generate options from the key/value pairs.</param>
/// <param name="table">The input map.</param>
///
/// <returns>The first result.</returns>
[<CompiledName("Pick")>]
val pick: chooser:('Key -> 'T -> 'U option) -> table:Map<'Key,'T> -> 'U
/// <summary>Folds over the bindings in the map.</summary>
///
/// <param name="folder">The function to update the state given the input key/value pairs.</param>
/// <param name="table">The input map.</param>
/// <param name="state">The initial state.</param>
///
/// <returns>The final state value.</returns>
[<CompiledName("FoldBack")>]
val foldBack<'Key,'T,'State> : folder:('Key -> 'T -> 'State -> 'State) -> table:Map<'Key,'T> -> state:'State -> 'State when 'Key : comparison
/// <summary>Folds over the bindings in the map </summary>
///
/// <param name="folder">The function to update the state given the input key/value pairs.</param>
/// <param name="state">The initial state.</param>
/// <param name="table">The input map.</param>
///
/// <returns>The final state value.</returns>
[<CompiledName("Fold")>]
val fold<'Key,'T,'State> : folder:('State -> 'Key -> 'T -> 'State) -> state:'State -> table:Map<'Key,'T> -> 'State when 'Key : comparison
/// <summary>Applies the given function to each binding in the dictionary</summary>
///
/// <param name="action">The function to apply to each key/value pair.</param>
/// <param name="table">The input map.</param>
[<CompiledName("Iterate")>]
......@@ -197,23 +242,29 @@ namespace Microsoft.FSharp.Collections
/// <summary>Returns true if the given predicate returns true for one of the
/// bindings in the map.</summary>
///
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="table">The input map.</param>
///
/// <returns>True if the predicate returns true for one of the key/value pairs.</returns>
[<CompiledName("Exists")>]
val exists: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> bool
/// <summary>Builds a new map containing only the bindings for which the given predicate returns 'true'.</summary>
///
/// <param name="predicate">The function to test the key/value pairs.</param>
/// <param name="table">The input map.</param>
///
/// <returns>The filtered map.</returns>
[<CompiledName("Filter")>]
val filter: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> Map<'Key, 'T>
/// <summary>Returns true if the given predicate returns true for all of the
/// bindings in the map.</summary>
///
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="table">The input map.</param>
///
/// <returns>True if the predicate evaluates to true for all of the bindings in the map.</returns>
[<CompiledName("ForAll")>]
val forall: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> bool
......@@ -221,56 +272,70 @@ namespace Microsoft.FSharp.Collections
/// <summary>Builds a new collection whose elements are the results of applying the given function
/// to each of the elements of the collection. The key passed to the
/// function indicates the key of element being transformed.</summary>
///
/// <param name="mapping">The function to transform the key/value pairs.</param>
/// <param name="table">The input map.</param>
///
/// <returns>The resulting map of keys and transformed values.</returns>
[<CompiledName("Map")>]
val map: mapping:('Key -> 'T -> 'U) -> table:Map<'Key,'T> -> Map<'Key,'U>
/// <summary>Tests if an element is in the domain of the map.</summary>
///
/// <param name="key">The input key.</param>
/// <param name="table">The input map.</param>
///
/// <returns>True if the map contains the key.</returns>
[<CompiledName("ContainsKey")>]
val containsKey: key:'Key -> table:Map<'Key,'T> -> bool
/// <summary>Builds two new maps, one containing the bindings for which the given predicate returns 'true',
/// and the other the remaining bindings.</summary>
///
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="table">The input map.</param>
///
/// <returns>A pair of maps in which the first contains the elements for which the predicate returned true
/// and the second containing the elements for which the predicated returned false.</returns>
[<CompiledName("Partition")>]
val partition: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> Map<'Key, 'T> * Map<'Key, 'T>
/// <summary>Removes an element from the domain of the map. No exception is raised if the element is not present.</summary>
///
/// <param name="key">The input key.</param>
/// <param name="table">The input map.</param>
///
/// <returns>The resulting map.</returns>
[<CompiledName("Remove")>]
val remove: key:'Key -> table:Map<'Key,'T> -> Map<'Key,'T>
/// <summary>Lookup an element in the map, returning a <c>Some</c> value if the element is in the domain
/// of the map and <c>None</c> if not.</summary>
///
/// <param name="key">The input key.</param>
/// <param name="table">The input map.</param>
///
/// <returns>The found <c>Some</c> value or <c>None</c>.</returns>
[<CompiledName("TryFind")>]
val tryFind: key:'Key -> table:Map<'Key,'T> -> 'T option
/// <summary>Evaluates the function on each mapping in the collection. Returns the key for the first mapping
/// where the function returns 'true'. Raise <c>KeyNotFoundException</c> if no such element exists.</summary>
///
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="table">The input map.</param>
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown if the key does not exist in the map.</exception>
/// <exception cref="T:System.Collections.Generic.KeyNotFoundException">Thrown if the key does not exist in the map.</exception>
///
/// <returns>The first key for which the predicate evaluates true.</returns>
[<CompiledName("FindKey")>]
val findKey: predicate:('Key -> 'T -> bool) -> table:Map<'Key,'T> -> 'Key
/// <summary>Returns the key of the first mapping in the collection that satisfies the given predicate.
/// Returns 'None' if no such element exists.</summary>
///
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="table">The input map.</param>
///
/// <returns>The first key for which the predicate returns true or None if the predicate evaluates to false for each key/value pair.</returns>
[<CompiledName("TryFindKey")>]
val tryFindKey: predicate:('Key -> 'T -> bool) -> table:Map<'Key,'T> -> 'Key option
......
......@@ -12,6 +12,7 @@ namespace Microsoft.FSharp.Math
namespace Microsoft.FSharp.Core
/// An abbreviation for <see cref="T:System.Numerics.BigInteger"/>
type bigint = System.Numerics.BigInteger
[<AutoOpen>]
......@@ -24,15 +25,21 @@ namespace Microsoft.FSharp.Core
/// Provides a default implementations of F# numeric literal syntax for literals of the form 'dddI'
val FromZero : value:unit -> 'T
/// Provides a default implementations of F# numeric literal syntax for literals of the form 'dddI'
val FromOne : value:unit -> 'T
/// Provides a default implementations of F# numeric literal syntax for literals of the form 'dddI'
val FromInt32 : value:int32 -> 'T
/// Provides a default implementations of F# numeric literal syntax for literals of the form 'dddI'
val FromInt64 : value:int64 -> 'T
/// Provides a default implementations of F# numeric literal syntax for literals of the form 'dddI'
val FromString : text:string -> 'T
/// Provides a default implementations of F# numeric literal syntax for literals of the form 'dddI'
val FromInt64Dynamic : value:int64 -> obj
/// Provides a default implementations of F# numeric literal syntax for literals of the form 'dddI'
val FromStringDynamic : text:string -> obj
......@@ -15,27 +15,34 @@ namespace Microsoft.FSharp.NativeInterop
[<CompiledName("OfNativeIntInlined")>]
/// <summary>Returns a typed native pointer for a given machine address.</summary>
/// <param name="address">The pointer address.</param>
///
/// <returns>A typed pointer.</returns>
val inline ofNativeInt : address:nativeint -> nativeptr<'T>
[<Unverifiable>]
[<CompiledName("ToVoidPtrInlined")>]
/// <summary>Returns an untyped native pointer for a given typed pointer.</summary>
///
/// <param name="address">The pointer address.</param>
///
/// <returns>A typed pointer.</returns>
val inline toVoidPtr : address:nativeptr<'T> -> voidptr
[<Unverifiable>]
[<CompiledName("OfVoidPtrInlined")>]
/// <summary>Returns a typed native pointer for a untyped native pointer.</summary>
///
/// <param name="address">The untyped pointer.</param>
///
/// <returns>A typed pointer.</returns>
val inline ofVoidPtr : voidptr -> nativeptr<'T>
[<Unverifiable>]
[<CompiledName("ToNativeIntInlined")>]
/// <summary>Returns a machine address for a given typed native pointer.</summary>
///
/// <param name="address">The input pointer.</param>
///
/// <returns>The machine address.</returns>
val inline toNativeInt : address:nativeptr<'T> -> nativeint
......@@ -44,8 +51,10 @@ namespace Microsoft.FSharp.NativeInterop
[<CompiledName("AddPointerInlined")>]
/// <summary>Returns a typed native pointer by adding index * sizeof&lt;'T&gt; to the
/// given input pointer.</summary>
///
/// <param name="address">The input pointer.</param>
/// <param name="index">The index by which to offset the pointer.</param>
///
/// <returns>A typed pointer.</returns>
val inline add : address:nativeptr<'T> -> index:int -> nativeptr<'T>
......@@ -53,21 +62,26 @@ namespace Microsoft.FSharp.NativeInterop
[<CompiledName("GetPointerInlined")>]
/// <summary>Dereferences the typed native pointer computed by adding index * sizeof&lt;'T&gt; to the
/// given input pointer.</summary>
///
/// <param name="address">The input pointer.</param>
/// <param name="index">The index by which to offset the pointer.</param>
///
/// <returns>The value at the pointer address.</returns>
val inline get : address:nativeptr<'T> -> index:int -> 'T
[<Unverifiable>]
[<CompiledName("ReadPointerInlined")>]
/// <summary>Dereferences the given typed native pointer.</summary>
///
/// <param name="address">The input pointer.</param>
///
/// <returns>The value at the pointer address.</returns>
val inline read : address:nativeptr<'T> -> 'T
[<Unverifiable>]
[<CompiledName("WritePointerInlined")>]
/// <summary>Assigns the <c>value</c> into the memory location referenced by the given typed native pointer.</summary>
///
/// <param name="address">The input pointer.</param>
/// <param name="value">The value to assign.</param>
val inline write : address:nativeptr<'T> -> value:'T -> unit
......@@ -76,20 +90,25 @@ namespace Microsoft.FSharp.NativeInterop
[<CompiledName("SetPointerInlined")>]
/// <summary>Assigns the <c>value</c> into the memory location referenced by the typed native
/// pointer computed by adding index * sizeof&lt;'T&gt; to the given input pointer.</summary>
///
/// <param name="address">The input pointer.</param>
/// <param name="index">The index by which to offset the pointer.</param>
/// <param name="value">The value to assign.</param>
val inline set : address:nativeptr<'T> -> index:int -> value:'T -> unit
/// <summary>Allocates a region of memory on the stack.</summary>
///
/// <param name="count">The number of objects of type T to allocate.</param>
///
/// <returns>A typed pointer to the allocated memory.</returns>
[<Unverifiable>]
[<CompiledName("StackAllocate")>]
val inline stackalloc : count:int -> nativeptr<'T>
/// <summary>Converts a given typed native pointer to a managed pointer.</summary>
///
/// <param name="address">The input pointer.</param>
///
/// <returns>The managed pointer.</returns>
[<Unverifiable>]
[<CompiledName("ToByRefInlined")>]
......
......@@ -19,6 +19,7 @@ namespace Microsoft.FSharp.Control
/// be triggered concurrently on different threads.</remarks>
/// <param name="source1">The first Observable.</param>
/// <param name="source2">The second Observable.</param>
///
/// <returns>An Observable that propagates information from both sources.</returns>
[<CompiledName("Merge")>]
val merge: source1:IObservable<'T> -> source2:IObservable<'T> -> IObservable<'T>
......@@ -29,6 +30,7 @@ namespace Microsoft.FSharp.Control
/// arising from the source and completes when the source completes.</summary>
/// <param name="mapping">The function applied to observations from the source.</param>
/// <param name="source">The input Observable.</param>
///
/// <returns>An Observable of the type specified by <c>mapping</c>.</returns>
[<CompiledName("Map")>]
val map: mapping:('T -> 'U) -> source:IObservable<'T> -> IObservable<'U>
......@@ -38,9 +40,11 @@ namespace Microsoft.FSharp.Control
/// for which the predicate returns true. The predicate is executed once for
/// each subscribed observer. The returned object also propagates error
/// observations arising from the source and completes when the source completes.</summary>
///
/// <param name="filter">The function to apply to observations to determine if it should
/// be kept.</param>
/// <param name="source">The input Observable.</param>
///
/// <returns>An Observable that filters observations based on <c>filter</c>.</returns>
[<CompiledName("Filter")>]
val filter: predicate:('T -> bool) -> source:IObservable<'T> -> IObservable<'T>
......@@ -52,9 +56,11 @@ namespace Microsoft.FSharp.Control
/// executed once for each subscribed observer. Both also propagate all error
/// observations arising from the source and each completes when the source
/// completes.</summary>
///
/// <param name="predicate">The function to determine which output Observable will trigger
/// a particular observation.</param>
/// <param name="source">The input Observable.</param>
///
/// <returns>A tuple of Observables. The first triggers when the predicate returns true, and
/// the second triggers when the predicate returns false.</returns>
[<CompiledName("Partition")>]
......@@ -67,9 +73,11 @@ namespace Microsoft.FSharp.Control
/// executed once for each subscribed observer. Both also propagate error
/// observations arising from the source and each completes when the source
/// completes.</summary>
///
/// <param name="splitter">The function that takes an observation an transforms
/// it into one of the two output Choice types.</param>
/// <param name="source">The input Observable.</param>
///
/// <returns>A tuple of Observables. The first triggers when <c>splitter</c> returns Choice1of2
/// and the second triggers when <c>splitter</c> returns Choice2of2.</returns>
[<CompiledName("Split")>]
......@@ -79,9 +87,11 @@ namespace Microsoft.FSharp.Control
/// using the given function. The returned object will trigger observations <c>x</c>
/// for which the splitter returns <c>Some x</c>. The returned object also propagates
/// all errors arising from the source and completes when the source completes.</summary>
///
/// <param name="chooser">The function that returns Some for observations to be propagated
/// and None for observations to ignore.</param>
/// <param name="source">The input Observable.</param>
///
/// <returns>An Observable that only propagates some of the observations from the source.</returns>
[<CompiledName("Choose")>]
val choose: chooser:('T -> 'U option) -> source:IObservable<'T> -> IObservable<'U>
......@@ -98,12 +108,14 @@ namespace Microsoft.FSharp.Control
/// <param name="collector">The function to update the state with each observation.</param>
/// <param name="state">The initial state.</param>
/// <param name="source">The input Observable.</param>
///
/// <returns>An Observable that triggers on the updated state values.</returns>
[<CompiledName("Scan")>]
val scan: collector:('U -> 'T -> 'U) -> state:'U -> source:IObservable<'T> -> IObservable<'U>
/// <summary>Creates an observer which permanently subscribes to the given observable and which calls
/// the given function for each observation.</summary>
///
/// <param name="callback">The function to be called on each observation.</param>
/// <param name="source">The input Observable.</param>
[<CompiledName("Add")>]
......@@ -111,8 +123,10 @@ namespace Microsoft.FSharp.Control
/// <summary>Creates an observer which subscribes to the given observable and which calls
/// the given function for each observation.</summary>
///
/// <param name="callback">The function to be called on each observation.</param>
/// <param name="source">The input Observable.</param>
///
/// <returns>An object that will remove the callback if disposed.</returns>
[<CompiledName("Subscribe")>]
val subscribe : callback:('T -> unit) -> source:IObservable<'T> -> System.IDisposable
......@@ -126,6 +140,7 @@ namespace Microsoft.FSharp.Control
/// That is, observations arising from the source must not be triggered concurrently
/// on different threads.</remarks>
/// <param name="source">The input Observable.</param>
///
/// <returns>An Observable that triggers on successive pairs of observations from the input Observable.</returns>
[<CompiledName("Pairwise")>]
val pairwise: source:IObservable<'T> -> IObservable<'T * 'T>
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -5,26 +5,32 @@ namespace Microsoft.FSharp.Core
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
/// <summary>Basic operations for values of type <see cref="T:Microsoft.FSharp.Core.Result`2"/>.</summary>
module Result =
/// <summary><c>map f inp</c> evaluates to <c>match inp with Error e -> Error e | Ok x -> Ok (f x)</c>.</summary>
/// <param name="mapping">A function to apply to the OK result value.</param>
/// <param name="result">The input result.</param>
///
/// <returns>A result of the input value after applying the mapping function, or Error if the input is Error.</returns>
[<CompiledName("Map")>]
val map : mapping:('T -> 'U) -> result:Result<'T, 'TError> -> Result<'U, 'TError>
/// <summary><c>map f inp</c> evaluates to <c>match inp with Error x -> Error (f x) | Ok v -> Ok v</c>.</summary>
///
/// <param name="mapping">A function to apply to the Error result value.</param>
/// <param name="result">The input result.</param>
///
/// <returns>A result of the error value after applying the mapping function, or Ok if the input is Ok.</returns>
[<CompiledName("MapError")>]
val mapError: mapping:('TError -> 'U) -> result:Result<'T, 'TError> -> Result<'T, 'U>
/// <summary><c>bind f inp</c> evaluates to <c>match inp with Error e -> Error e | Ok x -> f x</c></summary>
///
/// <param name="binder">A function that takes the value of type T from a result and transforms it into
/// a result containing a value of type U.</param>
/// <param name="result">The input result.</param>
///
/// <returns>A result of the output type of the binder.</returns>
[<CompiledName("Bind")>]
val bind: binder:('T -> Result<'U, 'TError>) -> result:Result<'T, 'TError> -> Result<'U, 'TError>
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -7,10 +7,12 @@ namespace FSharp.Compiler.Interactive
type IEventLoop =
/// <summary>Run the event loop.</summary>
///
/// <returns>True if the event loop was restarted; false otherwise.</returns>
abstract Run : unit -> bool
/// <summary>Request that the given operation be run synchronously on the event loop.</summary>
///
/// <returns>The result of the operation.</returns>
abstract Invoke : (unit -> 'T) -> 'T
......
......@@ -96,29 +96,29 @@ module NameMap =
//-------------------------------------------------------------------------
module Check =
/// Throw <c>System.InvalidOperationException()</c> if argument is <c>None</c>.
/// Throw <cref>System.InvalidOperationException</cref> if argument is <c>None</c>.
/// If there is a value (e.g. <c>Some(value)</c>) then value is returned.
let NotNone argName (arg:'T option) : 'T =
match arg with
| None -> raise (new System.InvalidOperationException(argName))
| Some x -> x
/// Throw <c>System.ArgumentNullException()</c> if argument is <c>null</c>.
/// Throw <cref>System.ArgumentNullException</cref> if argument is <c>null</c>.
let ArgumentNotNull arg argName =
match box(arg) with
| null -> raise (new System.ArgumentNullException(argName))
| _ -> ()
/// Throw <c>System.ArgumentNullException()</c> if array argument is <c>null</c>.
/// Throw <c>System.ArgumentOutOfRangeException()</c> is array argument is empty.
/// Throw <cref>System.ArgumentNullException</cref> if array argument is <c>null</c>.
/// Throw <cref>System.ArgumentOutOfRangeException</cref> is array argument is empty.
let ArrayArgumentNotNullOrEmpty (arr:'T[]) argName =
ArgumentNotNull arr argName
if (0 = arr.Length) then
raise (new System.ArgumentOutOfRangeException(argName))
/// Throw <c>System.ArgumentNullException()</c> if string argument is <c>null</c>.
/// Throw <c>System.ArgumentOutOfRangeException()</c> is string argument is empty.
/// Throw <cref>System.ArgumentNullException</cref> if string argument is <c>null</c>.
/// Throw <cref>System.ArgumentOutOfRangeException</cref> is string argument is empty.
let StringArgumentNotNullOrEmpty (s:string) argName =
ArgumentNotNull s argName
if s.Length = 0 then
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册