4 ms·
I think multiplication for string concatenation makes more sense than just "its juxtaposition so we call it multiplication". If you look at type theory, then a
by rocqua 5y ago
I think multiplication for string concatenation makes more sense than just "its juxtaposition so we call it multiplication". If you look at type theory, then a tuple of type (A, B) is called the product type of A and B. This is because there are #A times #B elements in the new type. A Sum type, in type theory is a tagged union. It is an element of Either A or B. (Like a C union with an extra tag saying which type it contains). This is a sum because it contains #A plus #B elements.
Concatenation of strings is much closer to the tuple approach. And the argument about the number of elements in the type still holds if you keep the string-length fixed.