Recently
Sunday, 01 May 2016 · 4 min read · thoughtsContinue reading →Make it easy for people to do the right things; make it hard for people to do the wrong things.
Here are my recent writing...
Continue reading →Make it easy for people to do the right things; make it hard for people to do the wrong things.

Let’s walk through the process of writing and publishing an Elixir library from start to finish. For illustrative purposes, we’ll create a pretend simple_statistics statistics toolkit for Elixir.
The full source code is available on Github.
Continue reading →
You’re building a REST API.
You develop an API backend with a few endpoints and deploy it to production. You publish several official language-specific API clients as well as an API documentation. Your API announces its public release; other developers start using it. Your day ends on a happy note.
The following day, you want to add a new feature to your API. You notice that you have to do a few things:
You let out a heavy sigh.
Continue reading →
Let’s demystify the frequently used use keyword in Elixir.
We can use the use keyword in Elixir to package behaviour and implementation for use in other modules, similar to abstract base classes or mixins in other languages. Mixins reduce the amount of boilerplate in your modules, especially for library authors.
Mixins in Elixir are similar on the surface to Concerns in Ruby and Traits in Scala. Before we start, you should be somewhat familiar with behaviours and macros.

An Elixir program can be represented by its own data structures as an abstract syntax tree (AST) of tuples with three elements. For example, the function call run(1, 2, 3) is represented internally as:
{:run, [], [1, 2, 3]}Macros in Elixir lets you perform syntactic extensions, which are expanded to before a program executes. We use macros to transform our internal program structure by treating code as data, and thus metaprogram.
Many of Elixir’s language features such as if and def are in fact macros, which are translated away into lower-level abstractions during compilation. Armed with the same tools that José utilized to write Elixir’s standard libraries, you can extend Elixir to suit your needs using macros.
Continue reading →The days are long, but the years are short.

This article was originally published on Elixir Recipes.
While Elixir is dynamically typed, we can supply optional typespecs to make sure
our programs are type-safe.
Preventing type errors ensures that there’s no discrepancy between differing types of our program’s constants,
variables, and functions. Typespecs are also useful as documentation.
Continue reading →If you’ve used type systems in
OCamlorF#,Elixir’s type system should feel familiar to you.

I’ve been spending some time learning Elixir, and I figure the best way to learn is to teach it to someone else. Announcing: Elixir Recipes!
Continue reading →
Here are my highlights from The Art of Thinking Clearly, a reference guide to cognitive biases and good decision-making.
Continue reading →
Over the Hack n Roll hackathon at NUS, I worked on a particularly interesting project which I thought I’d briefly write about.
Continue reading →