List.keyreplace/4

defmodule List do
  def keyreplace(list, key, index, new_tuple)
end

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.