Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Return a canonical rotation for a list of values
ResourceFunction["CanonicalListRotation"][list] sorts list, keeping rotationally-neighboring terms as neighbors. | |
ResourceFunction["CanonicalListRotation"][list,False] excludes reversals and cyclic permutations thereof. |
The list of items is returned as the lexicographically first rotation:
In[1]:= | ![]() |
Out[1]= | ![]() |
Exclude reversals and cyclic permutations of reversals:
In[2]:= | ![]() |
Out[2]= | ![]() |
Generate the six faces of a cube:
In[3]:= | ![]() |
Out[4]= | ![]() |
In[5]:= | ![]() |
Out[5]= | ![]() |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License