Skip to content

PositionIndex

Returns an association mapping each element to the list of its positions.

$ wo 'PositionIndex[{a, b, a, c, b}]'
<|a -> {1, 3}, b -> {2, 5}, c -> {4}|>