Maps as functions (F#)

We all know the concept of a function. For each value in the input domain, it assigns exactly one output in the output domain. In programming languages as well as in math we mostly deal with functions expressed as formulas, but it is not the only way to describe some function. While it’s usually the most convenient one, sometimes it’s easier to write a function in form of a table. In the context of programming, we may think about such table as a Map or Dictionary type. In this article, we’ll try to explore this idea and look how far we can get when expressing functions as F# maps.

More...

Extending folds for trees (F#)

Most articles providing an introduction to catamorphisms I’ve read present concepts of a cata function and a foldl (“left” fold) function and explain how they differ using a binary tree example. One the most important differences is the input to the function at each recursive step. While cata will receive results of reducing all current subtrees, foldl will only see a single value accumulated across nodes traversed so far.

What we’ll see today is a function that in some way combines those two, so that, at each step, it can use reduced subtrees (accumulated from leaves) and a value accumulated from the root.

More...

Splitting data structures through each element (F#)

F# standard library for sequences (the “enumerables” in F#’s nomenclature) has this very nice and simple zip function that combines two collections, by simply creating a collection of pairs of items. What I’d like to discuss today is a function that does the opposite: deconstructing a collection into two based on some arbitrary selectors.

More...

Experience of Akka.NET, part 2

In the previous part, I presented my conclusions of unit testing Akka.NET. The next big thing when starting to work with actor model based approach is how it’s omnipresent asynchronous communication requires different ways of designing and reasoning about the code.

Once again I want to remind that I’m writing from the perspective of a person just starting the journey into Akka.NET and actor model. My “findings” should only be perceived as something, that other people wanting to try Akka.NET might face. All the concerns described here may be only part of my incomplete knowledge.

More...

Experience of Akka.NET, part 1

Recently I finished a major development task, which makes big use of the Akka.NET. Since this was the first time when I used it for a serious software, I ended up with many conclusions that - I believe - might help someone who’s considering going this way.

More...