On Sat, 3 Jul 2004, Nathan Weston wrote:

> My first thought is to use fold here, since this function accumulates a result 
> as it traverses the list. But fold consumes one element of the list at a 
> time, while area needs to examine the first three elements of the list, and 
> consume two of them at a time.
> Is there a more general alternative to fold? Or is there some trick I'm 
> missing here?

What's about zipping delayed versions of the list, say
 zipWith3 (calcArea) v (tail v) (tail (tail v))  ? 



_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to