    # File lib/facets/core/enumerable/permutation.rb, line 56
        def each_permutation()
            arr = to_a
            size = arr.size
            perm_count = (1...size).inject(0) { |s,x| s + x * x.factorial }
            weights = Array.new(size-1) {|i| (i+1).factorial }
            s = weights.size
            x,i,v,pos = nil
            0.upto(perm_count) do |v|
                out = arr[0..0]
                arr.each_with_index {|x,i|
                    case i
                        when 0: next
                        when s: out.insert(v / weights[i-1], x)
                        else out.insert(v % weights[i] / weights[i-1], x)
                    end
                }
                yield out
            end
        end