Skip to content

Commit b446e2c

Browse files
richardadaltonlatkin
authored andcommitted
Implement sortDescending/sortByDescending for Array, List, Seq
Commits: Add Tests and naive implementation for Array SortDescending and SortByDescending Add Tests and naive implementation for List SortDescending and SortByDescending Add Tests and naive implementation for Seq SortDescending and SortByDescending Removed Array Reverse and Implementation of Array.sortByDescending properly Remove Whitespace/Dead Code Correct Implementation of List sortDescending and sortByDescending Updated SurfaceArea to include new Sort Functions sortDescending and sortByDescending for Array, List and Seq Added Unit Tests for sorting Tuples to verify stable sorting Fixed bug in Array.sortDescendingBy, removed unnecessary Array.Reverse Implemented Seq.sortDescending and sortDescendingBy using the List.sortWith method. Fixed Remarks for Seq SortDescending and SortByDescending to indicate that they are Stable Sorts Mark array and line sortDescending and sortDescendingBy as inline Moved List.sortDescending and sortByDescending to local.fs and List and Seq use that Added tuple, date, float and string tests for Sorting Arrays
1 parent aa7e945 commit b446e2c

File tree

12 files changed

+310
-2
lines changed

12 files changed

+310
-2
lines changed

src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,76 @@ type ArrayModule2() =
669669
if len2Arr <> [|3;8|] then Assert.Fail()
670670
Assert.AreEqual([|3;8|],len2Arr)
671671

672-
()
672+
()
673+
674+
[<Test>]
675+
member this.SortDescending() =
676+
// integer array
677+
let intArr = [|3;5;7;2;4;8|]
678+
let resultInt = Array.sortDescending intArr
679+
Assert.AreEqual([|8;7;5;4;3;2|], resultInt)
680+
681+
// string Array
682+
let strArr = [|"Z";"a";"d"; ""; "Y"; null; "c";"b";"X"|]
683+
let resultStr = Array.sortDescending strArr
684+
Assert.AreEqual([|"d"; "c"; "b"; "a"; "Z"; "Y"; "X"; ""; null|], resultStr)
685+
686+
// empty array
687+
let emptyArr:int[] = [| |]
688+
let resultEmpty = Array.sortDescending emptyArr
689+
if resultEmpty <> [||] then Assert.Fail()
690+
691+
// tuple array
692+
let tupArr = [|(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")|]
693+
let resultTup = Array.sortDescending tupArr
694+
Assert.AreEqual([|(2,"x");(2,"b");(2,"a");(1,"x");(1,"d");(1,"b");(1,"a")|], resultTup)
695+
696+
// date array
697+
let dateArr = [|DateTime(2014,12,31);DateTime(2014,1,1);DateTime(2015,1,1);DateTime(2013,12,31);DateTime(2014,1,1)|]
698+
let resultDate = Array.sortDescending dateArr
699+
Assert.AreEqual([|DateTime(2014,12,31);DateTime(2014,1,1);DateTime(2015,1,1);DateTime(2013,12,31);DateTime(2014,1,1)|], dateArr)
700+
Assert.AreEqual([|DateTime(2015,1,1);DateTime(2014,12,31);DateTime(2014,1,1);DateTime(2014,1,1);DateTime(2013,12,31)|], resultDate)
701+
702+
// float array
703+
let floatArr = [|0.5; 2.0; nan; 1.5; 1.0|]
704+
let resultFloat = Array.sortDescending floatArr
705+
Assert.AreEqual([|2.0; 1.5; 1.0; 0.5; nan; |], resultFloat)
673706

707+
()
708+
709+
[<Test>]
710+
member this.SortByDescending() =
711+
// integer array
712+
let intArr = [|3;5;7;2;4;8|]
713+
let resultInt = Array.sortByDescending int intArr
714+
Assert.AreEqual([|3;5;7;2;4;8|], intArr)
715+
Assert.AreEqual([|8;7;5;4;3;2|], resultInt)
716+
717+
// string array
718+
let strArr = [|".."; ""; "..."; "."; "...."|]
719+
let resultStr = Array.sortByDescending (fun (x:string) -> x.Length) strArr
720+
Assert.AreEqual([|".."; ""; "..."; "."; "...."|], strArr)
721+
Assert.AreEqual([|"....";"...";"..";"."; ""|], resultStr)
722+
723+
// empty array
724+
let emptyArr:int[] = [| |]
725+
let resultEmpty = Array.sortByDescending int emptyArr
726+
if resultEmpty <> [||] then Assert.Fail()
727+
728+
// tuple array
729+
let tupArr = [|(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")|]
730+
let sndTup = Array.sortByDescending snd tupArr
731+
Assert.AreEqual( [|(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")|] , tupArr)
732+
Assert.AreEqual( [|(2,"x");(1,"x");(1,"d");(1,"b");(2,"b");(2,"a");(1,"a")|] , sndTup)
733+
734+
// date array
735+
let dateArr = [|DateTime(2013,12,31);DateTime(2014,2,1);DateTime(2015,1,1);DateTime(2014,12,31);DateTime(2014,3,1)|]
736+
let resultDate = Array.sortByDescending (fun (d:DateTime) -> d.Month) dateArr
737+
Assert.AreEqual([|DateTime(2013,12,31);DateTime(2014,2,1);DateTime(2015,1,1);DateTime(2014,12,31);DateTime(2014,3,1)|], dateArr)
738+
Assert.AreEqual([|DateTime(2013,12,31);DateTime(2014,12,31);DateTime(2014,3,1);DateTime(2014,2,1);DateTime(2015,1,1)|], resultDate)
739+
740+
()
741+
674742
[<Test>]
675743
member this.Sub() =
676744
// integer array

src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,11 @@ type ListModule02() =
572572
let emptyArr : int list = [ ]
573573
let resultEpt = List.sort emptyArr
574574
Assert.AreEqual(List.empty<int>, resultEpt)
575+
576+
// tuple List
577+
let tupArr = [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]
578+
let resultTup = List.sort tupArr
579+
Assert.AreEqual([(1,"a");(1,"b");(1,"d");(1,"x");(2,"a");(2,"b");(2,"x")], resultTup)
575580

576581
()
577582

@@ -591,9 +596,62 @@ type ListModule02() =
591596
let emptyArr:int list = [ ]
592597
let resultEpt = List.sortBy int emptyArr
593598
Assert.AreEqual(List.empty<int>, resultEpt)
599+
600+
// tuple List
601+
let tupArr = [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]
602+
let resultTup = List.sortBy snd tupArr
603+
Assert.AreEqual([(2,"a");(1,"a");(1,"b");(2,"b");(1,"d");(2,"x");(1,"x")], resultTup)
594604

595-
()
605+
()
606+
607+
[<Test>]
608+
member this.SortDescending() =
609+
// integer List
610+
let intArr = [3;5;7;2;4;8]
611+
let resultInt = List.sortDescending intArr
612+
Assert.AreEqual(resultInt , [8;7;5;4;3;2])
613+
614+
// string List
615+
let strArr = ["Z";"a";"d";"Y";"c";"b";"X"]
616+
let resultStr = List.sortDescending strArr
617+
Assert.AreEqual(["d"; "c"; "b"; "a"; "Z"; "Y"; "X"], resultStr)
618+
619+
// empty List
620+
let emptyArr : int list = [ ]
621+
let resultEpt = List.sortDescending emptyArr
622+
Assert.AreEqual(List.empty<int>, resultEpt)
596623

624+
// tuple List
625+
let tupArr = [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]
626+
let resultTup = List.sortDescending tupArr
627+
Assert.AreEqual([(2,"x");(2,"b");(2,"a");(1,"x");(1,"d");(1,"b");(1,"a")], resultTup)
628+
629+
()
630+
631+
[<Test>]
632+
member this.SortByDescending() =
633+
// integer List
634+
let intArr = [3;5;7;2;4;8]
635+
let resultInt = List.sortByDescending int intArr
636+
Assert.AreEqual([8;7;5;4;3;2], resultInt)
637+
638+
// string List
639+
let strArr = [".."; "..."; "."; "...."]
640+
let resultStr = List.sortByDescending (fun (x:string) -> x.Length) strArr
641+
Assert.AreEqual(["...."; "..."; ".."; "."], resultStr)
642+
643+
// empty List
644+
let emptyArr:int list = [ ]
645+
let resultEpt = List.sortByDescending int emptyArr
646+
Assert.AreEqual(List.empty<int>, resultEpt)
647+
648+
// tuple List
649+
let tupArr = [(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]
650+
let resultTup = List.sortByDescending snd tupArr
651+
Assert.AreEqual( [(2,"x");(1,"x");(1,"d");(1,"b");(2,"b");(2,"a");(1,"a")] , resultTup)
652+
653+
()
654+
597655
[<Test>]
598656
member this.Sum() =
599657
// empty integer List

src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,64 @@ type SeqModule2() =
12501250
// null Seq
12511251
CheckThrowsArgumentNullException(fun() -> Seq.sortBy funcInt null |> ignore)
12521252
()
1253+
1254+
[<Test>]
1255+
member this.SortDescending() =
1256+
1257+
// integer Seq
1258+
let resultInt = Seq.sortDescending (seq [1;3;2;4;6;5;7])
1259+
let expectedInt = {7..-1..1}
1260+
VerifySeqsEqual expectedInt resultInt
1261+
1262+
// string Seq
1263+
1264+
let resultStr =Seq.sortDescending (seq ["str1";"str3";"str2";"str4"])
1265+
let expectedStr = seq ["str4";"str3";"str2";"str1"]
1266+
VerifySeqsEqual expectedStr resultStr
1267+
1268+
// empty Seq
1269+
let resultEpt = Seq.sortDescending Seq.empty
1270+
VerifySeqsEqual resultEpt Seq.empty
1271+
1272+
// tuple Seq
1273+
let tupSeq = (seq[(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")])
1274+
let resultTup = Seq.sortDescending tupSeq
1275+
let expectedTup = (seq[(2,"x");(2,"b");(2,"a");(1,"x");(1,"d");(1,"b");(1,"a")])
1276+
VerifySeqsEqual expectedTup resultTup
1277+
1278+
// null Seq
1279+
CheckThrowsArgumentNullException(fun() -> Seq.sort null |> ignore)
1280+
()
1281+
1282+
[<Test>]
1283+
member this.SortByDescending() =
1284+
1285+
// integer Seq
1286+
let funcInt x = Math.Abs(x-5)
1287+
let resultInt = Seq.sortByDescending funcInt (seq [1;2;4;5;7])
1288+
let expectedInt = seq [1;2;7;4;5]
1289+
VerifySeqsEqual expectedInt resultInt
1290+
1291+
// string Seq
1292+
let funcStr (x:string) = x.IndexOf("key")
1293+
let resultStr =Seq.sortByDescending funcStr (seq ["st(key)r";"str(key)";"s(key)tr";"(key)str"])
1294+
1295+
let expectedStr = seq ["str(key)";"st(key)r";"s(key)tr";"(key)str"]
1296+
VerifySeqsEqual expectedStr resultStr
1297+
1298+
// empty Seq
1299+
let resultEpt = Seq.sortByDescending funcInt Seq.empty
1300+
VerifySeqsEqual resultEpt Seq.empty
1301+
1302+
// tuple Seq
1303+
let tupSeq = (seq[(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")])
1304+
let resultTup = Seq.sortByDescending snd tupSeq
1305+
let expectedTup = (seq[(2,"x");(1,"x");(1,"d");(1,"b");(2,"b");(2,"a");(1,"a")])
1306+
VerifySeqsEqual expectedTup resultTup
1307+
1308+
// null Seq
1309+
CheckThrowsArgumentNullException(fun() -> Seq.sortByDescending funcInt null |> ignore)
1310+
()
12531311

12541312
[<Test>]
12551313
member this.Sum() =

src/fsharp/FSharp.Core.Unittests/SurfaceArea.4.0.fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ Microsoft.FSharp.Collections.ArrayModule: T[] Reverse[T](T[])
179179
Microsoft.FSharp.Collections.ArrayModule: T[] Singleton[T](T)
180180
Microsoft.FSharp.Collections.ArrayModule: T[] SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[])
181181
Microsoft.FSharp.Collections.ArrayModule: T[] Skip[T](Int32, T[])
182+
Microsoft.FSharp.Collections.ArrayModule: T[] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], T[])
182183
Microsoft.FSharp.Collections.ArrayModule: T[] SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], T[])
184+
Microsoft.FSharp.Collections.ArrayModule: T[] SortDescending[T](T[])
183185
Microsoft.FSharp.Collections.ArrayModule: T[] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], T[])
184186
Microsoft.FSharp.Collections.ArrayModule: T[] Sort[T](T[])
185187
Microsoft.FSharp.Collections.ArrayModule: T[] Tail[T](T[])
@@ -334,7 +336,9 @@ Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList
334336
Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] Singleton[T](T)
335337
Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T])
336338
Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] Skip[T](Int32, Microsoft.FSharp.Collections.FSharpList`1[T])
339+
Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.FSharpList`1[T])
337340
Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.FSharpList`1[T])
341+
Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] SortDescending[T](Microsoft.FSharp.Collections.FSharpList`1[T])
338342
Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.FSharpList`1[T])
339343
Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] Sort[T](Microsoft.FSharp.Collections.FSharpList`1[T])
340344
Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] Tail[T](Microsoft.FSharp.Collections.FSharpList`1[T])
@@ -473,7 +477,9 @@ Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1
473477
Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] Singleton[T](T)
474478
Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T])
475479
Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] Skip[T](Int32, System.Collections.Generic.IEnumerable`1[T])
480+
Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], System.Collections.Generic.IEnumerable`1[T])
476481
Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], System.Collections.Generic.IEnumerable`1[T])
482+
Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] SortDescending[T](System.Collections.Generic.IEnumerable`1[T])
477483
Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] Sort[T](System.Collections.Generic.IEnumerable`1[T])
478484
Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] Tail[T](System.Collections.Generic.IEnumerable`1[T])
479485
Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T])

src/fsharp/FSharp.Core/array.fs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,20 @@ namespace Microsoft.FSharp.Collections
799799
let result = copy array
800800
sortInPlace result;
801801
result
802+
803+
[<CompiledName("SortByDescending")>]
804+
let inline sortByDescending f array =
805+
checkNonNull "array" array
806+
let result = copy array
807+
sortInPlaceWith (fun a b -> compare (f b) (f a)) result
808+
result
809+
810+
[<CompiledName("SortDescending")>]
811+
let inline sortDescending array =
812+
checkNonNull "array" array
813+
let result = copy array
814+
sortInPlaceWith (fun a b -> compare b a) result;
815+
result
802816

803817
[<CompiledName("ToSeq")>]
804818
let toSeq array =

src/fsharp/FSharp.Core/array.fsi

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,26 @@ namespace Microsoft.FSharp.Collections
793793
[<CompiledName("SplitAt")>]
794794
val splitAt: index:int -> array:'T[] -> ('T[] * 'T[])
795795

796+
/// <summary>Sorts the elements of an array, in descending order, returning a new array. Elements are compared using Operators.compare. </summary>
797+
///
798+
/// <remarks>This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
799+
/// For a stable sort, consider using Seq.sort.</remarks>
800+
/// <param name="array">The input array.</param>
801+
/// <returns>The sorted array.</returns>
802+
[<CompiledName("SortDescending")>]
803+
val inline sortDescending: array:'T[] -> 'T[] when 'T : comparison
804+
805+
/// <summary>Sorts the elements of an array, in descending order, using the given projection for the keys and returning a new array.
806+
/// Elements are compared using Operators.compare.</summary>
807+
///
808+
/// <remarks>This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
809+
/// For a stable sort, consider using Seq.sort.</remarks>
810+
/// <param name="projection">The function to transform array elements into the type that is compared.</param>
811+
/// <param name="array">The input array.</param>
812+
/// <returns>The sorted array.</returns>
813+
[<CompiledName("SortByDescending")>]
814+
val inline sortByDescending: projection:('T -> 'Key) -> array:'T[] -> 'T[] when 'Key : comparison
815+
796816
/// <summary>Returns the sum of the elements in the array.</summary>
797817
/// <param name="array">The input array.</param>
798818
/// <returns>The resulting sum.</returns>

src/fsharp/FSharp.Core/list.fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,12 @@ namespace Microsoft.FSharp.Collections
502502
Microsoft.FSharp.Primitives.Basics.Array.stableSortInPlace array
503503
List.ofArray array
504504

505+
[<CompiledName("SortByDescending")>]
506+
let sortByDescending f xs = Microsoft.FSharp.Primitives.Basics.List.sortByDescending f xs
507+
508+
[<CompiledName("SortDescending")>]
509+
let sortDescending xs = Microsoft.FSharp.Primitives.Basics.List.sortDescending xs
510+
505511
[<CompiledName("OfSeq")>]
506512
let ofSeq source = Seq.toList source
507513

src/fsharp/FSharp.Core/list.fsi

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,23 @@ namespace Microsoft.FSharp.Collections
657657
[<CompiledName("SplitAt")>]
658658
val splitAt: index:int -> list:'T list -> ('T list * 'T list)
659659

660+
/// <summary>Sorts the given list in descending order using keys given by the given projection. Keys are compared using Operators.compare.</summary>
661+
///
662+
/// <remarks>This is a stable sort, i.e. the original order of equal elements is preserved.</remarks>
663+
/// <param name="projection">The function to transform the list elements into the type to be compared.</param>
664+
/// <param name="list">The input list.</param>
665+
/// <returns>The sorted list.</returns>
666+
[<CompiledName("SortByDescending")>]
667+
val sortByDescending: projection:('T -> 'Key) -> list:'T list -> 'T list when 'Key : comparison
668+
669+
/// <summary>Sorts the given list in descending order using Operators.compare.</summary>
670+
///
671+
/// <remarks>This is a stable sort, i.e. the original order of equal elements is preserved.</remarks>
672+
/// <param name="list">The input list.</param>
673+
/// <returns>The sorted list.</returns>
674+
[<CompiledName("SortDescending")>]
675+
val sortDescending: list:'T list -> 'T list when 'T : comparison
676+
660677
/// <summary>Returns the sum of the elements in the list.</summary>
661678
/// <param name="list">The input list.</param>
662679
/// <returns>The resulting sum.</returns>

src/fsharp/FSharp.Core/local.fs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,12 @@ module internal List =
689689
stableSortInner cmp a.Length ar
690690

691691
let sortWith cmp a = StableSortImplementation.stableSort cmp a
692+
693+
let sortDescending source = sortWith (fun a b -> compare b a) source
694+
695+
let sortByDescending keyf source = sortWith (fun a b -> compare (keyf b) (keyf a)) source
692696

697+
693698
module internal Array =
694699

695700
open System

src/fsharp/FSharp.Core/local.fsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ module internal List =
3838
val sortWith : ('T -> 'T -> int) -> 'T list -> 'T list
3939
val splitAt : int -> 'T list -> ('T list * 'T list)
4040
val truncate : int -> 'T list -> 'T list
41+
val sortDescending: 'T list -> 'T list when 'T : comparison
42+
val sortByDescending : projection:('T -> 'Key) -> list:'T list -> 'T list when 'Key : comparison
4143

4244
module internal Array =
4345
// The input parameter should be checked by callers if necessary

0 commit comments

Comments
 (0)