def permutation(n = @size)
      return enum_for(:permutation, n) if not block_given?
      if n < 0 || @size < n
        # yield nothing
      elsif n == 0
        yield []
      elsif n == 1
        each { |element| yield [element] }
      else
        used, result = [], []
        perms = lambda do |index|
          0.upto(@size-1) do |i|
            if !used[i]
              result[index] = get(i)
              if index < n-1
                used[i] = true
                perms[index+1]
                used[i] = false
              else
                yield result.dup
              end
            end
          end
        end
        perms[0]
      end
      return self
    end
def permutation(n = @size)
      return enum_for(:permutation, n) if not block_given?
      if n < 0 || @size < n
        # yield nothing
      elsif n == 0
        yield []
      elsif n == 1
        each { |element| yield [element] }
      else
        used, result = [], []
        perms = lambda do |index|
          0.upto(@size-1) do |i|
            if !used[i]
              result[index] = get(i)
              if index < n-1
                used[i] = true
                perms[index+1]
                used[i] = false
              else
                yield result.dup
              end
            end
          end
        end
        perms[0]
      end
      return self
    end
Yields all permutations of length `n` of elements from the `Tuple`, and then
 returns `self`. If no length `n` is specified, permutations of all elements
 will be yielded.

 There is no guarantee about which order the permutations will be yielded in.

 If no block is given, an `Enumerator` is returned instead.

 @example
   t = Erlang::Tuple[5, 6, 7]
   t.permutation(2) { |p| puts "Permutation: #{p}" }

   Permutation: [5, 6]
   Permutation: [5, 7]
   Permutation: [6, 5]
   Permutation: [6, 7]
   Permutation: [7, 5]
   Permutation: [7, 6]
   # => Erlang::Tuple[5, 6, 7]

 @return [self, Enumerator]