2017 PSLE Math Question

Answer: 10 (Yes!) but why ?

…(see explanation here )

Advertisements

Advanced Kotlin Education

Kotlin’s real power is to explore its Functional Programming features, besides the “cosmetic” improvement of concise codes to avoid Java’s annoying boilerplates.

Note: https://www.raywenderlich.com/173352/raywenderlich-com-goes-kotlin-and-needs-tech-editors

* Level of difficulty (* = Simple, ** = Medium, *** = Difficult)

0. What is Functional Programming ?

This Romanian IT expert introduces us to Functional Programming (FP). He has the advices:
1) No need to know deep Category Theory (CT)- but nice to know little bit. (In Romania, the students learn CT in Grade-12 (equivalent JC2);
2) Haskell is the lingua franca of FP. Learn it to understand most FP concepts, even if you later use other FP languages (Kotlin, Scala);
3) Dynamic Type languages (Lisp, Clojure) are not good, because only Static type (eg. Kotlin, Java with “final”) can ensure Immutability which is the essence of FP;

https://alexn.org/blog/2017/10/15/functional-programming.html

1. Sequence over Collection, Sealed Class, Object => new Class

https://medium.com/@manuelvicnt/kotlin-education-d0b958740d6a

2. Function Literal (Lambda Expression) (**)

https://tech.io/playgrounds/6973/kotlin-function-literal-with-receiver

3. “Either” Monad (**)

hcodesttps://kotlin.link/articles/Exploring-an-Either-Monad-in-Kotlin.html

4. Kotlin “DI” Dependency Injection – the “Reader” Monad vs Java Dagger: (***)

View story at Medium.com

5. Function Memoization (**)

View story at Medium.com

6. Remove all ugly “!!” with these 6 Kotlin techniques (*)

https://android.jlelse.eu/how-to-remove-all-from-your-kotlin-code-87dc2c9767fb

7. Generic Extension Function (aka Polymorphism) (**)

https://dzone.com/articles/kotlin-generic-extension-functions

8. Co-routine (Weather app demo) (***)

https://blog.elpassion.com/create-a-clean-code-app-with-kotlin-coroutines-and-android-architecture-components-f533b04b5431

9. Free Monads (***)

https://github.com/JorgeCastilloPrz/KotlinAndroidFunctional/pull/6

10. Free monoids and Free Monads (***) – (in Scala codes)

http://blog.higher-order.com/blog/2013/08/20/free-monads-and-free-monoids/

11. Operator Overloading (Antonio’s Chap 11) *

https://dzone.com/articles/operator-overloading-and-conventions-in-kotlin

12. Android UI Fragments in Kotlin

https://www.raywenderlich.com/169885/android-fragments-tutorial-introduction-2

13. Design Patterns in Kotlin

https://www.raywenderlich.com/168038/common-design-patterns-android-kotlin

14. Static Method (Companion Object)

https://dzone.com/articles/kotlin-static-methods

Kotlin 1.2 Multi-Platform Project

This language feature of writing only once and run on many platform was promised by Java in 1999 through JVM.

Kotlin, a successor of Java supported officially by Google since May 2017, goes further than Java on ambitious multi-platform, not only through Android’s Delvick JVM (a modified version of Oracle’s JVM), also on JavaScript engine (in supported browsers), and compiled to (future) native codes on Microsoft Windows…

http://kotlinlang.org/docs/reference/multiplatform.html

Kotlin 1.2 Beta Release 30/9/2017:

https://blog.jetbrains.com/kotlin/2017/09/kotlin-1-2-beta-is-out/

Zhihu 知乎: 环Ring, 域Field, (半Semi-)群Group, 幺半群 MonoId

数学中代数的有两个名词:环,半群,请问环为什么叫做环,它和汉字里的环(字典中的意思)有什么相同之处;同样,半群为什么叫做半群,这个”半“字是怎么解释呢?

[葛利流,数学科技]

(I) 环和域
环 (Ring) 是德文, 这名词是David Hilbert发明的。
“环”最好的例子: 整数(Integer) 记作 Z (德文Zahl) 是个环。 他研究 Clock Arithmetic 时钟 是个 Modular Arithmetic (Mod 12)运算, 比如 15 = 3 mod 12

钟表上的整数 Z 数字 排成 一个钟的环状, 故称 此数是 “Zahl Ring” 整数 “环”。

Hilbert 的得意女弟子 Emile Noether 把 环论 发扬光大, 创造 “Noether Ring”。

如果 把 “12” 变成 任一素数 p , “环”就升级成”域” (Field) – 除了有环的( + – *) 运算, 还可以 (÷)。

Hilbert 发现 “环”有个重要性质是含有 “理想” (Ideal) – 理想 * 任何”外面”的东西 还回来”里面”。
例子: Z Ring 里有 “0”, 2Z, nZ…
0 * 任何Z数 => 回来 “0家族里面”
偶数 2 * 任何Z数 => 回来” 偶数 (2Z)家族里面”

大名鼎鼎的中国古代算术”韩信点兵”就是 含有 “环 和理想”的理论。

(II) 群 Group / 半群 Semi-Group / 幺半群MonoId
Group 群 有4个性质 C.A.N.I.
C: Close 封闭性
A: Associative 连续性
N: Neutral (or Identity = Id) 幺元
I: Inverse 逆元

Semi-Group 半群 只有2个性质: C.A.

Monoid 么半群 : C.A. + N (= Id) => Mono + Id

https://www.zhihu.com/question/20564445/answer/233486338