I have a List[Int], perhaps like this:
List(1,2,3,3,4,5,6,6,7,8,9)
There will be occasional duplication (always 2, not more). When there's a dup I want to merge the elements together with a function. So in this simple example if my function is to add the 2 numbers together I'd get:
List(1,2,6,4,5,12,7,8,9)
What's a concise way to do this? List.map() only looks at/transforms 1 element at a time.