-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sat, 18 May 2002 01:44, Kontra, Gergely wrote: > Azt irtad, hogy > > >Holden Glova <dsafari / xtra.co.nz> writes: > >> On Fri, 17 May 2002 22:45, Yohanes Santoso wrote: > >> > The way I am implementing right now is: > >> > 80000.downto(2) {|i| array[i+1]=array[i]} > >> > >> irb(main):023:0> array[0..0] + [2] + array[1..-1] > >> [1, 2, 3, 4, 5] > > What about a[1...1]=2 > > Seems to work for me... I'll be damned. How this works doesn't make any sense to me. To me that reads; from the 1 position upto but excluding the 1 position, put a value (2 in this case). The same can be done with something like array[1,0]=2 as was pointed out by Rennex on IRC #ruby-lang. To me that reads; from the 1 position with a length of 0 assign the value. I'm almost reading this as a 1/2 element index - from a readability point of view to me it just doesn't make sense. Can anyone help me understand it from a readability POV? Some on irc have tried to explain it in implementation terms but when I'm coding in Ruby I'm not thinking about how it is understood in Ruby, more about how it reads in Ruby. Any help is welcomed. Thank you. - -- Signed, Holden Glova -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE85aqL+mF116Lw2cQRAuqpAJ9ij7aIzYZn+YZP6dPe7fquVF8kMgCgjhK9 ginaKAtv/tdUV5nxDkBx8So= =SvPw -----END PGP SIGNATURE-----