Replacing element in Seq at given position


#1

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


#2

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


#3

There’s also the more general patch