Pit Capitain <pit / capitain.de> wrote: > Maybe you could use something similar to the default value / block in > Hash.new, something like > > a = [1,2,3,4] > b = [2,4] > > a.zip(b) #=> [[1,2],[2,4]] > a.zip(b, nil) #=> [[1,2],[2,4],[3,nil],[4,nil]] > a.zip(b, "missing") #=> [[1,2],[2,4],[3,"missing"],[4,"missing"]] Sounds good to me > d = 0 > a.zip(b) { d += 1 } #=> [[1,2],[2,4],[3,1],[4,2]] This one's too confusing, IMO. I'd rather give it a new name, like zipfill. Another potentially useful variant: a.zip {block} as a shorthand for (not proper ruby, but gets the point across) a.collect {|i| [i,yield i]} {block} (and maybe a.izip, where zip:izip::each:each_index) martin