From aa5cdf5db6c0f78c52719f7edd0ffd92c872f730 Mon Sep 17 00:00:00 2001 From: XperiAndri Date: Mon, 30 Nov 2026 04:27:36 +0100 Subject: [PATCH 1/6] feat: add `FlatList.clear` It returns the empty flat list, as `ImmutableArray.Clear` does, and rejects a default flat list as the other functions of the module do. `IndexedList`, `Queue` and `Stack` get a `clear` in their pull requests, so that the modules of the lists do not differ in it. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 12 ++++++------ .../FlatList/FlatList.fs | 5 +++++ .../FlatList/FlatList.fsi | 10 ++++++++++ .../FlatList/FlatListTests.fs | 13 +++++++++++++ 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22b3dfaa..fb367c12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,12 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * `FlatList` has every function of the FSharp.Core `Array` module that applies to an immutable array, with its semantics - and exceptions, plus `add`, `asMemory`, `asSpan`, `binarySearch`, `binarySearchRange`, `binarySearchRangeWithComparer`, - `binarySearchWithComparer`, `indexOf`, `indexOfRange`, `indexOfRangeWith`, `indexOfWith`, `lastIndexOf`, - `lastIndexOfRange`, `lastIndexOfRangeWith`, `lastIndexOfWith`, `ofReadOnlySpan`, `ofSpan`, `remove`, `removeMany`, - `removeManyWith`, `removeWith`, `replace`, `replaceWith`, `skipLast` and `takeLast`. `remove` and `removeMany` remove by - value in `EqualityComparer<'T>.Default`, and the `With` variants take an equality comparer. The functions that wrap a - member of `ImmutableArray<'T>` throw what the member throws. + and exceptions, plus `add`, `asMemory`, `asSpan`, `binarySearch`, `binarySearchRange`, + `binarySearchRangeWithComparer`, `binarySearchWithComparer`, `clear`, `indexOf`, `indexOfRange`, `indexOfRangeWith`, + `indexOfWith`, `lastIndexOf`, `lastIndexOfRange`, `lastIndexOfRangeWith`, `lastIndexOfWith`, `ofReadOnlySpan`, + `ofSpan`, `remove`, `removeMany`, `removeManyWith`, `removeWith`, `replace`, `replaceWith`, `skipLast` and `takeLast`. + `remove` and `removeMany` remove by value in `EqualityComparer<'T>.Default`, and the `With` variants take an equality + comparer. The functions that wrap a member of `ImmutableArray<'T>` throw what the member throws. * The `FSharp.Collections.Immutable.Option.FlatList` and `FSharp.Collections.Immutable.Tuple.FlatList` modules repeat the functions that use value options or struct tuples with options and reference tuples. * The `FlatListBuilder` module works on the builder of a flat list: `add`, `addRange`, `blit`, `capacity`, `clear`, diff --git a/src/FSharp.Collections.Immutable/FlatList/FlatList.fs b/src/FSharp.Collections.Immutable/FlatList/FlatList.fs index 19cf6c68..178bef21 100644 --- a/src/FSharp.Collections.Immutable/FlatList/FlatList.fs +++ b/src/FSharp.Collections.Immutable/FlatList/FlatList.fs @@ -1007,6 +1007,11 @@ let toSeq (array : FlatList<'T>) = // ---- Type-specific ---- +[] +let clear (array : FlatList<'T>) = + checkNotDefault (nameof array) array + array.Clear () + [] let isDefault (array : FlatList<'T>) = array.IsDefault diff --git a/src/FSharp.Collections.Immutable/FlatList/FlatList.fsi b/src/FSharp.Collections.Immutable/FlatList/FlatList.fsi index 766f3a22..4dd92d26 100644 --- a/src/FSharp.Collections.Immutable/FlatList/FlatList.fsi +++ b/src/FSharp.Collections.Immutable/FlatList/FlatList.fsi @@ -2053,6 +2053,16 @@ val toSeq : array : FlatList<'T> -> seq<'T> // ---- Type-specific ---- +/// Returns the empty flat list. +/// The input flat list. +/// The empty flat list. +/// +/// O(1). The function wraps , which returns the empty +/// flat list of , whatever the input is. +/// +[] +val clear : array : FlatList<'T> -> FlatList<'T> + /// /// Returns whether the immutable array is a default value without an underlying array. /// diff --git a/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListTests.fs b/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListTests.fs index 50026a38..30e9f3df 100644 --- a/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListTests.fs +++ b/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListTests.fs @@ -190,6 +190,7 @@ type FlatListTests () = FlatList.binarySearchWithComparer Comparer.Default 1 defaultArray |> ignore )) + struct (nameof FlatList.clear, "array", (fun () -> FlatList.clear defaultArray |> ignore)) struct (nameof FlatList.blit, "source", (fun () -> FlatList.blit defaultArray 0 [| 0 |] 0 0)) // Array.concat dereferences a null element array without a check; a default element is a default flat list (D6) struct (nameof FlatList.concat, "arrays", (fun () -> FlatList.concat [ defaultArray ] |> ignore)) @@ -640,6 +641,18 @@ type FlatListTests () = "FlatList.create -1 must throw as Array.create does" ) + [] + member _.``clear returns the empty flat list itself`` () = + Assert.AreSame ( + underlying FlatList.empty, + underlying (FlatList.clear (FlatList.ofArray Inputs.Several)), + "FlatList.clear must return FlatList.empty" + ) + Assert.IsTrue ( + FlatList.isEmpty (FlatList.clear FlatList.empty), + "FlatList.clear of an empty flat list must be empty" + ) + [] member _.``isDefault and isDefaultOrEmpty tell a default value from an empty one`` () = Assert.IsTrue (FlatList.isDefault defaultArray, "isDefault must be true for a default value") From 638537ef7bbf877a88461f36ac630e769d0a5063 Mon Sep 17 00:00:00 2001 From: XperiAndri Date: Mon, 30 Nov 2026 04:27:48 +0100 Subject: [PATCH 2/6] refactor: the type parameters of the inline functions are written with `'` instead of `^` F# 7 accepts both for a statically resolved type parameter, and the signatures of the assembly and the generated documentation are the same. Co-Authored-By: Claude Opus 5.5 --- .../FlatList/FlatList.fs | 16 ++++----- .../FlatList/FlatList.fsi | 36 +++++++++---------- .../Assert.fs | 8 ++--- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/FSharp.Collections.Immutable/FlatList/FlatList.fs b/src/FSharp.Collections.Immutable/FlatList/FlatList.fs index 178bef21..96316f43 100644 --- a/src/FSharp.Collections.Immutable/FlatList/FlatList.fs +++ b/src/FSharp.Collections.Immutable/FlatList/FlatList.fs @@ -585,7 +585,7 @@ let zip3 (array1 : FlatList<'T1>) (array2 : FlatList<'T2>) (array3 : FlatList<'T // The inline functions can use public members only, so they check and unwrap the array themselves [] -let inline average (array : FlatList< ^T >) : ^T = +let inline average (array : FlatList<'T>) : 'T = if array.IsDefault then nullArg (nameof array) @@ -595,7 +595,7 @@ let inline average (array : FlatList< ^T >) : ^T = ) [] -let inline averageBy ([] projection : 'T -> ^U) (array : FlatList<'T>) : ^U = +let inline averageBy ([] projection : 'T -> 'U) (array : FlatList<'T>) : 'U = if array.IsDefault then nullArg (nameof array) @@ -693,7 +693,7 @@ let scanBack (folder : 'T -> 'State -> 'State) (array : FlatList<'T>) (state : ' |> wrapArray [] -let inline sum (array : FlatList< ^T >) : ^T = +let inline sum (array : FlatList<'T>) : 'T = if array.IsDefault then nullArg (nameof array) @@ -703,7 +703,7 @@ let inline sum (array : FlatList< ^T >) : ^T = ) [] -let inline sumBy ([] projection : 'T -> ^U) (array : FlatList<'T>) : ^U = +let inline sumBy ([] projection : 'T -> 'U) (array : FlatList<'T>) : 'U = if array.IsDefault then nullArg (nameof array) @@ -1106,7 +1106,7 @@ module Parallel = // The inline functions can use public members only, so they check and unwrap the array themselves [] - let inline average (array : FlatList< ^T >) : ^T = + let inline average (array : FlatList<'T>) : 'T = if array.IsDefault then nullArg (nameof array) @@ -1116,7 +1116,7 @@ module Parallel = ) [] - let inline averageBy ([] projection : 'T -> ^U) (array : FlatList<'T>) : ^U = + let inline averageBy ([] projection : 'T -> 'U) (array : FlatList<'T>) : 'U = if array.IsDefault then nullArg (nameof array) @@ -1153,7 +1153,7 @@ module Parallel = // Array.Parallel.sum dereferences a null array without a check; a default flat list throws ArgumentNullException, // which its documentation promises [] - let inline sum (array : FlatList< ^T >) : ^T = + let inline sum (array : FlatList<'T>) : 'T = if array.IsDefault then nullArg (nameof array) @@ -1163,7 +1163,7 @@ module Parallel = ) [] - let inline sumBy ([] projection : 'T -> ^U) (array : FlatList<'T>) : ^U = + let inline sumBy ([] projection : 'T -> 'U) (array : FlatList<'T>) : 'U = if array.IsDefault then nullArg (nameof array) diff --git a/src/FSharp.Collections.Immutable/FlatList/FlatList.fsi b/src/FSharp.Collections.Immutable/FlatList/FlatList.fsi index 4dd92d26..dc23ee59 100644 --- a/src/FSharp.Collections.Immutable/FlatList/FlatList.fsi +++ b/src/FSharp.Collections.Immutable/FlatList/FlatList.fsi @@ -1215,10 +1215,10 @@ val zip3 : array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> array3 : FlatList /// O(n). [] val inline average : - array : FlatList< ^T > -> ^T - when ^T : (static member (+) : ^T * ^T -> ^T) - and ^T : (static member DivideByInt : ^T * int -> ^T) - and ^T : (static member Zero : ^T) + array : FlatList<'T> -> 'T + when 'T : (static member (+) : 'T * 'T -> 'T) + and 'T : (static member DivideByInt : 'T * int -> 'T) + and 'T : (static member Zero : 'T) /// /// Returns the average of the results of a function applied to each element. @@ -1232,10 +1232,10 @@ val inline average : /// [] val inline averageBy : - projection : ('T -> ^U) -> array : FlatList<'T> -> ^U - when ^U : (static member (+) : ^U * ^U -> ^U) - and ^U : (static member DivideByInt : ^U * int -> ^U) - and ^U : (static member Zero : ^U) + projection : ('T -> 'U) -> array : FlatList<'T> -> 'U + when 'U : (static member (+) : 'U * 'U -> 'U) + and 'U : (static member DivideByInt : 'U * int -> 'U) + and 'U : (static member Zero : 'U) /// Compares two flat lists element by element with a comparer. /// The function that compares two elements. @@ -1479,7 +1479,7 @@ val scanBack : folder : ('T -> 'State -> 'State) -> array : FlatList<'T> -> stat /// The sum; zero for an empty flat list. /// O(n). [] -val inline sum : array : FlatList< ^T > -> ^T when ^T : (static member (+) : ^T * ^T -> ^T) and ^T : (static member Zero : ^T) +val inline sum : array : FlatList<'T> -> 'T when 'T : (static member (+) : 'T * 'T -> 'T) and 'T : (static member Zero : 'T) /// /// Returns the sum of the results of a function applied to each element. @@ -1492,8 +1492,8 @@ val inline sum : array : FlatList< ^T > -> ^T when ^T : (static member (+) : ^T /// [] val inline sumBy : - projection : ('T -> ^U) -> array : FlatList<'T> -> ^U - when ^U : (static member (+) : ^U * ^U -> ^U) and ^U : (static member Zero : ^U) + projection : ('T -> 'U) -> array : FlatList<'T> -> 'U + when 'U : (static member (+) : 'U * 'U -> 'U) and 'U : (static member Zero : 'U) // ---- Partitioning and grouping ---- @@ -2276,8 +2276,8 @@ module Parallel = /// [] val inline average : - array : FlatList< ^T > -> ^T - when ^T : (static member (+) : ^T * ^T -> ^T) and ^T : (static member DivideByInt : ^T * int -> ^T) + array : FlatList<'T> -> 'T + when 'T : (static member (+) : 'T * 'T -> 'T) and 'T : (static member DivideByInt : 'T * int -> 'T) /// /// Returns the average of the results of a function applied to each element. @@ -2292,8 +2292,8 @@ module Parallel = /// [] val inline averageBy : - projection : ('T -> ^U) -> array : FlatList<'T> -> ^U - when ^U : (static member (+) : ^U * ^U -> ^U) and ^U : (static member DivideByInt : ^U * int -> ^U) + projection : ('T -> 'U) -> array : FlatList<'T> -> 'U + when 'U : (static member (+) : 'U * 'U -> 'U) and 'U : (static member DivideByInt : 'U * int -> 'U) /// Applies an action to each element, in parallel. /// The action, called in parallel. @@ -2386,7 +2386,7 @@ module Parallel = /// one. /// [] - val inline sum : array : FlatList< ^T > -> ^T when ^T : (static member (+) : ^T * ^T -> ^T) and ^T : (static member Zero : ^T) + val inline sum : array : FlatList<'T> -> 'T when 'T : (static member (+) : 'T * 'T -> 'T) and 'T : (static member Zero : 'T) /// /// Returns the sum of the results of a function applied to each element. @@ -2400,8 +2400,8 @@ module Parallel = /// [] val inline sumBy : - projection : ('T -> ^U) -> array : FlatList<'T> -> ^U - when ^U : (static member (+) : ^U * ^U -> ^U) and ^U : (static member Zero : ^U) + projection : ('T -> 'U) -> array : FlatList<'T> -> 'U + when 'U : (static member (+) : 'U * 'U -> 'U) and 'U : (static member Zero : 'U) // ---- Partitioning and grouping ---- diff --git a/tests/FSharp.Collections.Immutable.Tests/Assert.fs b/tests/FSharp.Collections.Immutable.Tests/Assert.fs index 17b27fe3..545cfcf3 100644 --- a/tests/FSharp.Collections.Immutable.Tests/Assert.fs +++ b/tests/FSharp.Collections.Immutable.Tests/Assert.fs @@ -116,19 +116,19 @@ type Assert with /// Fails the test with unless is the default value of its /// type. /// - static member inline IsDefaultOf< ^T> (value : ^T, [] message : string) = - Assert.AreEqual (box value, box Unchecked.defaultof< ^T>, message) + static member inline IsDefaultOf<'T> (value : 'T, [] message : string) = + Assert.AreEqual (box value, box Unchecked.defaultof<'T>, message) /// /// Fails the test with unless is /// holding . /// - static member inline OkEquals< ^R, 'E> (expected : ^R, actual : Result< ^R, 'E >, [] message : string | null) = + static member inline OkEquals<'R, 'E> (expected : 'R, actual : Result<'R, 'E>, [] message : string | null) = Assert.AreEqual (box expected, box (Assert.WantOk (actual, message)), message) /// /// Fails the test with unless is /// holding . /// - static member inline ErrorEquals<'R, ^E> (expected : ^E, actual : Result<'R, ^E>, [] message : string | null) = + static member inline ErrorEquals<'R, 'E> (expected : 'E, actual : Result<'R, 'E>, [] message : string | null) = Assert.AreEqual (box expected, box (Assert.WantError (actual, message)), message) From 8ca961534d1048bc792986ed346a9f4a398fbbc4 Mon Sep 17 00:00:00 2001 From: XperiAndri Date: Mon, 30 Nov 2026 04:28:11 +0100 Subject: [PATCH 3/6] docs: the comments of the code follow the review of #31 Comments only; the code without them is the same. The references to the ADRs leave the comments: the documentation of the internal modules is in the XML of the package too, and a reader of it has no ADR. The cases of the option types are ``, not ``. `` and `` take one line each when their own text has up to 60 characters, whatever the length of the other one. `FlatListCE` is left to #52, which changes the file. Co-Authored-By: Claude Opus 5.5 --- build/CheckOrder.fs | 5 +- build/build.fs | 2 +- .../ComputationExpressions.fsi | 4 +- .../FlatList/FlatList.fs | 14 +- .../FlatList/FlatList.fsi | 579 ++++++------------ .../FlatList/FlatListBuilder.fsi | 24 +- .../FlatList/FlatListOption.fsi | 164 ++--- .../FlatList/FlatListTuple.fsi | 51 +- .../FlatList/FlatListTypes.fs | 6 +- .../Helper/Arrays.fs | 14 +- .../Helper/Comparers.fs | 2 +- .../Helper/ErrorStrings.fs | 2 +- .../Helper/ImmutableCollectionUtil.fs | 18 +- .../Helper/ParallelArrays.fs | 28 +- .../Helper/Raise.fs | 4 +- .../Contracts/ExceptionAssert.fs | 2 +- .../Contracts/IndexedContract.fs | 3 +- .../Contracts/Inputs.fs | 2 +- .../Contracts/Mirror.fs | 2 +- .../Contracts/OverrideAssert.fs | 2 +- .../Contracts/SeqCreationContract.fs | 2 +- .../SeqLike/SeqLikeAccessContract.fs | 2 +- .../Contracts/SeqLike/SeqLikeContract.fs | 2 +- .../Contracts/SeqOps.fs | 2 +- .../FlatList/FlatListParallelTests.fs | 2 +- .../FlatList/FlatListTests.fs | 2 +- .../TestCategories.fs | 2 +- .../TestCategoriesTests.fs | 2 +- 28 files changed, 372 insertions(+), 572 deletions(-) diff --git a/build/CheckOrder.fs b/build/CheckOrder.fs index cb006e4a..ce5aed96 100644 --- a/build/CheckOrder.fs +++ b/build/CheckOrder.fs @@ -1,6 +1,5 @@ /// -/// Checks the order of the functions in the signature files of the library and in their implementation files -/// (ADR 0001, D4). +/// Checks the order of the functions in the signature files of the library and in their implementation files. /// /// /// @@ -30,7 +29,7 @@ open Fantomas.FCS.Text [] type Violation = { Path : string; Line : int; Message : string } -/// The canonical category sequence of ADR 0001, D4. +/// The canonical category sequence. let private categories = [| "Creation" "Builder" diff --git a/build/build.fs b/build/build.fs index 55301ea2..9b762d0e 100644 --- a/build/build.fs +++ b/build/build.fs @@ -648,7 +648,7 @@ let checkFormatCode ctx = else Trace.logf "Errors while formatting: %A" result.Errors -/// Checks the category banners and the alphabetical order of the functions in the signature files (ADR 0001, D4) +/// Checks the category banners and the alphabetical order of the functions in the signature files let checkOrder _ = let struct (fileCount, violations) = CheckOrder.check (rootDirectory "src") diff --git a/src/FSharp.Collections.Immutable/ComputationExpressions.fsi b/src/FSharp.Collections.Immutable/ComputationExpressions.fsi index c0086e56..183954ea 100644 --- a/src/FSharp.Collections.Immutable/ComputationExpressions.fsi +++ b/src/FSharp.Collections.Immutable/ComputationExpressions.fsi @@ -1,6 +1,4 @@ -/// -/// The computation expressions of the collections (ADR 0001, D7). -/// +/// The computation expressions of the collections. [] module FSharp.Collections.Immutable.ComputationExpressions diff --git a/src/FSharp.Collections.Immutable/FlatList/FlatList.fs b/src/FSharp.Collections.Immutable/FlatList/FlatList.fs index 96316f43..b02f6b97 100644 --- a/src/FSharp.Collections.Immutable/FlatList/FlatList.fs +++ b/src/FSharp.Collections.Immutable/FlatList/FlatList.fs @@ -7,7 +7,7 @@ open System.Collections.Immutable open System.Runtime.InteropServices // Most functions unwrap the underlying array without a copy, call the FSharp.Core Array function, and wrap its fresh -// result without a copy (ADR 0001, D5), so that they have the semantics and the exceptions of the Array module (D6). +// result without a copy, so that they have the semantics and the exceptions of the Array module. // ---- Creation ---- @@ -26,7 +26,7 @@ let ofArray (array : 'T array) = Array.copy array |> wrapArray [] let ofList (list : 'T list) = - // Array.ofList dereferences a null list without a check; a null input throws ArgumentNullException here (ADR 0001, D6) + // Array.ofList dereferences a null list without a check; a null input throws ArgumentNullException here checkNotNull (nameof list) list Array.ofList list |> wrapArray @@ -36,7 +36,7 @@ let ofReadOnlySpan (span : ReadOnlySpan<'T>) = ImmutableArray.Create<'T> span [] let ofSeq (source : seq<'T>) = match source with - // An immutable array needs no copy; a default one is a default FlatList, which no function accepts (ADR 0001, D6) + // An immutable array needs no copy; a default one is a default FlatList, which no function accepts | :? ImmutableArray<'T> as array -> checkNotDefault (nameof source) array array @@ -752,7 +752,7 @@ let partitionWith (partitioner : 'T -> Choice<'T1, 'T2>) (array : FlatList<'T>) struct (wrapArray first, wrapArray second) // The range functions repeat the checks of Array.skip, Array.take and Array.splitAt and then slice: a slice copies the -// selected elements, unless the range is empty or covers the whole array (ADR 0001, D5) +// selected elements, unless the range is empty or covers the whole array [] let skip count (array : FlatList<'T>) = @@ -990,7 +990,7 @@ let asSpan (array : FlatList<'T>) = [] let blit (source : FlatList<'T>) sourceIndex (target : 'T array) targetIndex count = let items = unwrapArray (nameof source) source - // Array.blit reports a null target under the name of the BCL, destinationArray; the name is the parameter's here (D6) + // Array.blit reports a null target under the name of the BCL, destinationArray; the name is the parameter's here checkNotNull (nameof target) target Array.blit items sourceIndex target targetIndex count @@ -1019,7 +1019,7 @@ let isDefault (array : FlatList<'T>) = array.IsDefault let isDefaultOrEmpty (array : FlatList<'T>) = array.IsDefaultOrEmpty // Most functions unwrap the underlying array without a copy, call the Array.Parallel function, and wrap its fresh result -// without a copy (ADR 0001, D11), so that they have the semantics and the exceptions of Array.Parallel. Where the +// without a copy, so that they have the semantics and the exceptions of Array.Parallel. Where the // Array.Parallel function takes or returns options or builds a tuple per element or per group (choose, tryFind, // tryFindIndex, tryPick, zip, groupBy), an algorithm of ParallelArrays with value options and struct tuples runs instead. // Array.Parallel sorts a copy of its input, so the shared array is never changed. @@ -1065,7 +1065,7 @@ module Parallel = let collect (mapping : 'T -> FlatList<'U>) (array : FlatList<'T>) = // As in Array.Parallel.collect, the mapping runs in parallel, and the results are copied in their order into one // array of their total length. Array.Parallel.collect dereferences a null result; a default flat list from the - // mapping throws ArgumentNullException instead, as in the sequential collect (ADR 0001, D6). + // mapping throws ArgumentNullException instead, as in the sequential collect. let results = Array.Parallel.map mapping (unwrapArray (nameof array) array) let mutable length = 0 diff --git a/src/FSharp.Collections.Immutable/FlatList/FlatList.fsi b/src/FSharp.Collections.Immutable/FlatList/FlatList.fsi index dc23ee59..447ec72a 100644 --- a/src/FSharp.Collections.Immutable/FlatList/FlatList.fsi +++ b/src/FSharp.Collections.Immutable/FlatList/FlatList.fsi @@ -1,10 +1,8 @@ -/// -/// Functions for , the immutable array. -/// +/// Functions for , the immutable array. /// /// /// The module mirrors : each function has the semantics, the -/// argument checks and the exceptions of the function with the same name in that module (ADR 0001). Functions that +/// argument checks and the exceptions of the function with the same name in that module. Functions that /// FSharp.Core lacks wrap a member of and throw what that /// member throws. /// @@ -40,12 +38,8 @@ open System.Collections.Immutable [] val create : count : int -> value : 'T -> FlatList<'T> -/// -/// The empty flat list. -/// -/// -/// O(1). The value is . -/// +/// The empty flat list. +/// O(1). The value is . [] [] val empty<'T> : FlatList<'T> @@ -59,9 +53,7 @@ val empty<'T> : FlatList<'T> [] val init : count : int -> initializer : (int -> 'T) -> FlatList<'T> -/// -/// Creates a flat list from a copy of an array. -/// +/// Creates a flat list from a copy of an array. /// The input array. /// The flat list of the elements of the array. /// Thrown when is . @@ -79,9 +71,7 @@ val ofArray : array : 'T array -> FlatList<'T> [] val ofList : list : 'T list -> FlatList<'T> -/// -/// Creates a flat list from a copy of a read-only span. -/// +/// Creates a flat list from a copy of a read-only span. /// The input span. /// The flat list of the elements of the span. /// @@ -98,9 +88,7 @@ val ofReadOnlySpan : span : ReadOnlySpan<'T> -> FlatList<'T> [] val ofSeq : source : seq<'T> -> FlatList<'T> -/// -/// Creates a flat list from a copy of a span. -/// +/// Creates a flat list from a copy of a span. /// The input span. /// The flat list of the elements of the span. /// @@ -128,12 +116,13 @@ val singleton : value : 'T -> FlatList<'T> /// /// Creates a flat list from a generator, which returns the next element and the next state. /// -/// The function that returns the next element and state, or ValueNone to stop. +/// +/// The function that returns the next element and state, or +/// to stop. +/// /// The initial state. /// The generated flat list. -/// -/// O(n). -/// +/// O(n). [] val unfold : generator : ('State -> struct ('T * 'State) voption) -> state : 'State -> FlatList<'T> @@ -146,19 +135,13 @@ val unfold : generator : ('State -> struct ('T * 'State) voption) -> state : 'St [] val build : action : (FlatList<'T>.Builder -> unit) -> FlatList<'T> -/// -/// Creates an empty builder. -/// +/// Creates an empty builder. /// A builder of capacity 8. -/// -/// O(1). The function wraps . -/// +/// O(1). The function wraps . [] val builder : unit -> FlatList<'T>.Builder -/// -/// Creates an empty builder of a given capacity. -/// +/// Creates an empty builder of a given capacity. /// The initial capacity. /// The builder. /// Thrown when is negative. @@ -181,15 +164,11 @@ val builderWith : capacity : int -> FlatList<'T>.Builder [] val moveFromBuilder : builder : FlatList<'T>.Builder -> FlatList<'T> -/// -/// Returns a copy of the contents of a builder as a flat list. -/// +/// Returns a copy of the contents of a builder as a flat list. /// The builder, which stays unchanged. /// The flat list of the elements of the builder. /// Thrown when is . -/// -/// O(n). The function wraps . -/// +/// O(n). The function wraps . [] val ofBuilder : builder : FlatList<'T>.Builder -> FlatList<'T> @@ -198,9 +177,7 @@ val ofBuilder : builder : FlatList<'T>.Builder -> FlatList<'T> /// /// The input flat list. /// The builder. -/// -/// O(n). The function wraps . -/// +/// O(n). The function wraps . [] val toBuilder : array : FlatList<'T> -> FlatList<'T>.Builder @@ -210,9 +187,7 @@ val toBuilder : array : FlatList<'T> -> FlatList<'T>.Builder /// The action that changes the builder. /// The input flat list, which stays unchanged. /// The flat list of the elements of the changed builder. -/// -/// O(n). -/// +/// O(n). [] val update : action : (FlatList<'T>.Builder -> unit) -> array : FlatList<'T> -> FlatList<'T> @@ -276,58 +251,55 @@ val last : array : FlatList<'T> -> 'T val tail : array : FlatList<'T> -> FlatList<'T> /// -/// Returns the only element of the flat list, or ValueNone when it does not have exactly one element. +/// Returns the only element of the flat list, or when +/// it does not have exactly one element. /// /// The input flat list. -/// The only element, or ValueNone. -/// -/// O(1). -/// +/// The only element, or . +/// O(1). [] val tryExactlyOne : array : FlatList<'T> -> 'T voption /// -/// Returns the first element of the flat list, or ValueNone when it is empty. +/// Returns the first element of the flat list, or when +/// it is empty. /// /// The input flat list. -/// The first element, or ValueNone. -/// -/// O(1). -/// +/// The first element, or . +/// O(1). [] val tryHead : array : FlatList<'T> -> 'T voption /// -/// Returns the element at an index, or ValueNone when the index is out of range. +/// Returns the element at an index, or when the index +/// is out of range. /// /// The index of the element. /// The input flat list. -/// The element at the index, or ValueNone. -/// -/// O(1). -/// +/// The element at the index, or . +/// O(1). [] val tryItem : index : int -> array : FlatList<'T> -> 'T voption /// -/// Returns the last element of the flat list, or ValueNone when it is empty. +/// Returns the last element of the flat list, or when +/// it is empty. /// /// The input flat list. -/// The last element, or ValueNone. -/// -/// O(1). -/// +/// The last element, or . +/// O(1). [] val tryLast : array : FlatList<'T> -> 'T voption /// -/// Returns the flat list without its first element, or ValueNone when it is empty. +/// Returns the flat list without its first element, or +/// when it is empty. /// /// The input flat list. -/// A copy of the elements after the first one, or ValueNone. -/// -/// O(n). -/// +/// +/// A copy of the elements after the first one, or . +/// +/// O(n). [] val tryTail : array : FlatList<'T> -> FlatList<'T> voption @@ -438,9 +410,7 @@ val binarySearchWithComparer : comparer : IComparer<'T> -> value : 'T -> array : /// The value to find. /// The input flat list. /// when an element equals the value. -/// -/// O(n). -/// +/// O(n). [] val contains : value : 'T -> array : FlatList<'T> -> bool when 'T : equality @@ -460,9 +430,7 @@ val exists : predicate : ('T -> bool) -> array : FlatList<'T> -> bool /// The second flat list. /// when a pair satisfies the predicate. /// Thrown when the flat lists have different lengths. -/// -/// O(n). -/// +/// O(n). [] val exists2 : predicate : ('T1 -> 'T2 -> bool) -> array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> bool @@ -491,9 +459,7 @@ val findBack : predicate : ('T -> bool) -> array : FlatList<'T> -> 'T /// The input flat list. /// The index of the first element that satisfies the predicate. /// Thrown when no element satisfies the predicate. -/// -/// O(n). -/// +/// O(n). [] val findIndex : predicate : ('T -> bool) -> array : FlatList<'T> -> int @@ -504,9 +470,7 @@ val findIndex : predicate : ('T -> bool) -> array : FlatList<'T> -> int /// The input flat list. /// The index of the last element that satisfies the predicate. /// Thrown when no element satisfies the predicate. -/// -/// O(n). -/// +/// O(n). [] val findIndexBack : predicate : ('T -> bool) -> array : FlatList<'T> -> int @@ -526,9 +490,7 @@ val forall : predicate : ('T -> bool) -> array : FlatList<'T> -> bool /// The second flat list. /// when every pair satisfies the predicate. /// Thrown when the flat lists have different lengths. -/// -/// O(n). -/// +/// O(n). [] val forall2 : predicate : ('T1 -> 'T2 -> bool) -> array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> bool @@ -538,9 +500,7 @@ val forall2 : predicate : ('T1 -> 'T2 -> bool) -> array1 : FlatList<'T1> -> arra /// The value to find. /// The input flat list. /// The index of the first equal element, or -1. -/// -/// O(n). The function wraps . -/// +/// O(n). The function wraps . [] val indexOf : value : 'T -> array : FlatList<'T> -> int @@ -616,9 +576,7 @@ val indexOfWith : comparer : IEqualityComparer<'T> -> value : 'T -> array : Flat /// The value to find. /// The input flat list. /// The index of the last equal element, or -1. -/// -/// O(n). The function wraps . -/// +/// O(n). The function wraps . [] val lastIndexOf : value : 'T -> array : FlatList<'T> -> int @@ -694,73 +652,81 @@ val lastIndexOfWith : comparer : IEqualityComparer<'T> -> value : 'T -> array : /// /// Returns the first value that the chooser returns for the elements. /// -/// The function that returns a value, or ValueNone to go on. +/// +/// The function that returns a value, or to go on. +/// /// The input flat list. /// The first chosen value. -/// Thrown when the chooser returns ValueNone for every element. -/// -/// O(n). -/// +/// +/// Thrown when the chooser returns for every element. +/// +/// O(n). [] val pick : chooser : ('T -> 'U voption) -> array : FlatList<'T> -> 'U /// -/// Returns the first element that satisfies the predicate, or ValueNone. +/// Returns the first element that satisfies the predicate, or +/// . /// /// The function to test the elements. /// The input flat list. -/// The first element that satisfies the predicate, or ValueNone. -/// -/// O(n). -/// +/// +/// The first element that satisfies the predicate, or . +/// +/// O(n). [] val tryFind : predicate : ('T -> bool) -> array : FlatList<'T> -> 'T voption /// -/// Returns the last element that satisfies the predicate, or ValueNone. +/// Returns the last element that satisfies the predicate, or . /// /// The function to test the elements. /// The input flat list. -/// The last element that satisfies the predicate, or ValueNone. -/// -/// O(n). -/// +/// +/// The last element that satisfies the predicate, or . +/// +/// O(n). [] val tryFindBack : predicate : ('T -> bool) -> array : FlatList<'T> -> 'T voption /// -/// Returns the index of the first element that satisfies the predicate, or ValueNone. +/// Returns the index of the first element that satisfies the predicate, or +/// . /// /// The function to test the elements. /// The input flat list. -/// The index of the first element that satisfies the predicate, or ValueNone. -/// -/// O(n). -/// +/// +/// The index of the first element that satisfies the predicate, or +/// . +/// +/// O(n). [] val tryFindIndex : predicate : ('T -> bool) -> array : FlatList<'T> -> int voption /// -/// Returns the index of the last element that satisfies the predicate, or ValueNone. +/// Returns the index of the last element that satisfies the predicate, or +/// . /// /// The function to test the elements. /// The input flat list. -/// The index of the last element that satisfies the predicate, or ValueNone. -/// -/// O(n). -/// +/// +/// The index of the last element that satisfies the predicate, or +/// . +/// +/// O(n). [] val tryFindIndexBack : predicate : ('T -> bool) -> array : FlatList<'T> -> int voption /// -/// Returns the first value that the chooser returns for the elements, or ValueNone. +/// Returns the first value that the chooser returns for the elements, or +/// . /// -/// The function that returns a value, or ValueNone to go on. +/// +/// The function that returns a value, or to go on. +/// /// The input flat list. -/// The first chosen value, or ValueNone. -/// -/// O(n). -/// +/// The first chosen value, or . +/// O(n). [] val tryPick : chooser : ('T -> 'U voption) -> array : FlatList<'T> -> 'U voption @@ -772,9 +738,7 @@ val tryPick : chooser : ('T -> 'U voption) -> array : FlatList<'T> -> 'U voption /// The value to add. /// The input flat list. /// A flat list of the elements and the value. -/// -/// O(n). The function wraps . -/// +/// O(n). The function wraps . [] val add : value : 'T -> array : FlatList<'T> -> FlatList<'T> @@ -784,9 +748,7 @@ val add : value : 'T -> array : FlatList<'T> -> FlatList<'T> /// The first flat list. /// The second flat list. /// The pairs, in the order of the first flat list and then of the second one. -/// -/// O(n × m). -/// +/// O(n × m). [] val allPairs : array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> FlatList @@ -805,12 +767,13 @@ val append : array1 : FlatList<'T> -> array2 : FlatList<'T> -> FlatList<'T> /// /// Returns the values that the chooser returns for the elements. /// -/// The function that returns a value, or ValueNone to skip the element. +/// +/// The function that returns a value, or to skip the +/// element. +/// /// The input flat list. /// The chosen values. -/// -/// O(n). -/// +/// O(n). [] val choose : chooser : ('T -> 'U voption) -> array : FlatList<'T> -> FlatList<'U> @@ -830,9 +793,7 @@ val chunkBySize : chunkSize : int -> array : FlatList<'T> -> FlatListThe input flat list. /// The concatenation of the returned flat lists. /// Thrown when the mapping returns a default flat list. -/// -/// O(n + the total length of the returned flat lists). -/// +/// O(n + the total length of the returned flat lists). [] val collect : mapping : ('T -> FlatList<'U>) -> array : FlatList<'T> -> FlatList<'U> @@ -844,9 +805,7 @@ val collect : mapping : ('T -> FlatList<'U>) -> array : FlatList<'T> -> FlatList [] val concat : arrays : seq> -> FlatList<'T> -/// -/// Returns the elements that satisfy the predicate. -/// +/// Returns the elements that satisfy the predicate. /// The function to test the elements. /// The input flat list. /// The elements that satisfy the predicate, in their order. @@ -902,9 +861,7 @@ val map : mapping : ('T -> 'U) -> array : FlatList<'T> -> FlatList<'U> /// The second flat list. /// The results. /// Thrown when the flat lists have different lengths. -/// -/// O(n). -/// +/// O(n). [] val map2 : mapping : ('T1 -> 'T2 -> 'U) -> array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> FlatList<'U> @@ -917,9 +874,7 @@ val map2 : mapping : ('T1 -> 'T2 -> 'U) -> array1 : FlatList<'T1> -> array2 : Fl /// The third flat list. /// The results. /// Thrown when the flat lists have different lengths. -/// -/// O(n). -/// +/// O(n). [] val map3 : mapping : ('T1 -> 'T2 -> 'T3 -> 'U) -> @@ -934,9 +889,7 @@ val map3 : /// The function to transform the elements. /// The input flat list. /// The results. -/// -/// O(n). -/// +/// O(n). [] val mapi : mapping : (int -> 'T -> 'U) -> array : FlatList<'T> -> FlatList<'U> @@ -948,9 +901,7 @@ val mapi : mapping : (int -> 'T -> 'U) -> array : FlatList<'T> -> FlatList<'U> /// The second flat list. /// The results. /// Thrown when the flat lists have different lengths. -/// -/// O(n). -/// +/// O(n). [] val mapi2 : mapping : (int -> 'T1 -> 'T2 -> 'U) -> array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> FlatList<'U> @@ -968,9 +919,7 @@ val pairwise : array : FlatList<'T> -> FlatList /// The input flat list. /// The permuted flat list. /// Thrown when the function does not compute a permutation. -/// -/// O(n). -/// +/// O(n). [] val permute : indexMap : (int -> int) -> array : FlatList<'T> -> FlatList<'T> @@ -1025,9 +974,7 @@ val removeAt : index : int -> source : FlatList<'T> -> FlatList<'T> [] val removeMany : items : seq<'T> -> source : FlatList<'T> -> FlatList<'T> -/// -/// Returns a flat list without a range of elements. -/// +/// Returns a flat list without a range of elements. /// The index of the first removed element. /// The number of removed elements. /// The input flat list. @@ -1128,9 +1075,7 @@ val rev : array : FlatList<'T> -> FlatList<'T> /// A flat list whose element i holds the element i of every input flat list. /// Thrown when is or a default flat list, or contains a default flat list. /// Thrown when the flat lists have different lengths. -/// -/// O(the total length). -/// +/// O(the total length). [] val transpose : arrays : seq> -> FlatList> @@ -1156,15 +1101,11 @@ val unzip3 : array : FlatList -> struct (FlatList<'T1> /// The input flat list. /// The flat list with the new value. /// Thrown when the index is out of range. -/// -/// O(n). -/// +/// O(n). [] val updateAt : index : int -> value : 'T -> source : FlatList<'T> -> FlatList<'T> -/// -/// Returns the elements that satisfy the predicate. -/// +/// Returns the elements that satisfy the predicate. /// The function to test the elements. /// The input flat list. /// The elements that satisfy the predicate, in their order. @@ -1181,9 +1122,7 @@ val where : predicate : ('T -> bool) -> array : FlatList<'T> -> FlatList<'T> /// The input flat list. /// The windows; empty when the flat list is shorter than a window. /// Thrown when is not positive. -/// -/// O(n × windowSize). The windows are copies. -/// +/// O(n × windowSize). The windows are copies. [] val windowed : windowSize : int -> array : FlatList<'T> -> FlatList> @@ -1227,9 +1166,7 @@ val inline average : /// The input flat list. /// The average of the results. /// Thrown when the flat list is empty. -/// -/// O(n). -/// +/// O(n). [] val inline averageBy : projection : ('T -> 'U) -> array : FlatList<'T> -> 'U @@ -1255,9 +1192,7 @@ val compareWith : comparer : ('T -> 'T -> int) -> array1 : FlatList<'T> -> array /// The initial state. /// The input flat list. /// The final state. -/// -/// O(n). -/// +/// O(n). [] val fold : folder : ('State -> 'T -> 'State) -> state : 'State -> array : FlatList<'T> -> 'State @@ -1270,9 +1205,7 @@ val fold : folder : ('State -> 'T -> 'State) -> state : 'State -> array : FlatLi /// The second flat list. /// The final state. /// Thrown when the flat lists have different lengths. -/// -/// O(n). -/// +/// O(n). [] val fold2 : folder : ('State -> 'T1 -> 'T2 -> 'State) -> state : 'State -> array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> 'State @@ -1284,9 +1217,7 @@ val fold2 : /// The input flat list. /// The initial state. /// The final state. -/// -/// O(n). -/// +/// O(n). [] val foldBack : folder : ('T -> 'State -> 'State) -> array : FlatList<'T> -> state : 'State -> 'State @@ -1299,9 +1230,7 @@ val foldBack : folder : ('T -> 'State -> 'State) -> array : FlatList<'T> -> stat /// The initial state. /// The final state. /// Thrown when the flat lists have different lengths. -/// -/// O(n). -/// +/// O(n). [] val foldBack2 : folder : ('T1 -> 'T2 -> 'State -> 'State) -> array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> state : 'State -> 'State @@ -1320,9 +1249,7 @@ val iter : action : ('T -> unit) -> array : FlatList<'T> -> unit /// The first flat list. /// The second flat list. /// Thrown when the flat lists have different lengths. -/// -/// O(n). -/// +/// O(n). [] val iter2 : action : ('T1 -> 'T2 -> unit) -> array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> unit @@ -1340,9 +1267,7 @@ val iteri : action : (int -> 'T -> unit) -> array : FlatList<'T> -> unit /// The first flat list. /// The second flat list. /// Thrown when the flat lists have different lengths. -/// -/// O(n). -/// +/// O(n). [] val iteri2 : action : (int -> 'T1 -> 'T2 -> unit) -> array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> unit @@ -1353,9 +1278,7 @@ val iteri2 : action : (int -> 'T1 -> 'T2 -> unit) -> array1 : FlatList<'T1> -> a /// The initial state. /// The input flat list. /// The results and the final state. -/// -/// O(n). -/// +/// O(n). [] val mapFold : mapping : ('State -> 'T -> struct ('Result * 'State)) -> @@ -1370,9 +1293,7 @@ val mapFold : /// The input flat list. /// The initial state. /// The results, in the order of the elements, and the final state. -/// -/// O(n). -/// +/// O(n). [] val mapFoldBack : mapping : ('T -> 'State -> struct ('Result * 'State)) -> @@ -1395,9 +1316,7 @@ val max : array : FlatList<'T> -> 'T when 'T : comparison /// The input flat list. /// The first element with the greatest result. /// Thrown when the flat list is empty. -/// -/// O(n). -/// +/// O(n). [] val maxBy : projection : ('T -> 'U) -> array : FlatList<'T> -> 'T when 'U : comparison @@ -1416,9 +1335,7 @@ val min : array : FlatList<'T> -> 'T when 'T : comparison /// The input flat list. /// The first element with the smallest result. /// Thrown when the flat list is empty. -/// -/// O(n). -/// +/// O(n). [] val minBy : projection : ('T -> 'U) -> array : FlatList<'T> -> 'T when 'U : comparison @@ -1429,9 +1346,7 @@ val minBy : projection : ('T -> 'U) -> array : FlatList<'T> -> 'T when 'U : comp /// The input flat list. /// The combined value. /// Thrown when the flat list is empty. -/// -/// O(n). -/// +/// O(n). [] val reduce : reduction : ('T -> 'T -> 'T) -> array : FlatList<'T> -> 'T @@ -1442,9 +1357,7 @@ val reduce : reduction : ('T -> 'T -> 'T) -> array : FlatList<'T> -> 'T /// The input flat list. /// The combined value. /// Thrown when the flat list is empty. -/// -/// O(n). -/// +/// O(n). [] val reduceBack : reduction : ('T -> 'T -> 'T) -> array : FlatList<'T> -> 'T @@ -1455,9 +1368,7 @@ val reduceBack : reduction : ('T -> 'T -> 'T) -> array : FlatList<'T> -> 'T /// The initial state. /// The input flat list. /// The states; one more than the elements. -/// -/// O(n). -/// +/// O(n). [] val scan : folder : ('State -> 'T -> 'State) -> state : 'State -> array : FlatList<'T> -> FlatList<'State> @@ -1468,9 +1379,7 @@ val scan : folder : ('State -> 'T -> 'State) -> state : 'State -> array : FlatLi /// The input flat list. /// The initial state. /// The states; one more than the elements. -/// -/// O(n). -/// +/// O(n). [] val scanBack : folder : ('T -> 'State -> 'State) -> array : FlatList<'T> -> state : 'State -> FlatList<'State> @@ -1487,9 +1396,7 @@ val inline sum : array : FlatList<'T> -> 'T when 'T : (static member (+) : 'T * /// The function to transform the elements. /// The input flat list. /// The sum of the results; zero for an empty flat list. -/// -/// O(n). -/// +/// O(n). [] val inline sumBy : projection : ('T -> 'U) -> array : FlatList<'T> -> 'U @@ -1510,9 +1417,7 @@ val countBy : projection : ('T -> 'Key) -> array : FlatList<'T> -> FlatList /// The input flat list. /// The first occurrence of each element, in their order. -/// -/// O(n). -/// +/// O(n). [] val distinct : array : FlatList<'T> -> FlatList<'T> when 'T : equality @@ -1522,9 +1427,7 @@ val distinct : array : FlatList<'T> -> FlatList<'T> when 'T : equality /// The function that returns the key of an element. /// The input flat list. /// The first element of each key, in their order. -/// -/// O(n). -/// +/// O(n). [] val distinctBy : projection : ('T -> 'Key) -> array : FlatList<'T> -> FlatList<'T> when 'Key : equality @@ -1535,9 +1438,7 @@ val distinctBy : projection : ('T -> 'Key) -> array : FlatList<'T> -> FlatList<' /// The input flat list. /// The distinct remaining elements, in their order. /// Thrown when is or a default flat list. -/// -/// O(n + m). -/// +/// O(n + m). [] val except : itemsToExclude : seq<'T> -> array : FlatList<'T> -> FlatList<'T> when 'T : equality @@ -1560,18 +1461,17 @@ val partition : predicate : ('T -> bool) -> array : FlatList<'T> -> struct (Flat /// /// Splits the elements by the choice that a function returns for them. /// -/// The function that returns Choice1Of2 or Choice2Of2 for an element. +/// +/// The function that returns or +/// for an element. +/// /// The input flat list. /// The values of the first choices and of the second choices, both in the order of the elements. -/// -/// O(n). -/// +/// O(n). [] val partitionWith : partitioner : ('T -> Choice<'T1, 'T2>) -> array : FlatList<'T> -> struct (FlatList<'T1> * FlatList<'T2>) -/// -/// Returns the flat list without its first elements. -/// +/// Returns the flat list without its first elements. /// The number of elements to skip; a negative count skips nothing. /// The input flat list. /// The remaining elements. @@ -1582,9 +1482,7 @@ val partitionWith : partitioner : ('T -> Choice<'T1, 'T2>) -> array : FlatList<' [] val skip : count : int -> array : FlatList<'T> -> FlatList<'T> -/// -/// Returns the flat list without its last elements. -/// +/// Returns the flat list without its last elements. /// The number of elements to skip; a negative count skips nothing. /// The input flat list. /// The remaining elements. @@ -1607,9 +1505,7 @@ val skipLast : count : int -> array : FlatList<'T> -> FlatList<'T> [] val skipWhile : predicate : ('T -> bool) -> array : FlatList<'T> -> FlatList<'T> -/// -/// Splits the flat list at an index. -/// +/// Splits the flat list at an index. /// The index of the first element of the second part. /// The input flat list. /// The elements before the index and the elements from the index. @@ -1628,15 +1524,11 @@ val splitAt : index : int -> array : FlatList<'T> -> struct (FlatList<'T> * Flat /// The input flat list. /// The parts; the first ones are one element longer when the length does not divide evenly. /// Thrown when is not positive. -/// -/// O(n). The parts are copies. -/// +/// O(n). The parts are copies. [] val splitInto : count : int -> array : FlatList<'T> -> FlatList> -/// -/// Returns the elements of a range of the flat list. -/// +/// Returns the elements of a range of the flat list. /// The input flat list. /// The index of the first element of the range. /// The number of elements of the range. @@ -1657,9 +1549,7 @@ val splitInto : count : int -> array : FlatList<'T> -> FlatList> [] val sub : array : FlatList<'T> -> startIndex : int -> count : int -> FlatList<'T> -/// -/// Returns the first elements of the flat list. -/// +/// Returns the first elements of the flat list. /// The number of elements to take. /// The input flat list. /// The first elements. @@ -1671,9 +1561,7 @@ val sub : array : FlatList<'T> -> startIndex : int -> count : int -> FlatList<'T [] val take : count : int -> array : FlatList<'T> -> FlatList<'T> -/// -/// Returns the last elements of the flat list. -/// +/// Returns the last elements of the flat list. /// The number of elements to take. /// The input flat list. /// The last elements. @@ -1697,9 +1585,7 @@ val takeLast : count : int -> array : FlatList<'T> -> FlatList<'T> [] val takeWhile : predicate : ('T -> bool) -> array : FlatList<'T> -> FlatList<'T> -/// -/// Returns at most a given number of first elements. -/// +/// Returns at most a given number of first elements. /// The maximum number of elements; a count that is not positive returns an empty flat list. /// The input flat list. /// The first elements. @@ -1711,9 +1597,7 @@ val truncate : count : int -> array : FlatList<'T> -> FlatList<'T> // ---- Sorting ---- -/// -/// Sorts the elements in the order of F# generic comparison. -/// +/// Sorts the elements in the order of F# generic comparison. /// The input flat list. /// The sorted flat list. /// @@ -1728,9 +1612,7 @@ val sort : array : FlatList<'T> -> FlatList<'T> when 'T : comparison /// The function that returns the key of an element. /// The input flat list. /// The sorted flat list. -/// -/// O(n log n). This is not a stable sort. -/// +/// O(n log n). This is not a stable sort. [] val sortBy : projection : ('T -> 'Key) -> array : FlatList<'T> -> FlatList<'T> when 'Key : comparison @@ -1740,9 +1622,7 @@ val sortBy : projection : ('T -> 'Key) -> array : FlatList<'T> -> FlatList<'T> w /// The function that returns the key of an element. /// The input flat list. /// The sorted flat list. -/// -/// O(n log n). This is not a stable sort. -/// +/// O(n log n). This is not a stable sort. [] val sortByDescending : projection : ('T -> 'Key) -> array : FlatList<'T> -> FlatList<'T> when 'Key : comparison @@ -1751,9 +1631,7 @@ val sortByDescending : projection : ('T -> 'Key) -> array : FlatList<'T> -> Flat /// /// The input flat list. /// The sorted flat list. -/// -/// O(n log n). This is not a stable sort. -/// +/// O(n log n). This is not a stable sort. [] val sortDescending : array : FlatList<'T> -> FlatList<'T> when 'T : comparison @@ -1773,9 +1651,7 @@ val sortDescending : array : FlatList<'T> -> FlatList<'T> when 'T : comparison [] val sortRange : index : int -> count : int -> array : FlatList<'T> -> FlatList<'T> when 'T : comparison -/// -/// Sorts a range of the elements with a comparison function. -/// +/// Sorts a range of the elements with a comparison function. /// The function that compares two elements. /// The index of the first element of the range. /// The number of elements of the range. @@ -1790,9 +1666,7 @@ val sortRange : index : int -> count : int -> array : FlatList<'T> -> FlatList<' [] val sortRangeWith : comparison : ('T -> 'T -> int) -> index : int -> count : int -> array : FlatList<'T> -> FlatList<'T> -/// -/// Sorts a range of the elements with a comparer. -/// +/// Sorts a range of the elements with a comparer. /// The comparer. /// The index of the first element of the range. /// The number of elements of the range. @@ -1815,9 +1689,7 @@ val sortRangeWithComparer : comparer : IComparer<'T> -> index : int -> count : i [] val sortWith : comparer : ('T -> 'T -> int) -> array : FlatList<'T> -> FlatList<'T> -/// -/// Sorts the elements with a comparer. -/// +/// Sorts the elements with a comparer. /// The comparer. /// The input flat list. /// The sorted flat list; the input itself when it is already sorted. @@ -1830,15 +1702,11 @@ val sortWithComparer : comparer : IComparer<'T> -> array : FlatList<'T> -> FlatL // ---- Random ---- -/// -/// Returns a random element, chosen with . -/// +/// Returns a random element, chosen with . /// The input flat list. /// A random element. /// Thrown when the flat list is empty. -/// -/// O(1). -/// +/// O(1). [] val randomChoice : source : FlatList<'T> -> 'T @@ -1850,9 +1718,7 @@ val randomChoice : source : FlatList<'T> -> 'T /// A random element. /// Thrown when the flat list is empty. /// Thrown when the randomizer returns a number outside [0, 1). -/// -/// O(1). -/// +/// O(1). [] val randomChoiceBy : randomizer : (unit -> float) -> source : FlatList<'T> -> 'T @@ -1864,9 +1730,7 @@ val randomChoiceBy : randomizer : (unit -> float) -> source : FlatList<'T> -> 'T /// A random element. /// Thrown when is . /// Thrown when the flat list is empty. -/// -/// O(1). -/// +/// O(1). [] val randomChoiceWith : random : Random -> source : FlatList<'T> -> 'T @@ -1877,9 +1741,7 @@ val randomChoiceWith : random : Random -> source : FlatList<'T> -> 'T /// The input flat list. /// The chosen elements. /// Thrown when the count is negative or the flat list is empty. -/// -/// O(count). -/// +/// O(count). [] val randomChoices : count : int -> source : FlatList<'T> -> FlatList<'T> @@ -1892,9 +1754,7 @@ val randomChoices : count : int -> source : FlatList<'T> -> FlatList<'T> /// The chosen elements. /// Thrown when the count is negative or the flat list is empty. /// Thrown when the randomizer returns a number outside [0, 1). -/// -/// O(count). -/// +/// O(count). [] val randomChoicesBy : randomizer : (unit -> float) -> count : int -> source : FlatList<'T> -> FlatList<'T> @@ -1907,22 +1767,16 @@ val randomChoicesBy : randomizer : (unit -> float) -> count : int -> source : Fl /// The chosen elements. /// Thrown when is . /// Thrown when the count is negative or the flat list is empty. -/// -/// O(count). -/// +/// O(count). [] val randomChoicesWith : random : Random -> count : int -> source : FlatList<'T> -> FlatList<'T> -/// -/// Returns random elements at distinct indices, chosen with . -/// +/// Returns random elements at distinct indices, chosen with . /// The number of elements to choose. /// The input flat list. /// The chosen elements. /// Thrown when the count is negative or exceeds the length. -/// -/// O(count). -/// +/// O(count). [] val randomSample : count : int -> source : FlatList<'T> -> FlatList<'T> @@ -1935,9 +1789,7 @@ val randomSample : count : int -> source : FlatList<'T> -> FlatList<'T> /// The chosen elements. /// Thrown when the count is negative or exceeds the length. /// Thrown when the randomizer returns a number outside [0, 1). -/// -/// O(count). -/// +/// O(count). [] val randomSampleBy : randomizer : (unit -> float) -> count : int -> source : FlatList<'T> -> FlatList<'T> @@ -1950,20 +1802,14 @@ val randomSampleBy : randomizer : (unit -> float) -> count : int -> source : Fla /// The chosen elements. /// Thrown when is . /// Thrown when the count is negative or exceeds the length. -/// -/// O(count). -/// +/// O(count). [] val randomSampleWith : random : Random -> count : int -> source : FlatList<'T> -> FlatList<'T> -/// -/// Returns the elements in a random order, chosen with . -/// +/// Returns the elements in a random order, chosen with . /// The input flat list. /// The shuffled flat list. -/// -/// O(n). -/// +/// O(n). [] val randomShuffle : source : FlatList<'T> -> FlatList<'T> @@ -1974,9 +1820,7 @@ val randomShuffle : source : FlatList<'T> -> FlatList<'T> /// The input flat list. /// The shuffled flat list. /// Thrown when the randomizer returns a number outside [0, 1). -/// -/// O(n). -/// +/// O(n). [] val randomShuffleBy : randomizer : (unit -> float) -> source : FlatList<'T> -> FlatList<'T> @@ -1987,9 +1831,7 @@ val randomShuffleBy : randomizer : (unit -> float) -> source : FlatList<'T> -> F /// The input flat list. /// The shuffled flat list. /// Thrown when is . -/// -/// O(n). -/// +/// O(n). [] val randomShuffleWith : random : Random -> source : FlatList<'T> -> FlatList<'T> @@ -2000,15 +1842,11 @@ val randomShuffleWith : random : Random -> source : FlatList<'T> -> FlatList<'T> /// /// The input flat list. /// The memory region. -/// -/// O(1). The function wraps . -/// +/// O(1). The function wraps . [] val asMemory : array : FlatList<'T> -> ReadOnlyMemory<'T> -/// -/// Returns a read-only span over the elements, without a copy. -/// +/// Returns a read-only span over the elements, without a copy. /// The input flat list. /// The span. /// @@ -2068,9 +1906,7 @@ val clear : array : FlatList<'T> -> FlatList<'T> /// /// The input flat list, which can be a default value. /// for a default value. -/// -/// O(1). The function wraps . -/// +/// O(1). The function wraps . [] val isDefault : array : FlatList<'T> -> bool @@ -2079,9 +1915,7 @@ val isDefault : array : FlatList<'T> -> bool /// /// The input flat list, which can be a default value. /// for a default value or an empty flat list. -/// -/// O(1). The function wraps . -/// +/// O(1). The function wraps . [] val isDefaultOrEmpty : array : FlatList<'T> -> bool @@ -2091,7 +1925,7 @@ val isDefaultOrEmpty : array : FlatList<'T> -> bool /// /// /// The module mirrors : each function has the semantics, -/// the argument checks and the exceptions of the function with the same name in that module (ADR 0001, D11). The functions +/// the argument checks and the exceptions of the function with the same name in that module. The functions /// read the underlying array without a copy and never change it; the in-place sorts of that module have no counterpart. /// /// @@ -2132,9 +1966,7 @@ module Parallel = // ---- Search ---- - /// - /// Returns whether any element satisfies the predicate. - /// + /// Returns whether any element satisfies the predicate. /// The function to test the elements, called in parallel. /// The input flat list. /// when an element satisfies the predicate. @@ -2144,9 +1976,7 @@ module Parallel = [] val exists : predicate : ('T -> bool) -> array : FlatList<'T> -> bool - /// - /// Returns whether all elements satisfy the predicate. - /// + /// Returns whether all elements satisfy the predicate. /// The function to test the elements, called in parallel. /// The input flat list. /// when every element satisfies the predicate. @@ -2157,11 +1987,15 @@ module Parallel = val forall : predicate : ('T -> bool) -> array : FlatList<'T> -> bool /// - /// Returns the first element that satisfies the predicate, or ValueNone. + /// Returns the first element that satisfies the predicate, or + /// . /// /// The function to test the elements, called in parallel. /// The input flat list. - /// The first element that satisfies the predicate, or ValueNone. + /// + /// The first element that satisfies the predicate, or + /// . + /// /// /// O(n). The predicate can also run for elements after the first one that satisfies it. /// @@ -2169,11 +2003,15 @@ module Parallel = val tryFind : predicate : ('T -> bool) -> array : FlatList<'T> -> 'T voption /// - /// Returns the index of the first element that satisfies the predicate, or ValueNone. + /// Returns the index of the first element that satisfies the predicate, or + /// . /// /// The function to test the elements, called in parallel. /// The input flat list. - /// The index of the first element that satisfies the predicate, or ValueNone. + /// + /// The index of the first element that satisfies the predicate, or + /// . + /// /// /// O(n). The predicate can also run for elements after the first one that satisfies it. /// @@ -2181,11 +2019,18 @@ module Parallel = val tryFindIndex : predicate : ('T -> bool) -> array : FlatList<'T> -> int voption /// - /// Returns the first value that the chooser returns for the elements, or ValueNone. + /// Returns the first value that the chooser returns for the elements, or + /// . /// - /// The function that returns a value, or ValueNone to go on, called in parallel. + /// + /// The function that returns a value, or to go on, + /// called in parallel. + /// /// The input flat list. - /// The value for the first element that the chooser returns a value for, or ValueNone. + /// + /// The value for the first element that the chooser returns a value for, or + /// . + /// /// /// O(n). The chooser can also run for elements after the first one that it returns a value for. /// @@ -2198,13 +2043,12 @@ module Parallel = /// Returns the values that the chooser returns for the elements. /// /// - /// The function that returns a value, or ValueNone to skip the element, called in parallel. + /// The function that returns a value, or to skip + /// the element, called in parallel. /// /// The input flat list. /// The chosen values, in the order of their elements. - /// - /// O(n). - /// + /// O(n). [] val choose : chooser : ('T -> 'U voption) -> array : FlatList<'T> -> FlatList<'U> @@ -2215,9 +2059,7 @@ module Parallel = /// The input flat list. /// The concatenation of the returned flat lists, in the order of the elements. /// Thrown when the mapping returns a default flat list. - /// - /// O(n + the total length of the returned flat lists). - /// + /// O(n + the total length of the returned flat lists). [] val collect : mapping : ('T -> FlatList<'U>) -> array : FlatList<'T> -> FlatList<'U> @@ -2243,9 +2085,7 @@ module Parallel = /// The function to transform the elements, called in parallel. /// The input flat list. /// The results, in the order of the elements. - /// - /// O(n). - /// + /// O(n). [] val mapi : mapping : (int -> 'T -> 'U) -> array : FlatList<'T> -> FlatList<'U> @@ -2256,9 +2096,7 @@ module Parallel = /// The second flat list. /// The pairs of elements at the same index. /// Thrown when the flat lists have different lengths. - /// - /// O(n). - /// + /// O(n). [] val zip : array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> FlatList @@ -2307,9 +2145,7 @@ module Parallel = /// /// The action, called in parallel. /// The input flat list. - /// - /// O(n). - /// + /// O(n). [] val iteri : action : (int -> 'T -> unit) -> array : FlatList<'T> -> unit @@ -2405,9 +2241,7 @@ module Parallel = // ---- Partitioning and grouping ---- - /// - /// Groups the elements by the key of a projection. - /// + /// Groups the elements by the key of a projection. /// The function that returns the key of an element, called in parallel. /// The input flat list. /// @@ -2434,13 +2268,12 @@ module Parallel = /// Splits the elements by the choice that a function returns for them. /// /// - /// The function that returns Choice1Of2 or Choice2Of2 for an element, called in parallel. + /// The function that returns or + /// for an element, called in parallel. /// /// The input flat list. /// The values of the first choices and of the second choices, both in the order of the elements. - /// - /// O(n). - /// + /// O(n). [] val partitionWith : partitioner : ('T -> Choice<'T1, 'T2>) -> array : FlatList<'T> -> struct (FlatList<'T1> * FlatList<'T2>) @@ -2464,9 +2297,7 @@ module Parallel = /// The function that returns the key of an element, called in parallel. /// The input flat list. /// The sorted flat list. - /// - /// O(n log n). This is not a stable sort. - /// + /// O(n log n). This is not a stable sort. [] val sortBy : projection : ('T -> 'Key) -> array : FlatList<'T> -> FlatList<'T> when 'Key : comparison @@ -2476,9 +2307,7 @@ module Parallel = /// The function that returns the key of an element, called in parallel. /// The input flat list. /// The sorted flat list. - /// - /// O(n log n). This is not a stable sort. - /// + /// O(n log n). This is not a stable sort. [] val sortByDescending : projection : ('T -> 'Key) -> array : FlatList<'T> -> FlatList<'T> when 'Key : comparison @@ -2487,9 +2316,7 @@ module Parallel = /// /// The input flat list. /// The sorted flat list. - /// - /// O(n log n). This is not a stable sort. - /// + /// O(n log n). This is not a stable sort. [] val sortDescending : array : FlatList<'T> -> FlatList<'T> when 'T : comparison diff --git a/src/FSharp.Collections.Immutable/FlatList/FlatListBuilder.fsi b/src/FSharp.Collections.Immutable/FlatList/FlatListBuilder.fsi index 44aeb55e..9cdf4d6e 100644 --- a/src/FSharp.Collections.Immutable/FlatList/FlatListBuilder.fsi +++ b/src/FSharp.Collections.Immutable/FlatList/FlatListBuilder.fsi @@ -206,9 +206,7 @@ val clear : builder : FlatList<'T>.Builder -> FlatList<'T>.Builder [] val insertAt : index : int -> value : 'T -> builder : FlatList<'T>.Builder -> FlatList<'T>.Builder -/// -/// Inserts values at an index. -/// +/// Inserts values at an index. /// The index of the first inserted value, from 0 to the count. /// The values to insert. /// The builder. @@ -232,9 +230,7 @@ val insertManyAt : index : int -> values : seq<'T> -> builder : FlatList<'T>.Bui [] val remove : value : 'T -> builder : FlatList<'T>.Builder -> bool -/// -/// Removes every element that satisfies a predicate. -/// +/// Removes every element that satisfies a predicate. /// The function to test the elements. /// The builder. /// The same builder. @@ -269,9 +265,7 @@ val removeAt : index : int -> builder : FlatList<'T>.Builder -> FlatList<'T>.Bui [] val removeMany : items : seq<'T> -> builder : FlatList<'T>.Builder -> FlatList<'T>.Builder -/// -/// Removes a range of elements. -/// +/// Removes a range of elements. /// The index of the first removed element. /// The number of removed elements. /// The builder. @@ -418,9 +412,7 @@ val sort : builder : FlatList<'T>.Builder -> FlatList<'T>.Builder when 'T : comp [] val sortRange : index : int -> count : int -> builder : FlatList<'T>.Builder -> FlatList<'T>.Builder when 'T : comparison -/// -/// Sorts a range of the elements with a comparison function. -/// +/// Sorts a range of the elements with a comparison function. /// The function that compares two elements. /// The index of the first element of the range. /// The number of elements of the range. @@ -435,9 +427,7 @@ val sortRange : index : int -> count : int -> builder : FlatList<'T>.Builder -> val sortRangeWith : comparison : ('T -> 'T -> int) -> index : int -> count : int -> builder : FlatList<'T>.Builder -> FlatList<'T>.Builder -/// -/// Sorts a range of the elements with a comparer. -/// +/// Sorts a range of the elements with a comparer. /// /// The comparer. stands for . /// @@ -472,9 +462,7 @@ val sortWithComparer : comparer : IComparer<'T> -> builder : FlatList<'T>.Builde // ---- Conversion ---- -/// -/// Copies a range of the builder into an array. -/// +/// Copies a range of the builder into an array. /// The builder. /// The index of the first element to copy. /// The array to copy to. diff --git a/src/FSharp.Collections.Immutable/FlatList/FlatListOption.fsi b/src/FSharp.Collections.Immutable/FlatList/FlatListOption.fsi index e4b88802..ede31e05 100644 --- a/src/FSharp.Collections.Immutable/FlatList/FlatListOption.fsi +++ b/src/FSharp.Collections.Immutable/FlatList/FlatListOption.fsi @@ -5,7 +5,7 @@ /// /// /// After open FSharp.Collections.Immutable.Option, these functions shadow the default ones, and the other functions -/// of the default module stay available (ADR 0001, D3). Each function has the signature of the function with the same +/// of the default module stay available. Each function has the signature of the function with the same /// name in where that module has one. /// [] @@ -18,70 +18,63 @@ open FSharp.Collections.Immutable /// /// Creates a flat list from a generator, which returns the next element and the next state. /// -/// The function that returns the next element and state, or None to stop. +/// +/// The function that returns the next element and state, or to +/// stop. +/// /// The initial state. /// The generated flat list. -/// -/// O(n). -/// +/// O(n). [] val unfold : generator : ('State -> ('T * 'State) option) -> state : 'State -> FlatList<'T> // ---- Access ---- /// -/// Returns the only element of the flat list, or None when it does not have exactly one element. +/// Returns the only element of the flat list, or when it does not +/// have exactly one element. /// /// The input flat list. -/// The only element, or None. -/// -/// O(1). -/// +/// The only element, or . +/// O(1). [] val tryExactlyOne : array : FlatList<'T> -> 'T option /// -/// Returns the first element of the flat list, or None when it is empty. +/// Returns the first element of the flat list, or when it is empty. /// /// The input flat list. -/// The first element, or None. -/// -/// O(1). -/// +/// The first element, or . +/// O(1). [] val tryHead : array : FlatList<'T> -> 'T option /// -/// Returns the element at an index, or None when the index is out of range. +/// Returns the element at an index, or when the index is out of range. /// /// The index of the element. /// The input flat list. -/// The element at the index, or None. -/// -/// O(1). -/// +/// The element at the index, or . +/// O(1). [] val tryItem : index : int -> array : FlatList<'T> -> 'T option /// -/// Returns the last element of the flat list, or None when it is empty. +/// Returns the last element of the flat list, or when it is empty. /// /// The input flat list. -/// The last element, or None. -/// -/// O(1). -/// +/// The last element, or . +/// O(1). [] val tryLast : array : FlatList<'T> -> 'T option /// -/// Returns the flat list without its first element, or None when it is empty. +/// Returns the flat list without its first element, or when it is +/// empty. /// /// The input flat list. -/// A copy of the elements after the first one, or None. -/// -/// O(n). -/// +/// A copy of the elements after the first one, or . +/// O(n). [] val tryTail : array : FlatList<'T> -> FlatList<'T> option @@ -90,73 +83,80 @@ val tryTail : array : FlatList<'T> -> FlatList<'T> option /// /// Returns the first value that the chooser returns for the elements. /// -/// The function that returns a value, or None to go on. +/// +/// The function that returns a value, or to go on. +/// /// The input flat list. /// The first chosen value. -/// Thrown when the chooser returns None for every element. -/// -/// O(n). -/// +/// +/// Thrown when the chooser returns for every element. +/// +/// O(n). [] val pick : chooser : ('T -> 'U option) -> array : FlatList<'T> -> 'U /// -/// Returns the first element that satisfies the predicate, or None. +/// Returns the first element that satisfies the predicate, or . /// /// The function to test the elements. /// The input flat list. -/// The first element that satisfies the predicate, or None. -/// -/// O(n). -/// +/// +/// The first element that satisfies the predicate, or . +/// +/// O(n). [] val tryFind : predicate : ('T -> bool) -> array : FlatList<'T> -> 'T option /// -/// Returns the last element that satisfies the predicate, or None. +/// Returns the last element that satisfies the predicate, or . /// /// The function to test the elements. /// The input flat list. -/// The last element that satisfies the predicate, or None. -/// -/// O(n). -/// +/// +/// The last element that satisfies the predicate, or . +/// +/// O(n). [] val tryFindBack : predicate : ('T -> bool) -> array : FlatList<'T> -> 'T option /// -/// Returns the index of the first element that satisfies the predicate, or None. +/// Returns the index of the first element that satisfies the predicate, or +/// . /// /// The function to test the elements. /// The input flat list. -/// The index of the first element that satisfies the predicate, or None. -/// -/// O(n). -/// +/// +/// The index of the first element that satisfies the predicate, or +/// . +/// +/// O(n). [] val tryFindIndex : predicate : ('T -> bool) -> array : FlatList<'T> -> int option /// -/// Returns the index of the last element that satisfies the predicate, or None. +/// Returns the index of the last element that satisfies the predicate, or +/// . /// /// The function to test the elements. /// The input flat list. -/// The index of the last element that satisfies the predicate, or None. -/// -/// O(n). -/// +/// +/// The index of the last element that satisfies the predicate, or +/// . +/// +/// O(n). [] val tryFindIndexBack : predicate : ('T -> bool) -> array : FlatList<'T> -> int option /// -/// Returns the first value that the chooser returns for the elements, or None. +/// Returns the first value that the chooser returns for the elements, or +/// . /// -/// The function that returns a value, or None to go on. +/// +/// The function that returns a value, or to go on. +/// /// The input flat list. -/// The first chosen value, or None. -/// -/// O(n). -/// +/// The first chosen value, or . +/// O(n). [] val tryPick : chooser : ('T -> 'U option) -> array : FlatList<'T> -> 'U option @@ -165,12 +165,12 @@ val tryPick : chooser : ('T -> 'U option) -> array : FlatList<'T> -> 'U option /// /// Returns the values that the chooser returns for the elements. /// -/// The function that returns a value, or None to skip the element. +/// +/// The function that returns a value, or to skip the element. +/// /// The input flat list. /// The chosen values. -/// -/// O(n). -/// +/// O(n). [] val choose : chooser : ('T -> 'U option) -> array : FlatList<'T> -> FlatList<'U> @@ -190,11 +190,13 @@ module Parallel = // ---- Search ---- /// - /// Returns the first element that satisfies the predicate, or None. + /// Returns the first element that satisfies the predicate, or . /// /// The function to test the elements, called in parallel. /// The input flat list. - /// The first element that satisfies the predicate, or None. + /// + /// The first element that satisfies the predicate, or . + /// /// /// O(n). The predicate can also run for elements after the first one that satisfies it. /// @@ -202,11 +204,15 @@ module Parallel = val tryFind : predicate : ('T -> bool) -> array : FlatList<'T> -> 'T option /// - /// Returns the index of the first element that satisfies the predicate, or None. + /// Returns the index of the first element that satisfies the predicate, or + /// . /// /// The function to test the elements, called in parallel. /// The input flat list. - /// The index of the first element that satisfies the predicate, or None. + /// + /// The index of the first element that satisfies the predicate, or + /// . + /// /// /// O(n). The predicate can also run for elements after the first one that satisfies it. /// @@ -214,11 +220,18 @@ module Parallel = val tryFindIndex : predicate : ('T -> bool) -> array : FlatList<'T> -> int option /// - /// Returns the first value that the chooser returns for the elements, or None. + /// Returns the first value that the chooser returns for the elements, or + /// . /// - /// The function that returns a value, or None to go on, called in parallel. + /// + /// The function that returns a value, or to go on, called in + /// parallel. + /// /// The input flat list. - /// The value for the first element that the chooser returns a value for, or None. + /// + /// The value for the first element that the chooser returns a value for, or + /// . + /// /// /// O(n). The chooser can also run for elements after the first one that it returns a value for. /// @@ -231,12 +244,11 @@ module Parallel = /// Returns the values that the chooser returns for the elements. /// /// - /// The function that returns a value, or None to skip the element, called in parallel. + /// The function that returns a value, or to skip the element, + /// called in parallel. /// /// The input flat list. /// The chosen values, in the order of their elements. - /// - /// O(n). - /// + /// O(n). [] val choose : chooser : ('T -> 'U option) -> array : FlatList<'T> -> FlatList<'U> diff --git a/src/FSharp.Collections.Immutable/FlatList/FlatListTuple.fsi b/src/FSharp.Collections.Immutable/FlatList/FlatListTuple.fsi index de5ce621..9100dc9a 100644 --- a/src/FSharp.Collections.Immutable/FlatList/FlatListTuple.fsi +++ b/src/FSharp.Collections.Immutable/FlatList/FlatListTuple.fsi @@ -4,7 +4,7 @@ /// /// /// After open FSharp.Collections.Immutable.Tuple, these functions shadow the default ones, and the other functions -/// of the default module stay available (ADR 0001, D3). Optional values stay +/// of the default module stay available. Optional values stay /// ; open the namespace /// after this one for the shapes of /// . @@ -19,12 +19,13 @@ open FSharp.Collections.Immutable /// /// Creates a flat list from a generator, which returns the next element and the next state. /// -/// The function that returns the next element and state, or ValueNone to stop. +/// +/// The function that returns the next element and state, or +/// to stop. +/// /// The initial state. /// The generated flat list. -/// -/// O(n). -/// +/// O(n). [] val unfold : generator : ('State -> ('T * 'State) voption) -> state : 'State -> FlatList<'T> @@ -36,9 +37,7 @@ val unfold : generator : ('State -> ('T * 'State) voption) -> state : 'State -> /// The first flat list. /// The second flat list. /// The pairs, in the order of the first flat list and then of the second one. -/// -/// O(n × m). -/// +/// O(n × m). [] val allPairs : array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> FlatList<'T1 * 'T2> @@ -98,9 +97,7 @@ val zip3 : array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> array3 : FlatList /// The initial state. /// The input flat list. /// The results and the final state. -/// -/// O(n). -/// +/// O(n). [] val mapFold : mapping : ('State -> 'T -> 'Result * 'State) -> state : 'State -> array : FlatList<'T> -> FlatList<'Result> * 'State @@ -111,9 +108,7 @@ val mapFold : mapping : ('State -> 'T -> 'Result * 'State) -> state : 'State -> /// The input flat list. /// The initial state. /// The results, in the order of the elements, and the final state. -/// -/// O(n). -/// +/// O(n). [] val mapFoldBack : mapping : ('T -> 'State -> 'Result * 'State) -> array : FlatList<'T> -> state : 'State -> FlatList<'Result> * 'State @@ -147,18 +142,17 @@ val partition : predicate : ('T -> bool) -> array : FlatList<'T> -> FlatList<'T> /// /// Splits the elements by the choice that a function returns for them. /// -/// The function that returns Choice1Of2 or Choice2Of2 for an element. +/// +/// The function that returns or +/// for an element. +/// /// The input flat list. /// The values of the first choices and of the second choices, both in the order of the elements. -/// -/// O(n). -/// +/// O(n). [] val partitionWith : partitioner : ('T -> Choice<'T1, 'T2>) -> array : FlatList<'T> -> FlatList<'T1> * FlatList<'T2> -/// -/// Splits the flat list at an index. -/// +/// Splits the flat list at an index. /// The index of the first element of the second part. /// The input flat list. /// The elements before the index and the elements from the index. @@ -191,17 +185,13 @@ module Parallel = /// The second flat list. /// The pairs of elements at the same index. /// Thrown when the flat lists have different lengths. - /// - /// O(n). - /// + /// O(n). [] val zip : array1 : FlatList<'T1> -> array2 : FlatList<'T2> -> FlatList<'T1 * 'T2> // ---- Partitioning and grouping ---- - /// - /// Groups the elements by the key of a projection. - /// + /// Groups the elements by the key of a projection. /// The function that returns the key of an element, called in parallel. /// The input flat list. /// @@ -228,12 +218,11 @@ module Parallel = /// Splits the elements by the choice that a function returns for them. /// /// - /// The function that returns Choice1Of2 or Choice2Of2 for an element, called in parallel. + /// The function that returns or + /// for an element, called in parallel. /// /// The input flat list. /// The values of the first choices and of the second choices, both in the order of the elements. - /// - /// O(n). - /// + /// O(n). [] val partitionWith : partitioner : ('T -> Choice<'T1, 'T2>) -> array : FlatList<'T> -> FlatList<'T1> * FlatList<'T2> diff --git a/src/FSharp.Collections.Immutable/FlatList/FlatListTypes.fs b/src/FSharp.Collections.Immutable/FlatList/FlatListTypes.fs index ae31a470..d895f581 100644 --- a/src/FSharp.Collections.Immutable/FlatList/FlatListTypes.fs +++ b/src/FSharp.Collections.Immutable/FlatList/FlatListTypes.fs @@ -3,11 +3,9 @@ namespace FSharp.Collections.Immutable open System.Collections.Immutable // The abbreviation has its own file because the module of the folder is a root module, which cannot declare a type of -// the namespace; a file of abbreviations needs no signature file (ADR 0001, D2). +// the namespace; a file of abbreviations needs no signature file. -/// -/// An immutable array, . -/// +/// An immutable array, . /// /// The name comes from a similar construct in the sources of the F# compiler. /// diff --git a/src/FSharp.Collections.Immutable/Helper/Arrays.fs b/src/FSharp.Collections.Immutable/Helper/Arrays.fs index 5eec80a9..abf6d065 100644 --- a/src/FSharp.Collections.Immutable/Helper/Arrays.fs +++ b/src/FSharp.Collections.Immutable/Helper/Arrays.fs @@ -1,6 +1,6 @@ /// /// Algorithms over arrays that the default modules and the modules of the -/// namespace share (ADR 0001, D3). +/// namespace share. /// /// /// @@ -71,9 +71,7 @@ let inline allPairs ([] tuple : 'T1 -> 'T2 -> 'R) (array1 : 'T1 result -/// -/// A key that may be , for a dictionary, which rejects keys. -/// +/// A key that may be , for a dictionary, which rejects keys. /// /// /// FSharp.Core has no such type in its public API. @@ -268,9 +266,7 @@ let inline pairwise ([] tuple : 'T -> 'T -> 'R) (array : 'T arra result -/// -/// Splits an array of pairs into two arrays. -/// +/// Splits an array of pairs into two arrays. /// The function that reads a pair as a struct tuple. /// The input array. /// The two arrays, as a struct tuple. @@ -300,9 +296,7 @@ let inline unzip ([] split : 'P -> struct ('T1 * 'T2)) (array : struct (result1, result2) -/// -/// Splits an array of triples into three arrays. -/// +/// Splits an array of triples into three arrays. /// The function that reads a triple as a struct tuple. /// The input array. /// The struct tuple of three arrays. diff --git a/src/FSharp.Collections.Immutable/Helper/Comparers.fs b/src/FSharp.Collections.Immutable/Helper/Comparers.fs index 68d08d17..25779631 100644 --- a/src/FSharp.Collections.Immutable/Helper/Comparers.fs +++ b/src/FSharp.Collections.Immutable/Helper/Comparers.fs @@ -1,4 +1,4 @@ -/// The default comparers of the collections (ADR 0001, D5). +/// The default comparers of the collections. [] module internal FSharp.Collections.Immutable.Comparers diff --git a/src/FSharp.Collections.Immutable/Helper/ErrorStrings.fs b/src/FSharp.Collections.Immutable/Helper/ErrorStrings.fs index 1e42ecec..52cac278 100644 --- a/src/FSharp.Collections.Immutable/Helper/ErrorStrings.fs +++ b/src/FSharp.Collections.Immutable/Helper/ErrorStrings.fs @@ -2,7 +2,7 @@ /// The exception messages of FSharp.Core (FSCore.resx) and of the .NET libraries, in English. /// /// -/// The modules throw what the FSharp.Core function that they mirror throws (ADR 0001, D6). FSharp.Core keeps its resources +/// The modules throw what the FSharp.Core function that they mirror throws. FSharp.Core keeps its resources /// internal, so the texts are copied. The texts of the .NET libraries are for the functions that report a BCL exception /// under the name of their own parameter. Each constant is the text of one resource and its comment names the resource, /// so a text that no resource of FSharp.Core or of the .NET libraries holds does not belong here. diff --git a/src/FSharp.Collections.Immutable/Helper/ImmutableCollectionUtil.fs b/src/FSharp.Collections.Immutable/Helper/ImmutableCollectionUtil.fs index 5a7e4eae..7333fa58 100644 --- a/src/FSharp.Collections.Immutable/Helper/ImmutableCollectionUtil.fs +++ b/src/FSharp.Collections.Immutable/Helper/ImmutableCollectionUtil.fs @@ -1,5 +1,5 @@ /// Argument checks shared by the collection modules. -/// The module keeps its old name, so that the modules written before ADR 0001 compile unchanged until they are replaced. +/// The module keeps its old name, so that the old modules compile unchanged until they are replaced. [] module internal FSharp.Collections.Immutable.ImmutableCollectionUtil @@ -18,7 +18,7 @@ let inline checkNotNull name (arg : _ | null) = /// /// /// A default immutable array has no underlying array. The collection modules treat it as FSharp.Core treats a -/// array (ADR 0001, D6). +/// array. /// let inline checkNotDefault name (array : ImmutableArray<'T>) = if array.IsDefault then @@ -63,9 +63,9 @@ let inline isDefaultImmutableArray (source : obj) : bool = /// /// /// A default immutable array converts to a sequence without a check, and the sequence fails with -/// when a function enumerates it. A function that takes a sequence -/// calls this check, which treats a default immutable array as FSharp.Core treats a sequence -/// (ADR 0001, D6). Any other sequence passes. +/// when a function enumerates it. A function that takes a sequence calls +/// this check, which treats a default immutable array as FSharp.Core treats a sequence. Any other +/// sequence passes. /// /// /// An immutable array of the element type is recognized by its type, without reflection. A default immutable array of @@ -82,9 +82,7 @@ let inline checkNotNullOrDefaultSeq name (source : seq<'T>) = if isDefaultImmutableArray source then nullArg name -/// -/// The array under an immutable array, without a copy (ADR 0001, D5). -/// +/// The array under an immutable array, without a copy. /// /// The caller reads the array and never writes to it: the immutable array and every value that shares it see the same /// memory. A default immutable array throws for . @@ -95,9 +93,7 @@ let inline unwrapArray name (array : ImmutableArray<'T>) : 'T array = ImmutableCollectionsMarshal.AsArray array |> Unchecked.nonNull -/// -/// An immutable array over an array, without a copy (ADR 0001, D5). -/// +/// An immutable array over an array, without a copy. /// /// Only an array that nobody can write to any more may be wrapped: a fresh result of a computation. /// diff --git a/src/FSharp.Collections.Immutable/Helper/ParallelArrays.fs b/src/FSharp.Collections.Immutable/Helper/ParallelArrays.fs index 12ca9ff3..73db2cae 100644 --- a/src/FSharp.Collections.Immutable/Helper/ParallelArrays.fs +++ b/src/FSharp.Collections.Immutable/Helper/ParallelArrays.fs @@ -1,7 +1,6 @@ /// /// Parallel algorithms over arrays for the functions of -/// that take or return options or reference tuples -/// (ADR 0001, D3 and D11). +/// that take or return options or reference tuples. /// /// /// @@ -20,9 +19,11 @@ /// /// The summary of each function that mirrors a function of the FSharp.Core /// module is the summary of that function word for word -/// (FSharp.Core 10.1), with ValueSome and ValueNone where it says Some and None, and so are the -/// descriptions of the parameters and of the result where the signatures agree. The remarks say what differs and why the -/// function exists. +/// (FSharp.Core 10.1), with and +/// where it says +/// and , +/// and so are the descriptions of the parameters and of the result where the signatures agree. The remarks say what differs +/// and why the function exists. /// /// module internal FSharp.Collections.Immutable.ParallelArrays @@ -139,9 +140,7 @@ let choose (chooser : 'T -> 'U voption) (array : 'T array) : 'U array = result -/// -/// The comparer of the keys of a parallel grouping. -/// +/// The comparer of the keys of a parallel grouping. /// /// The comparer of F# structural equality, except that the keys of the types and /// compare with . @@ -226,12 +225,15 @@ let inline groupBy result /// -/// Returns the index of the first element in the array that satisfies the given predicate. Returns ValueNone if no -/// such element exists. +/// Returns the index of the first element in the array that satisfies the given predicate. Returns +/// if no such element exists. /// /// The function to test the input elements. /// The input array. -/// The index of the first element that satisfies the predicate, or ValueNone. +/// +/// The index of the first element that satisfies the predicate, or +/// . +/// /// /// /// This is an O(n) operation in the worst case, where n is the length of the array. @@ -265,8 +267,8 @@ let tryFindIndex (predicate : 'T -> bool) (array : 'T array) : int voption = /// /// Applies the given function to successive elements, returning the first result where the function returns -/// ValueSome x for some x. If the function never returns ValueSome x then ValueNone is -/// returned. +/// ValueSome x for some x. If the function never returns ValueSome x then +/// is returned. /// /// The function to transform the array elements into value options. /// The input array. diff --git a/src/FSharp.Collections.Immutable/Helper/Raise.fs b/src/FSharp.Collections.Immutable/Helper/Raise.fs index b36a1141..7141da5d 100644 --- a/src/FSharp.Collections.Immutable/Helper/Raise.fs +++ b/src/FSharp.Collections.Immutable/Helper/Raise.fs @@ -1,9 +1,7 @@ /// /// The exceptions of the DetailedExceptions module of FSharp.Core, with the same types, messages and parameter names. /// -/// -/// The callers pass the names of their own parameters (ADR 0001, D6). -/// +/// The callers pass the names of their own parameters. module internal FSharp.Collections.Immutable.Raise open System diff --git a/tests/FSharp.Collections.Immutable.Tests/Contracts/ExceptionAssert.fs b/tests/FSharp.Collections.Immutable.Tests/Contracts/ExceptionAssert.fs index d1e3b892..4bb4b158 100644 --- a/tests/FSharp.Collections.Immutable.Tests/Contracts/ExceptionAssert.fs +++ b/tests/FSharp.Collections.Immutable.Tests/Contracts/ExceptionAssert.fs @@ -4,7 +4,7 @@ open System open System.Globalization open Microsoft.VisualStudio.TestTools.UnitTesting -/// Compares the exception of a function with the exception of the FSharp.Core function that it mirrors (ADR 0001, D8). +/// Compares the exception of a function with the exception of the FSharp.Core function that it mirrors. [] type ExceptionAssert = diff --git a/tests/FSharp.Collections.Immutable.Tests/Contracts/IndexedContract.fs b/tests/FSharp.Collections.Immutable.Tests/Contracts/IndexedContract.fs index 46f0d8d2..24ae7c79 100644 --- a/tests/FSharp.Collections.Immutable.Tests/Contracts/IndexedContract.fs +++ b/tests/FSharp.Collections.Immutable.Tests/Contracts/IndexedContract.fs @@ -5,8 +5,7 @@ open FSharp.Collections.Immutable open Microsoft.VisualStudio.TestTools.UnitTesting /// -/// The contract of the index-based functions of FlatList, IndexedList and IIndexedList -/// (ADR 0001, Appendix A). +/// The contract of the index-based functions of FlatList, IndexedList and IIndexedList. /// /// /// The tests run on the input with several elements; the indices of their rows are computed from its length. diff --git a/tests/FSharp.Collections.Immutable.Tests/Contracts/Inputs.fs b/tests/FSharp.Collections.Immutable.Tests/Contracts/Inputs.fs index bc0809f0..4b7bc573 100644 --- a/tests/FSharp.Collections.Immutable.Tests/Contracts/Inputs.fs +++ b/tests/FSharp.Collections.Immutable.Tests/Contracts/Inputs.fs @@ -1,7 +1,7 @@ namespace FSharp.Collections.Immutable.Tests /// The inputs that the contract tests run the functions on. -/// Expectations are computed with FSharp.Core over the order in which the collection enumerates its elements (ADR 0001, D8). +/// Expectations are computed with FSharp.Core over the order in which the collection enumerates its elements. /// Every property builds new arrays on each read: MSTest hands the arrays of a row source to the tests as they are, so an /// array that the tests shared would carry the change that one test made into the others. [] diff --git a/tests/FSharp.Collections.Immutable.Tests/Contracts/Mirror.fs b/tests/FSharp.Collections.Immutable.Tests/Contracts/Mirror.fs index 4933a733..1882570c 100644 --- a/tests/FSharp.Collections.Immutable.Tests/Contracts/Mirror.fs +++ b/tests/FSharp.Collections.Immutable.Tests/Contracts/Mirror.fs @@ -1,6 +1,6 @@ namespace FSharp.Collections.Immutable.Tests -/// The FSharp.Core module whose argument checks a collection module mirrors (ADR 0001, D6). +/// The FSharp.Core module whose argument checks a collection module mirrors. type Mirror = /// `FlatList` mirrors `Array`. | ArrayMirror diff --git a/tests/FSharp.Collections.Immutable.Tests/Contracts/OverrideAssert.fs b/tests/FSharp.Collections.Immutable.Tests/Contracts/OverrideAssert.fs index 6b8d0c46..685bbd57 100644 --- a/tests/FSharp.Collections.Immutable.Tests/Contracts/OverrideAssert.fs +++ b/tests/FSharp.Collections.Immutable.Tests/Contracts/OverrideAssert.fs @@ -2,7 +2,7 @@ namespace FSharp.Collections.Immutable.Tests open Microsoft.VisualStudio.TestTools.UnitTesting -/// Compares a function of the `Option` or `Tuple` namespace with the default function after conversion (ADR 0001, D3). +/// Compares a function of the `Option` or `Tuple` namespace with the default function after conversion. [] type OverrideAssert = diff --git a/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqCreationContract.fs b/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqCreationContract.fs index 1169acd3..5c2645a3 100644 --- a/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqCreationContract.fs +++ b/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqCreationContract.fs @@ -5,7 +5,7 @@ open Microsoft.VisualStudio.TestTools.UnitTesting /// /// The contract of the creation functions of the concrete sequence-like modules: FlatList, IndexedList, -/// Queue and Stack (ADR 0001, Appendix A). +/// Queue and Stack. /// [] type SeqCreationContract<'C> (ops : SeqCreationOps<'C>) = diff --git a/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqLike/SeqLikeAccessContract.fs b/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqLike/SeqLikeAccessContract.fs index 8f9ba026..f67a5c1c 100644 --- a/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqLike/SeqLikeAccessContract.fs +++ b/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqLike/SeqLikeAccessContract.fs @@ -8,7 +8,7 @@ open Microsoft.VisualStudio.TestTools.UnitTesting /// /// /// The contract tests compute their expectations with the FSharp.Core Array module over the elements in the order -/// in which the collection enumerates them, so one test body serves FIFO, LIFO and indexed collections (ADR 0001, D8). +/// in which the collection enumerates them, so one test body serves FIFO, LIFO and indexed collections. /// [] type SeqContractBase<'C> (ops : SeqOps<'C>) = diff --git a/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqLike/SeqLikeContract.fs b/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqLike/SeqLikeContract.fs index 613eeee7..b2a03e98 100644 --- a/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqLike/SeqLikeContract.fs +++ b/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqLike/SeqLikeContract.fs @@ -5,7 +5,7 @@ open Microsoft.VisualStudio.TestTools.UnitTesting /// /// The contract of the functions that every sequence-like module provides: FlatList, IndexedList, -/// IIndexedList, Queue, IQueue, Stack and IStack (ADR 0001, Appendix A). +/// IIndexedList, Queue, IQueue, Stack and IStack. /// /// /// The facet is a chain of abstract classes, one file per category; a collection derives one test class from this last one. diff --git a/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqOps.fs b/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqOps.fs index c27dc794..e5d5e6dc 100644 --- a/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqOps.fs +++ b/tests/FSharp.Collections.Immutable.Tests/Contracts/SeqOps.fs @@ -8,7 +8,7 @@ open System.Collections.Generic /// /// /// -/// A record of functions checks at compile time that a module provides every function of a facet (ADR 0001, D8). The +/// A record of functions checks at compile time that a module provides every function of a facet. The /// fields follow the order of the signature files. /// /// diff --git a/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListParallelTests.fs b/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListParallelTests.fs index f901e7f6..d7b0b6a0 100644 --- a/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListParallelTests.fs +++ b/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListParallelTests.fs @@ -66,7 +66,7 @@ type ParallelPredicate = | ParallelPredicate.IsAboveNineHundred -> if item > 900 then ValueSome (item * 2) else ValueNone | ParallelPredicate.Never -> ValueNone -/// The `FlatList.Parallel` module, compared with the sequential functions of `FlatList` (ADR 0001, D11). +/// The `FlatList.Parallel` module, compared with the sequential functions of `FlatList`. /// Every function runs on the inputs of the contracts and on a larger input, which is long enough for the functions to split /// their work among several threads. Results whose order the module leaves open are compared after sorting, and exceptions /// are compared with those of `Array.Parallel`, which the module mirrors. diff --git a/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListTests.fs b/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListTests.fs index 30e9f3df..24985a7a 100644 --- a/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListTests.fs +++ b/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListTests.fs @@ -192,7 +192,7 @@ type FlatListTests () = )) struct (nameof FlatList.clear, "array", (fun () -> FlatList.clear defaultArray |> ignore)) struct (nameof FlatList.blit, "source", (fun () -> FlatList.blit defaultArray 0 [| 0 |] 0 0)) - // Array.concat dereferences a null element array without a check; a default element is a default flat list (D6) + // Array.concat dereferences a null element array without a check; a default element is a default flat list struct (nameof FlatList.concat, "arrays", (fun () -> FlatList.concat [ defaultArray ] |> ignore)) struct (nameof FlatList.transpose, "arrays", (fun () -> FlatList.transpose [ defaultArray ] |> ignore)) // Array.collect dereferences a null result of the mapping; a default result is rejected as in concat diff --git a/tests/FSharp.Collections.Immutable.Tests/TestCategories.fs b/tests/FSharp.Collections.Immutable.Tests/TestCategories.fs index 6c2bbb9e..d8b26236 100644 --- a/tests/FSharp.Collections.Immutable.Tests/TestCategories.fs +++ b/tests/FSharp.Collections.Immutable.Tests/TestCategories.fs @@ -6,7 +6,7 @@ open Microsoft.VisualStudio.TestTools.UnitTesting // Each attribute gives one category: its type name without the `TestCategoryAttribute` suffix, written as separate words. // The attributes are sorted by type name (ordinal); a new attribute goes to its sorted position. // The attributes go on the test classes only, for the collection and the area that a class examines; test methods carry -// no categories (ADR 0001, D8). +// no categories. /// The assertions that extend `Assert` (`Assert.fs`). type AssertExtensionsTestCategoryAttribute () = diff --git a/tests/FSharp.Collections.Immutable.Tests/TestCategoriesTests.fs b/tests/FSharp.Collections.Immutable.Tests/TestCategoriesTests.fs index 2c1958f7..da8e0a73 100644 --- a/tests/FSharp.Collections.Immutable.Tests/TestCategoriesTests.fs +++ b/tests/FSharp.Collections.Immutable.Tests/TestCategoriesTests.fs @@ -4,7 +4,7 @@ open System open System.Reflection open Microsoft.VisualStudio.TestTools.UnitTesting -/// Enforces the category rules of `.github/instructions/test-categories.instructions.md` and of ADR 0001, D8. +/// Enforces the category rules of `.github/instructions/test-categories.instructions.md`. [] type TestCategoriesTests () = From bd269bf0665d61329f0e6df955c46a549e330c9c Mon Sep 17 00:00:00 2001 From: XperiAndri Date: Mon, 30 Nov 2026 04:28:12 +0100 Subject: [PATCH 4/6] chore(ai): `` and `` take one line each by their own length The rule tied the layout of the two elements together, so that a remark such as `O(1).` took three lines under a long summary. Co-Authored-By: Claude Opus 5.5 --- .github/copilot-instructions.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 108f989d..4c264edd 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -245,12 +245,17 @@ Agents discover servers from [.mcp.json](../.mcp.json); these are only hints on /// Item Id ``` -* Keep `` and `` on one line each only when both are short – up to 60 characters of text each. When either is longer, write both over several lines, with each opening and closing tag on a line of its own: +* Write each of `` and `` on one line when its own text is short – up to 60 characters – and over several lines, with each opening and closing tag on a line of its own, when it is longer. The two are independent: a short `` takes one line under a long ``: ```fsharp /// Returns the number of elements. /// This is an O(1) operation. + /// + /// Returns the only element of the list, and throws when the list does not have exactly one element. + /// + /// This is an O(1) operation. + /// /// The inputs of the set contracts as rows of DynamicData: none, one and several elements. /// From 8dabd7f2a0aaa770c3968318f8214c697d0687ff Mon Sep 17 00:00:00 2001 From: XperiAndri Date: Mon, 30 Nov 2026 04:43:44 +0100 Subject: [PATCH 5/6] fixup! docs: the comments of the code follow the review of #31 The comments of `FlatList.Parallel.collect` and of `IndexedContract` are left to #53 and #31, which change the lines next to them, so that the branches do not conflict. Those pull requests have the same fix in them. Co-Authored-By: Claude Opus 5.5 --- src/FSharp.Collections.Immutable/FlatList/FlatList.fs | 2 +- .../Contracts/IndexedContract.fs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/FSharp.Collections.Immutable/FlatList/FlatList.fs b/src/FSharp.Collections.Immutable/FlatList/FlatList.fs index b02f6b97..20b89fba 100644 --- a/src/FSharp.Collections.Immutable/FlatList/FlatList.fs +++ b/src/FSharp.Collections.Immutable/FlatList/FlatList.fs @@ -1065,7 +1065,7 @@ module Parallel = let collect (mapping : 'T -> FlatList<'U>) (array : FlatList<'T>) = // As in Array.Parallel.collect, the mapping runs in parallel, and the results are copied in their order into one // array of their total length. Array.Parallel.collect dereferences a null result; a default flat list from the - // mapping throws ArgumentNullException instead, as in the sequential collect. + // mapping throws ArgumentNullException instead, as in the sequential collect (ADR 0001, D6). let results = Array.Parallel.map mapping (unwrapArray (nameof array) array) let mutable length = 0 diff --git a/tests/FSharp.Collections.Immutable.Tests/Contracts/IndexedContract.fs b/tests/FSharp.Collections.Immutable.Tests/Contracts/IndexedContract.fs index 24ae7c79..46f0d8d2 100644 --- a/tests/FSharp.Collections.Immutable.Tests/Contracts/IndexedContract.fs +++ b/tests/FSharp.Collections.Immutable.Tests/Contracts/IndexedContract.fs @@ -5,7 +5,8 @@ open FSharp.Collections.Immutable open Microsoft.VisualStudio.TestTools.UnitTesting /// -/// The contract of the index-based functions of FlatList, IndexedList and IIndexedList. +/// The contract of the index-based functions of FlatList, IndexedList and IIndexedList +/// (ADR 0001, Appendix A). /// /// /// The tests run on the input with several elements; the indices of their rows are computed from its length. From 3c0d253cb3ec4d5d12ad5480447bd4d985b1fcfe Mon Sep 17 00:00:00 2001 From: XperiAndri Date: Mon, 30 Nov 2026 14:36:53 +0100 Subject: [PATCH 6/6] test: the tests of `flatList { }` and of `FlatList.except` fail for the defects that they are about `FlatList.except` removed objects from a list that has none of them, so the test passed for a function that ignores the items to exclude. The resource of `use` and the compensation of `try finally` in `flatList { }` have to wait for the end of the body: the tests passed also for an expression that disposes the resource first. Co-Authored-By: Claude Opus 5.5 --- .../FlatList/FlatListComputationExpressionTests.fs | 6 ++++++ .../FlatList/FlatListTests.fs | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListComputationExpressionTests.fs b/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListComputationExpressionTests.fs index 93e6248f..64165d6f 100644 --- a/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListComputationExpressionTests.fs +++ b/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListComputationExpressionTests.fs @@ -215,20 +215,24 @@ type FlatListComputationExpressionTests () = [] member _.``try finally runs the compensation`` () = let mutable compensated = false + let mutable compensatedInBody = false let array = flatList { try yield 1 + compensatedInBody <- compensated finally compensated <- true } + Assert.IsFalse (compensatedInBody, "flatList must not run the compensation of try finally before the end of the body") Assert.IsTrue (compensated, "flatList must run the compensation of try finally") CollectionAssert.AreEqual ([| 1 |], FlatList.toArray array, "flatList must keep the elements of the body of try finally") [] member _.``use disposes the resource after the body`` () = let mutable disposed = false + let mutable disposedInBody = false let array = flatList { use _resource = { @@ -237,7 +241,9 @@ type FlatListComputationExpressionTests () = } yield 1 + disposedInBody <- disposed } + Assert.IsFalse (disposedInBody, "flatList must not dispose the resource of use before the end of the body") Assert.IsTrue (disposed, "flatList must dispose the resource of use") CollectionAssert.AreEqual ([| 1 |], FlatList.toArray array, "flatList must keep the elements of the body of use") diff --git a/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListTests.fs b/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListTests.fs index 24985a7a..b2d91332 100644 --- a/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListTests.fs +++ b/tests/FSharp.Collections.Immutable.Tests/FlatList/FlatListTests.fs @@ -686,6 +686,7 @@ type FlatListTests () = let widened = FlatListOracles.stringsAsObjects (FlatList.ofArray [| "a"; "b" |]) let asObjects (strings : string array) = strings |> Array.map (fun item -> item :> obj) let objects = FlatList.ofArray (asObjects [| "c" |]) + let removable = FlatList.ofArray (asObjects [| "a"; "c"; "b" |]) CollectionAssert.AreEqual ( asObjects [| "a"; "b" |], @@ -701,13 +702,13 @@ type FlatListTests () = CollectionAssert.AreEqual ( asObjects [| "c" |], - FlatList.toArray (FlatList.except widened objects), + FlatList.toArray (FlatList.except widened removable), "FlatList.except must take the elements of a flat list of strings as objects" ) CollectionAssert.AreEqual ( asObjects [| "c" |], - FlatList.toArray (FlatList.removeMany widened (FlatList.ofArray (asObjects [| "a"; "c"; "b" |]))), + FlatList.toArray (FlatList.removeMany widened removable), "FlatList.removeMany must take the elements of a flat list of strings as objects" ) []