My Notes

notes about functional programming and research in computing science

Composing multiple functions – the foldr way

This problem comes from the reddit haskell question here: Haskell question regarding foldr The exercise can be stated like this: given a list of functions (with appropriate types), construct the composition of the functions from that list using a foldr. The… Continue Reading →

Share Button

Re: the mean example explained in detail

In this post I’ll discuss in detail an example found in “Real World Haskell” ([1]) and “Thinking Functionally with Haskell” ([2]). The point of this post is to explain in detail some important functional transformations from an inefficient program to… Continue Reading →

Share Button

Some simple derivations of recursive functions

The following are some personal notes on how a study of classical mathematical notations can help us to derive algorithms. The functions obtained in this way are simple enough to understand and clarify the technique used. As an aside, I… Continue Reading →

Share Button

Heuristic guidance from equational reasoning

Working through the exercises of Richard Bird (Thinking Functionally with Haskell), I found a particular one that can be used to illustrate how equations can give us heuristic guidance in solving particular functional problems. The same pattern of thought will be… Continue Reading →

Share Button

Monoids and their efficiency in practice

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 →

Share Button

Cartesian product of lists

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 →

Share Button

An exercise in equational reasoning

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 →

Share Button

CodeEval Challenge – Correct Algorithm for Self Describing Numbers

In this post I’ll show you how you can practically apply formal methods to obtain a correct algorithm to solve a problem. The chosen problem is a challenge posted on CodeEval: Self Describing Numbers Simply put, a self describing number… Continue Reading →

Share Button

Test if a string is a palindrome – a functional programming approach in Haskell

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 →

Share Button

Functional programming – how to naturally construct basic functions. Part 1 – “until” function

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 →

Share Button

© 2022 — Powered by WordPress

Theme by Anders NorenUp ↑