back2basics

Introduction to Akka Streams – Part 1

Akka Streams is a library that is used to process and transform a stream of data. In this blog, I’ll be discussing the components of Akka Streams. Akka Streams is an implementation of Reactive Streams and uses bounded buffer space, and this property is known as boundedness. To use Akka Streams, add the below dependency in your build.sbt:

Extracting values using Regular Expressions

Regular expression is a sequence of characters that define a search pattern. Regular expressions are used to find particular sequences in a string or is used to extract value from a string. Fields of application range from validation to parsing/replacing strings, passing through translating data to other formats and web scraping.

monads

Back2Basics: Exception Handling – #4

In the previous series of blogs, we have seen how we can do error handling in Scala. In this blog, we will explore yet another way of handling exceptions using the functional style of programming. Scalactic is a library which provides an “Either with attitude” named Or, designed for functional error handling. Or gives you more convenient chaining of map and flatMap calls (and for Continue Reading

monads

Back2Basics: Understanding Partially Applied Functions

In this blog, we are going to talk about Partially applied functions and its use case. Before starting, first, we will emphasize that though Partial functions and Partially applied functions sound similar they are different from each other. To understand Partial Functions refer. What is function application? Applying a function is called calling a function. When we pass all arguments of the function, we can Continue Reading

Scala Extractors

Back2Basics: Scala Extractors in Detail

While working with the Case Classes closely, we have a very concise way to decompose an entity using pattern matching. The potent example is pattern matching on the Some(x) and None, as most of us know they are case class and case object respectively. The potential question that we have is do we have a provision to use similar patterns without having an associated case Continue Reading

monads

ScalaFP: Firsthand With Scala-Cats Monads – #1

In the previous post, we had a look at the reasons behind the monads and how monads can help us design the programs in a functional style. Now we are going to explore some of the monads which are frequently used in the applications but not available within the Scala predefined libraries. We will be exploring the monads which are provided by the scala-cats functional Continue Reading

monads

ScalaFP: Let’s Find The Reasons Behind Monads.

Monads in Functional Programming play an important role but they mostly confuse the beginners. One of the reasons for the confusion is that they mostly have a knowledge of imperative style programming, where they have no idea about function composition and its importance. In the terms of functional programming, the composition is the root where we have a set(Z) and we compose the elements of Continue Reading

monads

Back2Basics: Exception Handling – #3

In our previous blog Exception Handling – #2, we talked about how we can handle exception using Either. In this blog, we will explore further about Either, how we can elegantly handle exceptions using Either while working with Collections. We use collections when we want to perform some operations on elements. But what if something goes wrong while performing the transformation, do you have any Continue Reading

monads

Back2Basics: Understanding Partial Function – #2

In previous blog Understanding Partial Functions – #1, we have talked about what is partial function and how they are different from regular functions. In this blog, we will explore more about the partial function. We have talked about how we can define partial functions having one argument. But what to do if we have to pass more than one argument. Let’s try defining divide Continue Reading

monads

Back2Basics: Exception Handling – #2

In our previous blog, we have seen how we can handle exceptions using try/catch and Try block.  In this blog, we will explore how we can handle exceptions using Either. Either, just like a Try, is also a container type which can have one value either Left or Right at a time. We can also use Option to handle exceptions but if an exception occurs returning Continue Reading

monads

Back2Basics: Exception Handling – #1

While building an application, it is common that something might go wrong. What if there is an attempt to divide a number by 0 or fetching the data from the database which does not exist, or reading a file which can’t be located? We need to handle such situations to make sure our application does not go down. Every language provides ways to handle such Continue Reading

monads

Back2Basics: Catalogue #2

Knoldus Inc is pleased to announce the launch of “Back2Basics: Tutorials”. We at Knoldus firmly believe that quality of coding plays an important role in the success of any IT organization and here we are adding a few more steps to heighten out coding benchmarks. At Knoldus we are laying the foundation for adopting healthier scala coding environment through getting and setting our Basics right. In our Continue Reading

monads

Back2Basics: Understanding Partial Functions – #1

  In this blog, we will talk about partial functions. We know about functions in Scala. Let’s talk about it first. So, what is a function? A function is a mapping or a transformation of an input to an output. For example,  we have function isEven, which takes an int value and retuns boolean value. scala> def isEven(x :Int) = x % 2 == 0 Continue Reading

%d bloggers like this: