I have below code and I want to do sumproduct. When I do sum(weight) at wj
, it works. But if I do sum(weight*price) at wj
, it failed. How can I do the sumproduct? Thanks!!
t:([]sym:3#`ibm;time:10:01:01 10:01:04 10:01:08;price:100 101 105);
price:101 103 103 104 104 107 108 107 108;
weight:98 99 102 103 103 104 106 106 107;
q:([]sym:`ibm; time:10:01:01+til 9; price:price; weight:weight);
f:`sym`time;
w:-2 1+\:t.time;
wj[w;f;t;(q;(sum;`price);(sum;`weight))]; // OK
wj[w;f;t;(q;(sum;`price);(sum;(*;`price;`weight)))]; // failed