I would like an intersection function on lists like Intersection that also stores the coordinates of the intersections. For instance for {a,b,c}
and {b,c,e}
would give something like {{b,2,1},{c,3,2}}
.
If more elements match preferably it saves all of the positions.
So {a,b,c,a}
and {d,c,a,c}
would give something like {a,{1,4},3},{c,3,{2,4}}}
.
Can this be done easily?
(Only a comparison of two lists is needed for the present purpose. But a more general function that can be applied to any number of lists might be nice to have ready in the future too.)