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

Scala: Generic classes and Variance

Reading Time: 4 minutes Generic classes are classes which take a type as a parameter. This means, one class can be used with different types without actually writing down it multiple times. They are particularly useful for collection classes. Defining a generic class: Generic classes take a type as a parameter within square brackets [ ]. One convention is to use the letter A as type parameter identifier, though Continue Reading

ScalaFP: Mystery Of Scala Higher Kinded Type.

Reading Time: 3 minutes Scala type system holds a lot of mysteries. Sometimes these mysteries confuse us but mostly they provide us with a powerful feature. Today we will be discussing one of them called Higher Kinded Type Or Second Order Type. Before moving to higher kinded type lets brush up our basics first. Higher Order Function: So, functional programming follows an artistic rule called “functions are the first Continue Reading