News for hackers. Stuff that matters.
Re:Abusing the algebra of algebraic data types – why does th... by krastanov on Monday October 10, 2022 @02:48PM (#33155073)
This is fascinating, but I am still curious: would I ever have a good reason to repackage seven binary trees as one (or other way around)?
Re:Abusing the algebra of algebraic data types – why does th... by hither_shores on Monday October 10, 2022 @03:37PM (#33155559)
The particular example is not the point. The question you should be asking is

> would I ever have a need to understand what happens when you perform algebraic manipulations on data structures

and the answer is as usual that it depends on what you're working on. Parsers? Absolutely. CRUD apps? Yes, but only if you look for them. Numerical linear algebra? Probably not.

Re:Abusing the algebra of algebraic data types – why does th... by feoren on Monday October 10, 2022 @04:27PM (#33156042)
> CRUD apps? Yes, but only if you look for them.

I upvoted just for this breath of fresh air right here. CRUD apps are boring and crappy because people make them boring and crappy. I find uses for this type of thing all the time in "boring" CRUD apps, because I look for them.

Re:Abusing the algebra of algebraic data types – why does th... by svat on Monday October 10, 2022 @03:56PM (#33155758)
I can't imagine any application. :-)

The fascination is more that of explanation: if you treat T = 1 + T^2 as an algebraic equation in the complex numbers, you can get a lot of expressions that are meaningless: it's hard to make sense of T = 1/2 ± i√3/2 or T^3 = -1 or even T^6 = 1 (there is certainly no bijection sending six trees to the empty tree). But then, T^7 = T is suddenly very much meaningful and we can turn it into an explicit description. What's going on? Which equations are "meaningful" and which are not?

Blass's paper gives an explanation: an equation is meaningful if you can derive it by working in (something like) N[T]/(T = 1 + T^2) (with some more conditions). Baez's discussion (linked above) puts it in terms of "categorification", and is also interesting.

Re:Abusing the algebra of algebraic data types – why does th... by jerf on Monday October 10, 2022 @04:09PM (#33155881)
This is like giving an artist a new shade of color they've never had before, like a new rich blue or something. It isn't that everything is improved by using that new color as much as possible everywhere. It's that it opens up new possibilities you may never have considered before. This insight may be useless, but there are other useful ones that can emerge that you wouldn't have thought of on your own in a long time.
Re:Abusing the algebra of algebraic data types – why does th... by feoren on Monday October 10, 2022 @04:25PM (#33156021)
Sharding a huge database index (or other binary tree structure) onto 7 different servers or hard drives? Or 49 (recursively apply it)? I don't know if that's actually useful here but it's the first thing that came to mind.