I'm trying to do a small page counter with Mathematica, for leting me know about my reading progress on some books. I'm stuck on a problem:
Clear["Global`*"]
a = {v1, v2, v3, v4, v5, v6}
a[[1]] = 0
v1
With this, I'm trying to give 0 as a value to v1, but it seems that it swaps the v1 for 0 instead. I was expecting the evaluation of v1 to give me 0 as a value, but it still gives me v1, I've managed to partialy solve this with the following addition:
Clear["Global`*"]
a = {v1, v2, v3, v4, v5, v6}
Evaluate[a[[1]]] = 0
v1
When the v1 is evaluated, it gives me 0 as output, but it's not working in my program and I have no idea why this is happening.
I've also managed to perform a separate test by evaluation both:
Clear["Global`*"]
a = {v1, v2, v3, v4, v5, v6}
Evaluate[a[[1]]] = 0
v1
Clear["Global`*"]
a = {v1, v2, v3, v4, v5, v6}
a[[1]] = 0
v1
In this case, it the outputs for both v1's are v1. Why is this happening?
My program(If needed):
Clear["Global`*"] g = 1; i = 1; l = {}; ln = {}; pi = {}; m = 1; r1 := AppendTo[l, ToExpression["p" <> ToString[i++]]] r2 := AppendTo[ln, n] r3 := Clear[n] r4 := AppendTo[pi, np] r5 := Clear[np] r6 := Evaluate[l[[m]]] = 0 r7 := m++ o1 = Button["+1", r1; r2; r3; r4; r5; r6; r7, ImageSize -> {30, 19}]; o2 = InputField[Dynamic[n], String, FieldSize -> {15, 1}]; o3 = InputField[Dynamic[np], Number, FieldSize -> {4, 1}]; o4 = {o1, o2, o3}; o5 = Style["Book", 12]; o6 = Style["Book Title", 12]; o7 = Style["# Pages", 12]; o8 = {o5, o6, o7}; Grid[{o8, o4}, Frame -> True] t = Table[Button[ToString[x], Delete[l, {x}]], {x, 1, Length[l]}] // Dynamic l // Dynamic ln // Dynamic pi // Dynamic