Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This post really needs to explain why plausible alternative solutions (ideally ones used in real world open source projects) which are not monoids rapidly lead to having to deal with increased complexity. Otherwise, it's just bringing in a lot of terminology waving their hands saying "We came up with a solution that let us have mutiple extensions!" which, on the surface, seems pretty boilerplate.


It's worse than that, I think. They had some code that expects input in a certain format, they wanted it to accept input in a variety of other formats, and category theory was apparently necessary to come up with the idea of a format converter from each new format to the original format. Extremely basic. Trying to pretend it's a CT application is just pretentious in the extreme.


As far as I can tell, this is what category theory is for. It lets you take some quite basic structure or piece of work, and describe it in rigorous, impressive-sounding terms.


Imagine you've got ten pieces you need to stick end to end

    a b c d e f g h i j
How many ways can you do that with a binary operation? i.e. how many ways can you completely parenthesise that expression. e.g.

    ((a (((b (c d)) e) ((f g) h)) i) j)
I haven't worked it out exactly, but I think it's about a trillion.

On the other hand, suppose your binary operation is associative. How many different ways are there now? Effectively one.

That's a huge reduction in complexity. The notion of associativity is extremely useful in developing composable programs.


Are you sure of that? Isn't the answer to your question the Catalan numbers, for which this case the answer is 4862?


I'm not sure at all! My calculation came out very wrong, and a quick sanity check should have told me it's implausible that it's in the trillions.

Anyway, 4862 times is still a substantial complexity reduction.

Thanks for the correction.


I totally agree with this, it was like 'here's a solution using category theory', but what were the alternatives? How is this useful/applicable to me, and why should I learn category theory?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: