Array clone

Hi
array.clone cant be used for multi-dim arrays. Do I have to copy it in-deep
by hand? (map.map) or is there a method for that?
PS: you're welcome to translate the 2nd part to perfect English, if you can!

Thx Berg

Do you even try anything out or do you just come straight here first?

Please try to learn this language. Start by reading. Follow that up by experimentation. When you're truly stuck, google. If that doesn't help, come here.

···

On Mar 4, 2016, at 22:17, A Berger <aberger7890@gmail.com> wrote:

array.clone cant be used for multi-dim arrays. Do I have to copy it in-deep by hand? (map.map) or is there a method for that?
PS: you're welcome to translate the 2nd part to perfect English, if you can

Hi Ryan!
I looked up the docs, found nothing more than clone, and testet copying it
"by hand" (.map with an outer loop).
- But knowing Ruby I think there is a nicer way (I dont want to use dump or
metaprogramming, this should exist already).

2) is there sg. EXISTING like .to_a for strings?
( y=x.to_s.to_a would.work , but its also not nice (not efficient in terms
what it is doing)
Please tell me if you know the answer already!

Berg

"deep copy" is the term you want to search for.

martin

···

On Mar 4, 2016 10:18 PM, "A Berger" <aberger7890@gmail.com> wrote:

Hi
array.clone cant be used for multi-dim arrays. Do I have to copy it
in-deep by hand? (map.map) or is there a method for that?
PS: you're welcome to translate the 2nd part to perfect English, if you
can!

Thx Berg

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

I am sorry I have to agree with Ryan: there's plenty of explanations
around - and they are not hidden. For the sake of your learning
experience it will be much better if you experiment and dig into
things yourself. Knowledge gained that way sticks far better.

Kind regards

robert

···

On Sat, Mar 5, 2016 at 11:42 AM, A Berger <aberger7890@gmail.com> wrote:

Please tell me if you know the answer already!

--
[guy, jim, charlie].each {|him| remember.him do |as, often| as.you_can
- without end}
http://blog.rubybestpractices.com/