Compile Time Fun Time
Yevano
jamking1996 at gmail.com
Mon Feb 25 07:09:29 UTC 2019
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.
More information about the Digitalmars-d-learn
mailing list