An example parenthesization defined purely using the B combinator and composition.

Using only the B combinator

I recently wondered whether the B combinator alone is capable of producing any parenthesization. My intuition was that this should be the case, but I found more or less nothing solid or concise about it, let alone an explicit construction. I’m sure this floats around somewhere, but anyways: The goal of this post is to be discoverable. To be short and intuitive instead of a deep dive.

I certainly had fun figuring all of the following out, so consider not reading the solution if you enjoy a good puzzle!

Imagine a list of terms t1, t2, t3, t4, … and…

A table of one-point basis examples, together with SKI in terms of them.
A table of one-point basis examples, together with SKI in terms of them.
More or less well-known examples of one-point bases, including Iota, as well as similar and even smaller alternatives. On the right, S, K and I combinators are defined in terms of the respective basis X.

The Iota combinator and some alternatives

I first read about the Iota combinator years ago and was intrigued by its existence. Recently I wondered what some alternative one-point bases look like and whether Iota is the smallest such combinator. Here is what I found online, in papers, and from writing a small tool that searches for such bases.

Indeed, the tool found some that are smaller than Iota. I’m sure they have been found before, but it seems this information could be more discoverable. So here is a buffet of one-point bases; after a quick, informal recap/definition of what a (one-point) basis is.

Disclaimer: This is…

Translating from a language using lazy evaluation (left) to JavaScript (right)

Using lambdas to produce weak head normal forms

In this post I assume you know the difference between lazy evaluation and strict/eager evaluation, but here is a quick summary. Skip this if all you care about is the how.

x = 3 + 4    // <- does the addition happen here?
print x // <- or here?
print x // <- or even here?

No matter what your programming background and experience is, you have a mental model about what the above piece of code does, whatever language it may be. We would probably all guess that it prints “7” twice.

But depending on our background we will…

Fractional derivatives of exp(-x*x), starting with original function (order 0, blue) all the way to second derivative (order 2, yellow) in steps of 0.2

Real-time visuals for everyone

This is just a short story about the online Fractional Derivative Playground that I created out of curiosity and wanted to share with other curious minds. Disclaimer: I am not a mathematician, so take everything I claim or the playground shows with a grain of salt.

TL;DR: Fractional derivatives are a thing; I couldn’t find any nice interactive online visualization; I made one; let me know what you think!

One day my YouTube feed contained Dr. Peyam’s Definition of the Half Derivative. I didn’t even know something like that exists, must watch.

Dr. Peyam made my day. Derivatives and…

So you have an asynchronously retrievable list of float-distributions which are possibly null? Please give me an equivalent construct, only that all floats are offset by some constant. Shown is: 1) How that looks like in C# as of today (with some hypothetical way of handling distributions of stuff); 2) How consistent it can look like in C# if we try hard enough; 3) some random ideas of how we could make the same operation feel like by extending C# (very bottom snippet: lift 100% implicitly based on static type information). None of the ideas presented here are specific to C#. In this post I will derive all of the above and more.

Uniting various programming concepts by tracking down the pattern behind the mess

Have you ever written expressions like (await t).Select(x => x?.Foo())? Fun fact: await (async. programming), Select (list processing) and ?. (null-conditional) are really the same thing. Language designers could make this expression look like t???.Foo() or (await each nullable t).Foo(). Read on to find out why and how. Your feedback is highly appreciated!

Consider the following, seemingly independent, programming concepts:

  • rich list processing, e.g. LINQ in C#, list comprehension, etc.
  • side-effects/impurity, e.g. explicit in Haskell, implicit in imperative PLs
  • error handling, e.g. exceptions in Java vs C#, returning errors in Go
  • async programming, e.g. async/await in JS/C#, or via callbacks

Node REPL in Chrome vs CMD. The website is not just a front-end connected to some remote Node.js process (like most online REPLs such as, or An actual Node.js API instance is bootstrapped in the browser, using for UI.

To the Browser!

Bootstrapping Node.js in the browser — no browserify required

There are several reasons why a JavaScript developer may want to run Node.js code in the browser, including:

  • developed a Node.js app — now want to also offer it online
  • found a useful npm package that relies on Node.js
  • want to use Node.js APIs (buffer, crypto, fork, events, streams, …)
  • prefer to write CommonJS-style modules with require

One will a number of solutions fulfilling at least some of the above wishes, such as, or nodular.js. However, all of those approaches are based on some form of the source code transformation — either ahead of time (webpack and browserify)…

saved game from March 2005, successfully loaded and running in vanilla Chrome 🎈

To the Browser!

Porting OpenRCT2 to the Browser using Emscripten

I’ll illustrate my approach, some of the challenges, and the results I got when porting OpenRCT2 (open source RollerCoaster Tycoon clone written in C/C++) to HTML/JavaScript using Emscripten. The sources can be found in my fork of OpenRCT2. Due to the fact that OpenRCT2 relies on an installation of the original game for the brilliant artwork, I have not hosted my port anywhere. Needless to say, I would love to talk with Chris Sawyer/Origin8/Atari in order to change that!😀

I did all work on my Windows 10 laptop (i7–5557U@3.1GHz, 16GB), but made heavy use of WSL a.k.a. “Bash on Ubuntu…

Johannes Bader

compiler and programming language enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store