What's Algebraic Data Types?
“algebraic data type” in functional programing languages is better called “systematic composite data type system”.
You know how in python, you have int long float complex string dict list tuple etc? These are rather ad hoc, happens to be builtin.
The idea of algebraic data type is that, you start with a set of primitive types, and you can write code to create composite types. In this way, your types are well controlled and systematically extensible. That's the case of OCaml and Haskell.
“algebraic data type” does not mean a specific type, as in a int or string. But, rather, a system.
Also, “algebraic data type” has very little to do with algebra. It's “algebra” as much as microwave oven is science.
xah's edu corner extempore! on the idiocy of phraseology of algebraic data type of computing scientist dorks
1 the first time i heard of algebraic data types, i was so excited, thinking it so advanced
2 “algebraic data types” i thought that groups, ring, fields, of math is coming to advanced functional programing languages the likes of #haskell
3 to my chagrin, 'tis not so. the term “algebraic data types” is illusive, you can't never grasp it.
4 then yester i stomped my foot on the ground, and firmly tried to grasp algebraic data types as you do pokemon
5 turns out, algebraic data types is something comp sci dorks cooked up, and let xah explain u what it is the most lucid way
6 xah's explanation, is such that, beats anything blog wiki or books you'll ever tried to understand about the term algebraic data type
7 but wait, actually, let me just rephrase it sans even explanation, and you'll understand it immediately
8 “algebraic data type” in functional programing languages is better called “systematic data type system”.
9 for example, you know how in python, you have int long float complex string dict list tuple etc? these are rather ad hoc, happens to be builtin.
10 comes in algebraic data types, where, a lang has basic types, and you can write code to create composite types. that's #ocaml #haskell
11 that's why, “algebraic data types” is “SYSTEMATIC, COMPOSITE DATATYPE, SYSTEM”. It's a data type system, and systematic at it.
12 👏 👏 👏 💯 if you enjoyed my explanation, retweet, subscribe http://xahlee.info/ or buy my js tutorial http://xahlee.info/js/buy_xah_js_tutorial.html
If you have a question, put $5 at patreon and message me.