Future of string lambda functions/string predicate functions

Jakob Ovrum jakobovrum at gmail.com
Tue Aug 6 21:18:03 PDT 2013


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 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