How to fix this list assignment in mathematica?

Force the LHS to evaluate into pieces that can be assigned to.

Force the LHS to evaluate into pieces that can be assigned to: EvaluateTablepi, {i, -3, 0} = Flatten{Table0, {i, -3, -1}, 1}.

I got a lot of warnings when doing so. Is there any clean way of doing this? Thanks!

– Qiang Li Jan 10 at 23:23 @Qiang There are no problems with this answer. I suggest you to try it after a Clear"Global`*" or a clean Mma start. – belisarius Jan 10 at 23:36 @belisarius: right.

I forgot to do clear. But doesn't seem to be very elegant or at least the way I wanted. :( – Qiang Li Jan 10 at 23:39 @Qiang Perhaps you should be a little more precise in your question.

This is a valid Mma way to deal with tables in the LHS – belisarius Jan 10 at 23:43 This only works when symbols have no prior definitions. The following will work also in the latter case: SetAttributesassignToSymbol, HoldRest; assignToSymbolsym_Symbol, lhs_, rhs_ := Set @@ AppendBlock{sym}, HoldEvaluatelhs, Unevaluatedrhs , example of use: assignToSymbolp, Tablepi, {i, 3}, {1, 2, 3}, and then assignToSymbolp, Tablepi, {i, 3}, {4, 5, 6}. One can also make more complex version which will automatically detect which symbols on the l.h.

S need Block-ing – Leonid Shifrin Jan 107 at 11:05.

The reason it doesn't work is because Set has attribute HoldFirst. It means that Seta,stuff passes symbol a instead of value of a to Set function. As to why it has this attribute, ask yourself: when you do Seta,stuff, do you want to assign stuff to symbol a, or to the value of a?

In your example, a holds a table of variable names, so you want the value of a and HoldFirst is annoying. However, most of the time a will have a value like 5 and you want a=stuff to assign stuff to symbol a, not to the value 5 A common pattern to get around Holding attributes is the following: Set@@{Tablepi, {i, -3, 0},Flatten{Table0, {i, -3, -1}, 1}}.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions