How one can write a function "map2D" that will be a 2-dimensional equivalent of the standard "map" function?
In other words, I like it to work like in the following example:
Line:
1 + 2 = 3, or equivalently:
In other words, I like it to work like in the following example:
Line:
(map2D + '((1 . 2) (3 . 4) (5 . 6)) )
should return a result:
(3 7 11)
because:1 + 2 = 3, or equivalently:
(+ 1 2) == 3
3 + 4 = 7, or equivalently: (+ 3 4) == 7
5 + 6 = 11, or equivalently: (+ 5 6) == 11
Here "+" is acting like a function of two variables that is acting of every pair from the given list.