On Wednesday, 21 March 2012 at 20:13:37 UTC, Jesse Phillips wrote:
Note, I commented out reduce as it uses the array type instead
of the calculation type. I think I'll file than as a bug. Also
the reduce version would not give you a double back even if it
did work, need a cast in there.
Neve
On Wednesday, 21 March 2012 at 17:02:05 UTC, Brian Brady wrote:
As per the commented section, I want to be able to dynamically
figure out,
which member of the struct to average across, for all the
structs in the array.
Timon has given you an good example to get D to generate some
code for yo
Thanks for the replies.
Timons reply answers my question ... now I just have to figure out how :P
David Nadlinger:
I don't think this will ever be supported (without using
opDispatch) – para is a runtime value here…
David
Right, right, sorry, I meant a compile time argument.
And even that, it's not clear what arr[].foo means. Maybe a lazy
Range of that field, that is a lazy column.
B
On Wednesday, 21 March 2012 at 18:11:11 UTC, bearophile wrote:
Brian Brady:
// but if I write x[].para if throws an error
This is a quite natural syntax, and I think it's handy, but
it's not supported yet.
I don't think this will ever be supported (without using
opDispatch) – para is a ru
Brian Brady:
// but if I write x[].para if throws an error
This is a quite natural syntax, and I think it's handy, but it's
not supported yet.
Bye,
bearophile
#! /usr/bin/rdmd
import std.array;
import std.csv;
import std.stdio;
import std.string;
struct Data{
string Date;
double d1;
double d2;
int i4;
}
double average(Data[] x, string para){
double result = 0.0;
theswitch:switch(strip(para)){
foreach(member;__trait
All
This might be relatively trivial so please point me at documentation to read
if it is.
I am creating an array of Structs(is this the best thing to do) as per the
example below.
#! /usr/bin/rdmd
import std.array;
import std.csv;
import std.stdio;
import std.string;
struct Data
{
string Dat