Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.1
-
Fix Version/s: 1.7.2, 1.8-beta-1
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Sometimes you don't want to curry from the left hand side. You can always fake it by rewriting a reversed method or Closure manually but most functional languages support currying from the right or an arbitrary index.
An rcurry method allows examples like this:
def divide = { a, b -> a / b }
def halver = divide.rcurry(2)
assert halver(8) == 4
An ncurry method would allow, as an example, to curry the middle parameter of a three argument method, e.g.:
// curry middle param of this utility method: // Collections#binarySearch(List list, Object key, Comparator c) def catSearcher = Collections.&binarySearch.ncurry(1, "cat") def result = catSearcher(myList, myComparator)
Leaving out of 1_6_X for now.