[Question]
  [
Inspired by one of many bugs I ran into while implementing selection sort in trilangle.
Given a non-empty list of non-negative integers, "sort" the list using the following procedure:
1. Find and output the smallest value in the list.
2. If the list only has one element, stop.
3. Recurse on a sublist:
	* If the last element in the list is the smallest, recurse on everything but the last value.
	* Otherwise, recurse on everything but the first value.
Your code doesn't have to follow this procedure exactly, as long as the result is the same.
Sample implementation in JS:
```
function* sort(arr) {
    if (arr.length === 1) {
        return yield arr[0];
    }
    const min = Math.min(...arr);
    yield min;
    if (min === arr.at(-1)) {
        arr.pop();
        yield* sort(arr);
    } else {
        const [, ...rest] = arr;
        yield* sort(rest);
    }
}
```
Some notes on the algorithm:
* The output will always contain the same number of elements as the input.
* The input *may* contain duplicates.
* Every element in the output is an element of the input, but they don't necessarily appear the same number of times.
* The elements of the output will be in nondecreasing order.
## I/O
[I/O defaults](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods) apply. Since I don't see this mentioned there, I will explicitly add the following rule:
You are allowed to implement this destructively. If taking the input by reference, the input does not have to have the same value once the procedure is completed. Note that I use this in the sample implementation above: I call `.pop()` without copying the array first.
## Examples
```
[4, 3, 1, 2] => [1, 1, 1, 2]
[1, 2, 3, 4] => [1, 2, 3, 4]
[3, 2, 1, 0] => [0, 1, 2, 3]
[1, 2, 3, 1] => [1, 1, 2, 3]
[101, 103, 101, 105] => [101, 101, 101, 105]
```
## Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest program (per language) wins.
  
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), ~~15~~ ~~13~~ ~~10~~ 9 bytes
```
(:g…Ȯt=ǔḢ
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCIoOmfigKbIrnQ9x5ThuKIiLCIiLCJbNCwgMywgMSwgMl0iXQ==)
~~It's not every day I get to use recursion in a lambda~~ Nevermind, I don't anymore.
*-3 thanks to AndrovT*
*-1 by outputting items on newlines*
## Explained
```
(:g…Ȯt=ǔḢ
(          # input length times:
 :g…       #   get the minimum of the top of the stack without popping and print that without popping
    Ȯt     #   push the tail of the item over the top of the stack
      =    #   does that equal the min?
       ǔ   #  rotate the list right that many times (once if tail is min [placing tail at front] or no times at all).
        Ḣ  #  Remove the head of the list
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 10 bytes
```
ṖḊṂṄ=Ṫʋ`?ƒ
```
[Try it online!](https://tio.run/##y0rNyan8///hzmkPd3Q93Nn0cGeL7cOdq051J9gfm/T/cDuQr/n/f7SJjoKxjoKhjoJRrI5CNIgGC5iAeMZgHlDMAEXOEMwzAPINDUBcCMs0FgA "Jelly – Try It Online")
Full program, printing each element on its own line with a trailing newline.
I tried a couple printing-based solutions earlier (including some with `Ṫ` that also attempted to leverage it for `Ṗ`), but they all tied the pure solution. However, Jonathan Allan's golf to that gave me room to fit a print in with the extra space so long as it was also with dyadic chaining, which then required some creative wrestling with the loop quick of choice (at one point the program ended in `µµ¿`!) until it eventually inspired me to abuse `ƒ`.
```
         ƒ    Reduce over the list, starting with the list, by:
              Ignoring the right argument,
        ?     if
     Ṫʋ       the last element (popped) from
    =  `      the list of for each element in the list if it equals
  Ṃ           the minimum
   Ṅ          which is printed on its own line,
Ṗ             then remove the last element,
 Ḋ            else remove the first element.
         ƒ    The end result is an empty list with no effect on the output.
```
# [Jelly](https://github.com/DennisMitchell/jelly), ~~12~~ 11 bytes
```
ṖḊ=ṂṪƊ?ƬṂ€Ṗ
```
[Try it online!](https://tio.run/##y0rNyan8///hzmkPd3TZPtzZ9HDnqmNd9sfWAJmPmoDktP@H249Oerhzhmbk///RJjoKxjoKhjoKRrE6CtEgGixgAuIZg3lAMQMUOUMwzwDINzQAcSEs01gA "Jelly – Try It Online")
*-1 thanks to Jonathan Allan*
Feels kinda clumsy, but may as well post it ~~while it's the shortest~~ :P
```
       Ƭ       Repeat while unique, collecting all results:
      ?        If
    Ṫ          the last element (popped) from
  =  Ɗ         the list of, for each element of the input, if it's equal to
   Ṃ           the minimum,
Ṗ              then remove the last element,
 Ḋ             else remove the first element.
        Ṃ€     Take the minimum of each result
          Ṗ    and remove the last.
```
[Answer]
# [Nekomata](https://github.com/AlephAlpha/Nekomata), 10 bytes
```
ᶦ{:Ɔ≥$tI}ṁ
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m70iLzU7PzexJHFZtJJurlLsgqWlJWm6FhsfbltWbXWs7VHnUpUSz9qHOxuXFCclF0NlF9y0jDbRMdYx1DGK5YoGkkC2CZBlDGQZ6hjAxQxBLANDHUMDIBtMm8ZCTAAA)
```
ᶦ{:Ɔ≥$tI}ṁ
ᶦ{      }     Iterate the block until it fails
       I      Choose the first non-failed result between the following two:
  :Ɔ≥$          If the last item is the smallest, remove it from the list; otherwise fail
      t         Remove the first item of the list
         ṁ    Take the minimum of each step of the iteration
```
---
## [Nekomata v0.1.0.0](https://github.com/AlephAlpha/Nekomata/tree/v0.1.0.0), 13 bytes
```
ⁱ{:↔C≥↔$t?∃}⊥
```
```
ⁱ{:↔C≥↔$t?∃}⊥
ⁱ{         }     Iterate the block until it fails
         ?∃       Choose the first non-failed result between the following two:
  :↔C≥↔$            If the last item is the smallest, remove it from the list; otherwise fail
        t           Remove the first item of the list
            ⊥   Take the minimum of each step of the iteration
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~10~~ 9 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
vDW=Qθ._¦
```
-1 byte being inspired by the rotate used in [*@lyxal*'s Vyxal answer](https://codegolf.stackexchange.com/a/258952/52210).
[Try it online](https://tio.run/##yy9OTMpM/f@/zCXcNvDcDr34Q8v@/4820VEw1lEw1FEwigUA) or [verify all test cases](https://tio.run/##yy9OTMpM/V@m5JlXUFpipaBkX6nDpeRfWgLkFQO5OpUu/8tcwm0Dz@3Qiz@07H/toW32/6OjTXSMdQx1jGJ1FKKBFJBjAmIaA5mGOgYIUUMw08BQx9AAyAHTprGxAA).
**Original 10 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) answer:**
```
vDW=Êθ·<.$
```
Outputs the result on separated newlines.
[Try it online](https://tio.run/##yy9OTMpM/f@/zCXc9nDXuR2Httvoqfz/H22io2Cso2Coo2AUCwA) or [verify all test cases](https://tio.run/##yy9OTMpM/V@m5JlXUFpipaBkX6nDpeRfWgLkFQO5OpUu/8tcwm0Pd53bcWi7jZ7K/9pD2@z/R0eb6BjrGOoYxeooRAMpIMcExDQGMg11DBCihmCmgaGOoQGQA6ZNY2MB).
**Explanation:**
```
v           # Loop over the (implicit) input-list, without using its values:
 D          #  Duplicate the current list
            #  (which will be the implicit input-list in the first iteration)
  W         #  Push its minimum (without popping the list)
   =        #  Output it with trailing newline (without popping)
    Q       #  Check for each value in the list whether it's equal to this minimum
     θ      #  Pop and push the last item
      ._    #  Rotate the list that many times towards the left
        ¦   #  Remove the first item
vDW=        # Same as above
    Ê       #  Check for each value in the list whether it's NOT equal to this minimum
     θ      #  Pop and push the last item
      ·     #  Double it
       <    #  Decrease it by 1
        .$  #  Remove that many leading items from the list
            #  (1 will remove the first item; -1 will remove the last item)
```
[Answer]
# JavaScript (ES6), 65 bytes
```
f=a=>a+a?[m=Math.min(...b=[...a]),...f(b.pop()^m?a.slice(1):b)]:a
```
[Try it online!](https://tio.run/##dY5NDoIwEEb3nqLLNtahFdyQVE7gCZqaDAiKAUqEeP1aiiSG4Cz6M29evnniG4fiVffjobO30rlKoTrjHjPdqguOD2jrjgJArrQ/0TDur4rm0NuesmubIQxNXZRUsjRnJkVX2G6wTQmNvdOK6oSTmBPJydGQbzFGoohoGdqB7FbS1AxesiEtZC3FAfkBsZbEHOO9/0lye71tSUxQTNb8OplFmv/yh7gP "JavaScript (Node.js) – Try It Online")
### Commented
```
f = a =>            // recursive function taking the input array a[]
a + a ?             // if a[] is not empty:
  [                 //   append ...
    m = Math.min(   //   ... m, which is the minimum value in a[]
      ...b = [...a] //   define b[] as a copy of a[]
    ),              //
    ...f(           //   append the result of a recursive call:
      b.pop()       //     remove the last element from b[]
      ^ m ?         //     if it's not equal to the minimum:
        a.slice(1)  //       pass a[] without the first element
      :             //     else:
        b           //       pass b[] (i.e. a[] without the last element)
    )               //   end of recursive call
  ]                 //
:                   // else:
  a                 //   stop
```
---
# JavaScript (ES13), 64 bytes
Suggested by [@tsh](https://codegolf.stackexchange.com/users/44718/tsh).
```
f=a=>a+a?[m=Math.min(...a),...f(a,a.splice((a.at(-1)>m)-1,1))]:a
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m70kLz8ldcGCpaUlaboWNx3SbBNt7RK1E-2jc219E0sy9HIz8zT09PQSNXWAZJpGok6iXnFBTmZyqoZGol5iiYauoaZdrqauoY6hpmasVSLEnFuMAsn5ecX5Oal6OfnpGmka0SY6CsY6CoY6CkaxClCgqamgr68QbQgWBstwoWkCCYL1mWDRBJNB12QMlgIqMEDXZACxBqgPt02G2J2HXZMBSNIApAvCMo2FaYLwDZFkIAEDC2gA)
[Answer]
# [PARI/GP](https://pari.math.u-bordeaux.fr), 57 bytes
```
f(a)=if(#a,concat(m=vecmin(a),f(a[^if(m-a[#a],1,#a)])),a)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=VY9BCsIwEEWvMrSbBKaQ2Aq6qBcJUYZgJGBqKFXwLG66Ec_kbZzEunA1_82DP8zjlWgMh1Oa5-d18s3mvfWCZB-8qAndZXA0idjfji6GgQWyNXu2sSFTk0WNNUkrJZJcChKldL4LgmYHaQzDxLHKUEGulgjGdAgtgkZYWcY8y6LL1BbinfpzupBi1irjN62tXe7-HvgA)
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 25 bytes
```
Ｗθ«⟦Ｉ⌊θ⟧≔⎇⁼↨θ⁰⌊θ…θ⊖ＬθΦθλθ
```
[Try it online!](https://tio.run/##TY0/C8IwFMTn9lNkfIEILeLkpFUnBQe30iHERxN4Tc2fKkX87LFxcjnuuN9xSkuvRkkpvbQhZOA4e5fF1RsboW1kiHAx1gzTsDS849uy2IVgegs39Fb6GY5ukhRgLwOCE6zigv0tBGtmRdjo8ZHbAyqPA9qIdzij7aPO0EKdDEX0GaEc3XL0Salt66oWrK7WWX5u03Vp9aQv "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
Ｗθ«
```
Repeat until the list is empty.
```
⟦Ｉ⌊θ⟧
```
Output its minimum.
```
≔⎇⁼↨θ⁰⌊θ…θ⊖ＬθΦθλθ
```
Remove the last or first element as appropriate.
[Answer]
# Excel (ms365), 153 bytes
[![enter image description here](https://i.stack.imgur.com/BPrAO.png)](https://i.stack.imgur.com/BPrAO.png) - [![enter image description here](https://i.stack.imgur.com/alT49.png)](https://i.stack.imgur.com/alT49.png) - [![enter image description here](https://i.stack.imgur.com/8ou64.png)](https://i.stack.imgur.com/8ou64.png) - [![enter image description here](https://i.stack.imgur.com/Q2jFP.png)](https://i.stack.imgur.com/Q2jFP.png) - [![enter image description here](https://i.stack.imgur.com/jldqf.png)](https://i.stack.imgur.com/jldqf.png)
With data in `A1:A4`, formula in `B1`:
```
=TOCOL(BYCOL(REDUCE(A1:A4,A1:A3,LAMBDA(x,y,LET(z,TOCOL(TAKE(x,,-1),2),HSTACK(x,IF(TAKE(z,-1)=MIN(z),DROP(z,-1),DROP(z,1)))))),LAMBDA(a,MIN(TOCOL(a,2)))))
```
[Answer]
# [R](https://www.r-project.org/), ~~68~~ ~~63~~ 57 bytes
```
f=function(l)if(L<-sum(l|1))c(m<-min(l),f(l[-L^!l[L]>m]))
```
[Try it online!](https://tio.run/##K/r/P802rTQvuSQzP08jRzMzTcPHRre4NFcjp8ZQUzNZI9dGNzcTJKOTppETresTp5gT7RNrlxurqfk/TSNZw0THWMdQx0hTkwvEA7KAfBMozxjIM9QxQJEzhPEMDHUMDYB8MG0KNA0A "R – Try It Online")
-5 bytes thanks to pajonk. 50 bytes if using newer versions of R.
[Answer]
# [Python](https://www.python.org), 53 bytes
```
f=lambda l:l and[m:=min(l)]+f(l[l[-1]>m:][:len(l)-1])
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72soLIkIz9vwYKlpSVpuhY3TdNscxJzk1ISFXKschQS81Kic61sczPzNHI0Y7XTNHKic6J1DWPtcq1io61yUkHCQK4mVHNiWn6RQo5CZp5CdLSJjoKxjoKhjoJRrE40iALzTYAcYzAHKGSALGMI4hgAuYYGIB6EZRoba8XFWVCUmVeiAbRcE2oRzLUA)
Find the minimum. Remove the first element, or not, as appropriate; then take the first n−1 elements where n is the original number of elements, which removes the last element if the first wasn't removed. Call recursively.
[Answer]
# Swift 5.6, 96 bytes
```
func f(x:[Int])->[Int]{x.min().map{[$0]+f(x:$0==x.last ?x.dropLast():[_](x.dropFirst()))} ?? []}
```
[Try it on SwiftFiddle](https://swiftfiddle.com/bpzbefpbtjcodkgz5fjccssoyq)
It's not often you see [`Optional.map(_:)`](https://developer.apple.com/documentation/swift/optional/map(_:)-7txtz) used in real-world code, since it's easily confused with other operations of the same name (i.e. `Array.map(_:)`).
Ungolfed:
```
func f(_ arr: [Int]) -> [Int] {
    return arr.min()
        .map { min in
            [min] + f(
                arr.last == min
                    ? arr.dropLast()
                    : Array(arr.dropFirst()) // dropFirst is lazy by default
            )
        } ?? []
}
```
Or, written without `.map`:
```
func f(_ arr: [Int]) -> [Int] {
    if let min = arr.min() {
        return [min] + f(
            arr.last == min
                ? arr.dropLast()
                : Array(arr.dropFirst())
        )
    } else {
        return []
    }
}
```
[Answer]
# [Arturo](https://arturo-lang.io), 63 bytes
```
f:$[a][([]=a)?->a[m:min a@[m]++f(m=last a)?->chop a->drop a 1]]
```
[Try it](http://arturo-lang.io/playground?OrfXNA)
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 19 bytes
```
WgIg@v=PMNgDQgELPOg
```
Takes input as multiple command-line arguments. [Attempt This Online!](https://ato.pxeger.com/run?1=m724ILNgwYKlpSVpuhabw9M90x3KbAN8_dJdAtNdfQL80yEyUAVrok10FIx1FAx1FIxioWIA)
### Explanation
I was expecting to use recursion for this, but a plain old while loop ended up shorter.
```
WgIg@v=PMNgDQgELPOg
                    ; g is list of command-line args; v is -1 (implicit)
Wg                  ; Loop while g is not empty:
  I                 ;  If
        MNg         ;   Minimum of g
       P            ;   (Print that value)
      =             ;   Is equal to
   g@v              ;   Last element of g
                    ;  Then
           DQg      ;   Remove last element of g
              EL    ;  Else
                POg ;   Remove first element of g
```
[Answer]
# Haskell + [hgl](https://gitlab.com/wheatwizard/haskell-golfing-library), 25 bytes
```
uue$mn-<(nt?.tl~<gj*=*mn)
```
## Explanation
This answer is based around the `uue` builtin, which has the type:
```
uue :: (List a -> (b, List a)) -> List a -> List b
```
This is a bit complex but it basically describes the recursion scheme we want, it accepts a function which removes a value from a list, and repeatedly applies the function until the list is empty collecting the results in a list.
With this all we have to do is build a function which takes a list and "removes" the proper value. Getting the value itself is really easy, it's the minimum, so we can just use `mn`. We just have to build the list itself. `nt` removes the last element from a list and `tl` removes the first. We combine them with the ternary `(?.)` to make `nt?.tl` which accepts a boolean and a list and removes the last if true and the first otherwise. Then we make `gj*=*mn` which takes a list and compares if the minimum `mn` and the last `gj` are equal. We combine these with `(~<)` to thread their arguments together, to build
```
nt?.tl~<gj*=*mn
```
Which removes an element based on the logic described in the question.
To finish this off we use the fanout `(-<)` to combine the parts int a single function emitting a tuple, and feed that to `uue`.
## Reflection
This is pretty good, the logic in the question itself is pretty messy, and it feels like this captures it pretty efficiently. But I'm seeing a few things that could be improved.
* I could pre-compose `uue` and variants with a fanout. This can't be done with every unfolding function, but it would save a bunch of bytes here, and has reusability.
```
uef mn$nt?.tl~<gj*=*mn
```
* `ixu` could do with a version pre-composed with `ø`. i.e. an "interate until empty" function. This would save 1 byte:
```
mn<<ixe(nt?.tl~<gj*=*mn)
```
While I'm at that I might as well add other variants, like `ixz` for "iterate until zero".
[Answer]
# [Go](https://go.dev), ~~166~~ 160 bytes
```
func f(I[]int)[]int{m,L,k:=I[0],len(I),I
if L<2{return I}
for _,e:=range I{if e<m{m=e}}
if m==I[L-1]{k=f(I[:L-1])}else{k=f(I[1:])}
return append([]int{m},k...)}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=VVBBasMwELzrFSInCzbGTlIoJnqAwIfcgykmlYKxJRtZPgm9pBdTKPQLfUp_U62tSy-andFqZ1Yfn89x_ZnaR98-JdVtZ0inp9G6_KC0O3wtTh1ff1e1mAdVmbg3nXFsO72GGvqKi3vRwCBNJhgI0ilaX0_eSrdYQ0UgarT0DWTFbWuig_CxQ16111yGgO2axxH1sWx8z9GhwpoFOcwyKWUVOUkj22mS5j1LEQL0eZ6zkHJ-bzlxi4xRT4ZudjOtOL03ez_xF6BnoCXQUwDiETfhguy8sagV_-7KjRWRlwXSvXqJaiBpPTRCn33H3daTm42eg8mQQ_w9RMbwVcq7rjv-AQ)
A quick-and-dirty port of the sample implementation.
Changelog:
* `L==1 -> L<2`, `return I[0:1] -> return I`: -5 bytes
[Answer]
# [Julia 1.0](http://julialang.org/), 41 bytes
```
!l=!l[(2:end).-(l[end]==@show min(l...))]
```
[Try it online!](https://tio.run/##TY5BbsMgEEX3PsV3ViBRZJx004qqF@gJkBcThypElFiYtunpXQxN5ZFG@m/eDOLy6R2p27K0XrfesP7JhhOXD8ybHAatX@fz9RsfLjAvpeR8WN6vEQ4uIFo6eRfszHiDXCSO0LBf5NmbTSQnirNljlc7RReSD4wEdrC3yY5pxk7gWHWKPyhhu9saeh6qHymN55Lyv5rcizkI7AWUQD9Av8CoAoWbFfriD//yzo3ZF8ijrsqunmW/vVTbZ@@yW7FbbU2Pf0uV1Gb@Cw "Julia 1.0 – Try It Online")
I interpreted *"1. Find and output the smallest value in the list."* as *"print the value with garbage around it"*, hopefully that's acceptable. Also ends with an error. Otherwise, cleaner version below
## [Julia 1.0](http://julialang.org/), 55 bytes
```
!l=l>[] ? [(m=min(l...););!l[(2:end).-(l[end]==m)]] : l
```
[Try it online!](https://tio.run/##TY1NbsIwEEb3OcWXnS2lVhxgA3LoBTiB5cUgjORq4iInRb19cOJSZVbzvjc/Xz8cSP/Oc82Ge@twhhWDGUIUrJSSJ3mq2Yru6ONNqg/BNjfOmEE6hyN4vn8nBISI5OnGIfpRyAq5qLnCwD@JxcVPpB6URi@CLPaRQpw4CjJ9TSX6pHH0aUJNMAbXKj@a7b7BroFu0DmYHlavsHK1QLf6/b98c2V3K@SoLbIta9lvN/X27Fu2C7aLLd3hb6iQ3uQv "Julia 1.0 – Try It Online")
Clean version (returns the "sorted" list)
[Answer]
# Excel, 136 bytes
Define `g` in *Name Manager* as:
```
=LAMBDA(a,
    LET(
        b,TAKE(a,-1),
        c,MIN(a),
        d,DROP(a,-1^(c=b)),
        e,MIN(d),
        IF(COUNT(d),VSTACK(e,g(d)))
    )
)
```
Then, within the worksheet:
```
=LET(f,A1:A4,VSTACK(MIN(f),DROP(g(f),-1)))
```
Assumes data in `A1:A4`.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 13 bytes
```
#=?qeQ
hSQPQt
```
[Try it online!](https://tio.run/##K6gsyfj/X9nWvjA1kCsjODAgsOT//2gTHQVjHQVDHQWjWAA "Pyth – Try It Online")
### Explanation
```
#=?qeQhSQPQtQ    # implicitly add Q
                 # implicitly assign Q = eval(input())
#                # repeat until error
 =               # assign to Q
  ?qeQhSQ        # if the last element of Q equals the minimum element of Q (min element is printed here by newline)
         PQ      #   all but the last element of Q
           tQ    # else all but the first element of Q
```
[Answer]
as long as the numbers are within a small range, like `[0, 10^8)`, one could do ::::
```
 echo '1,1,3,101,2,2,2,101,103,4,3,3,4,105,1,3,0,2,1,1' | 
```
> 
> 
> ```
>   mawk  '
>   function ______(__,___,_,____) {
>       for(_ in __) break
>       if (length(__) <= (_+=_^=NF=FS=OFS="")) { 
>          if (+__[___=_--]<+__[_]) {
>                __[_]=__[___] substr("",
>                __[___]=__[_])
>       } return } _=+(____=" ")
>       for(___ in __) { !+(_=__[___]) ? ($!_=(_)____$!_) : $_=$_(____)_ } 
>       return split($(_<_),__,NF=FS=OFS=____) 
>   } BEGIN { CONVFMT = "%.250g" 
>     ORS = "," } { printf("\n [ %s%.0s ]\n\n [ ",
>                   $_, split($_,__,",")______(__)) 
>     for(___ = length(__); ++_<___;) print __[_]
>     printf("%s ]\n\n", __[___]) }'
> 
> ```
> 
> 
```
 [ 1,1,3,101,2,2,2,101,103,4,3,3,4,105,1,3,0,2,1,1 ]
 [ 0,1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,101,101,103,105 ]
```
instead of doing any sort of comparisons, it's what I would call `"NF-sort"` - it's essentially like a hybrid between counting sort and pigeonhole (aka bucket) sort,
e.g. right before the last step in the function,
> 
> `$101 == "101 101"` - 2 copies of the string `"101"`
> 
> 
> 
although the code isn't short at all, it's a purely linear algorithm (aka `O(n)`) since no comparisons, nested loops, or recursions are needed other than for the special case of `"0"`, which are prepended at `$1` instead.
]