mediumBy<T> function
Implementation
num mediumBy<T>(Iterable<T> list, num Function(T) call) {
List<num> nl = [];
for (var element in list) {
nl.add(call(element));
}
nl.sort();
int index = nl.length ~/ 2;
if (nl.length % 2 == 0) {
return (nl[index] + nl[index + 1]) / 2;
} else {
return nl[index];
}
}