[#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:04212] RE: inserion in array.

From: Aleksi Niemel<aleksi.niemela@...>
Date: 2000-07-25 15:49:17 UTC
List: ruby-talk #4212
> is not what I want, because it has flattened the whole array. 
>  Is this a
> case for an "insert" method for Array?  Or "Is There A Better 
> Way To Do
> It?"

Well, I'm not sure what you want, but I assume you want to insert another
array's content (all elements) after certain place in another array. That
is, by example, to array [1,2,3] you want to insert array [4,5,6] right
after second element, so that the end result would be [1,2,4,5,6,3].

And my ruby prints:

  ruby -e 'a=[1,2,3]; a[2,0]=[4,5,6]; p a'
  
  [1, 2, 4, 5, 6, 3]

	- Aleksi

In This Thread

Prev Next