def qSort(a:List[Int]):List[Int]={ if(a.length < 2) a else qSort(a.filter(a.head > _)) ++ a.filter(a.head == _) ++ qSort(a.filter(a.head < _)) } qSort(List(9,3,2,6,3,7,8,3,6,9,21))