Unfortunately I can not really understand your code...

But it looks a bit strange for me.
    
    
    for price in prices:
      pcount += 1
      farray[pcount] = ((price * price) * ((pcount+1) / prices.len))
      pips += price
      psum = farray.sum()
    
    
    Run

In this loop you modify only one entry of farray but you sum again over that 
whole array. Would you do that when you had to do it all in your head? (If it 
is not clear, when you modify only one field of the array, then the sum of 
whole array we be altered only by that field, so you can store the old sum 
value, and add (newfieldvalue - oldfieldvalue).

And the other point: In the Nim version you are using a fixed size array for 
your farray. I don't know Python well, as I was more a Ruby user. But I would 
assume that the Python array is growing dynamically, so there may be an 
advantage for Python, as it has not to sum over the full size from the 
beginning.

And finally, array[337588, float] as a return type of a proc is really strange. 
Maybe better returning a seq as a dynamic container. Or is that much slower?

Reply via email to