++- Quick sort, canonical version                               ++- Quick sort, a bit slower version

sort = src order-by + dest ->                                   sort -rc = list order-by + sorted ->
  - sort src order-by ( n -> attach dest n )                      left, right = {} ..
_
  src : list : <T>                                                detach -e list 1st others
  dest : list : T : [src]
;                                                                 for others x ->
                                                                    if (order-by = SORT_ASC) ->
sort sort -rc = list order-by @fp ->                                  if (x > 1st) attach right x
  left, right : [list._ % 2] = {} ..                                  else attach left x
                                                                    else
  detach -e list 1st others                                           if (x > 1st) attach left x
                                                                      else attach right x
  for others x ->                                                   ;
    if (order-by = SORT_ASC) ->                                   ;
      if (x > 1st) attach right x
      else attach left x                                          if list ->
    else                                                            attach sorted left-sorted 1st right-sorted
      if (x > 1st) attach left x                                    ' left-sorted = sort left order-by,
      else attach right x                                             right-sorted = sort right order-by
    ;                                                             ;
  ;                                                             _
                                                                  list : list : <T>
  if list ->                                                      sorted : list : T : [list]
    fp sorted                                                     order-by : SORT_* : {ASC DESC}
    ' sorted -- attach sorted ls 1st rs                         ;
    ' ls - sort left order-by ( n -> attach ls n ),
      rs - sort right order-by ( n -> attach rs n )             sort :: _ SORT_ASC
  ;
_                                                               
  order-by : SORT_* : {ASC DESC}
;

sort :: _ SORT_ASC

