## Evolving the Fibonacci

We all know about the Fibonacci sequence. Some of us also know a song that
uses it to achieve a spiraling feeling (yes, Tool fans!).
In Haskell:
fib 1 = 0
fib 2 = 1
fib x = fib (x - 1) (x - 2)
0 1 1 2 3 5 8 …
That’s it. Story ended. Well not quite. Let’s see a language where we can
reason about the execution, because I can’t in Haskell.
Sc...

## Finding Shortest Paths In Graphs In Haskell

As a rookie Haskeller coming from imperative languages I am still
often shocked how elegantly mathematical problems can be expressed in this
great language. Last time a wrote a blogpost about recursion.
As an example, I presented the
Relation type and implemented an operation to it I called join. If you are
familiar with relational algebra you m...

## FP Training @ RS: Recursion

Agenda
Example 1: factorial
Example 2: map
Example 3: join
1. We implemented the factorial example in JavaScript imperatively:
function factorial (n) {
var prev = 1
for (var i = 1; i <= n; ++i) {
prev = prev * i
}
return prev
}
Here prev is mutated, so this is not allowed in pure functional languages. How can we solve ...

## Curious logging activity

The heartbeat of our logs
Logentries draws a neat linechart to visualize your logging activity. This chart is great for seeing if there are any errors appearing after a change, so you see at a glance if it’s worth to check the logs. Looking at one of our services, this chart caught my eye:
At first sight this doesn’t say very much apart from...

## Type variance explained

Reasoning about subtype relations between parameterised types tend
to confuse developers. If you are a Java developer you've probably seen
the syntax ? extends T and ? super T, or might even used it to
create flexible method signatures. I was very confused at first when I
tried to use them as their meaning wasn't clear to me. So, I just
placed e...

## Java, the bad parts: Recursive lambdas

Have you ever tried to create a recursive lambda in Java?
You might ask why on earth would somebody do that. For you I have a
confession to begin with: I've been spoiled. I've been spoiled with
the overwhelming expressiveness of functional programming. I've been
using Scala and JavaScript for more almost 2 years now, and that leaves
a trace. I ...

## Monoids

Monoids
Monoids are algebraic structures that have an identity element and an associative binary operation. So what is a monoid? It’s a …
trait Monoid[A] {
def mempty: A
def mappend(a0: A, a1: A): A
}
defined trait Monoid
… and the associativity and identity rules which cannot be enforced by Scala 😞
Okay, but what can we do with it? ...

23 post articles, 4 pages.