Data Science with Kotlin


Explore Kotlin’s Advanced Functional Programming

Since May 2017 Kotlin released by Google, 12.8% Java developers have converted to Kotlin, yet they still keep to the OO spirit of Java (for Interoperability) , not taking full advantage of FP capability of Kotlin. The OO Design Patterns of Android Java still being used instead of the FP more elegant “Monadic” Design.

1. Interview with Kotlin Designer:

2. Android Studio 3.0 Released :

2a. Android Studio v3.0 with Kotlin built-in & many improvements.

(The previous stable v2.3 needs seperate Kotlin plug-in)

2c: Gradle upgrade

3. Inner / Infix Function

4. Test (Mockito)

Kluent library:

5. Function vs Procedure vs MethodKotlin simplifies all 3 into 1 : Function which always returns a value or UNIT.

View story at

6. Kotlin has which Java lacks … “with“, “?”, …

7. Kotlin Operator Overloading aka “Convention”: ‘plus’ / ‘+’

8. JVM Byte Code Generation:

9. Reified Types

10. SICP: Sequence as conventional interfaces: eg. flatmap, map, reduce, fold


12. Generic : Kotlin入门(11)江湖绝技之特殊函数

13. Array <String>: Kotlin入门(4)声明与操作数组

14. ViewPager (Horizontal Swipe)

15. Kotlin 1.2 Beta & Multiplatform iOS

16. Kotlin Edu ( Android Studio 3.0)

17. Kotlin Style Guide

18. Android Layout Foundamental – ConstraintLayout

19. Android SDK

20. Javalin v1.0 – Web Framework for Java + Kotlin

21. Ten Modern Features (Kotlin, Clojure, Javascript, Swift…)

View story at

22. Function literals with receiver

23. Sealed classes: (restricted types no “else”)

24. Android Intent

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.


* 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;

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

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

3. “Either” Monad (**)


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

View story at

5. Function Memoization (**)

View story at

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

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

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

Co-routine Recipes (***)

9. Free Monads (***)

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

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

12. Android UI Fragments in Kotlin

13. Design Patterns in Kotlin

This is still the old Java O-O spirit with abstract (& complex) Design Patterns brought over to Kotlin (which is FP + OO).
FP should get rid of OO thinking!

14. Static Method (Companion Object)

15. Android Animation

16 Kategory (***)

View story at

17. Cross-platform strategies (***)

View story at

18 Screenshot Testing (Espresso)

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…

Kotlin 1.2 Beta Release 30/9/2017:

Kotlin / Java With Android Studio 2017

Antonio Leiva; Kotlin for Android Developers (Online) – preview




ProGuard (Shrink Apps Code Size to remove unnecessary support libraries)


How to Start Programming – Lesson 1

Java & Android Studio


Mobile Apps’ 2 Camps: Android Kotlin vs iOS Swift

Today mobile apps world is divided into 2 camps:

  • The original Apple iOS camp with 2000s ObjectiveC (improved version Swift from 2015), and
  • The Google Android with 1997 Java “JVM” (improved version Kotlin from 18 May 2017).

Both improved languages (Swift & Kotlin) use Functional Programming features eg. “Type” = Category Math, Data immutability (can’t change at run-time for safe concurrency), execution by composition of “componentised” Functions, including ‘advanced’ aka ‘higher-order’ functions eg reduce, map, filter, etc… which are Category-Math Functors, ‘Monoids’ and its cousin ‘Monads’ for handling side-effects (printl, update database, error msg…).

From 2018 we see these 2 mobile camps unifying into 1 language independent of vendors like the Fortran/Cobol in early 1970s, but which one ? may be one of the “Grand-Fathers” of the “Pure” Functional Programming Haskell (1993) would be adopted by an independent consortium ala W3C Consortium (WWW).