7 ms·
It is not a lie it is just apparently familiar notation that actually has an entirely different meaning. It is not an equation, it is an assignment. X := X + 1
by SeanDav 10mo ago
It is not a lie it is just apparently familiar notation that actually has an entirely different meaning. It is not an equation, it is an assignment.
X := X + 1 is perhaps less confusing, even if meaning the same thing.
- npteljes 10mo agoThat's exactly right. Looking at the Assignment Operator Wiki page, it's also clear where these notations come from. I think an easy way to look at it, for someone coming from a math background, is to think of programming lines as instructions, instead of statements. x=x+1 can be then read as "let x be x+1", and that's it. https://en.wikipedia.org/wiki/Assignment_(computer_science) https://en.wikipedia.org/wiki/Assignment_(computer_science)
- sodapopcan 10mo agoAlthough in Erlang it's closer to an equation with assignment being a side effect. `=` is the pattern matching operator. Eshell V15.2.6 (press Ctrl+G to abort, type help(). for help) 1> X = 1. 1 2> X = X. 1 3> 1 = X. 1 4> X = 2. ** exception error: no match of right hand side value 2 5>
- antonvs 10mo agoIt’s not really such a different meaning, it’s just shorthand for something like: X’ = X + 1 DELETE X X = X’ Even if you treat it as “storing a value in a slot”, a comprehensive model of the operation needs to model the fact that the value of the slot changes over time. So another way to look at it would be: X_t1 = X_t0 + 1 …except that “X” is shorthand for “the latest binding that uses this name.”