Set the nth element in a list.