##### Tag

As we observed in the post about equational reasoning (An exercie in equational reasoning), constructing algorithms based on laws can help us gain a lot in efficiency. Let’s introduce a little theory first. A monoid is a pair (M,o) where… Continue Reading →

One of the patterns of problem solving in programming is the Exhaustive Search. This is simply saying that to find a solution to a specific problem, you have to search all the possible solutions and validate them based on some… Continue Reading →

This is an exercise found in the very good book of Richard Bird, Thinking Functionally with Haskell. It is a good example of how a certain method of thinking can help us to reason about programs in functional programming. The method… Continue Reading →

I could write this post by showing directly my solution and why it is efficient, but this is a kind of exposition that implies arrogance. Instead, I want to show you how functional reasoning allows you to write efficient programs…. Continue Reading →

When one meets for the first time functional programming, the first impression is that some higher order functions are too hard to cope with and to understand the basics is a little tricky. In this post I’ll show that is… Continue Reading →

One of the most useful things that you encounter all the time in programming is applying the same principle on every number in a sequence. For example, sometimes we have a list of numbers: [1,2,3] and we want to construct… Continue Reading →

When we work with infinite lists in Haskell, one important problem is: Problem. Construct a list which generates all the distinct ordered pairs of natural numbers. So, we want a method to generate the set: {(0,0), (0,1),(0,2),…, (1,0), (1,1),(1,2),…} etc…. Continue Reading →