Practical functional programming in JavaScript