On Mon, May 31, 2010 at 9:04 AM, Bug Free <amberarrow / yahoo.com> wrote:
> The following line:
>
> =A0 =A0[5, 7].each_with_index.each_cons(2) {|v| p v }
>
> prints [5, 7] but I'm expecting [[5, 0], [7, 1]].

you'll have specify the index, eg,

>>  [5, 7].map.with_index{|v,i| [v,i]}
=3D> [[5, 0], [7, 1]]

kind regards -botp