Hello all,
I have an implementation question that I hope someone can help out with. Say I have a fixed-size list: [1, 2, 3, 4, 5] that I want to treat as circular in a function in order to rotate one of the elements n positions. So rotating the second element 2 positions would result in: [1, 3, 4, 2, 5], or rotating the fourth element 2 positions would result in: [1, 2, 4, 3, 5]. There are two cases: if the element can be moved w/o rotating and where the element must be inserted into the list at the front. Is there an idomatic way to handle both of these cases in a function?
Thanks,
kevin