Map_enum
You can do this:
a = [*1..10]
m = [
proc {|i| i * 2},
proc {|i| i / 2}
]
m.each { p a.map(&_1) }
But also this:
a = [1*..10]
m = [proc {|i| i * 2}, proc {|i| i / 2}].to_enum
loop { p a.map(&m.next) }
You can do this:
a = [*1..10]
m = [
proc {|i| i * 2},
proc {|i| i / 2}
]
m.each { p a.map(&_1) }
But also this:
a = [1*..10]
m = [proc {|i| i * 2}, proc {|i| i / 2}].to_enum
loop { p a.map(&m.next) }