Project

General

Profile

Actions

Feature #4146

closed

Improvement of Symbol and Proc

Added by nobu (Nobuyoshi Nakada) almost 11 years ago. Updated almost 6 years ago.

Status:
Rejected
Priority:
Normal
Target version:
-
[ruby-dev:42733]

Description

現在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"]

Files

symbol_lambda.diff (5.39 KB) symbol_lambda.diff nobu (Nobuyoshi Nakada), 12/10/2010 08:02 PM

Related issues

Related to Ruby master - Feature #6483: parametric mapRejectedmatz (Yukihiro Matsumoto)05/22/2012Actions
Related to Ruby master - Feature #8987: map/collect extension which handles argumentsOpenActions
Related to Ruby master - Feature #9076: New one-argument block syntax: &.FeedbackActions
Related to Ruby master - Feature #12115: Add Symbol#call to allow to_proc shorthand with argumentsOpenActions
Actions

Also available in: Atom PDF