函数概念并不难,理解“函”字是关键——函数概念如何理解】

【函数概念并不难,理解“函”字是关键——函数概念如何理解】
https://m.toutiaocdn.com/group/6714162037842248205/?app=news_article_lite&timestamp=1563301386&req_id=201907170223060101520450386849493&group_id=6714162037842248205&tt_from=android_share&utm_medium=toutiao_android&utm_campaign=client_share

清. 李善兰 翻译 Function 为函数。函,信也。只能有一个收信人,所以 只有一个 f(x) 值。

The unique 1 single output of a function becomes very important for subsequent development in Math & IT:
functions are composable, associative, identify function,etc (distributive,… ) => it can be treated like vector => structure of a Vector Space “Vect”

Extended to..

“Vect” is a bigger structure “Category” in which “function of functions” is a
Functor” (函子)F:F(f)

Example : F(f) = fmap (in Haskell)

fmap (+1) {2,7,6,3}

=> {3,8,7,4}

here F = fmap, f = +1

The Math branch in the study of functions is called “functional” 泛函。

IT : Functional Programming in Lisp, Haskell, Scala, ensure safety of guaranteed output by math function property. Any unexpected exception (side effects: IO, errors) is handled by a special function called “Monad” (endo-Functor).

(想看更多合你口味的内容,马上下载 今日头条)
http://app.toutiao.com/news_article/?utm_source=link

A Functional Programmer’s Guide to Homotopy Type Theory (HoTT)

Since April 2019 until I re-visit this Youtube video on 12 August 2019, I can now totally understand his speech after a pause of 4 months by viewing other related Youtube (below prerequisite) videos on Category Theory, Type Theory, Homotopy Type Theory.

That is the technique of self-study:

  1. First go through the whole video,
  2. Don’t understand? view other related simpler videos.
  3. Repeat 1.

Prerequisite knowledge:

  1. Homotopy
  2. Type Theory
  3. Homotopy Type Theory
  4. Bijection = Isomorphism
  5. Functional Programming in Category Theory Concept: Monad & Applicative

Two Key Takeaway Points:

  1. In the Homotopy “Space” : Programs are points in the space, Paths are Types.
  2. “Univalence Axiom” : Paths Induce Bijection, vice versa.

Knowing Monads Through The Category Theory

https://dev.to/juaneto/knowing-monads-through-the-category-theory-1mea

While Mathematicians like to talk non-sensical abstract idea, Informaticians want to know how to apply the idea concretely:

Mathematical Parlance:

Monad = Monoid +Endofunctor

Monoid = Identity + Associative

Endo-functor = functor between 2 same categories

IT Parlance:

Monad is a ‘function’ to wrap the ‘side effects’ (exception errors, I/O,… ) so that function composition in ‘pipeline‘ chained operation sequence is still possible in pure FP (Functional Programming, which forbids side-effects).

Some common Monads: ‘Maybe’, ‘List’, ‘Reader’…
This allows monads to simplify a wide range of problems, like handling potential undefined values (with the Maybe monad), or keeping values within a flexible, well-formed list (using the List monad). With a monad, a programmer can turn a complicated sequence of functions into a succinct pipeline that abstracts away additional data management, control flow, or side-effects.[2][3]

Exploring Monads in Scala Collections

https://blog.redelastic.com/a-guide-to-scala-collections-exploring-monads-in-scala-collections-ef810ef3aec3