File: //usr/share/ri/3.0.0/system/Array/combination-i.ri
U:RDoc::AnyMethod[iI"combination:ETI"Array#combination;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"ICalls the block, if given, with combinations of elements of +self+; ;TI"@returns +self+. The order of combinations 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 combinations of +self+.;T@o;
; [I"
Example:;To:RDoc::Markup::Verbatim; [I"a = [0, 1, 2]
;TI"5a.combination(2) {|combination| p combination }
;T:@format0o;
; [I"Output:;To;; [I"[0, 1]
;TI"[0, 2]
;TI"[1, 2]
;T;
0o;
; [I"Another example:;To;; [I"a = [0, 1, 2]
;TI"5a.combination(3) {|combination| p combination }
;T;
0o;
; [I"Output:;To;; [I"[0, 1, 2]
;T;
0o;
; [I"DWhen +n+ is zero, calls the block once with a new empty \Array:;To;; [I"a = [0, 1, 2]
;TI":a1 = a.combination(0) {|combination| p combination }
;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.combination(-1) {|combination| fail 'Cannot happen' }
;TI"<a.combination(4) {|combination| fail 'Cannot happen' }
;T;
0o;
; [I"1Returns a new \Enumerator if no block given:;To;; [I"a = [0, 1, 2]
;TI"Ba.combination(2) # => #<Enumerator: [0, 1, 2]:combination(2)>;T;
0:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"Zarray.combination(n) {|element| ... } -> self
array.combination(n) -> new_enumerator
;T0[ I" (p1);T@MFI"
Array;TcRDoc::NormalClass00