Don’t misunderstand me, you can do this quite easily with List Shifter’s PROCESS List action (go watch the video) without needing code.
You could also do it (in what I think is a more laborious way) with things like Toolbox’s List Item Expression element.
It’s just super painful to explain this to people or to provide a specific examples, but here’s an already existing example page that shows how to do this with List Shifter:
You’ll find a button there to open the editor for that page, as well.
Edit: Also, here’s a painfully detailed explanation of that example, as well: List Shifter: Reverse, Rotate, Swap and ITERATE (Loop) Over Bubble Lists | Now at v1.4: Adds Numeric Option, GET INDEX Action - #438 by keith