Adds a function to get the index of a value.