|
|
|
|
|
by evincarofautumn
4204 days ago
|
|
There is a difference between “algebra with numbers” and “algebraic manipulation”. You do the latter all the time with code when you observe and use equivalences like this: if a then
return b
else
return c
===
return (if a then b else c)
I.e., “return” is distributive over the branches of the “if” expression, so you can factor it out.When you see “bad” programmers redundantly specifying Boolean expressions like “x == true” instead of “x”, it’s because they haven’t internalised the fact that “if” takes any algebraic expression denoting a Boolean, not just a special sort of expression with “&&” and “||” and “==” and “<”. Beginning programmers often struggle with learning the elements available in a language and how they can be composed—and that is exactly what an algebra is. I would be very surprised if an aptitude for algebra did not correlate with an aptitute for programming. |
|