(@ sort items @compare .sorted +-                                    sort = items @compare + sorted ->
    (# sort items SORT_ASC compare .sorted)                            sorted = sort items SORT_ASC compare
+                                                                    _
    {list : <T>} items                                                 items : list : <T>
    {list : T : [items]} sorted                                        sorted : list : T : [items]
)                                                                    ;
(@ sort:rc list order-by @compare .sorted +-
    (' .lesser .greater ..)                                          sort -rc = list order-by @compare + sorted ->
    (detach -e list 1st others)                                        lesser, greater = {} ..
    (.* others x >
        ([# compare] x 1st order-by >                                  detach -e list 1st others
            (attach greater x)
        >                                                              for others x ->
            (attach lesser x)                                            if (compare x 1st order-by) -> attach greater x
        )                                                                else attach lesser x
    )                                                                  ;
    ([list] >
        (attach sorted ls-sorted 1st gt-sorted -                       if list ->
            (# sort lesser compare order-by .ls-sorted                   attach sorted ls-sorted 1st gt-sorted
             # sort greater compare order-by .gt-sorted)                 ' ls-sorted = sort lesser compare order-by,
        )                                                                  gt-sorted = sort greater compare order-by
    )                                                                  ;
+                                                                    _
    {SORT_* : {ASC DESC}} order-by                                     order-by : SORT_* : {ASC DESC}
)                                                                    ;















