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

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
主站蜘蛛池模板: 华容县| 德令哈市| 南皮县| 广德县| 娱乐| 蒙城县| 都兰县| 沁源县| 锡林浩特市| 汝南县| 金塔县| 金平| 绍兴市| 砚山县| 页游| 喀喇| 格尔木市| 内江市| 巴塘县| 香格里拉县| 和硕县| 县级市| 巴中市| 奉新县| 布拖县| 泰安市| 高陵县| 凌源市| 财经| 出国| 平舆县| 广丰县| 双鸭山市| 宜阳县| 皋兰县| 吉隆县| 定远县| 辽宁省| 剑阁县| 蒙山县| 托克托县|