> For each call, I believe. An exception might be if the call to nco is > inlined into the calling function, but this is unlikely as nco is > recursive. > > So, you're probably better off with: > > > nco wn = nco' > > where wn' = cis wn > > nco' = 1 : map (wn'*) nco' > > In which case it will only be evaluated once.
The original version should also evaluate the expression 'cis wn' only once: > nco :: RealFloat a => a -> [ Complex a ] > nco wn = 1 : map ((*) (cis wn)) (nco wn) You can verify this using an appropriate semantics for lazy evaluation. However, another way to think about it is to consider the expression (*) (cis wn) as (let x = cis wn in (*) x) which when first evaluated will create a suspension for x in the heap, and return \y -> (*) y x as its value. So x only gets allocated/evaluated once. Cheers, Simon _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell