Weighted sum

x wsum y    wsum[x;y]

Where x and y are numeric lists, returns the weighted sum of the products of x and y. When both x and y are integer lists, they are first converted to floats.

q)2 3 4 wsum 1 2 4   / equivalent to sum 2 3 4 * 1 2 4f
24f

q)2 wsum 1 2 4       / equivalent to sum 2 * 1 2 4
14

q)(1 2;3 4) wsum (500 400;300 200)
1400 1600

wsum is an aggregate function, equivalent to {sum x*y}.