Home » Functional Programming » Functional programming in Scala

Functional programming in Scala

Functional Programming focuses on using functions as the basic units to construct the whole program. As a first step to get an insight into Functional Programming in scala, I summarize here some functional programming techniques in the scala language to build the functions.

1. Local functions
Like local Variables, local Functions can be defined inside a function


2. Function values
You can define a function without name (which is called a function literal) and then pass them around as a value after compiled (which is called a function value). You can store a function value in a variable, since a function value is also an object.


3. Partially applied functions
A partially applied function is an expression in which you don’t supply all of the arguments needed by the function. Instead, you supply some, or none, of the needed arguments.


4. Closures
A closure is a function value of a function literal with free variables


5. Curried functions
A curried function transform a traditional function with one list of multiple parameters to multiple lists of one parameter.