⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.25
Server IP:
109.199.105.153
Server:
Linux connect.inboxifs.com 5.15.0-152-generic #162-Ubuntu SMP Wed Jul 23 09:48:42 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
3.0.0
/
system
/
Array
/
View File Name :
permutation-i.ri
U:RDoc::AnyMethod[iI"permutation:ETI"Array#permutation;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"^When invoked with a block, yield all permutations of elements of +self+; returns +self+. ;TI"0The order of permutations is indeterminate.;To:RDoc::Markup::BlankLine o; ; [I"_When a block and an in-range positive \Integer argument +n+ (<tt>0 < n <= self.size</tt>) ;TI"Jare given, calls the block with all +n+-tuple permutations of +self+.;T@o; ; [I" Example:;To:RDoc::Markup::Verbatim; [I"a = [0, 1, 2] ;TI"5a.permutation(2) {|permutation| p permutation } ;T:@format0o; ; [I"Output:;To;; [I"[0, 1] ;TI"[0, 2] ;TI"[1, 0] ;TI"[1, 2] ;TI"[2, 0] ;TI"[2, 1] ;T; 0o; ; [I"Another example:;To;; [I"a = [0, 1, 2] ;TI"5a.permutation(3) {|permutation| p permutation } ;T; 0o; ; [I"Output:;To;; [I"[0, 1, 2] ;TI"[0, 2, 1] ;TI"[1, 0, 2] ;TI"[1, 2, 0] ;TI"[2, 0, 1] ;TI"[2, 1, 0] ;T; 0o; ; [I"DWhen +n+ is zero, calls the block once with a new empty \Array:;To;; [I"a = [0, 1, 2] ;TI"5a.permutation(0) {|permutation| p permutation } ;T; 0o; ; [I"Output:;To;; [I"[] ;T; 0o; ; [I"LWhen +n+ is out of range (negative or larger than <tt>self.size</tt>), ;TI"does not call the block:;To;; [I"a = [0, 1, 2] ;TI"=a.permutation(-1) {|permutation| fail 'Cannot happen' } ;TI"<a.permutation(4) {|permutation| fail 'Cannot happen' } ;T; 0o; ; [I")When a block given but no argument, ;TI"8behaves the same as <tt>a.permutation(a.size)</tt>:;To;; [I"a = [0, 1, 2] ;TI"2a.permutation {|permutation| p permutation } ;T; 0o; ; [I"Output:;To;; [I"[0, 1, 2] ;TI"[0, 2, 1] ;TI"[1, 0, 2] ;TI"[1, 2, 0] ;TI"[2, 0, 1] ;TI"[2, 1, 0] ;T; 0o; ; [I"1Returns a new \Enumerator if no block given:;To;; [I"a = [0, 1, 2] ;TI"=a.permutation # => #<Enumerator: [0, 1, 2]:permutation> ;TI"Ba.permutation(2) # => #<Enumerator: [0, 1, 2]:permutation(2)>;T; 0: @fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"�array.permutation {|element| ... } -> self array.permutation(n) {|element| ... } -> self array.permutation -> new_enumerator array.permutation(n) -> new_enumerator ;T0[ I"(*args);T@iFI" Array;TcRDoc::NormalClass00