code: function unfoldWithReturn (seed, unaryFn) {
      var state = seed,
          pair,
          value;
      return function () {
        if (state != null) {
          pair = unaryFn.call(state, state);
          value = pair[1];
          state = value != null ? pair[0] : void 0;
          return value;
        }
        else return void 0;
      };
    }
docs: note that the unfoldWithReturn behaves differently than unfold with respect to the first value returned