Folding things with Functional Programming

Introduction In this post we will discuss the concept of fold in functional programming: fold functions are used to reduce a data structure containing multiple values into a single one. Associated to the idea of fold are the concepts of recursion: via recursion, fold traverses the different elements of the data structure. summarisation: the data …

Focus on your data structures with Scala lenses

With new programming techniques come new problems and new patterns to solve them. In functional programming, immutability is a must. As a consequence, whenever it is needed to modify the content of a data structure, a new instance with updated values is created. Depending on how complex the data structure is, creating a copy may …

From Functional to Imperative programming

In The power of generic algorithms, we mentioned the need of taking into consideration the physical limitations of time and space when writing an algorithm. In this post, we will show how the anatomy of an algorithm varies as successive optimisations are added. This change is reflected, especially, in the shift from a functional to …