From 51c97eb465493afad63a9c6e4a7a55d4ca166c82 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Fri, 26 Aug 2022 11:24:21 -0700 Subject: [PATCH] Make GetReverseIndex Experimental again --- src/FSharp.Core/prim-types.fs | 6 ++++++ src/FSharp.Core/prim-types.fsi | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/FSharp.Core/prim-types.fs b/src/FSharp.Core/prim-types.fs index 3191bf8c649..1178620d63b 100644 --- a/src/FSharp.Core/prim-types.fs +++ b/src/FSharp.Core/prim-types.fs @@ -4107,6 +4107,7 @@ namespace Microsoft.FSharp.Collections let start = if i < 0 then 0 else i PrivateListHelpers.sliceTake (j - start) (PrivateListHelpers.sliceSkip start l) + [] member l.GetReverseIndex(_: int, offset: int) = l.Length - offset - 1 @@ -6902,6 +6903,7 @@ namespace Microsoft.FSharp.Core [] module ArrayExtensions = type ``[,,,]``<'T> with + [] member arr.GetReverseIndex(dim: int, offset: int) = let len = match dim with @@ -6914,6 +6916,7 @@ namespace Microsoft.FSharp.Core len - offset - 1 type ``[,,]``<'T> with + [] member arr.GetReverseIndex(dim: int, offset: int) = let len = match dim with @@ -6925,6 +6928,7 @@ namespace Microsoft.FSharp.Core len - offset - 1 type ``[,]``<'T> with + [] member arr.GetReverseIndex(dim: int, offset: int) = let len = match dim with @@ -6935,9 +6939,11 @@ namespace Microsoft.FSharp.Core len - offset - 1 type ``[]``<'T> with + [] member arr.GetReverseIndex (_: int, offset: int) = arr.Length - offset - 1 type String with + [] member str.GetReverseIndex (_: int, offset: int) = str.Length - offset - 1 namespace Microsoft.FSharp.Control diff --git a/src/FSharp.Core/prim-types.fsi b/src/FSharp.Core/prim-types.fsi index 80b48b92345..ccac892f8fc 100644 --- a/src/FSharp.Core/prim-types.fsi +++ b/src/FSharp.Core/prim-types.fsi @@ -2555,6 +2555,7 @@ namespace Microsoft.FSharp.Collections /// The offset from the end. /// /// The corresponding index from the start. + [] member GetReverseIndex: rank: int * offset: int -> int /// Returns a list with head as its first element and tail as its subsequent elements @@ -4608,6 +4609,7 @@ namespace Microsoft.FSharp.Core /// The offset from the end. /// /// The corresponding index from the start. + [] member GetReverseIndex: rank: int * offset: int -> int type ``[,,]``<'T> with @@ -4617,6 +4619,7 @@ namespace Microsoft.FSharp.Core /// The offset from the end. /// /// The corresponding index from the start. + [] member GetReverseIndex: rank: int * offset: int -> int type ``[,]``<'T> with @@ -4626,6 +4629,7 @@ namespace Microsoft.FSharp.Core /// The offset from the end. /// /// The corresponding index from the start. + [] member GetReverseIndex: rank: int * offset: int -> int type ``[]``<'T> with @@ -4635,6 +4639,7 @@ namespace Microsoft.FSharp.Core /// The offset from the end. /// /// The corresponding index from the start. + [] member GetReverseIndex: rank: int * offset: int -> int type System.String with @@ -4644,6 +4649,7 @@ namespace Microsoft.FSharp.Core /// The offset from the end. /// /// The corresponding index from the start. + [] member GetReverseIndex: rank: int * offset: int -> int /// A module of compiler intrinsic functions for efficient implementations of F# integer ranges