I want to add a new object between each object in an array using functional programming. The new object is derived using its two neighbors.
Let’s say that we start with an array of integers [1,2,3], I want to add new integers by adding its neighbors so the resulting array looks like this [1,3,2,5,3]
I know of intersperse but that only allows me to add a static element. I also considered chain but that only visits one element at a time