PositionIndex

PositionIndex[list]

gives an association between unique elements in list and the positions at which they occur.

PositionIndex[assoc]

gives an association whose keys are the distinct values in assoc, and whose values are lists of the keys with which they are associated.

Details

  • In PositionIndex[expr], the keys in the result appear in the order of their first occurrence in expr.

Examples

Basic Examples  (2)

Find positions of list elements:

Find positions of elements in an association:

Wolfram Research (2014), PositionIndex, Wolfram Language function, https://reference.wolfram.com/language/ref/PositionIndex.html.

Text

Wolfram Research (2014), PositionIndex, Wolfram Language function, https://reference.wolfram.com/language/ref/PositionIndex.html.

CMS

Wolfram Language. 2014. "PositionIndex." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PositionIndex.html.

APA

Wolfram Language. (2014). PositionIndex. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PositionIndex.html

BibTeX

@misc{reference.wolfram_2024_positionindex, author="Wolfram Research", title="{PositionIndex}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/PositionIndex.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_positionindex, organization={Wolfram Research}, title={PositionIndex}, year={2014}, url={https://reference.wolfram.com/language/ref/PositionIndex.html}, note=[Accessed: 22-December-2024 ]}