Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 114 additions & 3 deletions src/FSharp.Core/array.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ module Array =
///
/// <returns>The resulting array of pairs.</returns>
///
/// <remarks>
/// Time Complexity: O(n*m) where n is the length of array1 and m is the length of array2.
/// Space Complexity: O(n*m) for the resulting array.
/// </remarks>
///
/// <example id="all-pairs-1">
/// <code lang="fsharp">
/// ([| 1; 2 |], [| 3; 4 |]) ||> Array.allPairs
Expand All @@ -46,6 +51,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentNullException">Thrown when either of the input arrays is null.</exception>
///
/// <remarks>
/// Time Complexity: O(n+m) where n is the length of array1 and m is the length of array2.
/// Space Complexity: O(n+m) for the resulting array.
/// </remarks>
///
/// <example id="append-1">
/// <code lang="fsharp">
/// Array.append [| 1; 2 |] [| 3; 4 |]
Expand All @@ -64,6 +74,11 @@ module Array =
///
/// <returns>The average of the elements in the array.</returns>
///
/// <remarks>
/// Time Complexity: O(n) where n is the length of the array.
/// Space Complexity: O(1).
/// </remarks>
///
/// <example id="average-1">
/// <code lang="fsharp">
/// [| 1.0; 2.0; 6.0 |] |> Array.average
Expand Down Expand Up @@ -95,6 +110,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
///
/// <remarks>
/// Time Complexity: O(n) where n is the length of the array.
/// Space Complexity: O(1).
/// </remarks>
///
/// <example id="average-by-1">
/// <code lang="fsharp">
/// type Foo = { Bar: float }
Expand Down Expand Up @@ -138,6 +158,8 @@ module Array =
/// let target = [| 0; 1; 2; 3; 4; 5 |]
/// target[3..4] &lt;- source[1..2]
/// </code>
/// Time Complexity: O(count) where count is the number of elements to copy.
/// Space Complexity: O(1).
/// </remarks>
///
/// <exception cref="T:System.ArgumentNullException">Thrown when either of the input arrays is null.</exception>
Expand Down Expand Up @@ -165,6 +187,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
///
/// <remarks>
/// Time Complexity: O(n*k) where n is the length of the input array and k is the average length of the arrays returned by the mapping function.
/// Space Complexity: O(n*k) for the resulting array.
/// </remarks>
///
/// <example id="collect-1">
/// <code lang="fsharp">
/// type Foo = { Bar: int array }
Expand Down Expand Up @@ -203,6 +230,11 @@ module Array =
/// <exception cref="T:System.ArgumentNullException">Thrown when either of the input arrays
/// is null.</exception>
///
/// <remarks>
/// Time Complexity: O(min(n,m)) where n and m are the lengths of the arrays, as comparison stops at the first non-zero result.
/// Space Complexity: O(1).
/// </remarks>
///
/// <example id="compare-with-1">
/// <code lang="fsharp">
/// let closerToNextDozen a b =
Expand Down Expand Up @@ -278,6 +310,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
///
/// <remarks>
/// Time Complexity: O(∑|arrays[i]|) where ∑|arrays[i]| is the sum of lengths of all input arrays.
/// Space Complexity: O(∑|arrays[i]|) for the resulting array.
/// </remarks>
///
/// <example id="concat-1">
/// <code lang="fsharp">
/// let inputs = [ [| 1; 2 |]; [| 3 |]; [| 4; 5 |] ]
Expand All @@ -298,6 +335,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
///
/// <remarks>
/// Time Complexity: O(n) where n is the length of the array.
/// Space Complexity: O(1).
/// </remarks>
///
/// <example id="contains-1">
/// <code lang="fsharp">
/// [| 1; 2 |] |> Array.contains 2 // evaluates to true
Expand All @@ -315,6 +357,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
///
/// <remarks>
/// Time Complexity: O(n) where n is the length of the array.
/// Space Complexity: O(n) for the new array.
/// </remarks>
///
/// <example id="copy-1">
/// <code lang="fsharp">
/// let source = [| 12; 13; 14 |]
Expand All @@ -337,6 +384,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
///
/// <remarks>
/// Time Complexity: O(n) where n is the length of the array.
/// Space Complexity: O(k) where k is the number of unique keys.
/// </remarks>
///
/// <example id="count-by-1">
/// <code lang="fsharp">
/// type Foo = { Bar: string }
Expand All @@ -359,6 +411,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentException">Thrown when count is negative.</exception>
///
/// <remarks>
/// Time Complexity: O(n) where n is the count.
/// Space Complexity: O(n) for the new array.
/// </remarks>
///
/// <example id="create-1">
/// <code lang="fsharp">
/// Array.create 4 "a"
Expand Down Expand Up @@ -389,6 +446,11 @@ module Array =
///
/// <returns>The first element of the array or None.</returns>
///
/// <remarks>
/// Time Complexity: O(1).
/// Space Complexity: O(1).
/// </remarks>
///
/// <example id="tryhead-1">
/// <code lang="fsharp">
/// let inputs = [| "banana"; "pear" |]
Expand Down Expand Up @@ -420,6 +482,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
///
/// <remarks>
/// Time Complexity: O(n) where n is the length of the array.
/// Space Complexity: O(1).
/// </remarks>
///
/// <example id="trypick-1">
/// <code lang="fsharp">
/// let input = [| 1; 2; 3 |]
Expand Down Expand Up @@ -451,6 +518,11 @@ module Array =
/// <exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
/// <exception cref="T:System.ArgumentException">Thrown when either targetIndex or count is negative.</exception>
///
/// <remarks>
/// Time Complexity: O(count) where count is the number of elements to fill.
/// Space Complexity: O(1).
/// </remarks>
///
/// <example id="fill-1">
/// <code lang="fsharp">
/// let target = [| 0; 1; 2; 3; 4; 5 |]
Expand All @@ -475,6 +547,11 @@ module Array =
///
/// <returns>The first result.</returns>
///
/// <remarks>
/// Time Complexity: O(n) where n is the length of the array.
/// Space Complexity: O(1).
/// </remarks>
///
/// <example id="pick-1">
/// <code lang="fsharp">
/// let input = [| 1; 2; 3 |]
Expand Down Expand Up @@ -507,6 +584,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
///
/// <remarks>
/// Time Complexity: O(n) where n is the length of the array.
/// Space Complexity: O(k) where k is the number of elements for which the chooser returns Some.
/// </remarks>
///
/// <example id="choose-1">
/// <code lang="fsharp">
/// let input = [| Some 1; None; Some 2 |]
Expand Down Expand Up @@ -633,6 +715,11 @@ module Array =
/// <summary>Returns an empty array of the given type.</summary>
/// <returns>The empty array.</returns>
///
/// <remarks>
/// Time Complexity: O(1).
/// Space Complexity: O(1).
/// </remarks>
///
/// <example id="empty">
/// <code lang="fsharp">
/// Array.empty // Evaluates to [| |]
Expand Down Expand Up @@ -744,7 +831,10 @@ module Array =
///
/// <remarks>The predicate is applied to the elements of the input array. If any application
/// returns true then the overall result is true and no further elements are tested.
/// Otherwise, false is returned.</remarks>
/// Otherwise, false is returned.
/// Time Complexity: O(n) where n is the length of the array.
/// Space Complexity: O(1).
/// </remarks>
///
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="array">The input array.</param>
Expand Down Expand Up @@ -822,6 +912,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
///
/// <remarks>
/// Time Complexity: O(n) where n is the length of the array.
/// Space Complexity: O(k) where k is the number of elements that satisfy the predicate.
/// </remarks>
///
/// <example id="filter-1">
/// <code lang="fsharp">
/// let inputs = [| 1; 2; 3; 4 |]
Expand Down Expand Up @@ -1048,6 +1143,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
///
/// <remarks>
/// Time Complexity: O(n) where n is the length of the array.
/// Space Complexity: O(1).
/// </remarks>
///
/// <example id="fold-1">
/// <code lang="fsharp">
/// type Charge =
Expand Down Expand Up @@ -1530,7 +1630,10 @@ module Array =
///
/// <returns>The length of the array.</returns>
///
/// <remarks>The notation <c>array.Length</c> is preferred.</remarks>
/// <remarks>The notation <c>array.Length</c> is preferred.
/// Time Complexity: O(1).
/// Space Complexity: O(1).
/// </remarks>
///
/// <exception cref="T:System.NullReferenceException">Thrown when the input array is null.</exception>
///
Expand Down Expand Up @@ -1580,6 +1683,11 @@ module Array =
///
/// <exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
///
/// <remarks>
/// Time Complexity: O(n) where n is the length of the array.
/// Space Complexity: O(n) for the new array.
/// </remarks>
///
/// <example id="map-1">
/// <code lang="fsharp">
/// let inputs = [| "a"; "bbb"; "cc" |]
Expand Down Expand Up @@ -2268,7 +2376,10 @@ module Array =
/// <summary>Sorts the elements of an array, returning a new array. Elements are compared using <see cref="M:Microsoft.FSharp.Core.Operators.compare"/>. </summary>
///
/// <remarks>This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
/// For a stable sort, consider using <see cref="M:Microsoft.FSharp.Collections.SeqModule.Sort"/>.</remarks>
/// For a stable sort, consider using <see cref="M:Microsoft.FSharp.Collections.SeqModule.Sort"/>.
/// Time Complexity: O(n log n) where n is the length of the array.
/// Space Complexity: O(n) for the new array.
/// </remarks>
///
/// <param name="array">The input array.</param>
///
Expand Down
Loading