function Q_chainmap (args, func) {
    return Promise.resolve().then(function (inValue) {
        return args.reduce(function (soFar, arg) {
            return soFar.then(function (val) {
                return func(arg, val);
            });
        }, Promise.resolve(inValue));
    });
}