Demystify Scala Functions
Scala is a functional programming language. So, functions are the basic building blocks in Scala. In any other programming language, learning about the function is as simple as learning one basic syntax. I mean, you just need to know the syntax to define a function. However, that approach does not work with Scala. I often see many confusions around Scala functions that makes it difficult for a beginner. I blame two things for causing this trouble.
- Optional components and flexible syntax.
- Jargons and Functional Programming concepts.
There are several optional components and flexible syntax. They often create much confusion. Then, there are a bunch of functional programming jargons. I have already tried to separate out some of the jargons in a separate article series for an introduction to functional programming. This article takes a systematic and step by step approach to eliminate all the confusions around Scala functions. In this article, I am going to cover following things.
- Basics of Scala functions
- Function Literals in Scala
- Function values
- Local Functions
- Variable length argument
- Default values and named arguments
- Scala placeholder syntax
- Higher Order functions
- Partially applied functions
- Function currying
So, with the stage set, let's take these concepts one by one.
Read Next
Basics of Scala functions | Function Literals in Scala | Function values | Local Functions | Variable length argument | Default values and named arguments | Scala Placeholder syntax | Higher Order functions | Partially applied functions | Function currying