[前][次][番号順一覧][スレッド一覧]

ruby-changes:36701

From: akr <ko1@a...>
Date: Fri, 12 Dec 2014 12:16:12 +0900 (JST)
Subject: [ruby-changes:36701] akr:r48782 (trunk): [DOC]

akr	2014-12-12 12:15:56 +0900 (Fri, 12 Dec 2014)

  New Revision: 48782

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48782

  Log:
    [DOC]

  Modified files:
    trunk/enum.c
Index: enum.c
===================================================================
--- enum.c	(revision 48781)
+++ enum.c	(revision 48782)
@@ -3313,7 +3313,7 @@ slicewhen_i(RB_BLOCK_CALL_FUNC_ARGLIST(y https://github.com/ruby/ruby/blob/trunk/enum.c#L3313
  *    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(y https://github.com/ruby/ruby/blob/trunk/enum.c#L3325
  *    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]

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]