def fill(object, index = 0, length = nil)
      raise IndexError if index < -@size
      object = Erlang.from(object)
      index += @size if index < 0
      length ||= @size - index # to the end of the array, if no length given

      if index < @size
        suffix = flatten_suffix(@root, @levels * BITS_PER_LEVEL, index, [])
        suffix.fill(object, 0, length)
      elsif index == @size
        suffix = Array.new(length, object)
      else
        suffix = Array.new(index - @size, nil).concat(Array.new(length, object))
        index = @size
      end

      return replace_suffix(index, suffix)
    end
def fill(object, index = 0, length = nil)
      raise IndexError if index < -@size
      object = Erlang.from(object)
      index += @size if index < 0
      length ||= @size - index # to the end of the array, if no length given

      if index < @size
        suffix = flatten_suffix(@root, @levels * BITS_PER_LEVEL, index, [])
        suffix.fill(object, 0, length)
      elsif index == @size
        suffix = Array.new(length, object)
      else
        suffix = Array.new(index - @size, nil).concat(Array.new(length, object))
        index = @size
      end

      return replace_suffix(index, suffix)
    end
Replace a range of indexes with the given object.

 @overload fill(object)
   Return a new `Tuple` of the same size, with every index set to
   `object`.

   @param [Object] object Fill value.
   @example
     Erlang::Tuple["A", "B", "C", "D", "E", "F"].fill("Z")
     # => Erlang::Tuple["Z", "Z", "Z", "Z", "Z", "Z"]

 @overload fill(object, index)
   Return a new `Tuple` with all indexes from `index` to the end of the
   tuple set to `object`.

   @param [Object] object Fill value.
   @param [Integer] index Starting index. May be negative.
   @example
     Erlang::Tuple["A", "B", "C", "D", "E", "F"].fill("Z", 3)
     # => Erlang::Tuple["A", "B", "C", "Z", "Z", "Z"]

 @overload fill(object, index, length)
   Return a new `Tuple` with `length` indexes, beginning from `index`,
   set to `object`. Expands the `Tuple` if `length` would extend beyond
   the current length.

   @param [Object] object Fill value.
   @param [Integer] index Starting index. May be negative.
   @param [Integer] length
   @example
     Erlang::Tuple["A", "B", "C", "D", "E", "F"].fill("Z", 3, 2)
     # => Erlang::Tuple["A", "B", "C", "Z", "Z", "F"]
     Erlang::Tuple["A", "B"].fill("Z", 1, 5)
     # => Erlang::Tuple["A", "Z", "Z", "Z", "Z", "Z"]

 @return [Tuple]
 @raise [IndexError] if index is out of negative range.