List

keyreplace/4

keyreplace(list, key, index, new_tuple)

Receives a list of tuples and replaces the tuple whose index-th element is key with new_tuple.

If no tuple is found the list is returned untouched.