mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	[DOC]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									3b8c100418
								
							
						
					
					
						commit
						80870e14a7
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		
							
								
								
									
										8
									
								
								enum.c
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								enum.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -3313,7 +3313,7 @@ slicewhen_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
 | 
			
		|||
 *    enum.slice_when { |elt_before, elt_after| bool }.each { |ary| ... }
 | 
			
		||||
 *
 | 
			
		||||
 *  Other methods of the Enumerator class and Enumerable module,
 | 
			
		||||
 *  such as +map+, etc., are also usable.
 | 
			
		||||
 *  such as +to_a+, +map+, etc., are also usable.
 | 
			
		||||
 *
 | 
			
		||||
 *  For example, one-by-one increasing subsequence can be chunked as follows:
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -3325,6 +3325,12 @@ slicewhen_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
 | 
			
		|||
 *    d = c.join(",")
 | 
			
		||||
 *    p d #=> "1,2,4,9-12,15,16,19-21"
 | 
			
		||||
 *
 | 
			
		||||
 *  Near elements (threshold: 6) in sorted array can be chunked as follwos:
 | 
			
		||||
 *
 | 
			
		||||
 *    a = [3, 11, 14, 25, 28, 29, 29, 41, 55, 57]
 | 
			
		||||
 *    p a.slice_when {|i, j| 6 < j - i }.to_a
 | 
			
		||||
 *    #=> [[3], [11, 14], [25, 28, 29, 29], [41], [55, 57]]
 | 
			
		||||
 *
 | 
			
		||||
 *  Increasing (non-decreasing) subsequence can be chunked as follows:
 | 
			
		||||
 *
 | 
			
		||||
 *    a = [0, 9, 2, 2, 3, 2, 7, 5, 9, 5]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue