After some conversations with one of my friends about functional programming and implementing algorithms in a functional way, I decided to implement create a blog post and show how we can do it in Scala. And I tried to implement the most famous sorting algorithms. It is the story behind this blog post.

Disclaimer: I am not saying these implementations are the best and the most efficient ones. What I want to do is how we can solve algorithms in a functional approach and using immutable data structures.

A sorting algorithm is an algorithm that puts elements of a list…


If you are totally newcomer to Free Monad, Free Monads Are Simple is a good point to start and you can see this link which contains some resources just for this topic.

To put in a nutshell, the Free Monad is a way to describe a program which can be run by an interpreter and is free to interpretation and the exact implementation can be developed later.

In this tutorial, I want to develop a simple Docker client by using cats-free package, that can run the following program:

For simplicity, I want to only support these five operations, The…


A Trie, (also called radix tree or prefix tree) is a kind of search tree to store a dynamic set or associative array where the keys are usually String. Each Trie starts with an empty node as the root. Every node consists of multiple branches. Each branch represents a possible character of keys.

For defining the branches they usually have an array with a fixed size for all possible characters. For example, if we are representing the English alphabet, then the total number of child nodes will be 26. (English alphabet contains 26 letters). …

Alireza Meskin

Software engineer / Linux Administrator. Berlin, Germany.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store