You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varxs= Enumerable.Range(1,5).Select(x =>x*10).ToArray();IEnumerable<int>Unstable(){try{foreach(var x in xs)yieldreturnx;}finally{// rotate array elements by 1varx0= xs[0];
Array.Copy(xs,1, xs,0, xs.Length -1);
xs[^1]=x0;}}varresult= Unstable().Rank();foreach(var _ in xs)
Console.WriteLine(result.ToDelimitedString(", "));
The following code demonstrates this bug:
The output should have been:
Instead, it is:
It seems that
Rank
caches the source on the first iteration and reuses it on subsequent re-iterations. The culprit appears to be the following line:MoreLINQ/MoreLinq/Rank.cs
Line 84 in 9e8073d
which modifies the original captured
source
.This bug is present in the latest release (4.2).
The text was updated successfully, but these errors were encountered: