I'd declared the function below in the hope that if I am to overwrite some element in the list it actually works.But I am not completely sure if this is the right way.Any ideas different than mine will be appreciated
fun foo (ls,n) =if ls = nil then nil else ( rev ( 1::List.rev ( List.take (ls,n-1 ))))@(List.drop (ls,n)
it should work like this
foo ([0,3,9],2) = [0,1,9]