Skip to content

mapchain #14

@crazymonkyyy

Description

@crazymonkyyy

dlang/phobos#10808 (comment)

auto sumtypechain(Rs...)(Rs rs){
    //alias E=SumType!(staticMap!(ElementType,Rs));
    alias E=SumType!(NoDuplicates!(staticMap!(ElementType,Rs)));//snar this requirment is bad design
    return mapchain!(a=>E(a))(rs);
}

unittest{
    sumtypechain("abc",[1,2,3],iota(0,100),[13.37,4.20]).writeln;
}

combining ranges with an overloaded function that happen to return the same type if implemented at this abstraction level, trivializes the problem, where otherwise its a nightmare

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions