/* Quick sort */

ListSort : rc ->
Arg Dest : &A|L : T,
    Src : A|L : <T>,
    . : QUICK_SORT

Lesser, Greater : List : [Src._ % 2] = <> ..

Detach Src First List_tail ALLOW_EMPTY

Do get Element from List_tail
 If Element > First then Greater .= Element
 Else Lesser .= Element
;

If Src then
 Dest = Lesser_{sorted} || < First > || Greater_{sorted}
 With Lesser_{sorted} from ListSort >Lesser_{sorted}< Lesser QUICK_SORT,
      Greater_{sorted} from ListSort >Greater_{sorted}< Greater QUICK_SORT
;

Return

Export ListSort