What is the easiest way to convert
[x1, x2, x3, ... , xN]
to
[[x1, 2], [x2, 3], [x3, 4], ... , [xN, N+1]]
Over the top obfuscation:
arr = ('a'..'g').to_a indexes = arr.each_index.map(&2.method(:+)) arr.zip(indexes)