Is there any Ruby equivalent for Python's builtin zip
function? If not, what is a concise way of doing the same thing?
A bit of context: this came up when I was trying to find a clean way of doing a check involving two arrays. If I had zip
, I could have written something like:
zip(a, b).all? {|pair| pair[0] === pair[1]}
I'd also accept a clean way of doing this without anything resembling zip
(where "clean" means "without an explicit loop").