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

Deep Dive into Functions

Scala combines both object-oriented and functional programming paradigms. In particular, functions are a first-class language concept. They can be defined in a variety of ways, assigned to variables, passed as parameters, and stored in data structures. Scala gives a lot of flexibility with regard to how these actions can be performed.

We'll start this chapter by looking in detail at different flavors of defining a function. We'll then go on and apply the knowledge about types from the previous chapter to make our functions polymorphic and higher order. We'll study recursion, tail recursion, and trampolining as important aspects of functional programming for the JVM. Finally, we'll evaluate peculiarities related to the fact that functions in Scala are implemented in an object-oriented way.

The following topics will be covered in this chapter:

  • Ways to define a function
  • Polymorphic functions
  • Higher order functions
  • Recursion
  • Trampolining
  • Object-oriented aspects of functions
主站蜘蛛池模板: 花莲县| 多伦县| 会宁县| 视频| 永寿县| 诸城市| 凤翔县| 平南县| 临清市| 五台县| 蕉岭县| 沙河市| 句容市| 临沧市| 泰州市| 漯河市| 昭觉县| 运城市| 安溪县| 剑川县| 湾仔区| 元氏县| 衢州市| 长垣县| 皮山县| 高邮市| 临清市| 岐山县| 大方县| 安化县| 阿克苏市| 霞浦县| 闽清县| 喀喇| 高尔夫| 临湘市| 屏东县| 吉林市| 西和县| 侯马市| 沧源|