4 ms·
You probably also want to complete your toolkit with functions which are then exponentiation. Also, in any ADT system 0 should be exactly the empty sum and 1 e
by tel 11y ago
You probably also want to complete your toolkit with functions which are then exponentiation.
Also, in any ADT system 0 should be exactly the empty sum and 1 exactly the empty product. This is what makes things hang together properly.
- _asummers 11y ago0 and 1 are just idiomatic though, correct? The important part, from my knowledge of abstract algebra, is that there exist an identity for any operation function () such that for all x in your domain, x () identity = x.
- tel 11y agoOh sure, you can call them whatever you like. But if you have an ADT system which has a unit type that isn't quite the empty product then you'll be in for an interesting time at least. E.g., this is true in Haskell and it causes there to be some "extra structure" which often has to be smoothed over. Lots of library functions exist just to do this smoothing.
- fanf2 11y agoAnd differentiation, which is useful for functional update of persistent data structures. https://chris-taylor.github.io/blog/2013/02/13/the-algebra-of-algebraic-data-types-part-iii/ https://chris-taylor.github.io/blog/2013/02/13/the-algebra-o...
- tel 11y agoThat's nice, but I wouldn't call it particularly core to ADT systems. It also requires quite a bit more machinery to embed directly since you need to be able to talk about functors/containers.