On Wed, 18 Jun 2008, Achim Schneider wrote:

Henning Thielemann <[EMAIL PROTECTED]> wrote:

On Wed, 18 Jun 2008, Achim Schneider wrote:

Is there a generalisation of scan1, such that eg.

foo (+) [0,1] (1,2) = [0,1,1,2,3,5,8,13,...]

?

What is the (1,2) for?

Specifying the relative indexes an element depends on. Ideally, it
should be generalised for n-ary functions.

foo f prefix (n,m) =
   let k = length prefix
       xs = prefix ++ zipWith f (xss!!(k-n)) (xss!!(k-m))
       xss = List.tails xs
   in  xs

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

Reply via email to