Did you know ... Search Documentation:
Pack cosmos -- docs/faq.md

What is a functor?

Most Prolog tutorials simply explain functors as "composite data". Effectively, they're very similar to what's known as `named tuples`. They may in fact just be `named tuples`.

The use of the word in Prolog predates the functional use of the word. Despite this, many of the same patterns can be used regardless of whether it's functional or language programming we're talking about. It seems being typed makes logic functors very similar to functional functors.

But what is a functor? You're free to think about this whether it is from a philosophical, mathematical or historical perspective. It gets asked a lot.

Cosmos, however, is only interested in this from a pragmatic perspective. It's enough that we can use them as a language feature to implement lists and other structures. We don't ask "what is a for-statement?". We simply use for-statements.

Is this really a functor?

We stress that Cosmos functors simply compile to Prolog functors. This would indicate they're functors, still, this always seems to spur some doubts anyway.

That's even less interesting than the first question! It's utterly pointless. Even asking what functors are is somewhat interesting.

We don't ask "is this really a for-statement?" for every language that has a slightly different for-statement.

It's enough that we can implement similar patterns. Cosmos is not interested in such discussions.