ruby - Subract values of 2 arrays and get a new array with subtracted values -


basically, want this:

[1,2,3,4,5].some_method([1,5,8,7,8]) => [0,-3,-5,-3,-3] 

what best way in ruby?

[1,2,3,4,5].zip([1,5,8,7,8]).map { |a, b| - b } 

Comments