I have a list of elements and I wish to update them:
from this: [\"Off\",\"Off\",\"Off\",\"Off\"]
[\"Off\",\"Off\",\"Off\",\"Off\"]
to this: [\"Off\",\"Off\",\"On\",\"Off\
[\"Off\",\"Off\",\"On\",\"Off\
Here is a one liner that works perfectly
replace pos newVal list = take pos list ++ newVal : drop (pos+1) list
I doesn't seem efficient to do this kind of things in haskell.