JAX arrays are immutable — x[i] = v raises an error. Updates are expressed functionally: x.at[i].set(v) returns a new array with the change applied, leaving x untouched.
Implement replace_at(x, indices, values):
x: a 1-D jnp arrayindices: a list/array of integer positionsvalues: the new values for those positions (same length as indices)Return the updated array without modifying x. The test prints both the result and the original array afterward, so a mutating implementation fails even if the returned value looks right.