In the previous posts, we went over the process of building a DSL for arithmetic operations and we introduced the concept of Catamorphism as a way to decouple the traversal of the AST from the operations we want to perform on it. We saw how it could help us compose operations before traversing the AST... Continue Reading →
Combining traversals by example
This post is the third of the series of post focused on providing useful higher order functions that goes hand in hand with STL algorithms and ranges. The two previous posts went over the following set of tools: Lenses allow to “zoom” on the elements being scanned Traversal combinators allow to merge several scan into... Continue Reading →
Traversal Combinators
This post is the second of the series of post focused on providing useful higher order functions that goes hand in hand with STL algorithms and ranges. Last post was focused on higher order functions, lenses, that allows to zoom on the elements being scanned. Today's post is about exploring higher order functions that allows... Continue Reading →
Traversals and lenses
Following the amazing keynote of Eric Niebler on ranges at the CppCon2015, there has a been a lot of discussion on ranges in the C++ community. Ranges are an amazing tool to add to the STL. I am starting a series of post to introduce some useful higher order functions that go hand-in-hand with the... Continue Reading →
Accumulating your merge sort
In the previous post, we described an elegant algorithm that allows to stable sort a container based on fold (also known as std::accumulate or reduce). To make it simpler, we implemented it in Haskell and used it to merge lists. The subject of today's post is to: Implement this algorithm in C++ Make it work... Continue Reading →
Algorithms as design tools
Today's post is about a true war story. The story of some hard to read and slow code, patiently reworked to get faster and more readable version of it. This post will first walk through the steps it took to get there. Then we will step back and conclude by discussing a trick I found... Continue Reading →