You mean something like this?
quicksort [] = []
quicksort (x:xs) = quicksort less ++ (x : equal) ++ quicksort more
where (less, equal, more) = partition3 x xs
partition3 _ [] = ([], [], [])
partition3 x (y:ys) =
case compare y x of
LT -> (y:less, equal, more)
EQ -> (less, y:equal, more)
GT -> (less, equal, y:more)
where (less, equal, more) = partition3 x ys
Note that this isn't really quicksort, as the real quicksort is in-place.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…