3 ms·
+1 to this I remember struggling to understand the x = 7 syntax for storing a value in x. My young self was like “so if x is equal to 7, how come we can write
by baby 4y ago
+1 to this
I remember struggling to understand the x = 7 syntax for storing a value in x. My young self was like “so if x is equal to 7, how come we can write x is equal to 8 later? That doesn’t make sense”
- eyelidlessness 4y agoA cool thing about this in Erlang (which I think is the same in Prolog) is that the = operator works almost exactly how you would have expected: it binds the value but then it asserts the binding’s equality. So once you’ve established x = 7, x = 8 is actually an error! Because you’re right, it doesn’t make sense that at one point x = 7 and later the same x = 8!
- baby 4y agoThat's what I did in my own language[1], no shadowing allowed. [1]: https://github.com/mimoo/noname https://github.com/mimoo/noname