Functional Programming

Cats Effect : Pure Functional way to code in Scala

Reading Time: 2 minutes Follow 5 Simple Rules with Cats Program written using Cats Effect provides incredibly strong guarantees and powerful functionality, performance, safety, and composability, provided you follow each of the following rules: Wrap all side-effects in delay, async, blocking, or interruptible (pro tip: try to keep the size of your delay blocks small; two delays with a flatMap is much better than one big delay) Use bracket or Resource for anything which must be closed Never hard-block a thread outside of blocking or interruptible Use IOApp instead of writing your own def main Continue Reading

How to Tackle Error in Rust Programming

Reading Time: 3 minutes An Error is basically an unexpected behaviour that may lead a program to produce undesired output or terminate abruptly. Error handling is the process of handling the possibility of failure. In Rust, errors can be classified into two major categories. Recoverable UnRecoverable Recoverable Error Recoverable errors are those that do not cause the program to terminate abruptly. Such as a file not found error . Continue Reading

Referential Transparency in Java Programming

Reading Time: 4 minutes what is functional programming ? It is a declarative style of programming rather than imperative. The basic objective of this programming is to make code more concise, less complex, more predictable, and easy to test. Functional programming deals with certain key concepts such as pure function immutable, state, assignment-less programming etc. Imperative Vs Declarative Programming In the imperative style of coding, we define what to Continue Reading

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

How to use Pattern Matching in Rust

Reading Time: 3 minutes Rust has an extremely powerful control flow operator called Match. Pattern matching in Rust works by checking if a place in memory matches a certain pattern. Patterns can be : literal values variable names wildcards, and many other things Destructuring using Pattern Matching Pattern matching can use to destruct following items : Structures Enums Tuples  Destructuring breaks up a value into its component pieces. The syntax used is Continue Reading

Generics : How to use them and Implement them in Rust

Reading Time: 4 minutes When we want to write code for multiple contexts we use Generics. It give us primitives to declare placeholder that allow us to focus less on the specific types. It allows us writing a more concise and clean code by reducing code-duplication and providing type-safety.  Generic Functions In a generic definition, we write the type parameter between open and close angle brackets after the name. In Rust, generic also describes anything that accepts one or more generic type Continue Reading

Magnetometer as Compass | The stm32f3-Discovery Board Sensor-“Part-1”

Reading Time: 4 minutes Hi people, hope you are doing fine. In today’s blog, we are going to build a Compass. Yes, you read it right we are going to build a Compass using a Sensor of the stm32f3 -Discovery Board. In the previous blog, we read about a package named Lsm303dlhc which basically works for the older version of the Discovery board. We do have a newer version of Discovery Continue Reading

What are the different types of collection in Rust

Reading Time: 4 minutes Rust’s standard library includes a number of very useful data structures called collections. A collection is something that holds zero or more elements in some fashion that allows you to enumerate those elements, add or remove elements, find them and so forth. Rust’s collections can be grouped into four major categories: Sequences Maps Sets Misc Sequences Collection Sequences are supported in many forms in Rust. Vec Continue Reading

How to work with “No Invalid Address”? Safe Access

Reading Time: 3 minutes In the previous blog, we tried to write directly to the BSRR Register address and that was not Safe Access because of which we fall into Hardware Fault exception. You can read that blog from here. Now in this blog, we are going to work in a very different way. We are not going to use the BSRR register instead of that we are going Continue Reading

Let us Build Checkers, the Board Game in Rust

Reading Time: 4 minutes In my previous blog, you have seen how to build checkers game and implements its basic rules using WebAssembly. In this blog, we build Checkers game using Rust programming language. Let’s get started To get started, type the following in the terminal: Now rustycheckers the library project is created. Setting Up the Checkers Board To start writing the code to manage the game board, the Continue Reading

Optional Class in java 8

Reading Time: 2 minutes In this blog, we will understand what is the optional class and do we really need it? When you start writing the code in any project and one thing you always care that is the Null pointer exception and we apply many checks to prevent this error and try that error Never come in our code. that’s why we want something so that we can Continue Reading

Lambda Expression in Java 8

Reading Time: 3 minutes In this blog we will understand what is the lambda expression and why we need lambda expression and how we use lambda and about the functional interface. What is Lambda Expression : It is an anonymous function. Not having name No return type and no modifiers. Syntax of Lambda : The syntax of a lambda consists of the following: A comma-separated list of formal parameters Continue Reading

Introduction to Java Stream API

Reading Time: 3 minutes Hi friends in this blog we are going to cover streams, parallel streams and some of the popular function associated with them with example. Introduction Streams are wrappers around data source, which make data processing in bulk easier and fast. A stream is not a data structure i.e. it does not store data. Stream is defined in package. Different ways to create Streams 1) Continue Reading