[Haskell-cafe] Running Total or Incremental Sum as a higher order type ?

Sven Panne Sven.Panne at aedion.de
Sat Jul 3 05:44:53 EDT 2004

Crypt Master wrote:
> [...] Surely this is a pattern which has been abstracted ? I feel I 
> have missed the obvious here.

There is a prelude function "scanl1" for this kind of pattern, so you could write:

    incrementalSum = scanl1 (+)


More information about the Haskell-Cafe mailing list