higher order function

Higher Order Functions in Scala

Reading Time: 3 minutes Introduction: Some functions are called higher-ordered functions as they accept functions as parameters. You can also have a higher-order function as one that returns the functions. So basically, if there is a function that deals with a function, is kind of a meta-level, we call it higher order. Why do we use higher order functions..?? Because we want to be able to reuse our code Continue Reading

A Simple Introduction to Higher Order Functions in Scala

Reading Time: 4 minutes Overview In this blog, we’ll understand the concept of higher order function in Scala. Also, we’ll learn about some of the most commonly used higher order functions in Scala. Higher Order Function A function is said to be a Higher Order Function if it can take another function as an argument or returns a function as its result. This is possible because of the fact Continue Reading

Higher Order Functions and Closures in Scala

Reading Time: 2 minutes In this blog, we will go through the concepts of higher order functions and closures in Scala with the help of example. 1. Higher Order Functions A higher order function takes other functions as parameter or returns a function as a result. Let us understand it better with the help of examples: a) When a method is passed as an argument: Output: Open In the Continue Reading

Scala Beginner Series (3) : Functional Scala

Reading Time: 4 minutes This series is all about the taste of Scala.It is best suitable for all the newbies in Scala. You may also like: Scala Beginner Series (1) : BasicsScala Beginner Series (2) : Object Oriented Scala In the previous part, we covered the: Classes, constructors, inheritance, and abstract classes Traits and anonymous classes Singleton objects and companion objects Case classes and case objects This article will cover the functional Continue Reading

Unfolding foldLeft and foldRight in Scala

Reading Time: 4 minutes The fold method is a Higher Order Function in Scala and it has two variant namely,i. foldLeftii. foldRightIn this blog, we will look into them in detail and try to understand how they work. Before moving ahead, I want to clarify that the fold method is just a wrapper to foldLeft, i.e. the fold method internally invokes the foldLeft method. So, now let’s get started. Continue Reading

kafka with spark

Apache Spark 2.4: Adding a little more Spark to your code

Reading Time: 5 minutes Continuing with the objectives to make Spark faster, easier, and smarter, Apache Spark recently released its fifth release in the 2.x version line i.e Spark 2.4. We were lucky enough to experiment with it so soon in one of our projects. Today we will try to highlight the major changes in this version that we explored as well as experienced in our project. In our Continue Reading

Back2Basics: Demystifying Eta Expansion

Reading Time: 4 minutes In this blog, we will talk about eta expansion in Scala. How they behave under the hood before and after Scala version 2.12. Scala has both methods and functions in Scala. We refer them interchangeably but there are situations where the difference matters. class Test { val isEvn = (x: Int) => x % 2 == 0 def isEven(x: Int) = x % 2 == Continue Reading