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

ruby-changes:56181

From: Nobuyoshi <ko1@a...>
Date: Fri, 21 Jun 2019 17:54:10 +0900 (JST)
Subject: [ruby-changes:56181] Nobuyoshi Nakada: 16729f6430 (trunk): Remove duplicate functions

https://git.ruby-lang.org/ruby.git/commit/?id=16729f6430

From 16729f64306941a2662c8361d452e86998fc1239 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 21 Jun 2019 17:53:32 +0900
Subject: Remove duplicate functions


diff --git a/enumerator.c b/enumerator.c
index 185e5d5..8cb280b 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -2026,39 +2026,6 @@ lazy_select(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enumerator.c#L2026
     return lazy_add_method(obj, 0, 0, Qnil, Qnil, &lazy_select_funcs);
 }
 
-static VALUE
-lazy_filter_map_proc(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
-{
-    VALUE result = rb_yield_values2(argc - 1, &argv[1]);
-    if (RTEST(result)) {
-        rb_funcall(argv[0], idLTLT, 1, result);
-    }
-    return Qnil;
-}
-
-/*
- *  call-seq:
- *     lazy.filter_map { |obj| block } -> lazy_enumerator
- *
- *  Returns an enumerator which will return a new array containing the
- *  truthy results (everything except +false+ or +nil+) of running the
- *  +block+ for every element in +lazy+.
- *
- *     (1..).lazy.filter_map { |i| i * 2 if i.even? }.first(5) #=> [4, 8, 12, 16, 20]
- *
- */
-static VALUE
-lazy_filter_map(VALUE obj)
-{
-    if (!rb_block_given_p()) {
-        rb_raise(rb_eArgError, "tried to call lazy filter_map without a block");
-    }
-
-    return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj,
-                                         lazy_filter_map_proc, 0),
-                           Qnil, 0);
-}
-
 static struct MEMO *
 lazy_filter_map_proc(VALUE proc_entry, struct MEMO *result, VALUE memos, long memo_index)
 {
@@ -2078,6 +2045,8 @@ static const lazyenum_funcs lazy_filter_map_funcs = { https://github.com/ruby/ruby/blob/trunk/enumerator.c#L2045
  *     lazy.filter_map { |obj| block } -> lazy_enumerator
  *
  *  Like Enumerable#filter_map, but chains operation to be lazy-evaluated.
+ *
+ *     (1..).lazy.filter_map { |i| i * 2 if i.even? }.first(5) #=> [4, 8, 12, 16, 20]
  */
 
 static VALUE
-- 
cgit v0.10.2


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

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