Re: list mutability (very basic question)

*To*: mathgroup at smc.vnet.net*Subject*: [mg131716] Re: list mutability (very basic question)*From*: Alan G Isaac <alan.isaac at gmail.com>*Date*: Mon, 23 Sep 2013 21:58:30 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-outx@smc.vnet.net*Delivered-to*: mathgroup-newsendx@smc.vnet.net*References*: <20130921083830.751226A65@smc.vnet.net> <201309220228.36832.itais@wolfram.com>

On 9/22/2013 3:28 AM, Itai Seggev wrote:> Do you think that 0=1 should not be an error? If > you think it should be an error (as it is in every language I'm familiar with), > then why should {0}[[1]]=1, which would essentially be the same thing, not be > an error? Because I do not expect this syntax to lead to the LHS to be evaluated to 0. I expect it to mean: replace the first element of the list {0} with the value 1. (Compare Python: ``[0][0]=1`` is not an error, for exactly this reason.) In fact this is a key point of puzzlement for me: why ``x={0};x[[1]]=1`` is ok but ``{0}[[1]]=1`` is an error in Mathematica. What is the evaluation rule for the LHS that produces this difference? Thanks, Alan

**References**:**list mutability (very basic question)***From:*Alan <alan.isaac@gmail.com>