Replacing element in Seq at given position

Hello,

Given an immutable Seq[A], a new element a: A and a position pos: Int, I’d like to obtain a new Seq[A] that is like the old Seq, except that the element at position pos is replaced by a. Is there something in the standard library to do this? Thanks!

Best, Oliver

Seq("a", "b").updated(1, "c")

1 Like

There’s also the more general patch