by _Microft · 3y ago · 0 comments
My eldest is 10. He is good at math because we do math games all the time. I can’t get algebra to sink in properly yet. Doesn’t really click in the time we have and with the teacher he has (me). But in Python he is giving variables a name all the time. Perhaps there is something about programmatic math that helps, not hinders education.
On the hinders side though, I can understand it being confusing to try to grasp:
y = x + 2
As being sort of 'constantly updating', referring to x in abstract, when you've just learnt that Python will assign (once) the result of computing x (at that time) + 2 to y.You could def y as being x() + 2, but you might just be delaying the confusion to when you try to introduce functions in math and find yoursel saying 'no no that was just a hack to get python to behave more like algebra'.
Is there any language that allows this I wonder? Where you can do something like:
y = &(*x + 2)
That is, y is a pointer to the result of adding 2 to the value pointed to by x, and this is somehow kept up to date, by tracking references like garbage collection perhaps, or at compile time by inserting the code to update y whenever x is updated. (Names would need to be globally unique I suppose, or else x transformed in to some kind of struct that could contain y and other dependents I suppose, and then also a link from y to x so you can remove that if y definition changes.. but that's a lot of load for the humble assignment operator!)It might be tempting to think it's procedural vs declarative, but it's not really, you could procedurally evaluate that y should now be maintained to have such value. Admittedly you can't really do it any other way on declarative terms. But what allows you to do computation like that? Datalog maybe?
I'm ignoring Matlab/Octave/etc. because I'm not that familiar and of course (I assume) they work more like math. What's interesting is that everything else seems to do it differently; I'm not sure why or how that happened. Is it as simple as an early limitation (in terms of early computation and compilers) that stuck?