Currying and composition

Matt Soucy via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 27 12:05:16 PDT 2014


On 07/27/2014 12:09 PM, bearophile wrote:
> Matt Soucy:
> 
>> So, in the next release std.functional.curry has been renamed to std.functional.partial:
>>
>> https://github.com/D-Programming-Language/phobos/pull/1979
> 
> Oh, good. (And the "sigh" by Andrei is cute).
> 

I was hoping that was a "sigh, alright I guess this is something we sould do"

> 
>> I was starting to work on a proper curry replacement,
> 
> Is its syntax usage similar to the one I've shown for Python?
> 
> func(1, 2, 3)
> func(1, 2)(3)
> func(1)(2, 3)
> func(1)(2)(3)
> 

Mine didn't get very far, but the goal was to have that behavior

> Is it a good idea to also mix in the function composition operator overloading?

I'm not so sure about that one - mainly because then it's possible with some functions (the curried ones) but not all (including "regular" and delegates).


-- 
Matt Soucy
http://msoucy.me/


More information about the Digitalmars-d mailing list