Timon Gehr:

mixin ADT!q{ Term: Var char | Op char Term[] };

void main(){
const expr = Op('f', [Op('g',[Var('x'), Var('y')]), Op('a',[]), Var('x')]);
}

Where is ADT defined? (And why isn't it a Phobos patch on GitHub?)


convertNum could be written more compactly as:
char convertNum(int x){
    return "exyzfgh"[x<$?x:0];

That's too much compact :-) Humans put a space around operators, and sometimes some parentheses don't hurt:

char convertNum(in int x) pure nothrow
in {
    assert(x >= 0);
} body {
    return "exyzfgh"[(x < $) ? x : 0];
}

Bye,
bearophile

Reply via email to