I have trouble extracting part of a list in a specific order, say, increasingly in a cyclic manner. For example, I have the following list
list={0,10,6,-5,-10}
and I want to extract, as a new list, its increasing values from its minimum to its maximum, but only read in a cyclic manner, i.e. I want it to return {-10, 0, 10}.
Now, I know that in case the list is given already in increasing order, Parts[list,n;;m]
does the trick. But for a list with arbitrary order, is there a function that does what I want?
NestWhile[RotateLeft, {0, 10, 6, -5, -10}, First[#] != Min[#] &]
as a starting point? $\endgroup$