Working through the examples in Eloquent javascript by Marijn Haverbeke