- Functional Kotlin
- Mario Arias Rivu Chakraborty
- 112字
- 2021-06-24 19:15:26
Pure functions
Pure functions don't have side effects, nor memory, nor I/O. Pure functions have many properties, including referential transparency, caching (memoization), and others (we'll cover these features in the next chapters).
It is possible to write pure functions in Kotlin, but the compiler doesn't enforce it as in other languages. It is up to you to create pure functions to enjoy its benefits. Because Kotlin doesn't enforce pure functions, many programmers said that Kotlin isn't a real functional programming tool, and maybe they are right. Yes, Kotlin doesn't enforce pure functional programming, and that gives you great flexibility including the ability to write in a purely functional style, if you wish.
推薦閱讀
- Java逍遙游記
- Learning Java Functional Programming
- Web交互界面設(shè)計(jì)與制作(微課版)
- 云原生Spring實(shí)戰(zhàn)
- 人臉識(shí)別原理及算法:動(dòng)態(tài)人臉識(shí)別系統(tǒng)研究
- Mastering C# Concurrency
- 編譯系統(tǒng)透視:圖解編譯原理
- Android底層接口與驅(qū)動(dòng)開(kāi)發(fā)技術(shù)詳解
- C語(yǔ)言程序設(shè)計(jì)上機(jī)指導(dǎo)與習(xí)題解答(第2版)
- Protocol-Oriented Programming with Swift
- Visualforce Developer’s guide
- 機(jī)器學(xué)習(xí)微積分一本通(Python版)
- RocketMQ實(shí)戰(zhàn)與原理解析
- Django Design Patterns and Best Practices
- Python編程基礎(chǔ)教程