From: Jim Freeze Date: 2007-03-06T22:52:11+09:00 Subject: Re: [ ruby-Patches-9055 ] Dynamic Array#join with block --Apple-Mail-7--539087324 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Mar 6, 2007, at 7:22 AM, Jim Freeze wrote: > Hmm, it's not that difficult, but it is definitely more work than > join: > > ary = [1,3,2,4] # or [[1,3],[2,4]].flatten > ary[2..-4].inject(a[0..0]) { |a,e| a << (a[-1] > e ? ">" : "<"); > a << e }.join -------^^^^ 1..-1 Not sure how that typo happend. :) Jim --Apple-Mail-7--539087324 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1
On Mar 6, 2007, at = 7:22 AM, Jim Freeze wrote:

Hmm,= it's not that difficult, but it is definitely more work than = join:

=A0 ary =3D = [1,3,2,4]=A0 # or = [[1,3],[2,4]].flatten
=A0 ary[2..-4].inject(a[0..0]) { |a,e| a << (a[-1] = > e ? ">" : "<"); a << e = }.join
-------^^^^
=A0=A0 =A0=A0 = =A01..-1

Not sure how that typo = happend. :)

Jim

= --Apple-Mail-7--539087324--