全排列

Changes in Ruby 1.9

Array#combination
ary.combination(n){|c| ...}

yields all the combinations of length n of the elements in the array to the given block. If no block is passed, it returns an enumerator instead. The order of the combinations is unspecified.

[Copy to clipboard] [ - ]
p( [ anObject ]+ ) -> nil 

For each object, directly writes anObject.inspect followed by the current output record separator to the program's standard output. p bypasses the Ruby I/O libraries