[Issue 15732] std.function partial does not work with function / delegate references

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Feb 27 06:17:11 PST 2016


https://issues.dlang.org/show_bug.cgi?id=15732

--- Comment #2 from mikey <abc.mikey at googlemail.com> ---
Example of error:

auto partial_application () {
    // definition of a basic function on 3 parameters using lambda syntax
    auto basic = (float a, float b, float c) => a + b / c;

    // partially apply value to basic    
    import std.functional : partial;
    alias partial!(basic, 1) apply1;

    return &apply1;
    // Error: partial(Ts...)(Ts args2) is not an lvalue
}

void main(string[] args) {

    auto test = partial_application();

    import std.stdio : writeln;
    writeln("result: ", test(1, 2, 3));
}

--


More information about the Digitalmars-d-bugs mailing list