function memoize(callback) {
        var value;
        return function () {
            if (callback) {
                value = callback();
                callback = undefined;
            }
            return value;
        };
    }
Creates a map from the elements of an array.

@param array the array of input elements.
@param makeKey a function that produces a key for a given element.

This function makes no effort to avoid collisions; if any two elements produce
the same key with the given 'makeKey' function, then the element with the higher
index in the array will be the one associated with the produced key.