def transpose
      return self.class.empty if empty?
      result = Array.new(first.size) { [] }

      0.upto(@size-1) do |i|
        source = get(i)
        if source.size != result.size
          raise IndexError, "element size differs (#{source.size} should be #{result.size})"
        end

        0.upto(result.size-1) do |j|
          result[j].push(source[j])
        end
      end

      result.map! { |a| self.class.new(a) }
      return self.class.new(result)
    end
def transpose
      return self.class.empty if empty?
      result = Array.new(first.size) { [] }

      0.upto(@size-1) do |i|
        source = get(i)
        if source.size != result.size
          raise IndexError, "element size differs (#{source.size} should be #{result.size})"
        end

        0.upto(result.size-1) do |j|
          result[j].push(source[j])
        end
      end

      result.map! { |a| self.class.new(a) }
      return self.class.new(result)
    end
Assume all elements are tuples or arrays and transpose the rows and columns.
 In other words, take the first element of each nested tuple/array and gather
 them together into a new `Tuple`. Do likewise for the second, third, and so on
 down to the end of each nested Tuple/array. Gather all the resulting `Tuple`s
 into a new `Tuple` and return it.

 This operation is closely related to {#zip}. The result is almost the same as
 calling {#zip} on the first nested Tuple/array with the others supplied as
 arguments.

 @example
   Erlang::Tuple[["A", 10], ["B", 20], ["C", 30]].transpose
   # => Erlang::Tuple[Erlang::Tuple["A", "B", "C"], Erlang::Tuple[10, 20, 30]]

 @return [Tuple]
 @raise [IndexError] if elements are not of the same size.
 @raise [TypeError] if an element can not be implicitly converted to an array (using `#to_ary`)