1. 23
  1.  

  2. 11

    I appreciate this kind of work, but this repo feels like someone who doesn’t understand a lot of the things he’s explaining.

    A function f :: A => B is an expression - often called arrow or lambda expression - with exactly one (immutable) parameter of type A and exactly one return value of type B.

    That’s not true at all! Some programming languages like Haskell only allow one parameter, but plenty of languages have multiple arity functions. They even give an example of an arity-2 function under the definition of arity!

    [Isomorphism] A pair of transformations between 2 types of objects that is structural in nature and no data is lost.

    For example, 2D coordinates could be stored as an array [2,3] or object {x: 2, y: 3}.

    It’s not enough to have a bijection between the elements, it also needs to be homomorphic. You could add restrictions to make the array and point object isomorphic, but they’re not necessarily: you can append to the array to get a 3D point.

    Setoid: An object that has an equals function which can be used to compare other objects of the same type.

    A setoid is an object with an equivalence relation, not an equals function. Those are different. For example, you can have a setoid of all arrays where the equivalence relation is number of elements, meaning [1, 2] ~ [4, 5].

    1. 5

      I think your comment would be even better If it was a pull request so all the world can benefit, not just the few readers of lobsters

      1. 1

        I opened some issues, but I can’t guarantee that I’ll remember to come back for them.

        My honest opinion, though, is that some of the definitions, like “category”, are almost complete; and as a result, they might as well have been copied out of a textbook. So, given that there are like a half-dozen good category-theory textbooks available for free already, I don’t think that the problem with this jargon is that the material is not fully presented on this single particular article. Rather, I think that the issue is with the overflowing teacups of the typical programmer; a “simple terms” explainer article is not going to fix their unwillingness to be mathematical.

        To make this extremely vivid, I’ve contributed to English Wikipedia and nLab, and so if I were to write explanations of “category”, “functor”, “natural transformation”, etc. then they would probably resemble one of those two wikis. For example, here’s the first sentence for “functor” from the article:

        [A functor is a]n object that implements a map function that takes a function which is run on the contents of that object.

        And from English WP:

        In mathematics, specifically category theory, a functor is a mapping between categories.

        And from nLab:

        Idea: A functor is a homomorphism of categories.

        And, finally, from the issue that I opened:

        The central idea behind a functor is that it is a map between categories; for every arrow in the source category, the functor designates an arrow in the target category, such that identity and composition (the algebraic laws for categories) are preserved.

        I don’t mind contributing, but how am I supposed to simplify this idea when the article prefers to make it more complicated instead?

        1. 10

          I find Wikipedia’s mathematics articles frustrating in that they’re generally not approachable by non-mathematicians. (IMHO, of course, but I speak as a career programmer who has a B.Sci Eng. from a fairly elite university and did minor in math for a year until defeated by finite fields.)

          To wit, the definition of functor from WP (that you quoted) doesn’t bother to explain what “a mapping between categories” means; it thinks it sufficient to have linked to definitions of “mapping” and “category”. (And the one for “mapping” is to a dictionary definition, which is even less helpful.)

          The result is that Wikipedia’s math articles are an endless rabbit hole where the reader finds themself in an ontological free-fall of definitions, unless they decide to stay in one article and hack their way through a dense thicket of unexplained terminology like “functors were first considered in algebraic topology, where algebraic objects (such as the fundamental group) are associated to topological spaces, and maps between these algebraic objects are associated to continuous maps between spaces”, which is literally the second sentence in the article.

          (I know textbooks are often written this way, but usually only the more advanced ones in a field, and textbooks are usually provided along with lectures by a prof who goes into more detail at a shallower angle.)

          The ironic thing is that this is against Wilipedia’s policies, such that they have a canned warning to paste on articles saying that “this is written such that only an expert can understand it.” And yet I’ve never seen that warning on their math articles…

          The glossary in question may be less accurate than the sources you quote, but I found it approachable and comprehensible. It’s a shame it has errors, but I think I’d rather come away with a sketchy understanding of functors or monads than bounce completely off them and be turned off of the entire topic.

          1. 2

            For me, too, the glossary is something I can read and understand. I’m pretty good at maths but I struggle with strict definitions in mathematical language. Give me something in plainer English and I’ll dig into it to understand and resolve ambiguities and eventually get to the point where the mathematical language seems obvious.

            1. 1

              At least the math folks seem to be self-aware https://en.wikipedia.org/wiki/Abstract_nonsense

              1. 1

                It didn’t used to be that way, for reference.

        2. 2

          Arity, closure, side-effects, idempotence, and contracts are things on this list that you should know to be a good programmer even if you never stray anywhere near the FP world. And if you work in a language that has first-class functions then you should be at least passing familiar with higher-order functions and be able to read one without fear, even if you choose not to write one.