efficiency of UArray

Hal Daume III hdaume@ISI.EDU
Wed, 15 May 2002 16:54:54 -0700 (PDT)

can we expect a function like:

  sum [x*y | (x,y) <- zip (elems v) (elems u)]

to be as efficient as, say:

sum = 0
for i=1, n
  sum = sum + v[i] * u[i]


Basically, will any intermediate lists be created here?

Hal Daume III

 "Computer science is no more about computers    | hdaume@isi.edu
  than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume