Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Replace elements with their position of first appearance when flattened
| ResourceFunction["PositionsByFirstAppearance"][list] replaces elements of list by their position of first appearence in the flattened list. | 
Put digits of π into standard order:
| In[1]:= | ![{3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2} // ResourceFunction["PositionsByFirstAppearance"]](https://www.wolframcloud.com/obj/resourcesystem/images/72e/72e84095-aca6-4d95-9049-c410320fb300/7ed3f86fc7188ac0.png) | 
| Out[1]= |  | 
Put edges of the Petersen graph into standard order:
| In[2]:= | ![ResourceFunction["PositionsByFirstAppearance"][
 List @@@ GraphData["PetersenGraph", "EdgeList"]]](https://www.wolframcloud.com/obj/resourcesystem/images/72e/72e84095-aca6-4d95-9049-c410320fb300/65908cca7c8c5707.png) | 
| Out[2]= |  | 
Append {1,2,3} to permutations of {1,2,3} and put into standard order:
| In[3]:= | ![ResourceFunction["PositionsByFirstAppearance"][Join[#, {1, 2, 3}]] & /@
  Permutations[{1, 2, 3}]](https://www.wolframcloud.com/obj/resourcesystem/images/72e/72e84095-aca6-4d95-9049-c410320fb300/1fa49f24b19e220a.png) | 
| Out[3]= |  | 
Put characters of text into standard order:
| In[4]:= | ![ResourceFunction["PositionsByFirstAppearance"][
 Characters["Puts characters of text into standard order:"]]](https://www.wolframcloud.com/obj/resourcesystem/images/72e/72e84095-aca6-4d95-9049-c410320fb300/0e49b138b433712c.png) | 
| Out[4]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License