I have a huge array
huge = 1000
huge_array = (1..huge).to_a
How to best "expand" this array so that each element becomes a sub-array of format [original_element, "default value"], preferably in a memory-friendly way (without an explicit #map loop?)
expanded_huge_array = huge_array.some_magic
#=> [[1, "default value"],[2, "default value"], ... [1000, "default value"]]
maphave to do with it? If you need an array filled with values then you need an array filled with values. Why have the array index (plus one) be in the array at all? Etc.map? Bothmapandzipmake new arrays, but in different ways. Both iterate over the original array, thezipanswer creates a new array of the huge array's size then iterates, etc)