[Question]
  [
## Challenge
Given a non-empty array of integers, e.g.:
```
[5, 2, 7, 6, 4, 1, 3]
```
First sever it into arrays where no item is larger than the previous (i.e. non-ascending arrays):
```
[5, 2] [7, 6, 4, 1] [3]
```
Next, reverse each array:
```
[2, 5] [1, 4, 6, 7] [3]
```
Finally, concatenate them all together:
```
[2, 5, 1, 4, 6, 7, 3]
```
This should be what your program outputs/function returns. Repeat this procedure enough times and the array will be fully sorted.
## Rules
* Input and output may be given through any standard methods, and may be in any reasonable array format.
* The input array will never be empty, but may contain negatives and/or duplicates.
* The absolute value of each integer will always be less than 231.
## Test cases
Hopefully these cover all edge cases:
```
[1] -> [1]
[1, 1] -> [1, 1]
[1, 2] -> [1, 2]
[2, 1] -> [1, 2]
[2, 3, 1] -> [2, 1, 3]
[2, 1, 3] -> [1, 2, 3]
[2, 1, 2] -> [1, 2, 2]
[2, 1, 1] -> [1, 1, 2]
[3, 1, 1, 2] -> [1, 1, 3, 2]
[3, 2, 1, 2] -> [1, 2, 3, 2]
[3, 1, 2, 2] -> [1, 3, 2, 2]
[1, 3, 2, 2] -> [1, 2, 2, 3]
[1, 0, 5, -234] -> [0, 1, -234, 5]
[1, 0, 1, 0, 1] -> [0, 1, 0, 1, 1]
[1, 2, 3, 4, 5] -> [1, 2, 3, 4, 5]
[5, 4, 3, 2, 1] -> [1, 2, 3, 4, 5]
[2, 1, 5, 4, 3] -> [1, 2, 3, 4, 5]
[2, 3, 1, 5, 4] -> [2, 1, 3, 4, 5]
[5, 1, 4, 2, 3] -> [1, 5, 2, 4, 3]
[5, 2, 7, 6, 4, 1, 3] -> [2, 5, 1, 4, 6, 7, 3]
[-5, -2, -7, -6, -4, -1, -3] -> [-5, -7, -2, -6, -4, -3, -1]
[14, 5, 3, 8, 15, 7, 4, 19, 12, 0, 2, 18, 6, 11, 13, 1, 17, 16, 10, 9] -> [3, 5, 14, 8, 4, 7, 15, 0, 12, 19, 2, 6, 18, 11, 1, 13, 9, 10, 16, 17]
```
## Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so **the shortest code in bytes wins.**
  
[Answer]
# JavaScript (ES6), 64 bytes
```
f=([n,...a],z=[],q=[n,...z])=>a+a?n<a[0]?[...q,...f(a)]:f(a,q):q
```
Recursion FTW! The basic algorithm in use here is to keep track of the current non-ascending run in an array, "returning" it whenever an ascending element is found. We do this recursively, continually concatenating the results, until we run out of items. By creating each run in reverse (`[n,...z]` instead of `[...z,n]`), we can avoid the lengthy `.reverse()` at no cost.
### Test snippet
```
f=([n,...a],z=[],q=[n,...z])=>a+a?n<a[0]?[...q,...f(a)]:f(a,q):q
g=a=>console.log("Input:",`[${a}]`,"Output:",`[${f(a)}]`)
g([1])
g([1,1])
g([1,2])
g([2,1])
g([3,2,1])
g([3,1,2])
g([3,1,1,2])
g([5,2,7,6,4,1,3])
```
```
<input id=I value="5, 2, 7, 6, 4, 1, 3">
<button onclick="g((I.value.match(/\d+/g)||[]).map(Number))">Run</button>
```
[Answer]
# [Python 3](https://docs.python.org/3/), 63 bytes
```
f=lambda x,*p:x[:1]>p>()and p+f(x)or x and f(x[1:],x[0],*p)or p
```
[Try it online!](https://tio.run/nexus/python3#VVFBjoMwDDx3X@FbSetIdQItIC0fQRxYVUiVdtmo6iG/Z23XVbaHJOOZsTOEbfn8nn@@rjNkPKQ@jz1NQxoqN69XSMelyu73Dhmk5GKkfsI8niY2i5C2ReXbChWhQ9mB7AxyBqv5jAWyGgsMBaohPqEJXIW3ipQIdkt8q04IDYIPsS6E7a9U2lKzT4hGoV1RYhj9L/iTsxZSOZijUXhBOCv9@javQXix4lnyrHkWvapU60Qe3XJLo/3S3PEKGliStDqU5DXsUdhGQrGhc/3HLt1v66PKCHs/7FH@kXPbHw "Python 3 – TIO Nexus")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 8 bytes
```
Ṁ;<œṗ³UF
```
[Try it online!](https://tio.run/nexus/jelly#@/9wZ4O1zdHJD3dOP7Q51O3////RhiY6CqY6CsY6ChY6CoZAlrmOAlDI0BKIjXQUDHQUgKQhUM4MSBkCMVAliAIqMwQJARVYxgIA "Jelly – TIO Nexus")
## Explanation:
```
Ṁ;         Prepend the list [a1, a2… an] with its maximum.
  <        Elementwise compare this with the original list:
           [max(a) < a1, a1 < a2, …, a(n-1) < an, an]
           The first element is always 0.
   œṗ³     Partition the original list (³) at the indices
           of the non-zero values in the working list.
           (The spurious `an` at the end of the left argument,
           resulting from comparing lists of different sizes,
           is ignored by this operation, thankfully.)
      U    Reverse each part.
       F   Flatten.
```
[Answer]
## JavaScript (ES6), 70 bytes
Sure, this is already beaten by [ETHproductions answer](https://codegolf.stackexchange.com/a/104135/58563), but that's the best I could come up with so far without using recursion.
```
a=>a.map((n,i)=>a[x=[...o,...r=[n,...r]],i+1]>n&&(o=x,r=[]),r=o=[])&&x
```
*Note:* Initializing both `r` and `o` to the exact same object with `r = o = []` may look like a hazardous idea. But it is safe to do so here because `r` is immediately assigned its own instance (containing the first element of `a`) on the first iteration with `r = [n, ...r]`.
### Test cases
```
let f =
a=>a.map((n,i)=>a[x=[...o,...r=[n,...r]],i+1]>n&&(o=x,r=[]),r=o=[])&&x
console.log(JSON.stringify(f([1])));
console.log(JSON.stringify(f([1, 1])));
console.log(JSON.stringify(f([1, 2])));
console.log(JSON.stringify(f([2, 1])));
console.log(JSON.stringify(f([2, 3, 1])));
console.log(JSON.stringify(f([2, 1, 3])));
console.log(JSON.stringify(f([2, 1, 2])));
console.log(JSON.stringify(f([2, 1, 1])));
console.log(JSON.stringify(f([3, 1, 1, 2])));
console.log(JSON.stringify(f([3, 2, 1, 2])));
console.log(JSON.stringify(f([3, 1, 2, 2])));
console.log(JSON.stringify(f([1, 3, 2, 2])));
console.log(JSON.stringify(f([1, 0, 5, -234])));
console.log(JSON.stringify(f([1, 0, 1, 0, 1])));
console.log(JSON.stringify(f([1, 2, 3, 4, 5])));
console.log(JSON.stringify(f([5, 4, 3, 2, 1])));
console.log(JSON.stringify(f([2, 1, 5, 4, 3])));
console.log(JSON.stringify(f([2, 3, 1, 5, 4])));
console.log(JSON.stringify(f([5, 1, 4, 2, 3])));
console.log(JSON.stringify(f([5, 2, 7, 6, 4, 1, 3])));
console.log(JSON.stringify(f([-5, -2, -7, -6, -4, -1, -3])));
console.log(JSON.stringify(f([14, 5, 3, 8, 15, 7, 4, 19, 12, 0, 2, 18, 6, 11, 13, 1, 17, 16, 10, 9])));
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), 15 bytes
```
lidO>vYsGhXSOZ)
```
Input is a column vector, with the format `[5; 2; 7; 6; 4; 1; 3]` (semicolon is the row separator).
[Try it online!](https://tio.run/nexus/matl#@5@TmeJvVxZZ7J4REewfpfn/f7SptYKRtYK5tYKZtYKJtYKhtYJxLAA "MATL – TIO Nexus")
Take input `[5; 2; 7; 6; 4; 1; 3]` as an example.
### Explanation
```
l     % Push 1
      % STACK: 1
i     % Push input
      % STACK: 1, [5; 2; 7; 6; 4; 1; 3]
d     % Consecutive differences
      % STACK: 1, [-3; 5; -1; -2; -3; 2]
O>    % Test if greater than 0, element-wise
      % STACK: 1, [0; 1; 0; 0; 0; 1]
v     % Concatenate vertically
      % STACK: [1; 0; 1; 0; 0; 0; 1]
Ys    % Cumulative sum
      % STACK: [1; 1; 2; 2; 2; 2; 3]
G     % Push input again
      % STACK: [1; 1; 2; 2; 2; 2; 3], [5; 2; 7; 6; 4; 1; 3]
h     % Concatenate horizontally
      % STACK: [1 5; 1 2; 2 7; 2 6; 2 4; 2 1; 3 3]
XS    % Sort rows in lexicographical order
      % STACK: [1 2; 1 5; 2 1; 2 4; 2 6; 2 7; 3 3]
OZ)   % Get last column. Implicitly display
      % STACK: [2; 5; 1; 4; 6; 7; 3]
```
[Answer]
# Mathematica, ~~30~~ 27 bytes
*3 bytes saved due to [@Martin Ender](http://ppcg.lol/users/8478).*
```
Join@@Sort/@Split[#,#>#2&]&
```
Anonymous function. Takes a list of numbers as input and returns a list of numbers as output.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~19~~ ~~18~~ ~~16~~ 14 bytes
Saved 2 bytes using [Luis Mendo's](https://codegolf.stackexchange.com/a/104123/47066) sorting trick
```
ü‹X¸ì.pO¹)ø{ø¤
```
[Try it online!](https://tio.run/nexus/05ab1e#@394z6OGnRGHdhxeo1fgf2in5uEd1Yd3HFry/3@0oYmOgqmOgrGOgoWOgiGQZa6jABQytARiIx0FAx0FIGkIlDMDUoZADFQJooDKDEFCQAWWsQA "05AB1E – TIO Nexus")
**Explanation**
Example input `[5, 2, 7, 6, 4, 1, 3]`
```
ü‹               # pair-wise less-than
                 # STACK: [0, 1, 0, 0, 0, 1]
  X¸ì            # prepend a 1
                 # STACK: [1, 0, 1, 0, 0, 0, 1]
     .p          # prefixes
       O         # sum
                 # STACK: [1, 1, 2, 2, 2, 2, 3]
        ¹        # push input
                 # STACK: [1, 1, 2, 2, 2, 2, 3], [5, 2, 7, 6, 4, 1, 3]
         )       # wrap stack in list
                 # STACK: [[1, 1, 2, 2, 2, 2, 3], [5, 2, 7, 6, 4, 1, 3]]
          ø      # zip
                 # STACK: [[1, 5], [1, 2], [2, 7], [2, 6], [2, 4], [2, 1], [3, 3]]
           {     # sort
                 # STACK: [[1, 2], [1, 5], [2, 1], [2, 4], [2, 6], [2, 7], [3, 3]]
            ø    # zip
                 # STACK: [[1, 1, 2, 2, 2, 2, 3], [2, 5, 1, 4, 6, 7, 3]]
             ¤   # tail
                 # OUTPUT: [2, 5, 1, 4, 6, 7, 3]
```
**Previous 16 byte solution**
```
Dü‹X¸ì.pO.¡€g£í˜
```
[Answer]
# Python 2, 100 bytes
A really terrible golf, but I wanted to post my solution [*(one does not simply outgolf Dennis)*](https://codegolf.stackexchange.com/a/104142/60919)...
```
d=input();L=[];x=0;d+=-~d[-1],
for i in range(1,len(d)):
 if d[i]>d[i-1]:L+=d[x:i][::-1];x=i
print L
```
[**Test on repl.it!**](https://repl.it/EvQM/0)
Input should be given as a Python list literal, such as `[5, 3, 4, 2, 6, 1]`.
The basic idea is to make heavy use of Python's slicing syntax, slicing each necessary section from the array, reversing it, and adding it to the new array.
[Answer]
## Pyke, ~~11~~ 8 bytes ([old version](https://github.com/muddyfish/PYKE/commit/98f0079d7cb3d9e837dc1b36e9f7b4f5cd051f43))
```
$0m<fm_s
```
[Try it here!](http://pyke.catbus.co.uk/?code=%240m%3C0R%2Bfm_s&input=%5B5%2C+2%2C+7%2C+6%2C+4%2C+1%2C+3%5D) (works on latest version)
```
$        -     delta(input)
 0m<     -    map(i<0 for i in ^)
    f    -   split_at(input, ^)
     m_  -  map(reverse, ^)
       s - sum(^)
```
[Answer]
# [Retina](https://github.com/m-ender/retina), 163 bytes
Yes, I know how horrid this is. Supporting zeros and negatives was *super* fun. Byte count assumes ISO 8859-1 encoding.
```
\d+
$*
(?<=-1*)1
x
-
x,1
x¶1
\b(1+),(1+\1)\b
$1¶$2
,,1
,¶1
x,(¶|$)
x¶¶
(?<=\b\1x+(?=,(x+))),\b
¶
O%$#`.(?=(.*))
$.1
+`¶
,
\bx
-x
(\w+)
$.1
^,
0,
,$
,0
,,
,0,
^$
0
```
[**Try it online**](https://tio.run/nexus/retina#JY3RDcIwDET/bw2CFDeXKi4Ffqg6AgtEVVWxA/lgrgyQxYoLsnSy3tl3e34FuA5@fkxRO1EURKDQllYVefMahCZZJW9w2qobQPN5@IW@1Y@T47rVX0zespbg54m@BBGhvZn1PLvT2hv2fScC1yvCapzWYZ0FPr/Dny9EIujAZE2mxOKQ9v3KwSYx3hkH3jhSGS8GlOMX "Retina – TIO Nexus")
**Explanation:**
```
\d+                         # Convert to unary
$*
(?<=-1*)1                   # Replace negatives with x's instead of 1's
x
-                           # Remove minus sign
x,1                         # Separate if negative before positive
x¶1
\b(1+),(1+\1)\b             # or greater positive follows a positive
$1¶$2
,,1                         # or positive follows a zero
,¶1
x,(¶|$)                     # or zero follows a negative
x¶¶
(?<=\b\1x+(?=,(x+))),\b     # or negative follows a negative of greater magnitude.
¶
O%$#`.(?=(.*))              # Swear at the input, then reverse each line
$.1
+`¶                         # Remove breaks, putting commas back
,
\bx                         # Put the minus signs back
-x
(\w+)                       # Replace unary with length of match (decimal)
$.1
^,                          # Do a bunch of replacements to resurrect lost zeros
0,
,$
,0
,,
,0,
^$
0
```
[Answer]
# JavaScript (ECMA 6), ~~121~~ ~~128~~ ~~125~~ ~~119~~ 108 bytes
```
f=a=>{p=a[0],c=[],b=[];for(e of a){e>p&&b.push(c.reverse(c=[]));c.push(p=e)}return[].concat.call([],...b,c)}
```
Lambda expression takes a single `Array` parameter, `a`.
*Thanks to @ETHproductions for helping me see my first mistake.*
[Answer]
# Ruby, ~~60~~ 55 bytes
```
s=->x{x.slice_when{|p,q|p<q}.map{|z|z.reverse}.flatten} 
```
Pretty much what the challenge asked for. I defined a lambda `s`, that takes an array `x`, and *sever* (slices) it into smaller pieces where the following element would be greater than. This gives back an enumerator, which we can call map on and *reverse* the order of the pieces, before finally bringing it all together with flatten, which *concatenates* the elements in the defined order into one array.
Tests
```
p s[[1]]===[1]
p s[[1, 1]]===[1, 1]
p s[[1, 2]]===[1, 2]
p s[[2, 1]]===[1, 2]
p s[[2, 3, 1]]===[2, 1, 3]
p s[[2, 1, 3]]===[1, 2, 3]
p s[[2, 1, 2]]===[1, 2, 2]
p s[[2, 1, 1]]===[1, 1, 2]
p s[[3, 1, 1, 2]]===[1, 1, 3, 2]
p s[[3, 2, 1, 2]]===[1, 2, 3, 2]
p s[[3, 1, 2, 2]]===[1, 3, 2, 2]
p s[[1, 3, 2, 2]]===[1, 2, 2, 3]
p s[[1, 0, 5, -234]]===[0, 1, -234, 5]
p s[[1, 0, 1, 0, 1]]===[0, 1, 0, 1, 1]
p s[[1, 2, 3, 4, 5]]===[1, 2, 3, 4, 5]
p s[[5, 4, 3, 2, 1]]===[1, 2, 3, 4, 5]
p s[[2, 1, 5, 4, 3]]===[1, 2, 3, 4, 5]
p s[[2, 3, 1, 5, 4]]===[2, 1, 3, 4, 5]
p s[[5, 1, 4, 2, 3]]===[1, 5, 2, 4, 3]
p s[[5, 2, 7, 6, 4, 1, 3]]===[2, 5, 1, 4, 6, 7, 3]
p s[[-5, -2, -7, -6, -4, -1, -3]]===[-5, -7, -2, -6, -4, -3, -1]
p s[[14, 5, 3, 8, 15, 7, 4, 19, 12, 0, 2, 18, 6, 11, 13, 1, 17, 16, 10, 9]]===[3, 5, 14, 8, 4, 7, 15, 0, 12, 19, 2, 6, 18, 11, 1, 13, 9, 10, 16, 17]
```
[Answer]
# [Brachylog](http://github.com/JCumin/Brachylog), 10 bytes
```
~c:{>=r}ac
```
[Try it online!](http://brachylog.tryitonline.net/#code=fmM6ez49cn1hYw&input=WzU6Mjo3OjY6NDoxOjNd&args=Wg)
### Explanation
```
~c            Deconcatenate the Input
  :{>=r}a     Each resulting sublist must be non-increasing, and then reverse it
         c    Concatenate
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 4 bytes
```
ṁ↔ġ≤
```
[Try it online!](https://tio.run/##PU@7DcIwEN0lVZCepZwd59MwAC1llBIJCVFFDBAKJHoWQMoStIhFyCLm@WJS2O/j872742U4hXO@f0/5LjPb7LAZ5usYvq9xvj0@z/k@hRC6Tnp0guW2vK1yC5dQ4BKmV/VdRHUc7MqIyvhnZQU8jHVlEnqWMBaV8OSeqG1SgOr/EFFpjdC16ntijYp6Gc7EBJgapoIpYQQm2sLu7NBAPMtZ3EIs4xnR8LdwA12jhlAVaPv@Bw "Husk – Try It Online")
I've `ġ`ot `ṁ`yself the right tools for this job.
### Explanation
`ġ` is "groupby": it divides a list into sublists where in each sublist the given function returns a truthy value for any pair of elements. Used with `≤`, this divides the list into non-increasing sequences.
`ṁ` is "concatmap": it maps a function to each element of a list, and concatenates the results together. With `↔` (reverse), this performs the reverse-and-concatenate final part of the algorithm.
[Answer]
# [Dyalog APL](http://goo.gl/9KrKoM), ~~7~~ 15 [bytes](http://meta.codegolf.stackexchange.com/a/9429/43319)
Requires `⎕ML←3`, which is default on many systems.\*
```
{∊⌽¨⍵⊂⍨1+⍵-⌊/⍵}
```
`∊` enlist (flatten)
`⌽¨` each-reversed
`⍵⊂⍨` the argument partitioned\* by cutting where each corresponding element is larger than its predecessor in
`1+` one plus
`⍵-` the argument minus
`⌊/⍵` the smallest element of the argument
---
Old 7 byte solution fails with non-positive integers:
Requires `⎕ML←3`, which is default on many systems.\*
```
∊⌽¨⊆⍨⎕
```
`∊` enlist (flatten) the
`⌽¨` each-reversed
`⊂⍨` self-partitioned\*
---
\* Partition (`⊂`) is a function which cuts its right argument where the corresponding left argument is larger than the preceding one. (Unfortunately it only accepts non-negative integers, and zero has special meaning.) From version 16, this functionality of `⊂` is available on all systems (even those where `⎕ML≠3`), using the glyph `⊆`.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 bytes
```
<Ɲk$UF
```
[Try it online!](https://tio.run/##fZI9UsQwDIX7nMIzUNozsZxskhmGkhtQMDspaWAvQEtDT7UNN@AC1AzcAy5ipCfh9ZqfIrvW06cnWcnN9W53l/PZ@9Pt6eVFfn34vH9@e/x42fP/Vc7bbhtX705cOHd84si7SpAAGtUasUYNZ1qqZWFYMlpOdUGdoSZDJXM8jGaSZpqyiO6W/9021fXU5FPpXAXNWDozB713o3eB0lCQHq4ica5Q9ttQvd2tOwyGqh/jmteIk93rT0ovbex/VCpg@67qjhEBNV4jpEE3ocHk3QbS0TsmsGqyASQVAWvjh@PAcuBskL0dCoFMhn0jSTDZ1wBbDmc2H@ErnRd@CIuVm8xoGWXH9rEwFkViYCmdko44wGyAl1j26iWepEazmanfoj7wm9Zu/QI "Jelly – Try It Online")
## How it works
```
<Ɲk$UF - Main link. Takes an array A on the left
   $   - To A:
 Ɲ     -   For each overlapping pair of elements [a, b] in A:
<      -     Is a < b?
  k    -   Partition A at the truthy elements
    U  - Reverse each subarray
     F - Flatten
```
[Answer]
## Haskell, 49 bytes
```
(a:b)%l|any(<a)l=l++b%[a]|1<2=b%(a:l)
_%l=l
(%[])
```
Usage example: `(%[]) [5,2,7,6,4,1,3]` -> `[2,5,1,4,6,7,3]`.
Recursive approach. The function `%` takes the input list as its first parameter and an accumulator `l` which keeps track of the non-ascending chunk so far (in reverse order). The base case is reached when the input list is empty and then the result is the accumulator. If the input list is not empty and the first element `a` doesn't fit in the current chunk (`any(<a)l`), return the accumulator and append a recursive call on the rest of the list and `a` as the new accumulator (`l++b%[a]`). Else, make a recursive call on the rest of the list and `a` prepended to tha accumulator (`b%(a:l)`). The main function `(%[])` calls `%` with an empty accumulator.
[Answer]
## [Retina](https://github.com/m-ender/retina), 98 bytes
Byte count assumes ISO 8859-1 encoding.
```
$
-(\d+)
$1$*-/
\d+
$*
S-`(?<=(-+)/ )(?!\1)|(?=\b(1+))(?<!\2 )
O%`\S* 
¶
((-)|1)*/? 
$2$#1 
 $
```
[Try it online!](https://tio.run/nexus/retina#LU5LrsIwDNz7FINekJJWVnHSUpBAXb4lC7ZZVIhjcC4OwMX6Jn4sPJ7xZ@x9/F23IBCN9dknCRY6HYRcQid3XeNyuUbt04AUl1219IrLtT6i9YmFy65mJLnt13rvIJ@3SIyaXpa6YYGEHH4MgiDbZmJokSUzZxRHQ3H0KiulIVVB/mYiM@e@@YAJmsvo1KOZsj1ikonoq27n6v9U4@waK9RkGTOOVO0BbY7QGXqEjlCDFjH6cfMEmzjKwTMs8xyNT9w0/unPzjCqA85/ "Retina – TIO Nexus")
[Answer]
## R, 64 bytes
```
cat(unlist(lapply(split(x<-scan(),cumsum(c(F,diff(x)>0))),rev)))
```
Reads input from stdin. We split the input into a list of vectors using `split()` which requires a factor variable that groups the input. The factor is created by taking the cumulative sum of the the logical vector for which the difference is positive.
Consider the vector:
```
x=c(5, 2, 7, 6, 4, 1, 3)
```
Now taking the difference and prepending `F` by running `y=c(F,diff(x)>0)` would produce the following logical vector:
```
[1] FALSE FALSE  TRUE FALSE FALSE FALSE  TRUE
```
Taking the cumulative sum `cumsum(y)` produces a vector where each group is represented by a unique factor upon which we can combine with the `split` function:
```
[1] 0 0 1 1 1 1 2
```
[Answer]
# Octave, ~~75~~ 44 bytes
Based on [MATL answer](https://codegolf.stackexchange.com/a/104123/62451) of @LuisMendo
```
@(a)sortrows([cumsum([1;diff(a)>0]),a])(:,2)
```
[Try it Online!](https://tio.run/#bT0RW)
Previous answer
```
@(a)[fliplr(mat2cell(f=fliplr(a),1,diff(find([1,diff(f)<0,numel(a)])))){:}]
```
[Try it Online!](https://tio.run/#RzUCx)
reverse the array
```
f=fliplr(a)
```
take first difference of `f`
```
d = diff(f);
```
find position of where the next element is less than the previous element
```
p=find([1,diff(f)<0,numel(a)])
```
first difference of the positions returns length of each sub array
```
len=diff(p)
```
use length of each sub array in `mat2cell` to split the array to nested list of arrays
```
nest = mat2cell(f,1,len);
```
reverse the nested list
```
rev_nest = fliplr(nest) 
```
flatten the nested list
```
[rev_nest{:}]
```
[Answer]
# [R](https://www.r-project.org/), 41 bytes
```
ave(x,diffinv(diff(x<-scan())>0),FUN=rev)
```
[Try it online!](https://tio.run/##K/r/P7EsVaNCJyUzLS0zr0wDRGtU2OgWJyfmaWhq2hlo6riF@tkWpZZp/jdVMFIwVzBTMFEwVDD@DwA "R – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 12 bytes
*Completely and utterly outgolfed [by Leo](https://codegolf.stackexchange.com/a/218911/95126) while I was typing in my answer...!*
```
ṁ↔CẊ-Θ:W<¹L¹
```
[Try it online!](https://tio.run/##AS0A0v9odXNr///huYHihpRD4bqKLc6YOlc8wrlMwrn///9bNSwyLDcsNiw0LDEsM10 "Husk – Try It Online")
```
ṁ              # map this function:
 ↔             # reverse
               # across all the elements of:
  C            # cut the input into sublists given by
   Ẋ-          # differences between elements of
       W<¹     # list of indices of the input that are less than their successor
     Θ:   L¹   # prepended with zero and appended with the length of the input
```
[Answer]
# [Vyxal 3](https://github.com/Vyxal/Vyxal/tree/version-3), 6 bytes
```
ᵃ>ṁƒVf
```
[Try it Online!](https://vyxal.github.io/latest.html#WyIiLCIiLCLhtYM+4bmBxpJWZiIsIiIsIlsxLCAzLCAyLCAyXSAiLCIzLjQuMSJd)
a weird quirk of "partition after truthy indices" means it matches lengths so it will never include the last value when getting booleans from comparing the overlapping pairs. By appending the reversed list we can always have a partition such that the last values are kept
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), ~~17~~ 15 bytes
```
{,/|'x@=+\>':x}
```
[Try it online!](https://ngn.codeberg.page/k#eJx1U9tunDAQfecr5qFSWhUHbHO3GvU/tkhBGzaJkiwp0IpV2n575+IFb5U+eJk5c86ZGcMemrc4+XW1fP3y+dvNVbP8jqK5efuwO/0ZmwMALO52eHIfbw/d47Nb3MmNn1ri7GLtYt1ioEE7PBIaDA2FhlEfWkwQAOsrYKm2paxadeInqQXt6yg6Q5vEbizDkD37+FCMpZOGFHJQxmYuRQEFkJ8LfJx/rtugCXLcGhGcY8AzXMI0FJf+ha0U5AI2E42hYXaOz0xGpLCEAlO6IwNCKxDjsqLxQZWgClAZKFzCOgJLxgW0iPP42AobVqBz1KNjDdrgdjhHhZYat+TbLUFjlkLtLPXLUJGhAFUpCVBmiF6xgjQ1sUlTtlGURA/z/Do1SbIf7vr74flwPc3d/qlf9g/d8b6/3g8vyfcf/TQ/Dscp0WmmjU6m/mc/qmkYZ9UdVTeO3SmKdroFdQP4wDCGc0YRA2YF8A3vTMjwgF0xqsZ0aWu0UkPYhLBZ4aC1wFbgUKC5nS++42ZDpQmLdu0WJOEcMiEmaQx5zB+q1FM2ozymz8hT/G9ISf0a0TYMSy7n8y45R36L9ymynyf+l2JX1sVLCBtpTkzoknOeydKSlDEUDG1vzjBR5AUziK74evBgrhBWWFV0RV7F9dJzznUb8z8E/yDsiWmFzjmbUs8aj+E7pAUq7qfpOv1XgDRNEBJqaWNluIydMjYiv1SMyNCIS+WdxKwWEzYr279aDB9z)
Chunks the input on indices where the value is greater than the previous value, reversing each chunk and concatenating back into a single array.
* `>':x` check whether each element is larger than the prior element
* `=+\` group the cumulative sum of this; elements in each run of equal or decreasing values get assigned their own index in the resulting dictionary
* `x@` index back into the original input to retrieve the original values
* `|'` reverse each chunk
* `,/` flatten the chunks back into a single array
[Answer]
# Pyth - 15 bytes
```
s_McQf<@QtT@QTU
```
[Try it online here](http://pyth.herokuapp.com/?code=s_McQf%3C%40QtT%40QTU&input=%5B5%2C+2%2C+7%2C+6%2C+4%2C+1%2C+3%5D&debug=0).
[Answer]
# [Perl 6](http://perl6.org/), 59 bytes
```
{map |+«*.[0].reverse,m/:s([(\-?\d+)<?{[>=] $0}>] +)+/[0]}
```
Regex-based solution.  
Because this is ~~Sparta~~ Perl!!
* `m/ /`: Stringify the input array, and match a regex against it.
* `(\-? \d+)`: Match a number, and capture it as `$0`.
* `<?{ [>=] $0 }>`: Zero-width assertion that only matches if all `$0` captured so far in the current sub-match are in non-ascending order.
* `([ ] +)+`: Repeat the last two steps as often as possible, otherwise start a new sub-match.
* `map , [0]`: Iterate over the sub-matches.
* `|+«*.[0].reverse`: For each one, take the list of values matched by `$0`, reverse it, coerce the values to numbers (`+«`), and slip them into the outer list (`|`).
# [Perl 6](http://perl6.org/), 63 bytes
```
sub f(\a){flat $_,f a[+$_..*]with first {[<=] $_},:end,[\R,] a}
```
Recursive list processing solution.  
More laborious than I had hoped.  
Even though the language has lots of convenient built-ins, there seem to be none for list partitioning (e.g. like Ruby's `slice_when` or Haskell's `takeWhile`).
[Answer]
# [Stacked](https://github.com/ConorOBrien-Foxx/stacked), noncompeting, 34 bytes
Still constantly developing this language.
```
{e.b:e b last<}chunkby$revmap flat
```
Argument lies on TOS. [Try it here!](https://conorobrien-foxx.github.io/stacked/stacked.html)
`chunkby` takes a function and collects arrays of contiguous data that satisfy the function. The function then is:
```
{e.b:e b last<}
{e.b:         }  function with arguments [e, <unused>, b]--the element, <the index>, and the
                 chunk being built
     e       <   check if e is less than
       b last    the last element of b
```
This gives a strictly decreasing array.
`$revmap` is basically `[rev]map` and reverses each item.
`flat` finally flattens the array.
---
Some fun for actually sorting the array:
```
[{e.b:e b last<}chunkby$revmap flat] @:sortstep
[$sortstep periodloop] @:sort
10:> @arr
arr out
arr shuf @arr
arr out
arr sort out
```
This outputs (for example):
```
(0 1 2 3 4 5 6 7 8 9)
(4 5 1 0 6 7 2 8 9 3)
(0 1 2 3 4 5 6 7 8 9)
```
[Answer]
# Python, ~~151~~ 139 Bytes
*Saved 12 Bytes thanks to @Flp.Tkc!*
Nowhere near @Flp.Tkc, let alone...
```
def s(l):
 r=[];i=j=0
 while j<len(l)-1:
  if l[j+1]>l[j]:r+=l[i:j+1][::-1],;i=j+1
  j+=1
 r+=l[i:j+1][::-1],;return[i for s in r for i in s]
```
[Answer]
# Python 2, 74 bytes
```
b=[];c=[];a+=9e9,
for i in a[:-1]:
 b=[a.pop(0)]+b
 if b[0]<a[0]:c+=b;b=[]
```
Input in `a`, output in `c`
[Answer]
# Python 3, 191 Bytes
```
a=[int(i)for i in input().split()]
while a!=sorted(a):
 b=[[]]
 for i,j in enumerate(a):
  if a[i-1]<j:b+=[[j]]
  else:b[-1]+=[j]
 a=[]
 for l in[k[::-1]for k in b]:a+=[k for k in l]
print(a)
```
I'm not sure if using the `sorted` function to check is allowed here, but I couldn't think of a good reason against it, and it brought down my byte count by ~30 Bytes.
]