>So in swap when the value is equal to 2, the list is no longer list[1], should be list[2], isn't it?
Yes, you're right. Serves me right for rushing, and gives an excellent example of the problems that passing-by-name can cause.