Hacker News new | ask | show | jobs
by startling 3529 days ago
Functions are one kind of arrow. There are other arrows besides functions.

Renaming "arrow" to "function" is like replacing "number" with "1".

1 comments

What other types of arrows are there?
Some examples of categories whose arrows aren't functions:

(0) Any monoid can be viewed as a category with a single object. The arrows from the object to itself are the monoid's elements.

(1) Any preorder can be viewed as a category such that, between any two objects, there is at most one arrow, precisely when the source is less or equal than the target.

(2) Given a directed graph, or more generally a quiver[0], there is a small category[1] whose objects are the quiver's nodes, and whose arrows are the paths (finite sequences of edges) from a source node to a target node.

[0] https://en.wikipedia.org/wiki/Quiver_(mathematics)

[1] https://en.wikipedia.org/wiki/Free_category

State machines & object dependencies [and function composition, and... categories] are often drawn as directed graphs. When drawn like that, the circles/boxes represent objects, and the arrows represent arrows. The name comes from that kind of representation.

You can call them morphisms, too.

Then from what I'm understanding it's not an "arrow", it's something closer to a "step" or a "process". Some method to get from one location to another. An arrow means nothing without background information. If I say it takes "10 arrows to get from A to x(A)" as a way to explain there are 10 things happening in the function X, then wouldn't it be better to say it takes "10 steps/processes to get from A to x(A)"?

> The name comes from that kind of representation.

The representation, the way I conceive it, is a mode for displaying computational or data in a spacial manor. As such relating a computational or mathematical process to a spacial terminology would be a "step" not a stick with a rock at the end of it.

Does step help when thinking of the objects as individual data elements, the arrows as cons-links, map being a functor that respects cons-links [i.e. does not change the structure of the list]? The problem here is that implying process, ordering, or anything else is too narrow of a definition for what an arrow/morphism can be used to represent. That's why arrow (a thing that points to another thing), or morphism (a thing that helps define the shape) are actually better terms. Because Category Theory isn't about the things, it's about the relationships between the things, how these can be composed, and how higher-order operators that respect these relationships [and the new ones they represent for even higher-order operators] can form new relationships which can also be composed.
Given any set with a partial ordering you can construct a category whose objects are the elements of that set and that has an arrow from a to b if and only if a <= b.