addCharToRail = (targetRailIndex, letter) => {
  /**
   * Given a rail, adds a char to it if it matches a targetIndex.
   *
   * @param {Rail} rail
   * @param {number} currentRail
   * @returns {Rail}
   */
  function onEachRail(rail, currentRail) {
    return currentRail === targetRailIndex
      ? [...rail, letter]
      : rail;
  }
  return onEachRail;
}
@param {number} targetRailIndex
@param {string} letter
@returns {Function}