I’m a software engineer mainly interested in Elixir, TypeScript, and Rust. Occasional musician. he/him

Read this first

BEAM in the Browser with Lumen: Motivations & Constraints



This article is the first in a short series aiming to - unofficially - transcribe and interpret Paul Schoenfelder’s excellent talk introducing Lumen - an alternative BEAM implementation written in Rust.

My hope is that writing these might assist me and others with the goal of eventually contributing to the project.

What is Lumen?

Lumen is a new compiler and runtime for Erlang/Elixir being developed thanks to support from DockYard. It’s primarily built around Erlang, but supports Elixir and any other languages which compile to BEAM bytecode.

The central goal of the project is to bring these languages to the browser with all the functionality of the BEAM and the OTP standard library - at least the parts of it worth bringing - by targeting WebAssembly.

Lumen is not:

  • A new Elixir-like syntax on top JavaScript.
  • An Elixir to JavaScript transpiler.
  • An effort to...

Continue reading →

Verbalex - Regex with the reader and writer in mind


I created an Elixir library for verbally expressing and composing regular expressions. This is only a short post demonstrating what it can do, but if you’re not in the mood for reading you can find it here!

Why did I write this library?

For a few years now I’ve maintained a chatbot project which, to my surprise, has actually gained a decent number of users. It was my first time writing Ruby, which is partly why the repo is private - it’s best for everybody’s wellbeing.

It’s a small project, so when coming back to it to address a bug or add a feature it doesn’t take long to regain my bearings. However, servicing the regular expressions it relies on has always been a headache.

Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.

Regular expressions are notoriously write once, read once. Especially the ones I...

Continue reading →

Readable Repos with the Ecto Filter Pattern

If you’ve used Elixir for any significant period of time, chances are you’ve come across Ecto. This will not be a tutorial on Ecto itself. Instead, I wanted to showcase a great pattern for query composition I’ve come across at work.

Setting the Scene 🎬

For simplicity’s sake, we’ll be querying a single table with no associations. This table contains all players in the NBA and their details, like this:

defmodule Nba.Players.Player do
  use Ecto.Schema

  schema "nba_players" do
    field :first_name, :string
    field :last_name, :string
    field :team, :string
    field :college, :string
    field :height_cm, :integer
    field :weight_kg, :float
    field :salary, :integer

A typical Ecto query for some players in this context might look something like this:

defmodule Nba.Players.Repo do
  import Ecto.Query

  alias Nba.Players.Player
  alias Nba.Repo


Continue reading →

The Versatility of Function Declarations in Elixir

def hello
  puts "Hello world!"
def hello do
  IO.puts("Hello world!")

Over the past few months I’ve been lucky enough to use Elixir at work. I wrote some hobby projects in Ruby in the past, so my first surprise was in finding out how differently Elixir behaves despite the syntactic similarities between the two.

The sameness pretty much ends there. Ruby is an interpreted object-oriented language. Elixir on the other hand is a compiled, functional language which runs on the Erlang VM. In Elixir, functions are first-class citizens defined by two properties: name & arity.

Name is self-explanatory, but you may not have come across arity: The arity of a function is the number of arguments it takes.

def hello do
  IO.puts("Hello world!")

def hello(name), do: IO.puts("Hello {name}!")

hello()  Hello world!
hello("George")  Hello George!


Continue reading →