4 ms·
I mean ... just as an example, what happens if what you are adding are not numbers? For example, a string concat can be understood as an addition operation: 1
by hosh 5y ago
I mean ... just as an example, what happens if what you are adding are not numbers?
For example, a string concat can be understood as an addition operation:
1 + 0 = 1 (identity)
1 + 1 = 2
1 + 2 = 3
2 + 1 = 3 (communitive)
"a" + "" = "a" (identity)
"a" + "a" = "aa"
"a" + "b" = "ab"
"b" + "a" = "ba" (non-communitive)
There's this whole intuition about addition itself that can be applied to something other than integers, and being able to reason about that is applicable to how you design software, particularly function interfaces.
Just as a note, my mother made me memorize the multiplication table when I was a kid, and I had ended up memorizing additions just through sufficient practice. I was able to intuit what additions and multiplications meant, but for the purpose of taking tests in school or doing homework, additions just pop out as answers because of the memorization. It wasn't until much later in life that I started encountering ideas such as, what if you were adding something other than numbers.
- davchana 5y agoIn India we learn tables (multiplication tables, but we just call them tables) from 1 to 10, and later till 20. Each one has this format, 1x1=1 1x2=2 First number is 1, so its table of 1. Then x as multiplier sign. Then a count from 1 to 10. Then = sign. Then the result. We kids are supposed to write each line in left to right direction, then move to next line. We use paper with square tables or graph on it. Most of the time, kids simply write 1, move to next line, again write 1, all the way till 10th line. Then we move to next column, write x, then move up, x all the way till 1st line. Then 1,2,3, in next column, = in next column coming up. Then the answers going down.
- bckr 5y agoThis is how I learned arithmetic in the US 2 decades ago. edit: But actually after that I used something called "Math-U-See", which used physical blocks to develop intuition. That was pretty cool.
- layer8 5y agoStrings with string concatenation form a monoid [1] (natural numbers with addition form a commutative monoid, and integers with addition form an abelian group). Incidentally, that was literally the topic of the first class in my first CS semester. :) [1] https://en.m.wikipedia.org/wiki/Monoid https://en.m.wikipedia.org/wiki/Monoid
- dreamcompiler 5y agoOff-topic language quirk: It seems odd to me that monoids can be 'commutative' while groups can be 'abelian' but both adjectives mean the same thing. Alas, if the language were consistent this joke wouldn't exist: Q: What's purple and commutes? A: An abelian grape.
- chaxor 5y agoCircle + circle = 8 Circle x circle = torus
- macrolocal 5y agoI'm surprised the author depends on a single visual model for numbers. To provide another data point, my ordinal numbers are brightly colored (maybe an association with award ribbons I'd get in elementary school); cardinals with no extra structure are specific clusters of bluish cubes (8 is 2x2x2); when ring structure shows up, they're malleable grids (maybe because the distributive law's self similarity made learning the times table easier); for just multiplication, colored lights in a poset (so L-function identities "look like" intricate lattices of Christmas lights). For general groups, not much: I just feel like I'm playing a board game. It's hard to imagine having only one instinctive visualization for integers.