Issue #4146 has been updated by prijutme4ty (Ilya Vorontsov).


I also propose to consider recursive application for a method in a style I've written in http://bugs.ruby-lang.org/issues/6483#note-3:

Usual application:
(1..5).map(&:to_s.(2)) # => ['1', '10', '11', '100', '101']
Recursive application:
[[1,2,3],[4,5,6]].map(&:map.(&:to_s)) # => [['1','2','3'],['4','5','6']]
[[1,2,3],[4,5,6]].map(&:map.(&:to_s.(2))) # => [['1','10','11'],['100','101','110']]

All of this can be done with a bit of ruby code:

class Proc
  def curry_except_self(*args, &block)
    Proc.new{|slf| curry.call(slf, *args, &block) }
  end
end

class Symbol
  def call(*args, &block)
    obj=Object.new.instance_exec(self,args,block) do |sym,params,block| 
      @sym=sym
      @args = params
      @block = block
      self
    end
    obj.define_singleton_method :to_proc do
      @sym.to_proc.curry_except_self(*@args, &@block)
    end
    obj
  end
end
----------------------------------------
Feature #4146: Improvement of Symbol and Proc
https://bugs.ruby-lang.org/issues/4146#change-26991

Author: nobu (Nobuyoshi Nakada)
Status: Assigned
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 


=begin
 ???Symbol#to_proc??? %w[12 45 32].map(&:to_i) ???????????????????????????
 ??????????????????????????????????????????Symbol??????????????????
 ????????????????????????????????Proc????????????????????????????????????????
 
   %w[12 45 32].map(&:to_i(9)).map(&:*(2)) #=> [22, 82, 58]
   %w[abc def ghi].map(&:[1])              #=> ["b", "e", "h"]
=end



-- 
http://bugs.ruby-lang.org/