Thread deep copy eines Arrays (0 answers)
Opened by Kuerbis at 2016-10-12 09:03

Kuerbis
 2016-10-12 09:03
#185481 #185481
User since
2011-03-20
938 Artikel
BenutzerIn
[default_avatar]
Hallo,

ist diese Art ein mehrdimensionales Array zu kopieren "state of the art"?

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env perl6
use v6;


my @orig = (
    [ 'name'           ],
    [ 'year'           ],
    [ 'color', 'green' ],
    [ 'city'           ]
);

my @copy = @orig.deepmap( -> $c is copy { $c } );

@copy[1][1] = 1956;

say @copy;
say @orig;

View full thread deep copy eines Arrays