On Monday, 25 February 2019 at 07:03:21 UTC, Nicholas Wilson wrote:
import std.traits;
Abstraction L(alias f)() {
     alias Args = Parameters!f;
     Args v;
     foreach(i; 0 .. v.length) v[i] =  new Variable;
     auto _f = f(v);
     auto abstraction = new Abstraction(v[$-1],_f);
     foreach_reverse(e; v[ 0 .. $-2])
          abstraction =  new Abstraction( e, abstraction);
     return abstraction;
}

Unfortunately this does not work, because f has untyped arguments, and therefore is passed as some kind of pseudo-template with type void. In other words, Parameters!f fails, because f is technically not a function.

Reply via email to