Use fold in selectionSort