Forum: Ruby-dev Improvement of Symbol and Proc

F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2014-06-06 07:25
(Received via mailing list)
Issue #4146 has been updated by Nobuyoshi Nakada.

Related to Feature #9076: New one-argument block syntax: &. added

----------------------------------------
Feature #4146: Improvement of Symbol and Proc
https://bugs.ruby-lang.org/issues/4146#change-47057

* Author: Nobuyoshi Nakada
* Status: Rejected
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* 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


---Files--------------------------------
symbol_lambda.diff (5.39 KB)
This topic is locked and can not be replied to.