Module: Combinatorics::Permute::Mixin
Overview
Instance Method Summary collapse
-
#permute(r) {|permutation| ... } ⇒ Enumerator
Enumerate distinct r-permutations for a particular sequence of elements.
Instance Method Details
#permute(r) {|permutation| ... } ⇒ Enumerator
Enumerate distinct r-permutations for a particular sequence of elements.
39 40 41 42 43 44 45 46 47 |
# File 'lib/combinatorics/permute/mixin.rb', line 39 def permute(r,&block) return enum_for(:permute,r) unless block unless kind_of?(Enumerable) raise(TypeError,"#{inspect} must be Enumerable") end self.to_a.permutation(r,&block) end |