Ranking methods: Difference between revisions

m (→‎Functional ES5: (formatting))
Line 797:
ns = [44, 42, 42, 41, 41, 41, 39],
 
reversedsorted = nsxs.slicemap(0).reversefunction ()x, i) {
unique = ns.filter(function (n return { name: x, score: ns[i)] {};
}).sort(function (a, b) { return nsb.indexOf(n)score ===- ia.score; }),
}),
names = sorted.map(function (x) { return x.name; }),
scores = sorted.map(function (x) { return x.score; }),
 
rankingsreversed = function scores.slice(score0).reverse(), index, list) {
unique = scores.filter(function (x, i) {
return (listscores.indexOf(scorex) + 1)=== +i;
]});
 
return {
name: xs[index],
score: score,
 
// RANKINGS AS FUNCTIONS OF SCORE, LIST,SCORES: INDEXSORTED, REVERSED AND UNIQUE
 
var standard = function Standard: list.indexOf(score) + 1,{
return scores.indexOf(score) + 1;
 
]},
Modified: reversed.length - reversed.indexOf(score),
 
modified = function Dense: unique.indexOf(score) + 1,{
return reversed.length - reversed.indexOf(score);
},
dense = function (score) {
return unique.indexOf(score) + 1;
},
fractional = function (score) {
return (
(scores.indexOf(score) + 1) +
Modified: (reversed.length - reversed.indexOf(score),)
) / 2;
},
 
rankings = function (score, index) {
return {
name: xsnames[index],
score: score,
Fractional: (
Standard: standard(score),
Modified: modified(score),
Dense: dense(score),
Ordinal: index + 1,
Fractional: fractional(score)
 
Fractional: (
(list.indexOf(score) + 1) +
(reversed.length - reversed.indexOf(score))
) / 2
};
},
Line 827 ⟶ 846:
tbl = [
'Name Score Standard Modified Dense Ordinal Fractional'.split(' ')
].concat(nsscores.map(rankings).reduce(function (a, x) {
return a.concat([[x.name, x.score,
[x.nameStandard, x.scoreModified, x.Dense, x.Ordinal, x.Fractional
]]);
x.Standard, x.Modified, x.Dense, x.Ordinal, x.Fractional
]
]);
}, [])),
 
9,659

edits