Project

General

Profile

Actions

Feature #4146

closed

Improvement of Symbol and Proc

Added by nobu (Nobuyoshi Nakada) almost 14 years ago. Updated over 8 years ago.

Status:
Rejected
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 4 (2 open2 closed)

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

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0