Earlier quoted context omitted.
Why assume it is javascript? The article doesn't indicate the language anywhere that I can see.
Ok, let's say that it is not JS, but an untyped, closure-based programming language with a strikingly similar array and sort API to JS. Sadly, this comparator is still wrong for any sorting API that expects a general three-way comparison, because it does not handle equality as a separate case. And to tie it down to the mathematics: if a sorting algorithm asks for a full comparison between a and b, and your function r…
Ah! You're talking about Racket or Scheme!
```
> (sort '(3 1 2) (lambda (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.