26. Effect-Free
– Dad, how do I
10
Wednesday, October 3, 12 10
27. Effect-Free
– Dad, how do I
- print("Hello")?
10
Wednesday, October 3, 12 10
28. Effect-Free
– Dad, how do I
- print("Hello")?
- write to a file?
10
Wednesday, October 3, 12 10
29. Effect-Free
– Dad, how do I
- print("Hello")?
- write to a file?
- do both?
10
Wednesday, October 3, 12 10
30. Effect-Free
Are you functional?
Kotlin V X
– Dad, how do I
- print("Hello")?
Groovy V X
- write to a file?
Scala V X
- do both?
Java 8 V X
Recursion Pure
10
Wednesday, October 3, 12 10
31. Summary
• FP makes things simpler
• Sometimes at a huge price
• Our languages are
not purely functional
11
Wednesday, October 3, 12 11
32. Higher Order
FP brings order :)
Wednesday, October 3, 12 12
48. Example: Messages
Server Client
search for "lambda"
19
Wednesday, October 3, 12 19
49. Example: Messages
Server Client
search for "lambda"
exact match at ...
19
Wednesday, October 3, 12 19
50. Example: Messages
Server Client
search for "lambda"
exact match at ...
similarity at ...
19
Wednesday, October 3, 12 19
51. Example: Messages
Server Client
search for "lambda"
exact match at ...
similarity at ...
message ::= search for term
| exact item
| similar item
19
Wednesday, October 3, 12 19
52. ADT
Abstract Algebraic
data type data type
~I ~D
nte ata
rfa cla
ce ss
20
Wednesday, October 3, 12 20
53. Are you functional?
ADT
Kotlin V X V V
Groovy V X V V
Abstract Algebraic
Scala typeV
data X V data type
V
~I V ~D
Java 8 nt X V V ata
erf cla
ace ss
Recursion Pure HO ADT
20
Wednesday, October 3, 12 20