# Rationale for dropping List.scanl in elm 0.19

**URL:** https://discourse.elm-lang.org/t/rationale-for-dropping-list-scanl-in-elm-0-19/1759
**Category:** Learn
**Created:** [August 27, 2018, 10:06am UTC](https://discourse.elm-lang.org/t/rationale-for-dropping-list-scanl-in-elm-0-19/1759 "2018-08-27T10:06:41Z")
**Posts on this page:** 1
**Showing post:** 12

<div class="post-metadata">

### Author: ![enetsee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/enetsee/32/869_2.png) [@enetsee](https://discourse.elm-lang.org/u/enetsee)
#### Post date: [August 28, 2018, 3:23pm UTC](https://discourse.elm-lang.org/t/rationale-for-dropping-list-scanl-in-elm-0-19/1759/12 "2018-08-28T15:23:19Z")

</div>

Basically, any use case of `foldl` where you also want the intermediate results.

If you want the sum of a list of numbers, you can write:

```
sum : List number -> number 
sum = List.foldl (+) 0 

```

Substituting `scanl` gives you the cumulative sum, i.e. the list of intermediate sums:

```
cumulativeSum : List number -> List number 
cumulativeSum = 
    scanl (+) 0

sum [1,2,3]
>> 6

cumulativeSum [1,2,3]
>> [0, 1, 3, 6]
```

---

_[View the full topic](https://discourse.elm-lang.org/t/rationale-for-dropping-list-scanl-in-elm-0-19/1759)._
