code: function sequencePromises(list, f) {
    var result = Promise.resolve();
    list.forEach(function (item) {
      result = result.then(function() { return f(item); });
    });
    return result;
  }
docs: Chains .then() calls along a list after applying a function. The function
  is not called on a value in the list until the promise generated by calling
  the function on the previous value in the list completes.
  
  @param {Array.<T>} list
  @param {function(T): Promise<?>} f A function applied to each item on the
  list.
  @return {Promise<?>} A promise where each promise f(v), for each v in the
  list has completed.