How to get the index of an element in a list using an identity (instead of equality) test.[1]