Template currying
Yuxuan Shui via Digitalmars-d
digitalmars-d at puremagic.com
Thu May 5 23:34:36 PDT 2016
On Friday, 6 May 2016 at 06:30:27 UTC, Yuxuan Shui wrote:
> On Friday, 6 May 2016 at 06:26:14 UTC, Yuxuan Shui wrote:
>> On Friday, 6 May 2016 at 06:18:22 UTC, Yuxuan Shui wrote:
>>> On Thursday, 5 May 2016 at 23:33:07 UTC, Yuxuan Shui wrote:
>>>> [...]
>>>
>>> Wait, I just realized that this example works in 2.071, but
>>> not in 2.068.2. What has changed?
>>
>> Apply{Left, Right} is add in 2.071 as well, and I didn't see
>> them mentioned in the ChangLog...
>
> Oh, sorry, that doesn't work. My mistake.
>
> And ApplyLeft doesn't work for that example either (I thought
> it would). Looks like it's a bit more difficult to implement
> Curry!() than I thought.
I figured it out, here is a prototype of Curry:
template Curry(alias tmpl, Left...) {
auto Curry(Right...)(Right r) {
return tmpl!Left(r);
}
}
More information about the Digitalmars-d
mailing list