Going Functional: Map

Let’s face it: the ‘map’ function (a.k.a. ‘apply-to-all’) is pretty simple. You just pass it an array and a function and it returns an array of results of that function applied to each item. What’s it all about then? Here comes the important bit: the new…

RestQ

Here’s a confession – over time I have come to like services that expose their data via a RESTful [http://tomayko.com/writings/rest-to-my-wife] API. It’s scalable, it’s understandable and quite importantly – it’s elegant. Working with REST is a breeze, right? Well, a few weeks ago, I…

Lexical Dispatch in JavaScript

Using a big switch statement to fake polymorphism is evil. Everybody knows that. But how do you get rid of it? Let’s say you’ve got a method that receives a string describing some state (“normal”, “error” etc.). And depending on the value of that string (state) you want…