YANAGAWA Kazuhisa
3/8/2006 3:31:00 PM
In Message-Id: <1141814974.021092.267550@z34g2000cwc.googlegroups.com>
"Timothy Goddard" <interfecus@gmail.com> writes:
> (arr1 << arr2).flatten! (ideal, but most verbose)
>
> The first two generate new objects. I believe the third doesn't (I may
> be wrong). Take your pick.
Or use Array#concat to concatenate two arrays destructively.
irb(main):001:0> a1 = [0, 1, 2]
=> [0, 1, 2]
irb(main):002:0> a2 = [3, 4, 5]
=> [3, 4, 5]
irb(main):003:0> a1.concat(a2)
=> [0, 1, 2, 3, 4, 5]
irb(main):004:0> a1
=> [0, 1, 2, 3, 4, 5]
--
kjana@dm4lab.to March 9, 2006
Dreams come true --- excepting yours.