我试图在F#中使用数字数组,并对所有元素进行排名,以便联系获得相同的排名.基本上我试图在C#中复制我下面的算法,但只是为了一个双打数组.救命?
rankMatchNum = 0; rankMatchSum = 0; previousScore = -999999999;
for (int i = 0; i < factorStocks.Count; i++)
{
//The 1st time through it won't ever match the previous score...
if (factorStocks[i].factors[factorName + "_R"] == previousScore)
{
rankMatchNum = rankMatchNum + 1; //The count of matching ranks
rankMatchSum = rankMatchSum + i + 1; //The rank itself...
for (int j = 0; j <= rankMatchNum; j++)
{
factorStocks[i - j].factors[factorName + "_WR"] = rankMatchSum / (rankMatchNum + 1);
} …Run Code Online (Sandbox Code Playgroud) f# ×1