Replace individual list elements in Haskell?

后端 未结 9 684
死守一世寂寞
死守一世寂寞 2020-12-01 12:02

I have a list of elements and I wish to update them:

from this: [\"Off\",\"Off\",\"Off\",\"Off\"]

to this: [\"Off\",\"Off\",\"On\",\"Off\

9条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-01 12:26

    Actually, for many cases (not always) where you'd use a List, a Data.Vector is a better choice.

    It comes with an update function, see Hackage, that does exactly what you need.

提交回复
热议问题