Dissecting the Function
The intended audience: Beginner level
What is the article about?
This is a continuation of the previous article where we actually did a lot more new stuff than anticipated. So we are going to take a step back in this post and simply dissect the function type in scala
. The blog contains details which are very specific to scala
programming language and there are likely chances that the concepts/techniques won’t apply to other programming languages. But I’ll try to make this a small and simple read.
Understanding Function type includes:
- SAM (Single Abstract Method).
- Syntactic sugar.
- Function Type and value.
- A bit beyond functions.
SAM.
Single abstract method interface
as the name suggest it is an interface with an abstract method. I’m sure if you are coming from an OO background, you must have created such an interface. Let’s start with an example: Implementing a
1