官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 建湖县| 赤城县| 靖远县| 岱山县| 安达市| 东港市| 黄浦区| 松原市| 崇礼县| 博白县| 安阳县| 龙江县| 新宾| 垫江县| 长丰县| 通许县| 元朗区| 阳山县| 竹溪县| 营口市| 蓬莱市| 错那县| 通化市| 武冈市| 固阳县| 广安市| 乳源| 福州市| 陕西省| 西乌珠穆沁旗| 晋江市| 淮滨县| 濮阳市| 焦作市| 来宾市| 宁乡县| 昭通市| 靖边县| 叙永县| 通海县| 南宁市|