How to make a function table?

2019-02-15 Thread mnar53 via Digitalmars-d-learn
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.le

Re: How to make a function table?

2019-02-15 Thread Alex via Digitalmars-d-learn
On Saturday, 16 February 2019 at 05:06:55 UTC, mnar53 wrote: 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)

Re: How to make a function table?

2019-02-16 Thread mnar53 via Digitalmars-d-learn
On Saturday, 16 February 2019 at 06:29:28 UTC, Alex wrote: On Saturday, 16 February 2019 at 05:06:55 UTC, mnar53 wrote: [...] I assume, this would do its job: ยดยดยด import std.typecons; import std.math; [...] Yes, it works. Thx.