Absolutely a newbie to D. This code mimics c, but unfortunately does not work:

import std.typecons;
import std.math;

alias double function(double) UNARY;


UNARY[] FCNS = [sin, cos, tan];


double[][] MAP (int idx, double[][] args) nothrow {
    UNARY f = FCNS[idx];
    foreach(i; 0 .. args.length)
        foreach(j; 0 .. args[i].length)
            args[i][j] = f (args[i][j]);
    return args;
}


what's wrong with it?

Reply via email to