5 ms·
Oddly, that is precisely my problem with it as a name. I can't do any "basic algebra" operations on these things. I say this as someone that is having to help
by taeric 1y ago
Oddly, that is precisely my problem with it as a name. I can't do any "basic algebra" operations on these things.
I say this as someone that is having to help my grade schoolers learn algebra this week, actually. :D I can squint to see where things are going and how they intersect. But it takes a lot of squinting.
- adastra22 1y agoWhere are grade schoolers learning algebra?
- taeric 1y agoJust google "algebra 1." Largely, it is where they learn to do symbolic math. Lots of time spent on quadratics.
- adastra22 1y agoYes, where I live (Silicon Valley) the earliest you can take algebra 1 is in middle school, and that is the accelerated pathway for the smart kids.
- taeric 1y agoAh, I see that "grade school" is sometimes defined as just to 6th grade or so. I have always used it to include all schooling up to college. So, apologies on that. I am referring to the same stuff you are mentioning. I don't think that changes my point, at all?
- adastra22 1y agoNo it doesn’t, I was just curious. And yeah in the US grade school is just through 5th grade, and 6th grade in most of the rest of the world. Synonymous with elementary school AFAIK. I think the US is far too slow in introducing algebra, with it standardly being taught in 9th grade. So that made me curious.
- taeric 1y agoI don't remember my school days, oddly. For my kids, they don't have an "algebra" class until later. But they do basic symbolic math far sooner. I know they have done what we would call linear systems of equations as early as 6th grade. Different number systems even earlier. My 9th grader is in an algebra class. I don't remember if it is 1 or 2. I'm still not entirely clear I see the obvious path from the things they are doing to algebraic types.
- jghn 1y ago> in the US grade school is just through 5th grade, and 6th grade in most of the rest of the world Be careful with this. Where I grew up in the US, "Grade school" was usually through 6th grade with a grade 7-8 middle school or just 1-8.
- dkarl 1y agoYou can add and multiply. You have to learn what add and multiply mean with types. There was a time when you only knew how to add and multiply with numbers, and you had to learn how to deal with things like "x". It's confusing for most kids at first, and they spend weeks getting used to it. I'd say that virtually anybody who has learned grade school algebra will learn to add and multiply types faster than they learned to add and multiply polynomials. "Squaring" and "cubing" is an easy way to build intuition with type multiplication, because the name helps you visualize the result. If you have a type C with three values {red, green, blue} then C^2 = C x C is a "square" of values: (red, red) (red, green) (red, blue) (green, red) (green, green) (green, blue) (blue, red) (blue, green) (blue, blue) and C^3 = C x C x C can be visualized as a "cube" of values. You can imagine arranging other products of finite types in the same way: class Foo(color: C, enabled: Boolean) // the values of Foo can be arranged in a 3x2 array Foo(red, true) Foo(red, false) Foo(green, true) Foo(green, false) Foo(blue, true) Foo(blue, false) This is analogous to how kids are taught to multiply 3 x 2.
- taeric 1y agoLike I said, I can squint to see what you mean. But people tend to treat types more as what grade schools call units. And those act more as constraints on what you can do with the values. With you doing add/multiply on the values. Note that I'm not necessarily arguing that things should change. At this point, I'd consider the name fairly well established. But, it should be noted much more heavily that you are doing algebra on the types and that this does not imply anything that you can do with the values they may represent at any time.
- dkarl 1y ago> But people tend to treat types more as what grade schools call units. And those act more as constraints on what you can do with the values. With you doing add/multiply on the values. Ah, I see. Yes, it doesn't make sense unless you see types as sets of values. I haven't been super deep into type theory, so I don't know how far that definition takes you, but it's the intuitive/naive starting place for understanding the idea of algebraic data types. The addition and multiplication operations are on sets of values and don't have anything to do with adding or multiplying the values themselves.