I am doing exercises for functional programming concepts using python. I ran into this problem. I tried a lot and could not find a solution using functional programming constructors such as map / reduce, closures.
Problem: for a list of numbers
list = [10, 9, 8, 7, 6, 5, 4, 3]
Find the sum of the differences in each pair using Map / Reduce or any functional programming concepts like
[[10 -9] + [8 - 7] + [6 -5] + [4 - 3]] = 4
For me, the difficult part is highlighting pairs using map / reduce / recursion / clos
source
share