[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04213] Re: inserion in array.

From: Hugh Sasse Staff Elec Eng <hgs@...>
Date: 2000-07-25 15:50:18 UTC
List: ruby-talk #4213
On Tue, 25 Jul 2000, Hugh Sasse Staff Elec Eng wrote:

> case for an "insert" method for Array?  Or "Is There A Better Way To Do
> It?"

Found it.  I had not tried a range on the left side of assignment:

irb(main):019:0> a = [[1, 2, 3], 8, 9, [0, 1, 2]]
[[1, 2, 3], 8, 9, [0, 1, 2]]
irb(main):020:0> a[2...3]=[11,12,13]
[11, 12, 13]
irb(main):021:0> a
[[1, 2, 3], 8, 11, 12, 13, [0, 1, 2]]
irb(main):022:0> 

I assumed it would fail.
	Hugh
	hgs@dmu.ac.uk


In This Thread

Prev Next