/* Quick sort */

ListSort : rc ->
Arg Src : A|L : <T>,
    Dest : &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 'Lesser_{sorted}' QUICK_SORT,
      Greater_{sorted} from ListSort Greater 'Greater_{sorted}' QUICK_SORT
;

Return

Export ListSort