# Functional composition in c++11

The new functional components in c++11 such as lambda closures takes a welcomed step in the direction of making c++ more functional – in the functional paradigm sense of the word, it still remains a dysfunctional language in the sense that there is still an abundance of rope available for hangers. This post will detail my attempt at using some of that rope to make functional composition available to people who are rightfully reluctant to come close to the capricious coil.

# Using CRTP to easily hijack operators in c++11

In this post I will show a neat trick for hijacking operators in c++ without writing tons of repeating code. As an example, I will hijack the output operator <<, which is used to place objects into a stream. This allows for construction such as cout << multi('=', 80) << endl; to fill a standard console line with equality signs. The hijacking will allow me to write a very small class that focuses on the core task: to hijack the stream output iterator and put 80 equality signs into it.

2014–01–22 | c++, c++11, template meta programming, crtp

# Snaps decorum

It is no secret that we Scandinavians are fond of our flavored “vodka”: snaps, akvavit (from ‘aqua vitae’, water of life), brännvin (‘burn-wine’, distilling is typically referred to as burning), or whatever you call it. With my Swedish background, I use the term snaps to speak of the herbal liquor that litteraly goes with all festive meals.

2013–12–22 | Sweden, snaps

# Implementing the Poisson distribution in c++

In statistics, you frequently need to find the probability of a particular outcome given some distribution. The problem is that this functionality is surprisingly hard to come by in c/c++.

2013–10–08 | statistics, c, c++