FR version is available. Content is displayed in original English for accuracy.
Advertisement
Advertisement
⚡ Community Insights
Discussion Sentiment
100% Positive
Analyzed from 1083 words in the discussion.
Trending Topics
#category#theory#order#sort#object#mathematics#api#language#article#every

Discussion (37 Comments)Read Original on HackerNews
[1] https://arxiv.org/pdf/1612.09375
Category theory is also not that impressive unless you already understand some of the semantics it is trying to unify. In this regards, the book itself presents, for example, the initial property as trivial at first hand, unless you notice that it does not simply hold for arbitrary structures.
[1, 3, 2].sort((a, b) => { if (a > b) { return true
})This is not a valid comparator. It returns bools where the API expects a negative, zero or positive result, on my Chrome instance it returns `[1, 3, 2]`. That is roughly the level of correctness of the mathematics in the article as well, which I'm trying to present in sibling comment: https://news.ycombinator.com/item?id=47814213
And to tie it down to the mathematics: if a sorting algorithm asks for a full comparison between a and b, and your function returns only a bool, you are conflating the "no" (a is before b) with the "no" (a is the same as b). This fails to represent equality as a separate case, which is exactly the kind of imprecision the author should be trying to teach against.
Let's scroll up a little bit and read from the section you're finding fault with:
Rather than the usual "harrumph! This writer knows NOTHING of mathematics and has no business writing about it," maybe a simple counter-example would do, i.e. present an ordering "in which every object has its place depending on every other object" and "leaves no room for ambiguity in terms of which element comes before which" but also satisfies your requirement of allowing 'equal' ordering.Ah! You're talking about Racket or Scheme!
```
> (sort '(3 1 2) (lambda (a b) (< a b)))
'(1,2,3)
```
I suppose you ought to go and tell the r6rs standardisation team that a HN user vehemently disagrees with their api: https://www.r6rs.org/document/lib-html-5.96/r6rs-lib-Z-H-5.h...
To address your actual pedantry, clearly you have some implicit normative belief about how a book about category theory should be written. That's cool, but this book has clearly chosen another approach, and appears to be clear and well explained enough to give a light introduction to category theory.
This article is like living there for few months. You see things, some of them you recognize as something similar to what you have at home, then you learn how the locals look at them and call them. And suddenly you can understand what somebody means when they say:
"Each distributive lattice is isomorphic to an inclusion order of its join-irreducible elements."
Having a charitable local (or expat with years there under their belt) that helps you grasp it because they know where you came from, just like the person who wrote this article, is such a treasure.
I'm unclear what the last 10% of 'category theory' gives us.
In a preorder seen as a category, there is at most one arrow between any two objects. So every diagram commutes and uniqueness is basically free. Then products and coproducts stop looking like magic diagrams and become something very familiar: greatest lower bounds and least upper bounds.
Small nit: preorders are thin categories, but posets are the skeletal thin categories. In a preorder you can have distinct a and b with both a <= b and b <= a, which means they are isomorphic, not literally the same. Quotienting by that equivalence gives you the poset.
The software angle is the part I find most useful. This kind of bugs shows up when we force a total order onto something that is only partially ordered, or only preordered. Dependency graphs, versions, permissions, type hierarchies, CRDT states, rule specificity, build steps. A lot of these don’t really want a comparator and a sort. Sometimes they want a quotient, a topological sort, a join, or just the honest answer that two things are not comparable.
That feels like the practical lesson here: category theory is not always adding abstraction. Sometimes it is just a good way to stop pretending two different structures are the same thing.