Project

General

Profile

Actions

Feature #11161

closed

Proc/Method#rcurry working like curry but in reverse order

Added by Hanmac (Hans Mackowiak) almost 9 years ago. Updated almost 6 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:<unknown>]

Description

currenty with curry you can only replace elements in order
#rcurry should be added to be able to return the last parameter first.

def abc(a,b); "a=#{a}, b=#{b}"; end
c= method(:abc).curry

c[1,2] #=> "a=1, b=2" 
c[1][2] #=> "a=1, b=2" 

i image rcurry to be like that:

def abc(a,b); "a=#{a}, b=#{b}"; end
c= method(:abc).rcurry(2)

c[1,2] #=> "a=2, b=1" 
c[1][2] #=> "a=2, b=1" 

because of optional parameters, rcurry might be only be used when giving the arity

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0