Future of string lambda functions/string predicate functions

Timon Gehr timon.gehr at gmx.ch
Wed Aug 7 04:16:04 PDT 2013


On 08/07/2013 06:18 AM, Jakob Ovrum wrote:
> On Tuesday, 6 August 2013 at 19:38:08 UTC, Meta wrote:
>> Looks good except for the above point. UnaryFun and binaryFun still
>> have valid use cases, and I'd argue that it's even worth making an
>> nAryFun!(pred, arity).
>>
>> import std.functional;
>> import std.stdio;
>>
>> alias less = (int a, int b) => a < b; //Error
>> alias less = binaryFun!((a, b) => a < b); //Ok
>>
>> void main()
>> {
>>     writeln(less(1, 2)); //True
>> }
>
> This is a good point. I also agree that a fully generic, n-ary wrapper
> is the way to go for these cases.
>

I think the way to go for these cases is to fix the parser.

> I don't like the name `nAryFun` though, hopefully there's a more generic
> name that doesn't dwell on the history that would be `unaryFun` and
> `binaryFun`.



More information about the Digitalmars-d mailing list