Can you introspect predicate arity and if it's an equality predicate?

aliak something at something.com
Fri Jan 12 13:04:30 UTC 2018


On Friday, 12 January 2018 at 10:55:53 UTC, Seb wrote:
> On Friday, 12 January 2018 at 00:16:07 UTC, aliak wrote:
>> Hi, so basically is there a way to:
>>
>> void func(alias pred = null, Range)(Range range) {
>>   // 1) check if pred(ElementType!Range.init, 
>> ElementType!Range.init) is equality
>>   // 2) check if isUnary!pred
>>   // 3) check if isBinary!pred
>> }
>>
>> [...]
>
> It isn't possible yet, but will be very soon: 
> https://github.com/dlang/dmd/pull/7484

Thats to compare whether lambdaA == lambdaB right? Not if 
lambda(a, b) == lambda(b, a) == true <- i guess this is not 
possible anyway without knowing the entire set of inputs)


More information about the Digitalmars-d-learn mailing list