https://dev.to/jvanbruegge/what-the-heck-is-polymorphism-nmh

Examples: Generics

What is an algebra? by Tikhon Jelvis https://www.quora.com/What-is-an-algebra/answer/Tikhon-Jelvis?ch=3&share=2dd8711d&srid=oZzP

“Basically, an algebra is just an algebraic structure. It’s some set A along with some number of functions closed over the set. It’s a generalization over the structures we normally study: a group is an algebra, a ring is an algebra, a lattice is an algebra… etc.

Algebras have different “signatures” which specify the functions it has. For example, a group is an algebra that has an identity element, a function of one argument and a function of two arguments.

That is, a group with a carrier set A is just a tuple:

⟨A, 0:A, −:A→A, +:A×A→A⟩

For uniformity, we can write all of these as functions in the form An→A, where n is the “arity” of a function—the number of arguments it has. The identity element is a function A0→A, which just identifies a single element from A. Thus, we can talk about the signature of an algebra as the arities of its functions.

A group would be (0, 1, 2) while a ring would be (0, 0, 1, 2, 2).

Generally, the functions of an algebra have to be associative. Sometimes, we also look at other laws—for example, we might want to study algebras with commutative operations like Abelian groups.

So the intuition for an algebra in general is that it’s any structure like a group, a ring or whatever else we like. As the name “structure” implies, these additional operations on a set expose the internal structure of its elements:

a group describes symmetries, a lattice describes a partial order and so on.

The study of algebras, then, can be thought of as the study of “structured sets” in general.”

The “war” of **OOP** vs *FP* is akin to **Applied Math** vs *Pure Math*.

The formers (OOP & Applied Math) are not “rigourous” but practical, compared to the laters (FP & Pure Math) which are elegant but too abstract for popular usage.

OOP: SmallTalk and its followers – C++, C#, Objective-C, Java…

FP: LISP and its followers – Haskell, Clojure, …

The “hybrid” (OOP&FP): Scala, Kotlin (Google: Java ‘cousin’), Swift (Apple: Objective -C ‘cousin’), F# (MicroSoft)

The “cons” of OOP, which are bad for concurrency / parallel computing in multi-cored CPU:

- State changed
- Side-effect
- Mutability of data
- Polymorphism

https://blog.cleancoder.com/uncle-bob/2014/11/24/FPvsOO.html

How to keep state (counter, threshold, etc) in Functional Programming without BAD side effect ?

https://dzone.com/articles/functionalfun-states-in-functions-cache-lazy-and-c

**Key Point**:

Haskell & any FP compiler don’t check the Category Theory proof if your codes (eg. fmap) follow Functor’s Laws (eg. Preserve structure, identity) or Monad’s Laws !

I hate Android Architecture since it is based on OO Java, Kotlin is FP cousin of Java, hopefully it could simplify the Android Architecture by getting rid of the complex OO architecture. Here Antonio attempts to simplify it with more terse Kotlin codes, albeit still in the OO architecture spirit.