const calculateTotalDistance = ([leftList, rightList]: number[][]) =>
pipe(
leftList,
Array.sort(Order.number),
Array.reduce(0, (total, current, index) => total + Math.abs(current - rightList.sort(Order.number)[index]))
)
const calculateSimilarity = ([leftList, rightList]: number[][]) =>
pipe(
leftList,
Array.reduce(0, (total, leftNum) => total + (leftNum * rightList.filter(n => n === leftNum).length))
)
const calculateTotalDistance = ([leftList, rightList]: number[][]) =>
pipe(
leftList,
Array.sort(Order.number),
Array.reduce(0, (total, current, index) => total + Math.abs(current - rightList.sort(Order.number)[index]))
)
const calculateSimilarity = ([leftList, rightList]: number[][]) =>
pipe(
leftList,
Array.reduce(0, (total, leftNum) => total + (leftNum * rightList.filter(n => n === leftNum).length))
)